20#include "FairLogger.h"
21#include "FairRootManager.h"
22#include "FairRunAna.h"
23#include "FairRuntimeDb.h"
28#include "R3BTCalEngine.h"
29#include "R3BTCalPar.h"
30#include "TClonesArray.h"
34#define planes fNofPMTs / 100
35#define toID(x, y, z) (((x - 1) * 50 + (y - 1)) * 2 + (z - 1))
37Double_t
wlk(Double_t x)
41 Double_t par1 = 1500.;
42 Double_t par2 = 0.00075;
43 y = par1 * TMath::Power(x, par2) - (par1 * TMath::Power(400., par2));
52 : FairTask(
"NeulandTacquilaMapped2Cal", 1)
57 ,
fPmt(new TClonesArray(
"R3BNeulandCalData"))
71 : FairTask(name, iVerbose)
76 ,
fPmt(new TClonesArray(
"R3BNeulandCalData"))
101 LOG(info) <<
"R3BNeulandTacquilaMapped2Cal::Init : read " <<
fTcalPar->GetNumModulePar() <<
" calibrated modules";
104 FairRootManager* mgr = FairRootManager::Instance();
107 LOG(fatal) <<
"FairRootManager not found";
113 LOG(fatal) <<
"Branch R3BEventHeader not found";
116 fRawHit =
dynamic_cast<TClonesArray*
>(mgr->GetObject(
"NeulandTacquilaMappedData"));
119 LOG(fatal) <<
"Branch NeulandTacquilaMappedData not found";
122 mgr->Register(
"NeulandCalData",
"Neuland",
fPmt, kTRUE);
124 fh_pulser_5_2 =
new TH1F(
"h_pulser_5_2",
"Single PMT resolution Bar 5 vs 2", 40000, -200., 200.);
125 fh_pulser_105_2 =
new TH1F(
"h_pulser_105_2",
"Single PMT resolution Bar 105 vs 2", 40000, -200., 200.);
134 FairRunAna* ana = FairRunAna::Instance();
135 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
136 fTcalPar =
dynamic_cast<R3BTCalPar*
>(rtdb->getContainer(
"LandTCalPar"));
143 std::map<Int_t, Double_t> tempMapQdcOffset;
145 for (Int_t plane = 1; i <=
planes; plane++)
146 for (Int_t bar = 1; bar <= 50; bar++)
147 for (Int_t side = 1; side <= 2; side++)
149 tempMapQdcOffset[i] =
fQCalPar->GetParAt(plane, bar, side);
153 LOG(info) <<
"R3BNeulandTacquilaMapped2Cal::SetParameter : Number of Parameters: " << i;
175 Int_t nHits =
fRawHit->GetEntriesFast();
199 Double_t time1 = nan(
"");
200 for (Int_t i = 0; i <
fNPmt; i++)
209 for (Int_t i = 0; i <
fNPmt; i++)
226 Int_t nHits =
fRawHit->GetEntriesFast();
232 const auto channel = 0;
234 R3BTCalModulePar* par;
239 for (Int_t khit = 0; khit < nHits; khit++)
251 if (!(par =
fTcalPar->GetModuleParAt(iPlane, iPaddle, iSide)))
253 LOG(debug) <<
"R3BNeulandTacquilaMapped2Cal::Exec : Tcal par not found, channel: " << iPlane <<
" / "
254 << iPaddle <<
" / " << iSide;
259 time = par->GetTimeTacquila(tdc);
262 LOG(error) <<
"R3BNeulandTacquilaMapped2Cal::Exec : error in time calibration: ch=" << channel
263 <<
", tdc=" << tdc <<
", time=" << time;
267 if (!(par =
fTcalPar->GetModuleParAt(iPlane, iPaddle, iSide + 2)))
269 LOG(debug) <<
"R3BNeulandTacquilaMapped2Cal::Exec : Tcal par not found, channel: " << iPlane <<
" / "
270 << iPaddle <<
" / " << (iSide + 2);
275 time2 = par->GetTimeTacquila(tdc);
278 LOG(error) <<
"R3BNeulandTacquilaMapped2Cal::Exec : error in time calibration: ch=" << channel
279 <<
", tdc=" << tdc <<
", time=" << time2;
284 qdc = std::max(qdc, 0);
298 if (fVerbose && 0 == (
fNEvents % 1000))
300 LOG(info) <<
"R3BNeulandTacquilaMapped2Cal::Exec : event=" <<
fNEvents <<
" nPMTs=" <<
fNPmt;
ClassImp(R3B::Neuland::Cal2HitPar)
auto GetSide() const -> int
auto GetBarId() const -> int
auto GetTime() const -> double
An analysis task to apply TCAL calibration for NeuLAND.
Bool_t fPulserMode
Running with pulser data.
Double_t fClockFreq
Clock cycle in [ns].
virtual void Exec(Option_t *option)
Method for event loop implementation.
Bool_t fWalkEnabled
Enable / Disable walk correction.
virtual InitStatus ReInit()
Method for re-initialization of parameter containers in case the Run ID has changed.
virtual void FinishEvent()
A method for finish of processing of an event.
std::map< Int_t, Bool_t > fMap17Seen
Map with flag of observed stop signal.
TClonesArray * fPmt
Array with time items - output data.
virtual void FinishTask()
Method for finish of the task execution.
R3BTCalPar * fTcalPar
TCAL parameter container.
Int_t fNPmt
Number of produced time items per event.
Int_t fNofPMTs
Number of photomultipliers.
virtual ~R3BNeulandTacquilaMapped2Cal()
Destructor.
TClonesArray * fRawHit
Array with raw items - input data.
Int_t fNEvents
Event counter.
TH1F * fh_pulser_5_2
Resolution of one PMT.
Int_t fTrigger
Trigger value.
virtual void SetParContainers()
Method for initialization of the parameter containers.
std::map< Int_t, Double_t > fMapQdcOffset
Map with value of qdc offset.
R3BNeulandQCalPar * fQCalPar
QCAL parameter container.
virtual InitStatus Init()
Method for task initialization.
R3BNeulandTacquilaMapped2Cal()
Default constructor.
std::map< Int_t, Double_t > fMapStopTime
Map with value of stop time.
std::map< Int_t, Int_t > fMapStopClock
Map with value of stop clock.
R3BEventHeader * header
Event header.
TH1F * fh_pulser_105_2
Resolution of one PMT.
UShort_t GetClock() const
UShort_t GetQdcData() const
UShort_t GetStopT() const
UShort_t GetTacData() const