CbmRoot
Loading...
Searching...
No Matches
CbmTrdModuleSimR.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Etienne Bechtel, Florian Uhlig [committer] */
4
5#ifndef CBMTRDMODULESIMR_H
6#define CBMTRDMODULESIMR_H
7
8#include "CbmTrdCheckUtil.h"
9#include "CbmTrdModuleSim.h"
10#include "CbmTrdRawToDigiR.h"
11
12class TRandom3;
13class TFile;
14class TH2D;
15class TH1I;
16class TH1D;
18class CbmTimeSlice;
19
24public:
25 CbmTrdModuleSimR(Int_t mod, Int_t ly, Int_t rot);
26 virtual ~CbmTrdModuleSimR() { ; }
27 void GetCounters(Int_t& nEl, Int_t& nLattice, Int_t& nOverThr) const
28 {
29 nEl = nofElectrons;
30 nLattice = nofLatticeHits;
31 nOverThr = nofPointsAboveThreshold;
32 }
33 Int_t FlushBuffer(ULong64_t time = 0);
34 Bool_t MakeDigi(CbmTrdPoint* p, Double_t time, Bool_t TR);
35 Bool_t MakeRaw(/*CbmTrdPoint *p*/) { return kTRUE; }
36
37 //seter functions
38 void SetAsicPar(CbmTrdParModAsic* p = NULL);
39 void SetNCluster(Int_t nCluster) { fnClusterConst = nCluster; }
40 void SetNoiseLevel(Double_t sigma_keV);
41 void SetDistributionPoints(Int_t points);
42 void SetSpadicResponse(Double_t calibration, Double_t tau);
43 void SetPulsePars(Int_t mode);
44 void SetPulseMode(Bool_t pulsed);
45 void SetGamma(Double_t gamma) { fGamma = gamma; }
46 void SetTriggerThreshold(Double_t minCharge) { fMinimumChargeTH = minCharge; }
47 void SetPadPlaneScanArea(Int_t row);
49 {
50 nofElectrons = 0;
53 }
56 void SetQA(CbmTrdCheckUtil* qa) { fQA = qa; }
57
58private:
61
62 //pulsed mode
63 void AddDigitoPulseBuffer(Int_t address, Double_t reldrift, Double_t charge, Double_t chargeTR, Double_t time,
64 Int_t trigger, Int_t epoints, Int_t ipoint);
65 std::vector<Double_t> MakePulse(Double_t charge, std::vector<Double_t> pulse, Int_t address);
66 void AddToPulse(Int_t address, Double_t charge, Double_t reldrift, std::vector<Double_t> pulse);
67 Bool_t CheckMulti(Int_t address, std::vector<Double_t> pulse);
68 Int_t CheckTrigger(std::vector<Double_t> pulse);
69 Double_t CalcResponse(Double_t t);
70 void ProcessPulseBuffer(Int_t address, Bool_t FNcall, Bool_t MultiCall, Bool_t down, Bool_t up);
71 Int_t GetMultiBin(std::vector<Double_t> pulse);
72
73 //vintage EB
74 void AddDigi(Int_t address, Double_t charge, Double_t chargeTR, Double_t time, Int_t trigger);
75
76 //non pulsed TB mode
77 void AddDigitoBuffer(Int_t address, Double_t charge, Double_t chargeTR, Double_t time, Int_t trigger);
78 void ProcessBuffer(Int_t address);
79
80 //Buffer managment
81 void CheckBuffer(Bool_t EB);
82 void CleanUp(Bool_t EB);
83
84 //general tools
85 Bool_t DistributeCharge(Double_t pointin[3], Double_t pointout[3], Double_t delta[3], Double_t pos[3], Int_t ipoints);
86 Double_t AddDrifttime(Double_t x, Double_t z);
87 Double_t AddDrifttime(Int_t x);
88 Double_t AddNoise(Double_t charge);
89 Double_t GetStep(Double_t dist, Int_t roll);
90 std::pair<Int_t, std::vector<Double_t>> GetTotalSteps(Double_t In[3], Double_t Out[3], Double_t dist);
91 Int_t AddNoiseADC();
92 Int_t AddCrosstalk(Double_t address, Int_t i, Int_t sec, Int_t row, Int_t col, Int_t ncols);
93 Double_t CalcPRF(Double_t x, Double_t W, Double_t h);
94 void CheckTime(Int_t address);
95 void NoiseTime(ULong64_t eventTime);
96 void SetDist(Int_t dist) { fDistributionMode = dist; }
97 std::vector<Double_t> AddCorrelatedNoise(std::vector<Double_t> pulse);
98
99 //general MC data usage - distributing MC charge over the pad plane
100 void ScanPadPlane(const Double_t* local_point, Double_t reldrift, Double_t clusterELoss, Double_t clusterELossTR,
101 Int_t epoints, Int_t ipoint);
102
103
104 //spadic response parameters
105 Double_t fCalibration = 35. / 1.1107 / 0.8 * 1.5; // calibrating pulse height to MIP
106 Double_t fEReco = 0.; // calibrating energy reconstruction to the amount and position of used samples of the pulse
107 Double_t fTau = 120.0; // peaking time of the pulse
108 Double_t fTriggerSlope = 12.0; // trigger setting of the pulse
109 Int_t fRecoMode = 2; // mode for reconstruction samples
110
111 //general globals
114 Double_t fCurrentTime;
115 Double_t fAddress;
117 Double_t fEventTime;
118 Double_t fLastTime;
119 Double_t fCollectTime;
122
127 Bool_t fClipping;
128
129 Int_t fepoints;
133
134 Int_t fLastPoint = 0;
135 Int_t fLastEvent = 0;
136 Int_t frecostart = 2;
137 Int_t frecostop = 5;
138
139 Int_t fClipLevel = 500;
140 Int_t fPresamples = 2;
141 Int_t fShapingOrder = 1;
142 Int_t fMaxBin = 2 + fPresamples;
143 Int_t fMinBin = 0 + fPresamples;
144 Double_t fGamma = 0.;
145 Double_t fMinDrift = 12.5;
147
148
149 //counters
153
154 Double_t fDriftStart = 0;
155
156 std::map<Int_t, std::vector<std::pair<CbmTrdDigi*, CbmMatch*>>> fAnalogBuffer;
157 std::map<Int_t, std::pair<std::vector<Double_t>, CbmMatch*>> fPulseBuffer;
158 std::map<Int_t, std::pair<Double_t, Int_t>> fMultiBuffer;
159 std::map<Int_t, Double_t> fTimeBuffer;
160 std::map<Int_t, Double_t> fShiftQA;
161 std::map<Int_t, std::vector<std::map<TString, Int_t>>> fLinkQA;
162 std::map<Int_t, Double_t> fMCQA;
163 std::map<Int_t, std::vector<std::vector<Int_t>>> fMCBuffer;
164 Float_t fQAPosition[3] = {0., 0., 0.};
165 Float_t fQAPos_out[3] = {0., 0., 0.};
166
168 TH2D* fDriftTime = NULL;
170 Bool_t fDebug = true;
171
172 ClassDef(CbmTrdModuleSimR,
173 1) // Simulation module implementation for rectangular pad geometry
174};
175
176#endif
TClonesArray * points
Generates beam ions for transport simulation.
Bookkeeping of time-slice content.
Simulation module implementation for rectangular pad geometry.
void SetPulsePars(Int_t mode)
void SetQA(CbmTrdCheckUtil *qa)
std::pair< Int_t, std::vector< Double_t > > GetTotalSteps(Double_t In[3], Double_t Out[3], Double_t dist)
void GetCounters(Int_t &nEl, Int_t &nLattice, Int_t &nOverThr) const
Int_t FlushBuffer(ULong64_t time=0)
Flush local digi buffer.
void SetSpadicResponse(Double_t calibration, Double_t tau)
Bool_t MakeRaw()
Steering routine for converting MC point to raw format.
void SetNoiseLevel(Double_t sigma_keV)
Bool_t MakeDigi(CbmTrdPoint *p, Double_t time, Bool_t TR)
Steering routine for converting MC point to digits.
void AddDigi(Int_t address, Double_t charge, Double_t chargeTR, Double_t time, Int_t trigger)
Double_t AddNoise(Double_t charge)
void CleanUp(Bool_t EB)
Double_t CalcPRF(Double_t x, Double_t W, Double_t h)
void SetDist(Int_t dist)
Double_t CalcResponse(Double_t t)
void AddDigitoBuffer(Int_t address, Double_t charge, Double_t chargeTR, Double_t time, Int_t trigger)
void ProcessBuffer(Int_t address)
std::map< Int_t, std::vector< std::vector< Int_t > > > fMCBuffer
void NoiseTime(ULong64_t eventTime)
CbmTrdCheckUtil * fQA
void ScanPadPlane(const Double_t *local_point, Double_t reldrift, Double_t clusterELoss, Double_t clusterELossTR, Int_t epoints, Int_t ipoint)
std::vector< Double_t > AddCorrelatedNoise(std::vector< Double_t > pulse)
CbmTrdRawToDigiR * fMessageConverter
void SetGamma(Double_t gamma)
virtual ~CbmTrdModuleSimR()
CbmTrdModuleSimR(Int_t mod, Int_t ly, Int_t rot)
std::map< Int_t, std::vector< std::pair< CbmTrdDigi *, CbmMatch * > > > fAnalogBuffer
void SetTriggerThreshold(Double_t minCharge)
CbmTimeSlice * fTimeSlice
link to CBM time slice
Int_t CheckTrigger(std::vector< Double_t > pulse)
void AddDigitoPulseBuffer(Int_t address, Double_t reldrift, Double_t charge, Double_t chargeTR, Double_t time, Int_t trigger, Int_t epoints, Int_t ipoint)
std::map< Int_t, Double_t > fShiftQA
std::map< Int_t, Double_t > fMCQA
Int_t AddCrosstalk(Double_t address, Int_t i, Int_t sec, Int_t row, Int_t col, Int_t ncols)
void SetAsicPar(CbmTrdParModAsic *p=NULL)
std::vector< Double_t > MakePulse(Double_t charge, std::vector< Double_t > pulse, Int_t address)
Double_t AddDrifttime(Double_t x, Double_t z)
void SetMessageConverter(CbmTrdRawToDigiR *conv)
std::map< Int_t, std::vector< std::map< TString, Int_t > > > fLinkQA
void CheckTime(Int_t address)
CbmTrdModuleSimR & operator=(const CbmTrdModuleSimR &)
Int_t GetMultiBin(std::vector< Double_t > pulse)
Bool_t CheckMulti(Int_t address, std::vector< Double_t > pulse)
void SetNCluster(Int_t nCluster)
std::map< Int_t, std::pair< Double_t, Int_t > > fMultiBuffer
std::map< Int_t, std::pair< std::vector< Double_t >, CbmMatch * > > fPulseBuffer
std::map< Int_t, Double_t > fTimeBuffer
void ProcessPulseBuffer(Int_t address, Bool_t FNcall, Bool_t MultiCall, Bool_t down, Bool_t up)
void SetPadPlaneScanArea(Int_t row)
void SetDistributionPoints(Int_t points)
void SetPulseMode(Bool_t pulsed)
void GetModuleType(CbmTrdRawToDigiR *conv)
Double_t GetStep(Double_t dist, Int_t roll)
void AddToPulse(Int_t address, Double_t charge, Double_t reldrift, std::vector< Double_t > pulse)
void CheckBuffer(Bool_t EB)
Bool_t DistributeCharge(Double_t pointin[3], Double_t pointout[3], Double_t delta[3], Double_t pos[3], Int_t ipoints)
CbmTrdModuleSimR(const CbmTrdModuleSimR &)
Abstract class for module wise digitization and raw format producing.
Describe TRD module ASIC settings (electronic gain, delays, etc)
Describe TRD module ASIC settings (electronic gain, delays, etc)