CbmRoot
CbmTofDigitize.h
Go to the documentation of this file.
1 
11 #ifndef CBMTOFDIGITIZE_H
12 #define CBMTOFDIGITIZE_H 1
13 
14 #include "CbmDefs.h"
15 #include "CbmDigitize.h"
16 #include "CbmTofDigi.h"
17 #include "TH1.h"
18 #include "TH2.h"
19 #include "TStopwatch.h"
20 #include "TTimeStamp.h"
21 #include <vector>
22 
23 class TClonesArray;
24 class TRandom3;
25 class CbmTofCell;
26 class CbmTofDigiBdfPar;
27 class CbmTofDetectorId;
28 class CbmTofDigiPar;
29 class CbmTofGeoHandler;
30 class CbmTofPoint;
31 
32 
33 class CbmTofDigitize : public CbmDigitize<CbmTofDigi> {
34 public:
39 
43  CbmTofDigitize(const char* name, Int_t verbose = 1);
47  virtual ~CbmTofDigitize();
48 
49 
51 
55  virtual InitStatus Init();
56 
60  virtual void SetParContainers();
61 
65  virtual void Exec(Option_t* option);
66 
70  virtual void Finish();
71 
72 
73  void SetInputFileName(TString FileName) { fsBeamInputFile = FileName; }
74 
75  Bool_t SetHistoFileName(TString sFilenameIn = "./tofDigiBdf.hst.root");
76 
77  void SetMonitorHistograms(Bool_t bMonitor = kTRUE) {
78  fbMonitorHistos = bMonitor;
79  }
80 
81  void UseMcTrackMonitoring(Bool_t bMcTrkMonitor = kTRUE) {
82  fbMcTrkMonitor = bMcTrkMonitor;
83  }
84 
85  void AllowPointsWithoutTrack(Bool_t bAllow = kTRUE) {
87  }
88 
89  inline void SetDigiTimeConvFactor(Double_t dfac) {
90  fdDigiTimeConvFactor = dfac;
91  }
92 
93 
94 private:
103 
104  // Functions common for all clusters approximations
108  Bool_t RegisterInputs();
112  Bool_t InitParameters();
118  Bool_t LoadBeamtimeValues();
119 
120  // Histogramming functions
121  Bool_t CreateHistos();
122  Bool_t FillHistos();
123  Bool_t WriteHistos();
124  Bool_t DeleteHistos();
125 
126  // Functions for the merging of "gap digis" and "multiple hits digis" into "channel digis"
131  Bool_t MergeSameChanDigis();
132 
133  // Functions for the Cluster Radius generation
138  Double_t GenerateClusterRadius(Int_t iSmType, Int_t iRpc);
139 
140  // Functions for a direct use of the cluster size
151  Bool_t DigitizeDirectClusterSize();
152 
153  // Functions for a simple "Flat disc" cluster approximation
159  Bool_t DigitizeFlatDisc();
160 
164  Double_t ComputeClusterAreaOnChannel(Int_t iChanId,
165  Double_t dClustRadius,
166  Double_t dClustCentX,
167  Double_t dClustCentY);
168 
169  // Functions for a 2D Gauss cluster approximation
177  Bool_t DigitizeGaussCharge();
178 
179  // Auxiliary functions
180  // Area
184  Double_t TriangleArea(Double_t dXa,
185  Double_t dYa,
186  Double_t dXb,
187  Double_t dYb,
188  Double_t dXc,
189  Double_t dYc);
194  Double_t DiscSectionArea(Double_t dDiscRadius, Double_t dDistBaseToCenter);
195  // Points
202  Double_t CircleIntersectPosX(Int_t iChanId,
203  Double_t dClustRadius,
204  Double_t dClustCentX,
205  Double_t dClustCentY,
206  Bool_t bUpperSide);
213  Double_t CircleIntersectPosY(Int_t iChanId,
214  Double_t dClustRadius,
215  Double_t dClustCentX,
216  Double_t dClustCentY,
217  Bool_t bRightSide);
224  Double_t DistanceCircleToBase(Double_t dClustRadius,
225  Double_t dBaseXa,
226  Double_t dBaseYa,
227  Double_t dBaseXb,
228  Double_t dBaseYb);
229 
230  Bool_t CompareTimes(CbmTofDigi* p1, CbmTofDigi* p2);
231 
245  // Fee properties and constants
246  Double_t fdFeeGainSigma;
247  Double_t fdFeeTotThr;
248  Double_t fdTimeResElec;
250 
251  // Beamtime variables [nbSmType]
252  std::vector<TH1*> fh1ClusterSizeProb;
253  std::vector<TH1*> fh1ClusterTotProb;
254 
255  // RPC variables from beamtime [nbSmType][NbSm][NbRpc]
256  std::vector<std::vector<std::vector<Double_t>>> fvdSignalVelocityRpc;
257 
258  // Channel variables [nbSmType][NbSm*NbRpc][NbChannel*NbSides]
259  std::vector<std::vector<std::vector<Double_t>>>
260  fdChannelGain; // <- Generated from parameter FeeGainSigma
261 
262  // ToF geometry variables
269  std::vector<std::vector<std::vector<Int_t>>>
270  fvRpcChOffs; // Offset in channel index for first channel of each RPC
271 
272  // Input variables
273  TClonesArray* fTofPointsColl; // TOF MC points
274  TClonesArray* fMcTracksColl; // MC tracks
275 
276  // Intermediate storage variables
277  // Store all digis to allow merging
278  std::vector<
279  std::vector<std::vector<std::vector<std::pair<CbmTofDigi*, CbmMatch*>>>>>
280  fStorDigi; //[nbType][nbSm*nbRpc][nbCh*NbSide][nDigis]
281  std::vector<std::vector<std::vector<std::vector<Int_t>>>>
282  fStorDigiMatch; //[nbType][nbSm*nbRpc][nbCh*NbSide][nDigis]
283  // Temporary storing of the Track/Point/Digi info to make sure all gap/Tofpoint
284  // linked to same track in same channel give same result (single cluster per track/channel pair)
285  std::vector<std::vector<ULong64_t>>
286  fvlTrckChAddr; // [nbMcTracks][nbChannelFiredByTrk]
287  // Temporary storing of the Track/Rpc info to make sure all clusters
288  // linked to same track in same detector give the same results for timing
289  std::vector<std::vector<ULong64_t>>
290  fvlTrckRpcAddr; // [nbMcTracks][nbRpcFiredByTrk]
291  std::vector<std::vector<Double_t>>
292  fvlTrckRpcTime; // [nbMcTracks][nbRpcFiredByTrk]
293 
294  // Output variables
295  Int_t fiNbDigis; // Index of the CbmTofDigi TClonesArray
296 
297  // Output file name and path
299  // Histograms
305  /*
306  TH2 * fhTofPointsPerTrackVsPdg;
307  TH1 * fhMeanPointPerTrack;
308  TH2 * fhMeanPointPerTrack2d;
309  TH1 * fhMeanDigiPerPoint;
310  TH1 * fhMeanFiredPerPoint;
311  */
318  TH1* fhPtTime;
322  TH1* fhToTDist;
323 
330 
331  TTimeStamp fStart;
332  TTimeStamp fStop;
333  Double_t fdDigitizeTime;
334  Double_t fdMergeTime;
335  // --- Run counters
336  TStopwatch fTimer;
337  Int_t fiNofEvents;
338  Double_t fdNofTofMcTrkTot;
339  Double_t fdNofPointsTot;
340  Double_t fdNofDigisTot;
341  Double_t fdTimeTot;
342 
344 
349 
350  //Int_t fiCurrentFileId; is now in base class
351  //Int_t fiCurrentEventId; is now in base class
352  //Double_t fdCurrentEventTime; is now in base class
354 
356 };
357 
358 #endif // CBMTOFDIGITIZE_H
CbmTofDigitize::Exec
virtual void Exec(Option_t *option)
Inherited from FairTask.
Definition: CbmTofDigitize.cxx:271
CbmTofDigitize::TriangleArea
Double_t TriangleArea(Double_t dXa, Double_t dYa, Double_t dXb, Double_t dYb, Double_t dXc, Double_t dYc)
Compute triangle area from its corners.
Definition: CbmTofDigitize.cxx:4651
CbmTofDigitize::FillHistos
Bool_t FillHistos()
Definition: CbmTofDigitize.cxx:880
CbmTofDigitize::fStop
TTimeStamp fStop
Definition: CbmTofDigitize.h:332
CbmTofDigitize::fDigiBdfPar
CbmTofDigiBdfPar * fDigiBdfPar
Definition: CbmTofDigitize.h:267
CbmTofDigitize::fbTimeBasedOutput
Bool_t fbTimeBasedOutput
Definition: CbmTofDigitize.h:347
CbmTofDigitize::fdNofPointsTot
Double_t fdNofPointsTot
Total number of points processed.
Definition: CbmTofDigitize.h:339
CbmTofDigitize::fhDigiTime
TH1 * fhDigiTime
Definition: CbmTofDigitize.h:319
CbmTofDigitize::fdDigiTimeConvFactor
Double_t fdDigiTimeConvFactor
Definition: CbmTofDigitize.h:353
CbmTofDigitize::MergeSameChanDigis
Bool_t MergeSameChanDigis()
Merge the digis on he same readout channel.
Definition: CbmTofDigitize.cxx:1143
CbmTofDigitize::RegisterInputs
Bool_t RegisterInputs()
Recover pointer on input TClonesArray: TofPoints, ...
Definition: CbmTofDigitize.cxx:351
CbmTofDigitize::GetSystemId
ECbmModuleId GetSystemId() const
Detector system ID.
Definition: CbmTofDigitize.h:50
CbmTofDigitize::fhTofPtsInTrkVsGapInd
TH2 * fhTofPtsInTrkVsGapInd
Definition: CbmTofDigitize.h:301
CbmTofDigitize::fhTofPtsInTrkVsGapIndPrm
TH2 * fhTofPtsInTrkVsGapIndPrm
Definition: CbmTofDigitize.h:302
CbmTofDigitize::fdDigitizeTime
Double_t fdDigitizeTime
Definition: CbmTofDigitize.h:333
CbmTofDigitize::GenerateClusterRadius
Double_t GenerateClusterRadius(Int_t iSmType, Int_t iRpc)
Generate a value for the cluster radius from the beamtime data corresponding.
Definition: CbmTofDigitize.cxx:1409
CbmTofDigitize::fvdSignalVelocityRpc
std::vector< std::vector< std::vector< Double_t > > > fvdSignalVelocityRpc
Definition: CbmTofDigitize.h:256
CbmTofDigitize::DeleteHistos
Bool_t DeleteHistos()
Definition: CbmTofDigitize.cxx:1096
CbmTofDigitize::fhMeanDigiPerTrack
TH1 * fhMeanDigiPerTrack
Definition: CbmTofDigitize.h:316
CbmTofDigitize::fh1ClusterSizeProb
std::vector< TH1 * > fh1ClusterSizeProb
Definition: CbmTofDigitize.h:252
CbmTofDigitize::SetInputFileName
void SetInputFileName(TString FileName)
Definition: CbmTofDigitize.h:73
CbmTofDigitize::fdTimeTot
Double_t fdTimeTot
Total execution time.
Definition: CbmTofDigitize.h:341
CbmTofDigitize::fhElecChOccup
TH1 * fhElecChOccup
Definition: CbmTofDigitize.h:324
CbmTofDigitize::fdFeeTotThr
Double_t fdFeeTotThr
Definition: CbmTofDigitize.h:247
CbmTofDigitize::fvRpcChOffs
std::vector< std::vector< std::vector< Int_t > > > fvRpcChOffs
Definition: CbmTofDigitize.h:270
CbmTofDigitize::~CbmTofDigitize
virtual ~CbmTofDigitize()
Destructor.
Definition: CbmTofDigitize.cxx:223
CbmTofDigitize::fhEvtProcTime
TH1 * fhEvtProcTime
Definition: CbmTofDigitize.h:312
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmTofDigitize::UseMcTrackMonitoring
void UseMcTrackMonitoring(Bool_t bMcTrkMonitor=kTRUE)
Definition: CbmTofDigitize.h:81
CbmTofDigitize::fbAllowPointsWithoutTrack
Bool_t fbAllowPointsWithoutTrack
Definition: CbmTofDigitize.h:348
CbmTofDigitize::fStart
TTimeStamp fStart
Definition: CbmTofDigitize.h:331
CbmTofDigi.h
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
CbmTofDigitize::fiNbDigis
Int_t fiNbDigis
Definition: CbmTofDigitize.h:295
CbmTofDigitize::SetHistoFileName
Bool_t SetHistoFileName(TString sFilenameIn="./tofDigiBdf.hst.root")
Definition: CbmTofDigitize.cxx:1027
CbmTofDigitize::SetMonitorHistograms
void SetMonitorHistograms(Bool_t bMonitor=kTRUE)
Definition: CbmTofDigitize.h:77
CbmTofDigitize::fMcTracksColl
TClonesArray * fMcTracksColl
Definition: CbmTofDigitize.h:274
CbmTofDigitize::DigitizeGaussCharge
Bool_t DigitizeGaussCharge()
Convert TofPoints in input TClonesArray to Tof Digis using an approximation of the.
Definition: CbmTofDigitize.cxx:3123
CbmTofDigitize::fhPtTime
TH1 * fhPtTime
Definition: CbmTofDigitize.h:318
CbmTofDigitize::fdFeeGainSigma
Double_t fdFeeGainSigma
Definition: CbmTofDigitize.h:246
CbmTofDigitize::SetParContainers
virtual void SetParContainers()
Inherited from FairTask.
Definition: CbmTofDigitize.cxx:259
CbmTofDigitize::ComputeClusterAreaOnChannel
Double_t ComputeClusterAreaOnChannel(Int_t iChanId, Double_t dClustRadius, Double_t dClustCentX, Double_t dClustCentY)
Compute geometrical intersection area of a cluster and a channel.
Definition: CbmTofDigitize.cxx:4196
CbmTofDigitize::Init
virtual InitStatus Init()
Inherited from FairTask.
Definition: CbmTofDigitize.cxx:230
CbmTofDigitize::fhDigiTimeResB
TH2 * fhDigiTimeResB
Definition: CbmTofDigitize.h:321
CbmTofDigitize::fhNbTracksEvtElCh
TH2 * fhNbTracksEvtElCh
Definition: CbmTofDigitize.h:327
CbmTofDigitize::ClassDef
ClassDef(CbmTofDigitize, 1)
CbmTofDigitize::fbMonitorHistos
Bool_t fbMonitorHistos
Definition: CbmTofDigitize.h:345
CbmTofDigitize::CbmTofDigitize
CbmTofDigitize(const CbmTofDigitize &)
Copy constructor.
CbmTofDigitize::InitParameters
Bool_t InitParameters()
Initialize other parameters not included in parameter classes.
Definition: CbmTofDigitize.cxx:370
CbmTofDigitize::fhProcTimeEvtSize
TH2 * fhProcTimeEvtSize
Definition: CbmTofDigitize.h:315
CbmTofGeoHandler
Definition: CbmTofGeoHandler.h:30
CbmTofDigitize::fhTofPtsPosVsGap
TH2 * fhTofPtsPosVsGap[10]
Definition: CbmTofDigitize.h:304
CbmDigitize
Base class template for CBM digitisation tasks.
Definition: CbmDigitize.h:39
CbmTofDigitize::fhMultiDigiEvtElCh
TH1 * fhMultiDigiEvtElCh
Definition: CbmTofDigitize.h:325
CbmTofCell
Definition: CbmTofCell.h:8
CbmTofDigitize::fdNofTofMcTrkTot
Double_t fdNofTofMcTrkTot
Total number of MC tracks with TOF points.
Definition: CbmTofDigitize.h:338
CbmTofDigitize::fGeoHandler
CbmTofGeoHandler * fGeoHandler
Definition: CbmTofDigitize.h:263
CbmTofDigitize::fh1ClusterTotProb
std::vector< TH1 * > fh1ClusterTotProb
Definition: CbmTofDigitize.h:253
CbmTofDigitize::fiNbElecChTot
Int_t fiNbElecChTot
Definition: CbmTofDigitize.h:268
CbmTofDigitize::fTofPointsColl
TClonesArray * fTofPointsColl
Definition: CbmTofDigitize.h:273
CbmTofDigitize::fdMergeTime
Double_t fdMergeTime
Definition: CbmTofDigitize.h:334
CbmTofDigitize::fdSignalPropSpeed
Double_t fdSignalPropSpeed
Definition: CbmTofDigitize.h:249
CbmTofDigiBdfPar
Parameters class for the CBM ToF digitizer using beam data distributions.
Definition: CbmTofDigiBdfPar.h:30
CbmTofDigitize::fhFiredEvtElCh
TH1 * fhFiredEvtElCh
Definition: CbmTofDigitize.h:328
CbmTofDigitize::fhToTDist
TH1 * fhToTDist
Definition: CbmTofDigitize.h:322
CbmTofDigitize::CreateHistos
Bool_t CreateHistos()
Definition: CbmTofDigitize.cxx:687
CbmTofDigitize::fvlTrckRpcAddr
std::vector< std::vector< ULong64_t > > fvlTrckRpcAddr
Definition: CbmTofDigitize.h:290
CbmTofDigitize::SetDigiTimeConvFactor
void SetDigiTimeConvFactor(Double_t dfac)
Definition: CbmTofDigitize.h:89
CbmTofDigitize::fhMeanFiredPerTrack
TH1 * fhMeanFiredPerTrack
Definition: CbmTofDigitize.h:317
CbmTofDigitize::CircleIntersectPosX
Double_t CircleIntersectPosX(Int_t iChanId, Double_t dClustRadius, Double_t dClustCentX, Double_t dClustCentY, Bool_t bUpperSide)
Compute the x position of the intersection of a circle with the upper or.
Definition: CbmTofDigitize.cxx:4685
CbmTofDigitize::fbMcTrkMonitor
Bool_t fbMcTrkMonitor
Definition: CbmTofDigitize.h:346
CbmTofDigitize::LoadBeamtimeValues
Bool_t LoadBeamtimeValues()
Load the beamtime values designed in the parameters: histograms or single values.
Definition: CbmTofDigitize.cxx:401
CbmTofDigitize::DigitizeFlatDisc
Bool_t DigitizeFlatDisc()
Convert TofPoints in input TClonesArray to Tof Digis using an approximation of the.
Definition: CbmTofDigitize.cxx:2084
CbmTofDigitize::fdChannelGain
std::vector< std::vector< std::vector< Double_t > > > fdChannelGain
Definition: CbmTofDigitize.h:260
CbmTofDigitize::Finish
virtual void Finish()
Inherited from FairTask.
Definition: CbmTofDigitize.cxx:319
CbmTofDigitize::fStorDigi
std::vector< std::vector< std::vector< std::vector< std::pair< CbmTofDigi *, CbmMatch * > > > > > fStorDigi
Definition: CbmTofDigitize.h:280
CbmTofDigitize::fChannelInfo
CbmTofCell * fChannelInfo
Definition: CbmTofDigitize.h:266
CbmTofDigi
Data class for expanded digital TOF information.
Definition: CbmTofDigi.h:38
CbmTofDigitize::fhDigiTimeRes
TH1 * fhDigiTimeRes
Definition: CbmTofDigitize.h:320
CbmTofDigitize::fTimer
TStopwatch fTimer
ROOT timer.
Definition: CbmTofDigitize.h:336
CbmTofDigitize::fStorDigiMatch
std::vector< std::vector< std::vector< std::vector< Int_t > > > > fStorDigiMatch
Definition: CbmTofDigitize.h:282
CbmTofDigitize::fhTofPointsPerTrack
TH1 * fhTofPointsPerTrack
Definition: CbmTofDigitize.h:300
CbmTofDigitize::DigitizeDirectClusterSize
Bool_t DigitizeDirectClusterSize()
Convert TofPoints in input TClonesArray to Tof Digis using directly the.
Definition: CbmTofDigitize.cxx:1497
CbmTofDigitize::AllowPointsWithoutTrack
void AllowPointsWithoutTrack(Bool_t bAllow=kTRUE)
Definition: CbmTofDigitize.h:85
CbmTofDigitize::fdNofDigisTot
Double_t fdNofDigisTot
Total number of digis created.
Definition: CbmTofDigitize.h:340
CbmTofDigitize::fTofId
CbmTofDetectorId * fTofId
Definition: CbmTofDigitize.h:264
CbmTofDigitize::fsBeamInputFile
TString fsBeamInputFile
Definition: CbmTofDigitize.h:343
CbmTofDigitize::fhMultiProbElCh
TH1 * fhMultiProbElCh
Definition: CbmTofDigitize.h:329
CbmTofDigitize::fiNofEvents
Int_t fiNofEvents
Total number of events processed.
Definition: CbmTofDigitize.h:337
CbmTofDigitize::fhDigiNbElecCh
TH1 * fhDigiNbElecCh
Definition: CbmTofDigitize.h:314
CbmTofDigitize::DistanceCircleToBase
Double_t DistanceCircleToBase(Double_t dClustRadius, Double_t dBaseXa, Double_t dBaseYa, Double_t dBaseXb, Double_t dBaseYb)
Compute the distance from the cluster center to the base of a disc.
Definition: CbmTofDigitize.cxx:4834
CbmTofDigitize::fsHistoOutFilename
TString fsHistoOutFilename
Definition: CbmTofDigitize.h:298
CbmTofDigiPar
Definition: CbmTofDigiPar.h:18
CbmTofDigitize::CompareTimes
Bool_t CompareTimes(CbmTofDigi *p1, CbmTofDigi *p2)
Definition: CbmTofDigitize.cxx:4864
CbmTofDigitize::WriteHistos
Bool_t WriteHistos()
Definition: CbmTofDigitize.cxx:1033
CbmTofDigitize::fhTofPtsInTrkVsGapIndSec
TH2 * fhTofPtsInTrkVsGapIndSec
Definition: CbmTofDigitize.h:303
CbmTofPoint
Geometric intersection of a MC track with a TOFb detector.
Definition: CbmTofPoint.h:40
CbmTofDigitize::fdTimeResElec
Double_t fdTimeResElec
Definition: CbmTofDigitize.h:248
CbmTofDigitize::DiscSectionArea
Double_t DiscSectionArea(Double_t dDiscRadius, Double_t dDistBaseToCenter)
Compute area of a disc section from the disc radius and the distance of the.
Definition: CbmTofDigitize.cxx:4661
CbmTofDigitize::fvlTrckRpcTime
std::vector< std::vector< Double_t > > fvlTrckRpcTime
Definition: CbmTofDigitize.h:292
CbmTofDigitize::fhDigiMergeTime
TH1 * fhDigiMergeTime
Definition: CbmTofDigitize.h:313
CbmTofDigitize::fhNbDigiEvtElCh
TH2 * fhNbDigiEvtElCh
Definition: CbmTofDigitize.h:326
CbmTofDetectorId
Definition: CbmTofDetectorId.h:66
CbmTofDigitize::CircleIntersectPosY
Double_t CircleIntersectPosY(Int_t iChanId, Double_t dClustRadius, Double_t dClustCentX, Double_t dClustCentY, Bool_t bRightSide)
Compute the y position of the intersection of a circle with the left or right edge of a channel....
Definition: CbmTofDigitize.cxx:4758
CbmTofDigitize::fDigiPar
CbmTofDigiPar * fDigiPar
Definition: CbmTofDigitize.h:265
CbmTofDigitize::operator=
CbmTofDigitize & operator=(const CbmTofDigitize &)
Copy operator.
CbmDigitize.h
CbmTofDigitize::CbmTofDigitize
CbmTofDigitize()
Constructor.
Definition: CbmTofDigitize.cxx:85
CbmTofDigitize
CBM ToF digitizer using beam data distributions as hit/cluster models.
Definition: CbmTofDigitize.h:33
CbmTofDigitize::fvlTrckChAddr
std::vector< std::vector< ULong64_t > > fvlTrckChAddr
Definition: CbmTofDigitize.h:286
CbmDefs.h