CbmRoot
CbmMuchDigitizeGem.h
Go to the documentation of this file.
1 
24 #ifndef CBMMUCHDIGITIZEGEM_H
25 #define CBMMUCHDIGITIZEGEM_H 1
26 #define NTIMEBINS 200
27 #include "CbmDigitize.h"
28 
29 #include "TArrayD.h"
30 #include "TClonesArray.h"
31 #include "TMath.h"
32 #include "TPolyLine.h"
33 #include "TStopwatch.h"
34 #include "TString.h"
35 //#include "TH1D.h"
36 
37 #include "CbmDefs.h" // for ECbmModuleId
38 #include "CbmMuchDigi.h"
39 #include "CbmMuchDigiMatch.h"
40 #include "CbmMuchGeoScheme.h"
41 #include "CbmMuchSignal.h"
42 #include "TF1.h"
43 #include "TH1.h"
44 #include <map>
45 class CbmMuchSector;
46 class CbmMuchPoint;
47 class CbmMuchPad;
49 class TChain;
50 
52 
53 static const Double_t gkResponsePeriod = 400.;
54 //static const Int_t gkResponseBin = 1;
55 
56 class CbmMuchDigitizeGem : public CbmDigitize<CbmMuchDigi> {
57 public:
60 
62  CbmMuchDigitizeGem(const char* digiFileName, Int_t flag);
63 
66 
68  virtual ~CbmMuchDigitizeGem();
69 
71  virtual void Exec(Option_t* opt);
72 
74  virtual void Finish();
75 
77 
78 
83  void SetSpotRadius(Double_t spotRadius = 0.05) { fSpotRadius = spotRadius; }
84 
89  void SetMeanGasGain(Double_t gasGain) { fMeanGasGain = gasGain; }
90 
95  void SetQMaximum(UInt_t qMax) { fQMax = qMax; }
96 
101  void SetQThreshold(UInt_t qThreshold) { fQThreshold = qThreshold; }
102 
107  void SetNADCChannels(UInt_t nADCChannels) { fNADCChannels = nADCChannels; }
108 
113  void SetMeanNoise(UInt_t meanNoise) { fMeanNoise = meanNoise; }
114 
119  void SetDeadPadsFrac(Double_t deadPadsFrac) { fDeadPadsFrac = deadPadsFrac; }
120 
124  void SetDTime(Double_t dTime) { fDTime = dTime; }
125 
127  Double_t GetDTime() { return fDTime; }
128 
133  Double_t Sigma_n_e(Double_t Tkin, Double_t mass);
134 
139  Double_t MPV_n_e(Double_t Tkin, Double_t mass);
140 
141  void ReadAndRegister(
142  Long_t); //Read from CbmMuchReadoutBuffer and Register as per mode
144  Int_t GetNofSignals() const { return fNofSignals; }
145 
146  //Iteriate on each element of fAddressCharge, create a CbmMuchSignal and store in CbmMuchReadoutBuffer.
147  Bool_t BufferSignals(Int_t, Double_t, Double_t);
149  CbmMuchSignal*); //Converting Analog Signal to Digital Digi
150 
151  void SetMcChain(TChain* mcChain) { fMcChain = mcChain; }
152  //void SetDeadTime(Double_t deadTime) {fDeadTime = deadTime; }
153  void SetDriftVelocity(Double_t velocity) { fDriftVelocity = velocity; }
154  //void SetPeakingTime(Double_t peakingTime) {fPeakingTime = peakingTime; }
155  //void SetRemainderTime(Double_t remainderTime) {fRemainderTime = remainderTime; }
156  void SetTimeBinWidth(Double_t timeBinWidth) { fTimeBinWidth = timeBinWidth; }
157  void SetAlgorithm(Int_t algorithm) { fAlgorithm = algorithm; }
158  void SetTimeOverThreshold(Bool_t tot) { fTOT = tot; }
159  //TArrayD fgDeltaResponse; // Signal shape on delta function response
160  void SetLight(Bool_t islight) { fIsLight = islight; }
161 
162  //------------------------Noise Generation-----------------------//
163 
164  void SetGenerateNoise(Bool_t Noise) {
166  } // Setting Generate Noise for Time Based Mode
167  void SetPerPadNoiseRate(Double_t noiserate) {
168  fPerPadNoiseRate = noiserate;
169  } // Setting Generate Noise for Time Based Mode
170  Int_t GenerateNoise(Double_t, Double_t);
171  Int_t GenerateNoisePerModule(CbmMuchModuleGem*, Double_t, Double_t);
172  void AddNoiseSignal(CbmMuchPad*, Double_t, Double_t);
173 
174  //-------------------------------------------------------------//
175 
176 
177 private:
178  Int_t fAlgorithm; // Algorithm
179  CbmMuchGeoScheme* fGeoScheme; // Main object responsible for geometry
180  TString fDigiFile; // Digitization file
181  TClonesArray* fPoints; // Input array of CbmMuchPoint
182  TClonesArray* fMCTracks; // Input array of MCTrack
183  //std::vector<CbmMuchDigi>* fDigis; //< Output array of CbmMuchDigi and will be stored in vector
184  //std::vector<CbmMatch>* fDigiMatches; //< Output array of CbmMatch and will be stored in vector
185  //TClonesArray* fDigis; // Output array of CbmMuchDigi
186  //TClonesArray* fDigiMatches; // Output array of CbmMuchDigiMatches
187  Int_t fNFailed; // Total number of points which digitization has failed
188  Int_t fNOutside; // Total number of points which was found outside a detector
189  Int_t fNMulti; // Total number of channels that was hitby several points
190  Int_t fFlag; // flag to distinguish geometry
191 
192 
193  /*
194  TH1D* hPriElAfterDriftpathgem;
195  TH1D* hPriElAfterDriftpathrpc;
196  TH1F * hadcGEM;
197  TH1F * hadcRPC;
198 */
199 
200  UInt_t fNADCChannels; // Number of ADC channels
201  UInt_t fQMax; // Maximum charge that a pad can collect [electrons]
202  UInt_t fQThreshold; // Charge threshold [electrons]
203  UInt_t
204  fMeanNoise; // Mean electronics noise value [electrons] different than fGenerateElectronicsNoise
205  Double_t fSpotRadius; // Spot radius from secondary electrons [cm]
206  Double_t fMeanGasGain; // Mean gas gain value (1e4 by default)
207  Double_t fDTime; // Time resolution [ns]
208  Double_t fDeadPadsFrac; // Probability to find a dead pad
209  TStopwatch fTimer; // Timer
210  TChain* fMcChain; // Chain of McFiles with McTrack info
211  Double_t fDeadTime; // Channel dead time [ns]
212  Double_t fDriftVelocity; // Drift Velocity [um/ns]
213  //Double_t fPeakingTime; // Peaking time [ns]
214  //Double_t fRemainderTime; // Remainder time = t_r [ns]: remainder is simulated as exp(-t/t_r)
215  Double_t fTimeBinWidth; // Width of the bin for signal shape simulation
216  Int_t fNTimeBins; // Number of bins for signal shape simulation
217  // Int_t fNdigis; // Number of created digis
218  Bool_t
219  fTOT; // Flag to switch between time over threshold/direct amplitude measurement
220  Double_t
221  fTotalDriftTime; // Total drift time (calculated from drift velocity and drift volume width)
222 
223  TF1* fSigma[3];
224  TF1* fMPV[3];
225  Bool_t fIsLight; //Default fIsLight = 1
226 
227  // --- Time of last processed Much Point (for time mode)
228  Double_t fTimePointLast;
229 
230  // --- Digi times (for stream mode, in each step)
231  Double_t fTimeDigiFirst;
232  Double_t fTimeDigiLast;
233  // --- Event counters
234  Int_t fNofPoints;
235  Int_t fNofSignals;
236  Int_t fNofDigis;
237 
238  // --- Run counters
239  Int_t fNofEvents;
240  Double_t fNofPointsTot;
241  Double_t fNofSignalsTot;
242  Double_t fNofDigisTot;
243  Double_t fTimeTot;
244 
245  //Data members for Electronics Noise Generation
246  Double_t fPerPadNoiseRate; //Noise rate per pad
247  Double_t fPreviousEventTime = -1;
248  // Double_t fCurrentEventTime = 0; //!Current Event Time
249  Bool_t
251  Int_t fNofNoiseTot = 0;
252  Int_t fNofNoiseSignals = 0;
254  //TH1D* noise;
255 
256  //Storing all the charges which is generated from the same MCPoint in a map<address, charge>
257  std::map<UInt_t, UInt_t> fAddressCharge;
258 
260  virtual InitStatus Init();
261 
263  Bool_t ExecPoint(const CbmMuchPoint* point, Int_t);
264 
272  // Bool_t AddDigi(CbmMuchPad* pad);
273  inline Int_t GasGain();
274  void DetectorParameters(CbmMuchModule* module);
275  Double_t GetNPrimaryElectronsPerCm(const CbmMuchPoint* point,
276  int detectortype);
277  Bool_t AddCharge(CbmMuchSectorRadial* s,
278  UInt_t ne,
279  Int_t iPoint,
280  Double_t time,
281  Double_t driftTime,
282  Double_t phi1,
283  Double_t phi2);
284  void AddCharge(CbmMuchPad* pad,
285  UInt_t charge,
286  Int_t iPoint,
287  Double_t time,
288  Double_t driftTime);
289  void Reset();
290 
292 };
293 #endif
CbmMuchDigitizeGem::SetDTime
void SetDTime(Double_t dTime)
Definition: CbmMuchDigitizeGem.h:124
CbmMuchDigitizeGem::AddCharge
Bool_t AddCharge(CbmMuchSectorRadial *s, UInt_t ne, Int_t iPoint, Double_t time, Double_t driftTime, Double_t phi1, Double_t phi2)
Definition: CbmMuchDigitizeGem.cxx:1191
CbmMuchDigitizeGem::Finish
virtual void Finish()
Definition: CbmMuchDigitizeGem.cxx:756
CbmMuchDigitizeGem::fPoints
TClonesArray * fPoints
Definition: CbmMuchDigitizeGem.h:181
CbmMuchDigi.h
CbmMuchGeoScheme
Definition: CbmMuchGeoScheme.h:43
CbmMuchPoint
Definition: CbmMuchPoint.h:21
CbmMuchSignal.h
CbmMuchSectorRadial
Definition: CbmMuchSectorRadial.h:19
CbmMuchDigitizeGem::fTimeTot
Double_t fTimeTot
Total execution time.
Definition: CbmMuchDigitizeGem.h:243
CbmMuchDigitizeGem::fNOutside
Int_t fNOutside
Definition: CbmMuchDigitizeGem.h:188
CbmMuchDigitizeGem::fNofDigisTot
Double_t fNofDigisTot
Total number of digis created.
Definition: CbmMuchDigitizeGem.h:242
CbmMuchDigitizeGem::CbmMuchDigitizeGem
CbmMuchDigitizeGem()
Definition: CbmMuchDigitizeGem.cxx:79
CbmMuchDigitizeGem::Init
virtual InitStatus Init()
Definition: CbmMuchDigitizeGem.cxx:314
CbmMuchDigitizeGem::fPerPadNoiseRate
Double_t fPerPadNoiseRate
Definition: CbmMuchDigitizeGem.h:246
kGEM
@ kGEM
Definition: CbmMuchDigitizeGem.h:51
CbmMuchDigitizeGem::DetectorParameters
void DetectorParameters(CbmMuchModule *module)
Definition: CbmMuchDigitizeGem.cxx:273
CbmMuchDigitizeGem::GetNPrimaryElectronsPerCm
Double_t GetNPrimaryElectronsPerCm(const CbmMuchPoint *point, int detectortype)
Definition: CbmMuchDigitizeGem.cxx:1138
CbmMuchDigitizeGem::ExecPoint
Bool_t ExecPoint(const CbmMuchPoint *point, Int_t)
Definition: CbmMuchDigitizeGem.cxx:823
CbmMuchDigitizeGem::fNMulti
Int_t fNMulti
Definition: CbmMuchDigitizeGem.h:189
CbmMuchDigitizeGem::fNofSignalsTot
Double_t fNofSignalsTot
Total Number of signals.
Definition: CbmMuchDigitizeGem.h:241
CbmMuchDigitizeGem::SetDriftVelocity
void SetDriftVelocity(Double_t velocity)
Definition: CbmMuchDigitizeGem.h:153
CbmMuchDigitizeGem::fQThreshold
UInt_t fQThreshold
Definition: CbmMuchDigitizeGem.h:202
CbmMuchDigitizeGem::SetAlgorithm
void SetAlgorithm(Int_t algorithm)
Definition: CbmMuchDigitizeGem.h:157
CbmMuchDigitizeGem::fTimePointLast
Double_t fTimePointLast
Definition: CbmMuchDigitizeGem.h:228
CbmMuchSector
Definition: CbmMuchSector.h:22
CbmMuchDigitizeGem::fNoiseCharge
TF1 * fNoiseCharge
Definition: CbmMuchDigitizeGem.h:253
CbmMuchDigitizeGem::Exec
virtual void Exec(Option_t *opt)
Definition: CbmMuchDigitizeGem.cxx:476
CbmMuchDigitizeGem::fNofPointsTot
Double_t fNofPointsTot
Total number of points processed.
Definition: CbmMuchDigitizeGem.h:240
CbmMuchDigitizeGem::fDeadPadsFrac
Double_t fDeadPadsFrac
Definition: CbmMuchDigitizeGem.h:208
CbmMuchDigitizeGem::fNFailed
Int_t fNFailed
Definition: CbmMuchDigitizeGem.h:187
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmMuchDigitizeGem::SetNADCChannels
void SetNADCChannels(UInt_t nADCChannels)
Definition: CbmMuchDigitizeGem.h:107
DetectorType
DetectorType
Definition: CbmMuchDigitizeGem.h:51
CbmMuchDigitizeGem::SetPerPadNoiseRate
void SetPerPadNoiseRate(Double_t noiserate)
Definition: CbmMuchDigitizeGem.h:167
CbmMuchDigitizeGem::fMeanNoise
UInt_t fMeanNoise
Definition: CbmMuchDigitizeGem.h:204
CbmMuchDigitizeGem::SetTimeBinWidth
void SetTimeBinWidth(Double_t timeBinWidth)
Definition: CbmMuchDigitizeGem.h:156
CbmMuchDigitizeGem::SetDeadPadsFrac
void SetDeadPadsFrac(Double_t deadPadsFrac)
Definition: CbmMuchDigitizeGem.h:119
CbmMuchDigitizeGem::fNofNoiseTot
Int_t fNofNoiseTot
Set this boolean variable to True if want to generated Elecronics Noise.
Definition: CbmMuchDigitizeGem.h:251
CbmMuchDigitizeGem::fMeanGasGain
Double_t fMeanGasGain
Definition: CbmMuchDigitizeGem.h:206
CbmMuchDigitizeGem::GenerateNoise
Int_t GenerateNoise(Double_t, Double_t)
Definition: CbmMuchDigitizeGem.cxx:541
CbmMuchDigitizeGem::MPV_n_e
Double_t MPV_n_e(Double_t Tkin, Double_t mass)
Definition: CbmMuchDigitizeGem.cxx:1114
CbmMuchDigitizeGem::fDTime
Double_t fDTime
Definition: CbmMuchDigitizeGem.h:207
CbmMuchDigitizeGem::fTimer
TStopwatch fTimer
Definition: CbmMuchDigitizeGem.h:209
CbmMuchDigitizeGem::SetGenerateNoise
void SetGenerateNoise(Bool_t Noise)
Definition: CbmMuchDigitizeGem.h:164
CbmMuchDigitizeGem::Reset
void Reset()
Definition: CbmMuchDigitizeGem.cxx:266
CbmMuchDigitizeGem::SetTimeOverThreshold
void SetTimeOverThreshold(Bool_t tot)
Definition: CbmMuchDigitizeGem.h:158
CbmMuchDigitizeGem::fMcChain
TChain * fMcChain
Definition: CbmMuchDigitizeGem.h:210
CbmMuchDigitizeGem::fDigiFile
TString fDigiFile
Definition: CbmMuchDigitizeGem.h:180
CbmMuchDigitizeGem::fAddressCharge
std::map< UInt_t, UInt_t > fAddressCharge
Function to sample the noise charge.
Definition: CbmMuchDigitizeGem.h:257
CbmMuchDigitizeGem::fNofDigis
Int_t fNofDigis
Number of created digis in Exec.
Definition: CbmMuchDigitizeGem.h:236
CbmMuchSignal
Data class for an analog signal in the MUCH Simple data class used in the digitisation process of the...
Definition: CbmMuchSignal.h:31
CbmMuchDigitizeGem::AddNoiseSignal
void AddNoiseSignal(CbmMuchPad *, Double_t, Double_t)
Definition: CbmMuchDigitizeGem.cxx:618
CbmMuchDigitizeGem::SetMcChain
void SetMcChain(TChain *mcChain)
Definition: CbmMuchDigitizeGem.h:151
CbmMuchDigitizeGem::fNADCChannels
UInt_t fNADCChannels
Definition: CbmMuchDigitizeGem.h:200
CbmMuchDigitizeGem::ConvertSignalToDigi
CbmMuchDigi * ConvertSignalToDigi(CbmMuchSignal *)
Definition: CbmMuchDigitizeGem.cxx:696
CbmDigitize
Base class template for CBM digitisation tasks.
Definition: CbmDigitize.h:39
CbmMuchDigitizeGem::fNofNoiseSignals
Int_t fNofNoiseSignals
Definition: CbmMuchDigitizeGem.h:252
CbmMuchDigitizeGem::SetMeanNoise
void SetMeanNoise(UInt_t meanNoise)
Definition: CbmMuchDigitizeGem.h:113
CbmMuchDigitizeGem::Sigma_n_e
Double_t Sigma_n_e(Double_t Tkin, Double_t mass)
Definition: CbmMuchDigitizeGem.cxx:1092
CbmMuchModuleGem
Definition: CbmMuchModuleGem.h:24
CbmMuchDigitizeGem::fPreviousEventTime
Double_t fPreviousEventTime
Definition: CbmMuchDigitizeGem.h:247
CbmMuchDigitizeGem::fTimeDigiFirst
Double_t fTimeDigiFirst
Time of first digi sent to DAQ.
Definition: CbmMuchDigitizeGem.h:231
CbmMuchDigitizeGem::fAlgorithm
Int_t fAlgorithm
Definition: CbmMuchDigitizeGem.h:178
CbmMuchDigitizeGem::GenerateNoisePerModule
Int_t GenerateNoisePerModule(CbmMuchModuleGem *, Double_t, Double_t)
Definition: CbmMuchDigitizeGem.cxx:595
CbmMuchDigitizeGem::fNofPoints
Int_t fNofPoints
Number of points processed in Exec.
Definition: CbmMuchDigitizeGem.h:234
CbmMuchDigitizeGem::fGenerateElectronicsNoise
Bool_t fGenerateElectronicsNoise
Previous Event Time.
Definition: CbmMuchDigitizeGem.h:250
CbmMuchDigitizeGem::fDeadTime
Double_t fDeadTime
Definition: CbmMuchDigitizeGem.h:211
CbmMuchDigitizeGem::fGeoScheme
CbmMuchGeoScheme * fGeoScheme
Definition: CbmMuchDigitizeGem.h:179
CbmMuchDigitizeGem::fQMax
UInt_t fQMax
Definition: CbmMuchDigitizeGem.h:201
CbmMuchDigitizeGem::GasGain
Int_t GasGain()
Definition: CbmMuchDigitizeGem.cxx:1083
CbmMuchDigitizeGem
Definition: CbmMuchDigitizeGem.h:56
CbmMuchDigitizeGem::GetNofSignals
Int_t GetNofSignals() const
Definition: CbmMuchDigitizeGem.h:144
CbmMuchDigitizeGem::operator=
CbmMuchDigitizeGem & operator=(const CbmMuchDigitizeGem &)=delete
CbmMuchDigitizeGem::fNofSignals
Int_t fNofSignals
Number of signals.
Definition: CbmMuchDigitizeGem.h:235
CbmMuchModule
Definition: CbmMuchModule.h:24
CbmDigitize< CbmMuchDigi >::ClassDef
ClassDef(CbmDigitize, 1)
CbmMuchDigitizeGem::fTOT
Bool_t fTOT
Definition: CbmMuchDigitizeGem.h:219
CbmMuchDigitizeGem::fTotalDriftTime
Double_t fTotalDriftTime
Definition: CbmMuchDigitizeGem.h:221
CbmMuchDigitizeGem::fDriftVelocity
Double_t fDriftVelocity
Definition: CbmMuchDigitizeGem.h:212
CbmMuchDigitizeGem::fMPV
TF1 * fMPV[3]
Definition: CbmMuchDigitizeGem.h:224
CbmMuchDigi
Definition: CbmMuchDigi.h:31
gkResponsePeriod
static const Double_t gkResponsePeriod
Definition: CbmMuchDigitizeGem.h:53
CbmMuchDigitizeGem::BufferSignals
Bool_t BufferSignals(Int_t, Double_t, Double_t)
Definition: CbmMuchDigitizeGem.cxx:1276
CbmMuchDigitizeGem::GetSystemId
ECbmModuleId GetSystemId() const
Detector system ID.
Definition: CbmMuchDigitizeGem.h:76
CbmMuchPad
Definition: CbmMuchPad.h:21
CbmMuchDigitizeGem::fTimeDigiLast
Double_t fTimeDigiLast
Time of last digi sent to DAQ.
Definition: CbmMuchDigitizeGem.h:232
CbmMuchDigitizeGem::fSigma
TF1 * fSigma[3]
Definition: CbmMuchDigitizeGem.h:223
CbmMuchDigitizeGem::fNTimeBins
Int_t fNTimeBins
Definition: CbmMuchDigitizeGem.h:216
CbmMuchDigitizeGem::SetMeanGasGain
void SetMeanGasGain(Double_t gasGain)
Definition: CbmMuchDigitizeGem.h:89
CbmMuchDigitizeGem::CbmMuchDigitizeGem
CbmMuchDigitizeGem(const CbmMuchDigitizeGem &)=delete
CbmMuchDigitizeGem::SetQMaximum
void SetQMaximum(UInt_t qMax)
Definition: CbmMuchDigitizeGem.h:95
CbmMuchDigitizeGem::SetQThreshold
void SetQThreshold(UInt_t qThreshold)
Definition: CbmMuchDigitizeGem.h:101
CbmMuchDigitizeGem::fNofEvents
Int_t fNofEvents
Total number of events processed.
Definition: CbmMuchDigitizeGem.h:239
ECbmModuleId::kMuch
@ kMuch
Muon detection system.
CbmMuchDigiMatch.h
CbmMuchDigitizeGem::fIsLight
Bool_t fIsLight
Definition: CbmMuchDigitizeGem.h:225
CbmMuchGeoScheme.h
CbmMuchDigitizeGem::fFlag
Int_t fFlag
Definition: CbmMuchDigitizeGem.h:190
CbmMuchDigitizeGem::~CbmMuchDigitizeGem
virtual ~CbmMuchDigitizeGem()
Definition: CbmMuchDigitizeGem.cxx:253
CbmMuchDigitizeGem::fMCTracks
TClonesArray * fMCTracks
Definition: CbmMuchDigitizeGem.h:182
CbmMuchDigitizeGem::fTimeBinWidth
Double_t fTimeBinWidth
Definition: CbmMuchDigitizeGem.h:215
CbmMuchDigitizeGem::SetLight
void SetLight(Bool_t islight)
Definition: CbmMuchDigitizeGem.h:160
kMICROMEGAS
@ kMICROMEGAS
Definition: CbmMuchDigitizeGem.h:51
CbmMuchDigitizeGem::GetDTime
Double_t GetDTime()
Definition: CbmMuchDigitizeGem.h:127
CbmMuchDigitizeGem::fSpotRadius
Double_t fSpotRadius
Definition: CbmMuchDigitizeGem.h:205
CbmMuchDigitizeGem::ReadAndRegister
void ReadAndRegister(Long_t)
Definition: CbmMuchDigitizeGem.cxx:643
CbmDigitize.h
CbmMuchDigitizeGem::SetSpotRadius
void SetSpotRadius(Double_t spotRadius=0.05)
Definition: CbmMuchDigitizeGem.h:83
CbmDefs.h