CbmRoot
Loading...
Searching...
No Matches
CbmTofFindTracks.h
Go to the documentation of this file.
1/* Copyright (C) 2015-2021 PI-UHd, GSI
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Norbert Herrmann [committer], Pierre-Alain Loizeau */
4
5// -------------------------------------------------------------------------
6// ----- CbmTofFindTracks header file -----
7// ----- Created 25/04/15 by N. Herrmann -----
8// ----- according to the CbmTrdFindTracks -----
9// -------------------------------------------------------------------------
10
21#ifndef CBMTOFFINDTRACKS
22#define CBMTOFFINDTRACKS 1
23
24#include "FairTask.h"
25//#include "CbmTofTypes.h"
26#include "TTimeStamp.h"
27
28#include <map>
29#include <vector>
30
34class TClonesArray;
35class TFile;
36class TH1;
37class TH2;
38class TH3;
39// Geometry
42class CbmTofDigiPar;
44class CbmTofAddress;
45class CbmTofHit;
46class CbmMatch;
47class CbmEvent;
48
49class CbmTofFindTracks : public FairTask {
50 friend class CbmTofTrackFinderNN;
51 friend class CbmTofAnaTestbeam;
52
53 public:
56
57
64 CbmTofFindTracks(const char* name, const char* title = "FairTask", CbmTofTrackFinder* finder = NULL);
65
67 virtual ~CbmTofFindTracks();
68
69 inline static CbmTofFindTracks* Instance() { return fInstance; }
70
72 virtual InitStatus Init();
73
74 // Initialize other parameters not included in parameter classes.
75 Bool_t InitParameters();
76
78 virtual void Exec(Option_t* opt);
79 virtual void ExecFind(Option_t* opt, CbmEvent* tEvent = NULL);
80
82 virtual void Finish();
83
85 virtual void SetParContainers();
86
87 virtual void CreateHistograms();
88
89 virtual void FillUHits();
90
91 virtual Bool_t CheckHit2Track(CbmTofHit* pHit);
92
93 virtual void FindVertex();
94
95 virtual void FillHistograms(CbmEvent* tEvent = NULL);
96
99 Int_t GetNofTracks() { return fNofTracks; };
100 Int_t GetNofStations() { return fNTofStations; };
101
103 void UseFinder(CbmTofTrackFinder* finder) { fFinder = finder; };
104
105 inline void SetMinNofHits(Int_t i) { fMinNofHits = i - 1; };
106 inline void SetNStations(Int_t i) { fNTofStations = i; };
107 inline void SetNReqStations(Int_t i) { fNReqStations = i; };
108
109 inline Int_t GetMinNofHits() const { return fMinNofHits + 1; }
110 inline Int_t GetNStations() const { return fNTofStations; }
111 inline Int_t GetNReqStations() const { return fNReqStations; }
112
113 void SetStations(Int_t ival);
114 void SetStation(Int_t iVal, Int_t iModType, Int_t iModId, Int_t iRpcId);
115 void SetBeamCounter(Int_t iModType, Int_t iModId, Int_t iRpcId);
116 void PrintSetup();
117
118 inline void SetR0Lim(Double_t dVal) { fdR0Lim = dVal; }
119 inline Double_t GetR0Lim() { return fdR0Lim; }
120 inline void SetTtMin(Double_t dVal) { fdTtMin = dVal; }
121 inline Int_t GetAddrOfStation(Int_t iVal) { return fMapStationRpcId[iVal]; }
122 inline Int_t GetDetIndSize() { return fMapRpcIdParInd.size(); }
123 Int_t GetStationOfAddr(Int_t iAddr);
124 void PrintMapRpcIdParInd();
125
126 inline Int_t GetStationType(Int_t i) { return fStationType[i]; }
127 inline Int_t GetTypeStation(Int_t i) { return fTypeStation[i]; }
128 inline Int_t GetCorMode() const { return fiCorMode; }
129 inline Int_t GetBeamCounter() const { return fiBeamCounter; }
130 inline Int_t GetEventNumber() const { return fiEvent; }
131 inline Double_t GetTtTarg() const { return fTtTarg; }
132 inline Double_t GetTtLight() const { return fTtLight; }
133 inline Double_t GetTOffScal() const { return fdTOffScal; }
134
135 inline Double_t GetSigT() const { return fSIGT; }
136 inline Double_t GetSigX() const { return fSIGX; }
137 inline Double_t GetSigY() const { return fSIGY; }
138 inline Double_t GetSigZ() const { return fSIGZ; }
139 inline Bool_t InspectEvent() const { return fInspectEvent; }
140
141 Double_t GetSigT(Int_t iAddr);
142 Double_t GetSigX(Int_t iAddr);
143 Double_t GetSigY(Int_t iAddr);
144 Double_t GetSigZ(Int_t iAddr);
145 Double_t GetTOff(Int_t iAddr);
146
147 Double_t GetStationSigT(Int_t iSt);
148 Double_t GetStationSigX(Int_t iSt);
149 Double_t GetStationSigY(Int_t iSt);
150 Double_t GetStationSigZ(Int_t iSt);
151
152 inline void SetSIGT(Double_t dval) { fSIGT = dval; }
153 inline void SetSIGX(Double_t dval) { fSIGX = dval; }
154 inline void SetSIGY(Double_t dval) { fSIGY = dval; }
155 inline void SetSIGZ(Double_t dval) { fSIGZ = dval; }
156 inline void SetUseSigCalib(Bool_t bval) { fbUseSigCalib = bval; }
157 inline void SetRefVelMean(Double_t dval) { fdRefVelMean = dval; }
158 inline void SetRefDVel(Double_t dval) { fdRefDVel = dval; }
159
160 inline void SetCorMode(Int_t ival) { fiCorMode = ival; }
161 inline void SetCalParFileName(TString CalParFileName) { fCalParFileName = CalParFileName; }
162 inline void SetCalOutFileName(TString CalOutFileName) { fCalOutFileName = CalOutFileName; }
163 inline void SetTtTarg(Double_t val) { fTtTarg = val; }
164 inline void SetTtLight(Double_t val) { fTtLight = val; }
165
166 inline void SetTOffScal(Double_t val) { fdTOffScal = val; }
167 inline void SetT0MAX(Double_t val) { fT0MAX = val; }
168
169 inline void SetStationMaxHMul(Int_t ival) { fiStationMaxHMul = ival; }
170 void MarkStationFired(Int_t iSt);
171 Int_t GetNStationsFired();
172 void ResetStationsFired();
173 void SetStationStatus(int iStation, int iStatus);
174 int GetStationStatus(int iStation);
175
176 inline void SetBeamMomentumLab(Double_t dval) { fdBeamMomentumLab = dval; }
178 inline void SetBeamMaxHMul(Int_t ival) { fiBeamMaxHMul = ival; }
179 inline void SetCalOpt(Int_t ival) { fiCalOpt = ival; }
180 inline void SetNoHistos() { fbDoHistos = kFALSE; }
181
182 inline Double_t GetVertexT() const { return fVTX_T; }
183 inline Double_t GetVertexX() const { return fVTX_X; }
184 inline Double_t GetVertexY() const { return fVTX_Y; }
185 inline Double_t GetVertexZ() const { return fVTX_Z; }
186
187 inline Int_t GetTofHitIndex(Int_t iHit)
188 {
189 if (fTofHitIndexArray.size() < 1)
190 return iHit;
191 else
192 return fTofHitIndexArray[iHit];
193 }
194
195 int GetNbHits();
196 CbmTofHit* GetHitPointer(int iHit);
197 int GetHitIndex(int iHit);
198
199
200 bool EvalDoublets(int iI0, int iI1, int iI2, double* dTshift);
201
202 private:
204 CbmTofTrackFinder* fFinder; // Pointer to TrackFinder concrete class
205 CbmTofTrackletTools* fTrackletTools; // Pointer to Tracklet tools class
206 CbmTofCalibrator* fTofCalibrator; // Pointer to Calibrator
207 TClonesArray* fEventsColl; // CBMEvents (time based)
208 TClonesArray* fTofHitArrayIn; // Input array of TOF hits
209 TClonesArray* fTofMatchArrayIn; // Input array of TOF hit matches
210 TClonesArray* fTofHitArray; // Output array of recalibrated TOF hits
211 std::vector<Int_t> fTofHitIndexArray; // Index of hit in TS
212 TClonesArray* fTofHitArrayOut; // Output array of recalibrated TOF hits
213 TClonesArray* fTofUHitArrayOut; // Output array of recalibrated TOF hits
214 TClonesArray* fTrackArray; // Output array of CbmTofTracks
215 TClonesArray* fTrackArrayOut; // Output array of CbmTofTracks in CbmEvent mode
216 TClonesArray* fTofUHitArray; // Output array of unused TOF hits
217
218 Int_t fMinNofHits; // minimal number of Tof Hits for filling histos
219 Int_t fNofTracks; // Number of tracks created
220 Int_t fNTofStations; // Number of Tof Stations
221 Int_t fNReqStations; // Number of requested Stations
222 Bool_t fInspectEvent; // analyse event flag
223
224 std::vector<Int_t> fStationType; // Station SM type
225 std::vector<Int_t> fStationHMul; // Station Hit Multiplicity
226 std::vector<Int_t> fRpcAddr; // vector of RPC addresses
227 std::map<Int_t, Int_t> fMapStationRpcId;
228 std::map<Int_t, Int_t> fMapRpcIdParInd;
229
230 std::vector<Double_t> fvToff; // station correction parameter
231 std::vector<Double_t> fvXoff; // station correction parameter
232 std::vector<Double_t> fvYoff; // station correction parameter
233 std::vector<Double_t> fvZoff; // station correction parameter
234
235 std::vector<Double_t> fvTsig; // station resolution parameter
236 std::vector<Double_t> fvXsig; // station resolution parameter
237 std::vector<Double_t> fvYsig; // station resolution parameter
238 std::vector<Double_t> fvZsig; // station resolution parameter
239
242
243 void CheckMaxHMul();
244
245 // Control histograms
251
275
276 std::vector<TH1*> vhPullX;
277 std::vector<TH1*> vhPullY;
278 std::vector<TH1*> vhPullZ;
279 std::vector<TH1*> vhPullT;
280 std::vector<TH1*> vhPullTB;
281 std::vector<TH1*> vhTrefRms;
282 std::vector<TH1*> vhFitDT0;
283 std::vector<TH1*> vhFitT0Err;
284 std::vector<TH1*> vhFitTt;
285 std::vector<TH1*> vhFitTtErr;
286 std::vector<TH1*> vhFitDTMean;
287 std::vector<TH1*> vhFitDTMeanErr;
288 std::vector<TH2*> vhResidualTBWalk;
289 std::vector<TH2*> vhResidualYWalk;
290 std::vector<TH2*> vhXY_AllTracks; // for monitoring
291 std::vector<TH2*> vhXY_AllStations; // for efficiency estimation
292 std::vector<TH2*> vhXY_AllFitStations; // for efficiency estimation
293 std::vector<TH2*> vhXY_MissedStation; // for efficiency estimation
294 std::vector<TH3*> vhXY_DX;
295 std::vector<TH3*> vhXY_DY;
296 std::vector<TH3*> vhXY_DT;
297 std::vector<TH3*> vhXY_TOT;
298 std::vector<TH3*> vhXY_CSZ;
299 std::vector<TH3*> vhUDXDY_DT;
300 std::vector<TH3*> vhUCDXDY_DT;
301
305
306 Int_t fTypeStation[1000]; // FIXME fixed array size
307 std::vector<int> fiStationStatus; // counter status with Geo index in calibration process
308 TString fOutHstFileName; // name of the histogram output file name with Calibration Parameters
309
310 Bool_t LoadCalParameter();
311 Bool_t WriteHistos();
312
313 TString fCalParFileName; // name of the file name with Calibration Parameters
315 TFile* fCalParFile; // pointer to Calibration Parameter file
316 TH2* fhPullT_Smt; // Time calibration histo
317 TH1* fhPullT_Smt_Off; // Time calibration histo
318 TH2* fhPullX_Smt; // position calibration histo
319 TH1* fhPullX_Smt_Off; // position calibration histo
320 TH2* fhPullY_Smt; // position calibration histo
321 TH1* fhPullY_Smt_Off; // position calibration histo
322 TH2* fhPullZ_Smt; // position calibration histo
323 TH1* fhPullZ_Smt_Off; // position calibration histo
324 TH1* fhPullT_Smt_Width; // position calibration histo
325 TH1* fhPullX_Smt_Width; // position calibration histo
326 TH1* fhPullY_Smt_Width; // position calibration histo
327 TH1* fhPullZ_Smt_Width; // position calibration histo
328 TH2* fhTOff_Smt; // Time calibration histo
329 TH1* fhTOff_Smt_Off; // Time calibration histo
330 TH2* fhDeltaTt_Smt; // Time calibration histo
331 TH2* fhDeltaTc_Smt; // Time calibration histo
332 TH2* fhTOff_HMul2; // Time calibration histo
336 Double_t fTtTarg; // expected average slope in ns/cm
337 Double_t fTtLight; // slope of Light in ns/cm
338 Double_t fdTOffScal; // modifier to tune average velocity
339 Double_t fVTXNorm; // Number of Hits contributing to Vertex determination
340 Double_t fVTX_T; // measured event wise t0
341 Double_t fVTX_X; // measured event wise vertex x
342 Double_t fVTX_Y; // measured event wise vertex y
343 Double_t fVTX_Z; // measured event wise vertex z
344 Double_t fT0MAX; // range of calibration histogram
345 Int_t fiEvent; // Number of processed events
346 // ToF geometry variables
347
352
353 Double_t fSIGT;
354 Double_t fSIGX;
355 Double_t fSIGY;
356 Double_t fSIGZ;
358 Double_t fdRefVelMean;
359 Double_t fdRefDVel;
360 Double_t fdR0Lim;
361 Double_t fdTtMin;
362
363 TTimeStamp fStart;
364 TTimeStamp fStop;
366
367 Double_t fdBeamMomentumLab; // beam momentum in lab frame [AGeV/c]
371 Bool_t fbDoHistos = kTRUE;
372
374};
375
376#endif
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
CBM ToF interface class to the unique address.
contains filling and updating of calibration histos
Parameters class for the CBM ToF digitizer using beam data distributions.
Int_t fTypeStation[1000]
void SetRefVelMean(Double_t dval)
TClonesArray * fTofUHitArray
std::vector< TH3 * > vhXY_DX
TClonesArray * fTofUHitArrayOut
std::vector< TH3 * > vhXY_TOT
std::vector< Int_t > fRpcAddr
std::vector< TH2 * > vhResidualTBWalk
void UseFinder(CbmTofTrackFinder *finder)
std::vector< TH3 * > vhXY_CSZ
std::map< Int_t, Int_t > fMapStationRpcId
void SetCalOutFileName(TString CalOutFileName)
Double_t GetStationSigZ(Int_t iSt)
std::vector< TH3 * > vhUDXDY_DT
void SetStationMaxHMul(Int_t ival)
Double_t GetSigZ() const
void SetCorMode(Int_t ival)
Double_t GetVertexT() const
Int_t GetBeamCounter() const
TClonesArray * fTofHitArrayIn
void SetTtTarg(Double_t val)
std::vector< TH1 * > vhPullX
virtual void Exec(Option_t *opt)
CbmTofTrackletTools * fTrackletTools
std::vector< TH1 * > vhTrefRms
std::vector< Double_t > fvTsig
std::vector< Double_t > fvZoff
Double_t GetStationSigT(Int_t iSt)
std::vector< TH2 * > vhXY_AllTracks
Int_t GetStationOfAddr(Int_t iAddr)
std::vector< TH1 * > vhPullTB
TClonesArray * fTofHitArrayOut
std::vector< TH1 * > vhFitTt
static CbmTofFindTracks * Instance()
TClonesArray * fTrackArrayOut
std::vector< Double_t > fvZsig
Int_t GetTofHitIndex(Int_t iHit)
Double_t GetTtLight() const
Double_t GetSigY() const
std::map< Int_t, Int_t > fMapRpcIdParInd
void SetSIGY(Double_t dval)
std::vector< Double_t > fvXsig
std::vector< TH2 * > vhResidualYWalk
void SetBeamCounter(Int_t iModType, Int_t iModId, Int_t iRpcId)
CbmTofTrackFinder * GetFinder()
std::vector< Double_t > fvXoff
void SetStations(Int_t ival)
void SetUseSigCalib(Bool_t bval)
void SetNReqStations(Int_t i)
std::vector< Int_t > fStationType
CbmTofDigiPar * fDigiPar
Double_t GetStationSigX(Int_t iSt)
Int_t GetCorMode() const
Double_t GetTtTarg() const
int GetStationStatus(int iStation)
std::vector< TH2 * > vhXY_AllStations
std::vector< TH1 * > vhFitTtErr
virtual void FillHistograms(CbmEvent *tEvent=NULL)
virtual void CreateHistograms()
void SetRefDVel(Double_t dval)
virtual void FindVertex()
int GetHitIndex(int iHit)
std::vector< int > fiStationStatus
Int_t GetMinNofHits() const
CbmTofHit * GetHitPointer(int iHit)
void SetStationStatus(int iStation, int iStatus)
void SetTtLight(Double_t val)
CbmTofFindTracks(const CbmTofFindTracks &)
Double_t GetSigT() const
std::vector< TH1 * > vhPullZ
std::vector< Double_t > fvYoff
virtual Bool_t CheckHit2Track(CbmTofHit *pHit)
std::vector< TH1 * > vhPullT
void SetSIGX(Double_t dval)
virtual InitStatus Init()
void SetCalOpt(Int_t ival)
virtual void SetParContainers()
std::vector< TH1 * > vhFitT0Err
std::vector< Int_t > fStationHMul
Double_t GetTOffScal() const
void SetNStations(Int_t i)
std::vector< TH2 * > vhXY_MissedStation
void SetT0MAX(Double_t val)
bool EvalDoublets(int iI0, int iI1, int iI2, double *dTshift)
TClonesArray * fTrackArray
void SetSIGT(Double_t dval)
Int_t GetTypeStation(Int_t i)
std::vector< TH1 * > vhFitDT0
void SetRemoveSignalPropagationTime(Bool_t bval)
CbmTofTrackFinder * fFinder
void SetStation(Int_t iVal, Int_t iModType, Int_t iModId, Int_t iRpcId)
CbmTofDigiBdfPar * fDigiBdfPar
Double_t GetStationSigY(Int_t iSt)
std::vector< Int_t > fTofHitIndexArray
Double_t GetTOff(Int_t iAddr)
CbmTofGeoHandler * fGeoHandler
TClonesArray * fTofMatchArrayIn
virtual void ExecFind(Option_t *opt, CbmEvent *tEvent=NULL)
CbmTofCalibrator * fTofCalibrator
Double_t GetSigX() const
Int_t GetAddrOfStation(Int_t iVal)
CbmTofFindTracks & operator=(const CbmTofFindTracks &)
virtual void FillUHits()
void SetMinNofHits(Int_t i)
Bool_t fbRemoveSignalPropagationTime
std::vector< TH3 * > vhXY_DT
Double_t GetVertexY() const
std::vector< TH2 * > vhXY_AllFitStations
void SetBeamMaxHMul(Int_t ival)
void SetBeamMomentumLab(Double_t dval)
void SetTOffScal(Double_t val)
Int_t GetNReqStations() const
void SetSIGZ(Double_t dval)
Double_t GetVertexX() const
Bool_t InspectEvent() const
CbmTofDetectorId * fTofId
void SetR0Lim(Double_t dVal)
Int_t GetStationType(Int_t i)
Int_t GetNStations() const
static CbmTofFindTracks * fInstance
ClassDef(CbmTofFindTracks, 1)
std::vector< TH1 * > vhFitDTMean
std::vector< TH1 * > vhFitDTMeanErr
std::vector< TH3 * > vhXY_DY
std::vector< TH1 * > vhPullY
void SetTtMin(Double_t dVal)
Double_t GetVertexZ() const
std::vector< Double_t > fvYsig
TClonesArray * fTofHitArray
std::vector< TH3 * > vhUCDXDY_DT
Int_t GetEventNumber() const
TClonesArray * fEventsColl
void SetCalParFileName(TString CalParFileName)
std::vector< Double_t > fvToff
void MarkStationFired(Int_t iSt)
contains fits and resolution functions