CbmRoot
Loading...
Searching...
No Matches
CbmTofDigitize.h
Go to the documentation of this file.
1/* Copyright (C) 2013-2020 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer], Volker Friese */
4
15#ifndef CBMTOFDIGITIZE_H
16#define CBMTOFDIGITIZE_H 1
17
18#include "CbmDefs.h"
19#include "CbmDigitize.h"
20#include "CbmTofDigi.h"
21
22#include "TH1.h"
23#include "TH2.h"
24#include "TStopwatch.h"
25#include "TTimeStamp.h"
26
27#include <vector>
28
29class TClonesArray;
30class TRandom3;
31class CbmTofCell;
34class CbmTofDigiPar;
36class CbmTofPoint;
37
38
39class CbmTofDigitize : public CbmDigitize<CbmTofDigi> {
40public:
45
49 CbmTofDigitize(const char* name, Int_t verbose = 1);
53 virtual ~CbmTofDigitize();
54
55
57
61 virtual InitStatus Init();
62
66 virtual void SetParContainers();
67
71 virtual void Exec(Option_t* option);
72
76 virtual void Finish();
77
78
79 void SetInputFileName(TString FileName) { fsBeamInputFile = FileName; }
80
81 Bool_t SetHistoFileName(TString sFilenameIn = "./tofDigiBdf.hst.root");
82
83 void SetMonitorHistograms(Bool_t bMonitor = kTRUE) { fbMonitorHistos = bMonitor; }
84
85 void UseMcTrackMonitoring(Bool_t bMcTrkMonitor = kTRUE) { fbMcTrkMonitor = bMcTrkMonitor; }
86
87 void AllowPointsWithoutTrack(Bool_t bAllow = kTRUE) { fbAllowPointsWithoutTrack = bAllow; }
88
89 inline void SetDigiTimeConvFactor(Double_t dfac) { fdDigiTimeConvFactor = dfac; }
90
91
92private:
101
102 // Functions common for all clusters approximations
106 Bool_t RegisterInputs();
110 Bool_t InitParameters();
116 Bool_t LoadBeamtimeValues();
117
118 // Histogramming functions
119 Bool_t CreateHistos();
120 Bool_t FillHistos();
121 Bool_t WriteHistos();
122 Bool_t DeleteHistos();
123
124 // Functions for the merging of "gap digis" and "multiple hits digis" into "channel digis"
129 Bool_t MergeSameChanDigis();
130
131 // Functions for the Cluster Radius generation
136 Double_t GenerateClusterRadius(Int_t iSmType, Int_t iRpc);
137
138 // Functions for a direct use of the cluster size
150
151 // Functions for a simple "Flat disc" cluster approximation
157 Bool_t DigitizeFlatDisc();
158
162 Double_t ComputeClusterAreaOnChannel(Int_t iChanId, Double_t dClustRadius, Double_t dClustCentX,
163 Double_t dClustCentY);
164
165 // Functions for a 2D Gauss cluster approximation
173 Bool_t DigitizeGaussCharge();
174
175 // Auxiliary functions
176 // Area
180 Double_t TriangleArea(Double_t dXa, Double_t dYa, Double_t dXb, Double_t dYb, Double_t dXc, Double_t dYc);
185 Double_t DiscSectionArea(Double_t dDiscRadius, Double_t dDistBaseToCenter);
186 // Points
193 Double_t CircleIntersectPosX(Int_t iChanId, Double_t dClustRadius, Double_t dClustCentX, Double_t dClustCentY,
194 Bool_t bUpperSide);
201 Double_t CircleIntersectPosY(Int_t iChanId, Double_t dClustRadius, Double_t dClustCentX, Double_t dClustCentY,
202 Bool_t bRightSide);
209 Double_t DistanceCircleToBase(Double_t dClustRadius, Double_t dBaseXa, Double_t dBaseYa, Double_t dBaseXb,
210 Double_t dBaseYb);
211
212 Bool_t CompareTimes(CbmTofDigi* p1, CbmTofDigi* p2);
213
227 // Fee properties and constants
229 Double_t fdFeeTotThr;
232
233 // Beamtime variables [nbSmType]
234 std::vector<TH1*> fh1ClusterSizeProb;
235 std::vector<TH1*> fh1ClusterTotProb;
236
237 // RPC variables from beamtime [nbSmType][NbSm][NbRpc]
238 std::vector<std::vector<std::vector<Double_t>>> fvdSignalVelocityRpc;
239
240 // Channel variables [nbSmType][NbSm*NbRpc][NbChannel*NbSides]
241 std::vector<std::vector<std::vector<Double_t>>> fdChannelGain; // <- Generated from parameter FeeGainSigma
242
243 // ToF geometry variables
250 std::vector<std::vector<std::vector<Int_t>>> fvRpcChOffs; // Offset in channel index for first channel of each RPC
251
252 // Input variables
253 TClonesArray* fTofPointsColl; // TOF MC points
254 TClonesArray* fMcTracksColl; // MC tracks
255
256 // Intermediate storage variables
257 // Store all digis to allow merging
258 std::vector<std::vector<std::vector<std::vector<std::pair<CbmTofDigi*, CbmMatch*>>>>>
259 fStorDigi; //[nbType][nbSm*nbRpc][nbCh*NbSide][nDigis]
260 std::vector<std::vector<std::vector<std::vector<Int_t>>>> fStorDigiMatch; //[nbType][nbSm*nbRpc][nbCh*NbSide][nDigis]
261 // Temporary storing of the Track/Point/Digi info to make sure all gap/Tofpoint
262 // linked to same track in same channel give same result (single cluster per track/channel pair)
263 std::vector<std::vector<ULong64_t>> fvlTrckChAddr; // [nbMcTracks][nbChannelFiredByTrk]
264 // Temporary storing of the Track/Rpc info to make sure all clusters
265 // linked to same track in same detector give the same results for timing
266 std::vector<std::vector<ULong64_t>> fvlTrckRpcAddr; // [nbMcTracks][nbRpcFiredByTrk]
267 std::vector<std::vector<Double_t>> fvlTrckRpcTime; // [nbMcTracks][nbRpcFiredByTrk]
268
269 // Output variables
270 Int_t fiNbDigis; // Index of the CbmTofDigi TClonesArray
271
272 // Output file name and path
274 // Histograms
280 /*
281 TH2 * fhTofPointsPerTrackVsPdg;
282 TH1 * fhMeanPointPerTrack;
283 TH2 * fhMeanPointPerTrack2d;
284 TH1 * fhMeanDigiPerPoint;
285 TH1 * fhMeanFiredPerPoint;
286 */
298
305
306 TTimeStamp fStart;
307 TTimeStamp fStop;
309 Double_t fdMergeTime;
310 // --- Run counters
311 TStopwatch fTimer;
314 Double_t fdNofPointsTot;
315 Double_t fdNofDigisTot;
316 Double_t fdTimeTot;
317
319
324
325 //Int_t fiCurrentFileId; is now in base class
326 //Int_t fiCurrentEventId; is now in base class
327 //Double_t fdCurrentEventTime; is now in base class
329
331};
332
333#endif // CBMTOFDIGITIZE_H
ECbmModuleId
Definition CbmDefs.h:39
@ kTof
Time-of-flight Detector.
Base class template for CBM digitisation tasks.
Definition CbmDigitize.h:44
Parameters class for the CBM ToF digitizer using beam data distributions.
Data class for expanded digital TOF information.
Definition CbmTofDigi.h:47
CBM ToF digitizer using beam data distributions as hit/cluster models.
virtual void Exec(Option_t *option)
Inherited from FairTask.
TString fsBeamInputFile
TH2 * fhTofPtsInTrkVsGapIndPrm
CbmTofDetectorId * fTofId
Bool_t LoadBeamtimeValues()
Load the beamtime values designed in the parameters: histograms or single values.
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....
std::vector< TH1 * > fh1ClusterTotProb
CbmTofDigitize()
Constructor.
TStopwatch fTimer
ROOT timer.
std::vector< std::vector< std::vector< Double_t > > > fvdSignalVelocityRpc
Double_t GenerateClusterRadius(Int_t iSmType, Int_t iRpc)
Generate a value for the cluster radius from the beamtime data corresponding.
TH2 * fhTofPtsPosVsGap[10]
std::vector< std::vector< std::vector< std::vector< Int_t > > > > fStorDigiMatch
Double_t fdTimeTot
Total execution time.
std::vector< std::vector< ULong64_t > > fvlTrckChAddr
TString fsHistoOutFilename
std::vector< std::vector< std::vector< std::vector< std::pair< CbmTofDigi *, CbmMatch * > > > > > fStorDigi
Double_t DiscSectionArea(Double_t dDiscRadius, Double_t dDistBaseToCenter)
Compute area of a disc section from the disc radius and the distance of the.
std::vector< std::vector< std::vector< Double_t > > > fdChannelGain
virtual void Finish()
Inherited from FairTask.
std::vector< TH1 * > fh1ClusterSizeProb
Bool_t DigitizeDirectClusterSize()
Convert TofPoints in input TClonesArray to Tof Digis using directly the.
void SetInputFileName(TString FileName)
Double_t fdNofDigisTot
Total number of digis created.
Double_t fdDigiTimeConvFactor
Bool_t DigitizeFlatDisc()
Convert TofPoints in input TClonesArray to Tof Digis using an approximation of the.
Bool_t RegisterInputs()
Recover pointer on input TClonesArray: TofPoints, ...
CbmTofDigitize & operator=(const CbmTofDigitize &)
Copy operator.
std::vector< std::vector< ULong64_t > > fvlTrckRpcAddr
TClonesArray * fTofPointsColl
Bool_t CompareTimes(CbmTofDigi *p1, CbmTofDigi *p2)
CbmTofDigiBdfPar * fDigiBdfPar
Bool_t MergeSameChanDigis()
Merge the digis on he same readout channel.
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.
CbmTofDigitize(const CbmTofDigitize &)
Copy constructor.
Bool_t SetHistoFileName(TString sFilenameIn="./tofDigiBdf.hst.root")
void AllowPointsWithoutTrack(Bool_t bAllow=kTRUE)
Double_t fdNofPointsTot
Total number of points processed.
Bool_t fbAllowPointsWithoutTrack
TTimeStamp fStart
Double_t fdNofTofMcTrkTot
Total number of MC tracks with TOF points.
Bool_t InitParameters()
Initialize other parameters not included in parameter classes.
virtual void SetParContainers()
Inherited from FairTask.
ECbmModuleId GetSystemId() const
Detector system ID.
void SetMonitorHistograms(Bool_t bMonitor=kTRUE)
Double_t fdDigitizeTime
Bool_t DigitizeGaussCharge()
Convert TofPoints in input TClonesArray to Tof Digis using an approximation of the.
Double_t fdSignalPropSpeed
TH2 * fhTofPtsInTrkVsGapIndSec
virtual ~CbmTofDigitize()
Destructor.
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.
CbmTofGeoHandler * fGeoHandler
virtual InitStatus Init()
Inherited from FairTask.
Int_t fiNofEvents
Total number of events processed.
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.
void UseMcTrackMonitoring(Bool_t bMcTrkMonitor=kTRUE)
Double_t fdFeeGainSigma
std::vector< std::vector< Double_t > > fvlTrckRpcTime
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.
Double_t fdTimeResElec
ClassDef(CbmTofDigitize, 1)
TClonesArray * fMcTracksColl
std::vector< std::vector< std::vector< Int_t > > > fvRpcChOffs
CbmTofDigiPar * fDigiPar
CbmTofCell * fChannelInfo
TH2 * fhTofPtsInTrkVsGapInd
void SetDigiTimeConvFactor(Double_t dfac)
Geometric intersection of a MC track with a TOFb detector.
Definition CbmTofPoint.h:44