CbmRoot
Loading...
Searching...
No Matches
CbmMuchDigitizeGem.h
Go to the documentation of this file.
1/* Copyright (C) 2009-2020 St. Petersburg Polytechnic University, St. Petersburg
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Mikhail Ryzhinskiy [committer], Vikas Singhal, Evgeny Kryshen */
4
30#ifndef CBMMUCHDIGITIZEGEM_H
31#define CBMMUCHDIGITIZEGEM_H 1
32#define NTIMEBINS 200
33#include "CbmDigitize.h"
34
35#include "TArrayD.h"
36#include "TClonesArray.h"
37#include "TMath.h"
38#include "TPolyLine.h"
39#include "TStopwatch.h"
40#include "TString.h"
41//#include "TH1D.h"
42
43#include "CbmDefs.h" // for ECbmModuleId
44#include "CbmMuchDigi.h"
45#include "CbmMuchDigiMatch.h"
46#include "CbmMuchGeoScheme.h"
47#include "CbmMuchSignal.h"
48
49#include "TF1.h"
50#include "TH1.h"
51
52#include <map>
53class CbmMuchSector;
54class CbmMuchPoint;
55class CbmMuchPad;
57class TChain;
58
64
65static const Double_t gkResponsePeriod = 400.;
66//static const Int_t gkResponseBin = 1;
67
68class CbmMuchDigitizeGem : public CbmDigitize<CbmMuchDigi> {
69public:
72
74 CbmMuchDigitizeGem(const char* digiFileName, Int_t flag);
75
78
80 virtual ~CbmMuchDigitizeGem();
81
83 virtual void Exec(Option_t* opt);
84
86 virtual void Finish();
87
89
90
95 void SetSpotRadius(Double_t spotRadius = 0.05) { fSpotRadius = spotRadius; }
96
101 void SetMeanGasGain(Double_t gasGain) { fMeanGasGain = gasGain; }
102
107 void SetQMaximum(UInt_t qMax) { fQMax = qMax; }
108
113 void SetQThreshold(UInt_t qThreshold) { fQThreshold = qThreshold; }
114
119 void SetNADCChannels(UInt_t nADCChannels) { fNADCChannels = nADCChannels; }
120
125 void SetMeanNoise(UInt_t meanNoise) { fMeanNoise = meanNoise; }
126
131 void SetDeadPadsFrac(Double_t deadPadsFrac) { fDeadPadsFrac = deadPadsFrac; }
132
136 void SetDTime(Double_t dTime) { fDTime = dTime; }
137
139 Double_t GetDTime() { return fDTime; }
140
145 Double_t Sigma_n_e(Double_t Tkin, Double_t mass);
146
151 Double_t MPV_n_e(Double_t Tkin, Double_t mass);
152
153 void ReadAndRegister(Long_t); //Read from CbmMuchReadoutBuffer and Register as per mode
155 Int_t GetNofSignals() const { return fNofSignals; }
156
157 //Iteriate on each element of fAddressCharge, create a CbmMuchSignal and store in CbmMuchReadoutBuffer.
158 Bool_t BufferSignals(Int_t, Double_t, Double_t);
159 CbmMuchDigi* ConvertSignalToDigi(CbmMuchSignal*); //Converting Analog Signal to Digital Digi
160
161 void SetMcChain(TChain* mcChain) { fMcChain = mcChain; }
162 //void SetDeadTime(Double_t deadTime) {fDeadTime = deadTime; }
163 void SetDriftVelocity(Double_t velocity) { fDriftVelocity = velocity; }
164 //void SetPeakingTime(Double_t peakingTime) {fPeakingTime = peakingTime; }
165 //void SetRemainderTime(Double_t remainderTime) {fRemainderTime = remainderTime; }
166 void SetTimeBinWidth(Double_t timeBinWidth) { fTimeBinWidth = timeBinWidth; }
167 void SetAlgorithm(Int_t algorithm) { fAlgorithm = algorithm; }
168 void SetTimeOverThreshold(Bool_t tot) { fTOT = tot; }
169 //TArrayD fgDeltaResponse; // Signal shape on delta function response
170 void SetLight(Bool_t islight) { fIsLight = islight; }
171
172 //------------------------Noise Generation-----------------------//
173
174 void SetGenerateNoise(Bool_t Noise)
175 {
177 } // Setting Generate Noise for Time Based Mode
178 void SetPerPadNoiseRate(Double_t noiserate)
179 {
180 fPerPadNoiseRate = noiserate;
181 } // Setting Generate Noise for Time Based Mode
182 Int_t GenerateNoise(Double_t, Double_t);
183 Int_t GenerateNoisePerModule(CbmMuchModuleGem*, Double_t, Double_t);
184 void AddNoiseSignal(CbmMuchPad*, Double_t, Double_t);
185
186 //-------------------------------------------------------------//
187
188
189private:
190 Int_t fAlgorithm; // Algorithm
191 CbmMuchGeoScheme* fGeoScheme; // Main object responsible for geometry
192 TString fDigiFile; // Digitization file
193 TClonesArray* fPoints; // Input array of CbmMuchPoint
194 TClonesArray* fMCTracks; // Input array of MCTrack
195 //std::vector<CbmMuchDigi>* fDigis; //< Output array of CbmMuchDigi and will be stored in vector
196 //std::vector<CbmMatch>* fDigiMatches; //< Output array of CbmMatch and will be stored in vector
197 //TClonesArray* fDigis; // Output array of CbmMuchDigi
198 //TClonesArray* fDigiMatches; // Output array of CbmMuchDigiMatches
199 Int_t fNFailed; // Total number of points which digitization has failed
200 Int_t fNOutside; // Total number of points which was found outside a detector
201 Int_t fNMulti; // Total number of channels that was hitby several points
202 Int_t fFlag; // flag to distinguish geometry
203
204
205 /*
206 TH1D* hPriElAfterDriftpathgem;
207 TH1D* hPriElAfterDriftpathrpc;
208 TH1F * hadcGEM;
209 TH1F * hadcRPC;
210*/
211
212 UInt_t fNADCChannels; // Number of ADC channels
213 UInt_t fQMax; // Maximum charge that a pad can collect [electrons]
214 UInt_t fQThreshold; // Charge threshold [electrons]
215 UInt_t fMeanNoise; // Mean electronics noise value [electrons] different than fGenerateElectronicsNoise
216 Double_t fSpotRadius; // Spot radius from secondary electrons [cm]
217 Double_t fMeanGasGain; // Mean gas gain value (1e4 by default)
218 Double_t fDTime; // Time resolution [ns]
219 Double_t fDeadPadsFrac; // Probability to find a dead pad
220 TStopwatch fTimer; // Timer
221 TChain* fMcChain; // Chain of McFiles with McTrack info
222 Double_t fDeadTime; // Channel dead time [ns]
223 Double_t fDriftVelocity; // Drift Velocity [um/ns]
224 //Double_t fPeakingTime; // Peaking time [ns]
225 //Double_t fRemainderTime; // Remainder time = t_r [ns]: remainder is simulated as exp(-t/t_r)
226 Double_t fTimeBinWidth; // Width of the bin for signal shape simulation
227 Int_t fNTimeBins; // Number of bins for signal shape simulation
228 // Int_t fNdigis; // Number of created digis
229 Bool_t fTOT; // Flag to switch between time over threshold/direct amplitude measurement
230 Double_t fTotalDriftTime; // Total drift time (calculated from drift velocity and drift volume width)
231
232 TF1* fSigma[3];
233 TF1* fMPV[3];
234 Bool_t fIsLight; //Default fIsLight = 1
235
236 // --- Time of last processed Much Point (for time mode)
238
239 // --- Digi times (for stream mode, in each step)
240 Double_t fTimeDigiFirst;
241 Double_t fTimeDigiLast;
242 // --- Event counters
245 Int_t fNofDigis;
246
247 // --- Run counters
249 Double_t fNofPointsTot;
250 Double_t fNofSignalsTot;
251 Double_t fNofDigisTot;
252 Double_t fTimeTot;
253
254 //Data members for Electronics Noise Generation
255 Double_t fPerPadNoiseRate; //Noise rate per pad
256 Double_t fPreviousEventTime = -1;
257 // Double_t fCurrentEventTime = 0; //!Current Event Time
259 Int_t fNofNoiseTot = 0;
262 //TH1D* noise;
263
264 //Storing all the charges which is generated from the same MCPoint in a map<address, charge>
265 std::map<UInt_t, UInt_t> fAddressCharge;
266
268 virtual InitStatus Init();
269
271 Bool_t ExecPoint(const CbmMuchPoint* point, Int_t);
272
280 // Bool_t AddDigi(CbmMuchPad* pad);
281 inline Int_t GasGain();
282 void DetectorParameters(CbmMuchModule* module);
283 Double_t GetNPrimaryElectronsPerCm(const CbmMuchPoint* point, int detectortype);
284 Bool_t AddCharge(CbmMuchSectorRadial* s, UInt_t ne, Int_t iPoint, Double_t time, Double_t driftTime, Double_t phi1,
285 Double_t phi2);
286 void AddCharge(CbmMuchPad* pad, UInt_t charge, Int_t iPoint, Double_t time, Double_t driftTime);
287 void Reset();
288
289 //Below variables are applying X, Y correction for different mCBM geometries.
290 //In future we'll remove these and try to read directly from Geometry file.
291 // For GEM
292 Double_t fGemTX = 0.0;
293 Double_t fGemTY = 0.0;
294 // For RPC
295 Double_t fRpcTX = 0.0;
296 Double_t fRpcTY = 0.0;
297
299};
300#endif
ECbmModuleId
Definition CbmDefs.h:39
@ kMuch
Muon detection system.
static const Double_t gkResponsePeriod
@ kMICROMEGAS
Base class template for CBM digitisation tasks.
Definition CbmDigitize.h:44
ClassDef(CbmDigitize, 1)
CbmMuchDigitizeGem(const CbmMuchDigitizeGem &)=delete
Int_t GetNofSignals() const
Int_t fNofDigis
Number of created digis in Exec.
void SetSpotRadius(Double_t spotRadius=0.05)
Double_t MPV_n_e(Double_t Tkin, Double_t mass)
Int_t fNofEvents
Total number of events processed.
void SetMcChain(TChain *mcChain)
Int_t fNofSignals
Number of signals.
CbmMuchDigitizeGem & operator=(const CbmMuchDigitizeGem &)=delete
void DetectorParameters(CbmMuchModule *module)
CbmMuchGeoScheme * fGeoScheme
void SetAlgorithm(Int_t algorithm)
Double_t fTimeDigiLast
Time of last digi sent to DAQ.
void SetLight(Bool_t islight)
Int_t GenerateNoisePerModule(CbmMuchModuleGem *, Double_t, Double_t)
Double_t fTimeTot
Total execution time.
void SetDriftVelocity(Double_t velocity)
void SetMeanGasGain(Double_t gasGain)
void AddNoiseSignal(CbmMuchPad *, Double_t, Double_t)
Bool_t ExecPoint(const CbmMuchPoint *point, Int_t)
void SetTimeOverThreshold(Bool_t tot)
Double_t fTimeDigiFirst
Time of first digi sent to DAQ.
virtual void Exec(Option_t *opt)
void SetDTime(Double_t dTime)
void SetTimeBinWidth(Double_t timeBinWidth)
Bool_t BufferSignals(Int_t, Double_t, Double_t)
void SetQThreshold(UInt_t qThreshold)
Bool_t AddCharge(CbmMuchSectorRadial *s, UInt_t ne, Int_t iPoint, Double_t time, Double_t driftTime, Double_t phi1, Double_t phi2)
Double_t GetNPrimaryElectronsPerCm(const CbmMuchPoint *point, int detectortype)
void SetDeadPadsFrac(Double_t deadPadsFrac)
Int_t fNofNoiseTot
Set this boolean variable to True if want to generated Elecronics Noise.
void SetPerPadNoiseRate(Double_t noiserate)
Int_t fNofPoints
Number of points processed in Exec.
Double_t Sigma_n_e(Double_t Tkin, Double_t mass)
Bool_t fGenerateElectronicsNoise
Previous Event Time.
void SetNADCChannels(UInt_t nADCChannels)
std::map< UInt_t, UInt_t > fAddressCharge
Function to sample the noise charge.
Double_t fNofSignalsTot
Total Number of signals.
ECbmModuleId GetSystemId() const
Detector system ID.
Double_t fNofDigisTot
Total number of digis created.
void SetGenerateNoise(Bool_t Noise)
Double_t fNofPointsTot
Total number of points processed.
Int_t GenerateNoise(Double_t, Double_t)
virtual InitStatus Init()
CbmMuchDigi * ConvertSignalToDigi(CbmMuchSignal *)
void SetQMaximum(UInt_t qMax)
void SetMeanNoise(UInt_t meanNoise)
Data class for an analog signal in the MUCH Simple data class used in the digitisation process of the...