forked from R3BRootGroup/R3BRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathR3BPdcMapped2CalPar.cxx
110 lines (88 loc) · 3.33 KB
/
R3BPdcMapped2CalPar.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/******************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
* Copyright (C) 2019 Members of R3B Collaboration *
* *
* This software is distributed under the terms of the *
* GNU General Public Licence (GPL) version 3, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this license GSI does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
******************************************************************************/
// ----------------------------------------------------------------
// ----- R3BPdcMapped2CalPar -----
// ----- Created Apr 2016 by R.Plag -----
// ----------------------------------------------------------------
#include "R3BPdcMapped2CalPar.h"
#include "TClonesArray.h"
#include "FairLogger.h"
#include "FairRuntimeDb.h"
#include "R3BPdcMappedData.h"
#include "R3BTCalEngine.h"
#include "R3BTCalPar.h"
R3BPdcMapped2CalPar::R3BPdcMapped2CalPar()
: FairTask("R3BPdcMapped2CalPar", 1)
, fUpdateRate(1000000)
, fMinStats(100000)
, fCalPar(nullptr)
, fMapped(nullptr)
, fEngine(nullptr)
{
}
R3BPdcMapped2CalPar::R3BPdcMapped2CalPar(const char* name, Int_t iVerbose)
: FairTask(name, iVerbose)
, fUpdateRate(1000000)
, fMinStats(100000)
, fCalPar(nullptr)
, fEngine(nullptr)
{
}
R3BPdcMapped2CalPar::~R3BPdcMapped2CalPar()
{
delete fCalPar;
delete fEngine;
}
InitStatus R3BPdcMapped2CalPar::Init()
{
FairRootManager* rm = FairRootManager::Instance();
if (!rm)
{
return kFATAL;
}
fMapped = (TClonesArray*)rm->GetObject("PdcMapped");
if (!fMapped)
{
return kFATAL;
}
// container needs to be created in tcal/R3BTCalContFact.cxx AND R3BTCal needs
// to be set as dependency in CMakelists.txt (in this case in the tof directory)
fCalPar = (R3BTCalPar*)FairRuntimeDb::instance()->getContainer("PdcTCalPar");
if (!fCalPar)
{
LOG(ERROR) << "R3BPdcMapped2CalPar::Init() Couldn't get handle on PdcTCalPar. ";
return kFATAL;
}
fCalPar->setChanged();
fEngine = new R3BTCalEngine(fCalPar, fMinStats);
return kSUCCESS;
}
void R3BPdcMapped2CalPar::Exec(Option_t* option)
{
Int_t nHits = fMapped->GetEntries();
// Loop over mapped hits
for (Int_t i = 0; i < nHits; i++)
{
auto mapped = (R3BPdcMappedData const*)fMapped->At(i);
fEngine->Fill(mapped->GetPlaneId(), mapped->GetWireId(), mapped->GetEdgeId(), mapped->GetTimeFine());
}
}
void R3BPdcMapped2CalPar::FinishEvent() {}
void R3BPdcMapped2CalPar::FinishTask()
{
fEngine->CalculateParamClockTDC(R3BTCalEngine::CTDC_16_BWD_150);
fCalPar->printParams();
}
void R3BPdcMapped2CalPar::SetUpdateRate(Int_t rate) { fUpdateRate = rate; }
void R3BPdcMapped2CalPar::SetMinStats(Int_t minStats) { fMinStats = minStats; }
ClassImp(R3BPdcMapped2CalPar)