Belle II Software  release-05-02-19
SVDDigitizerModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2011 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Zbynek Drasal, Martin Ritter, Peter Kvasnicka *
7  * *
8  **************************************************************************/
9 
10 #ifndef SVDDigitizerModule_H
11 #define SVDDigitizerModule_H
12 
13 #include <framework/core/Module.h>
14 #include <svd/dataobjects/SVDSimHit.h>
15 #include <svd/simulation/SVDSignal.h>
16 #include <svd/geometry/SensorInfo.h>
17 #include <svd/calibration/SVDFADCMaskedStrips.h>
18 #include <svd/online/SVDOnlineToOfflineMap.h>
19 #include <framework/database/PayloadFile.h>
20 
21 #include <string>
22 
23 #include <root/TVector3.h>
24 #include <root/TFile.h>
25 #include <root/TTree.h>
26 #include <root/TH1D.h>
27 
28 namespace Belle2 {
33  namespace SVD {
34 
36  typedef std::map<short int, SVDSignal> StripSignals;
37 
39  typedef std::pair<StripSignals, StripSignals> Sensor;
40 
42  typedef std::map<VxdID, Sensor> Sensors;
43 
52  class SVDDigitizerModule : public Module {
53  public:
56 
58  void processHit();
59 
66  void driftCharge(const TVector3& position, double carriers, SVD::SensorInfo::CarrierType carrierType);
67 
73  double addNoise(double charge, double noise);
74 
78  void saveDigits();
79 
83  void saveWaveforms();
84 
88  void saveSignals();
89 
91  virtual void initialize() override;
93  virtual void beginRun() override;
95  virtual void event() override;
97  virtual void terminate() override;
98 
99  protected:
100 
101  // Members holding module parameters:
102 
103  // 1. Collections
105  std::string m_storeMCParticlesName = "";
107  std::string m_storeSimHitsName = "";
109  std::string m_storeTrueHitsName = "";
111  std::string m_relMCParticleSimHitName = "";
113  std::string m_relTrueHitSimHitName = "";
115  std::string m_storeShaperDigitsName = "";
117  std::string m_relShaperDigitMCParticleName = "";
119  std::string m_relShaperDigitTrueHitName = "";
121  std::string m_svdEventInfoName = "SVDEventInfoSim";
122 
123  // 2. Physics
125  double m_segmentLength = 0.020;
127  double m_widthOfDiffusCloud = 3.0;
128 
129  // 3. Noise
131  bool m_applyPoisson = true;
133  bool m_applyNoise = false;
135  double m_SNAdjacent = 3.0;
137  bool m_roundZS = true;
139  unsigned short m_nSamplesOverZS = 1;
141  double m_noiseFraction = 0.01;
142 
143  // 4. Timing
145  double m_shapingTime = 250.0;
147  double m_samplingTime = 16000. / 509.;
152  bool m_randomizeEventTimes = false;
154  float m_minTimeFrame = -300;
156  float m_maxTimeFrame = 150;
160  float m_currentEventTime = 0.0;
161 
162 
166  double m_startSampling = -2.0;
167 
168  // 5. Reporting
170  std::string m_rootFilename = "";
172  bool m_storeWaveforms = false;
174  std::string m_signalsList = "";
175 
176  // Other data members:
177 
180 
182  const SVDSimHit* m_currentHit = nullptr;
184  int m_currentParticle = -1;
188  Sensor* m_currentSensor = NULL;
190  const SensorInfo* m_currentSensorInfo = nullptr;
192  double m_currentTime = 0;
194  double m_sensorThickness = 0.03;
196  double m_depletionVoltage = 40;
198  double m_biasVoltage = 100;
200  double m_backplaneCapacitanceU = 0.1; //pF/cm
202  double m_interstripCapacitanceU = 0.7; //pF/cm
204  double m_couplingCapacitanceU = 15; //pF/cm
206  double m_backplaneCapacitanceV = 0.4; //pF/cm
208  double m_interstripCapacitanceV = 0.7; //pF/cm
210  double m_couplingCapacitanceV = 30; //pF/cm
212  // double m_aduEquivalentU;
214  // double m_aduEquivalentV;
216  double m_elNoiseU = 500; //e-
218  double m_elNoiseV = 500; //e-
219 
220  //run-dependent MC payloads:
222  static std::string m_xmlFileName ;
224  std::unique_ptr<SVDOnlineToOfflineMap> m_map;
226  // ROOT stuff:
228  TFile* m_rootFile = nullptr;
230  TH1D* m_histChargeSharing_u = nullptr;
232  TH1D* m_histChargeSharing_v = nullptr;
233 
235  TH1D* m_histMobility_e = nullptr;
237  TH1D* m_histMobility_h = nullptr;
239  TH1D* m_histVelocity_e = nullptr;
241  TH1D* m_histVelocity_h = nullptr;
243  TH1D* m_histDistanceToPlane_e = nullptr;
245  TH1D* m_histDistanceToPlane_h = nullptr;
247  TH1D* m_histDriftTime_e = nullptr;
249  TH1D* m_histDriftTime_h = nullptr;
250 
252  TH1D* m_histLorentz_u = nullptr;
254  TH1D* m_histLorentz_v = nullptr;
256  TH1D* m_signalDist_u = nullptr;
258  TH1D* m_signalDist_v = nullptr;
260  TTree* m_waveTree = nullptr;
261 
262  };//end class declaration
263 
264 
265  } // end namespace SVD
267 } // end namespace Belle2
268 
269 #endif // SVDDigitizerModule_H
Belle2::SVD::SVDDigitizerModule::m_relShaperDigitMCParticleName
std::string m_relShaperDigitMCParticleName
Name of the relation between SVDShaperDigits and MCParticles.
Definition: SVDDigitizerModule.h:124
Belle2::SVD::SVDDigitizerModule::m_currentTime
double m_currentTime
Time of the current SimHit.
Definition: SVDDigitizerModule.h:199
Belle2::SVD::SVDDigitizerModule::m_histDistanceToPlane_h
TH1D * m_histDistanceToPlane_h
Histogram showing the distance to plane for h.
Definition: SVDDigitizerModule.h:252
Belle2::SVD::SVDDigitizerModule::m_map
std::unique_ptr< SVDOnlineToOfflineMap > m_map
channel mapping map
Definition: SVDDigitizerModule.h:231
Belle2::SVD::SVDDigitizerModule::m_sensors
Sensors m_sensors
Structure containing signals in all existing sensors.
Definition: SVDDigitizerModule.h:186
Belle2::SVD::SVDDigitizerModule::m_backplaneCapacitanceU
double m_backplaneCapacitanceU
The backplane capacitanceU wrt.
Definition: SVDDigitizerModule.h:207
Belle2::SVD::SVDDigitizerModule::m_backplaneCapacitanceV
double m_backplaneCapacitanceV
The backplane capacitanceV wrt.
Definition: SVDDigitizerModule.h:213
Belle2::SVD::SVDDigitizerModule::m_segmentLength
double m_segmentLength
Max.
Definition: SVDDigitizerModule.h:132
Belle2::SVD::SVDDigitizerModule::m_mapping
DBObjPtr< PayloadFile > m_mapping
channel mapping payload
Definition: SVDDigitizerModule.h:230
Belle2::SVD::SVDDigitizerModule::m_applyPoisson
bool m_applyPoisson
Whether or not to apply poisson fluctuation of charge.
Definition: SVDDigitizerModule.h:138
Belle2::SVDFADCMaskedStrips
This class defines the dbobject and the method to access strips which are masked at FADC level.
Definition: SVDFADCMaskedStrips.h:44
Belle2::SVD::SVDDigitizerModule::m_storeWaveforms
bool m_storeWaveforms
Store waveform data in the reporting file?
Definition: SVDDigitizerModule.h:179
Belle2::SVD::SVDDigitizerModule::addNoise
double addNoise(double charge, double noise)
Calculate the noise contribution to one strip with given charge.
Definition: SVDDigitizerModule.cc:637
Belle2::SVD::SVDDigitizerModule::m_relMCParticleSimHitName
std::string m_relMCParticleSimHitName
Name of the relation between MCParticles and SVDSimHits.
Definition: SVDDigitizerModule.h:118
Belle2::SVD::SVDDigitizerModule::saveSignals
void saveSignals()
Save signals to a root-delimited file (to be analyzed in Python).
Definition: SVDDigitizerModule.cc:889
Belle2::SVD::Sensor
std::pair< StripSignals, StripSignals > Sensor
Signals of u- and v- strips in one sensor.
Definition: SVDDigitizerModule.h:46
Belle2::DBObjPtr< PayloadFile >
Specialization of DBObjPtr in case of PayloadFiles.
Definition: PayloadFile.h:64
Belle2::SVDSimHit
Class SVDSimHit - Geant4 simulated hit for the SVD.
Definition: SVDSimHit.h:28
Belle2::SVD::SVDDigitizerModule::m_roundZS
bool m_roundZS
Round ZS cut to nearest ADU.
Definition: SVDDigitizerModule.h:144
Belle2::SVD::SVDDigitizerModule::m_interstripCapacitanceV
double m_interstripCapacitanceV
The interstrip capacitanceV for the sensor.
Definition: SVDDigitizerModule.h:215
Belle2::SVD::SVDDigitizerModule::m_currentSensorInfo
const SensorInfo * m_currentSensorInfo
Pointer to the SensorInfo of the current sensor.
Definition: SVDDigitizerModule.h:197
Belle2::SVD::SVDDigitizerModule::m_histDriftTime_e
TH1D * m_histDriftTime_e
Histogram showing the drift time of e.
Definition: SVDDigitizerModule.h:254
Belle2::SVD::SVDDigitizerModule::saveWaveforms
void saveWaveforms()
Save waveforms to the statistics file.
Definition: SVDDigitizerModule.cc:851
Belle2::SVD::SVDDigitizerModule::event
virtual void event() override
Digitize one event.
Definition: SVDDigitizerModule.cc:285
Belle2::SVD::SVDDigitizerModule::m_rootFilename
std::string m_rootFilename
Name of the ROOT filename to output statistics.
Definition: SVDDigitizerModule.h:177
Belle2::SVD::SVDDigitizerModule::m_samplingTime
double m_samplingTime
Interval between two waveform samples (30 ns).
Definition: SVDDigitizerModule.h:154
Belle2::SVD::SVDDigitizerModule::m_relShaperDigitTrueHitName
std::string m_relShaperDigitTrueHitName
Name of the relation between SVDShaperDigits and SVDTrueHits.
Definition: SVDDigitizerModule.h:126
Belle2::SVD::SVDDigitizerModule::m_randomizeEventTimes
bool m_randomizeEventTimes
Randomize event times? If set to true, event times will be randomized uniformly from m_minTimeFrame t...
Definition: SVDDigitizerModule.h:159
Belle2::SVD::SVDDigitizerModule::m_histLorentz_u
TH1D * m_histLorentz_u
Histogram showing the Lorentz angles in u (r-phi).
Definition: SVDDigitizerModule.h:259
Belle2::SVD::Sensors
std::map< VxdID, Sensor > Sensors
Map of all signals in all sensors.
Definition: SVDDigitizerModule.h:49
Belle2::SVD::SVDDigitizerModule::m_signalDist_u
TH1D * m_signalDist_u
Histogram showing the distribution of digit signals in u (r-phi).
Definition: SVDDigitizerModule.h:263
Belle2::SVD::SVDDigitizerModule::m_interstripCapacitanceU
double m_interstripCapacitanceU
The interstrip capacitanceU for the sensor.
Definition: SVDDigitizerModule.h:209
Belle2::SVD::SVDDigitizerModule::m_waveTree
TTree * m_waveTree
Tree for waveform storage.
Definition: SVDDigitizerModule.h:267
Belle2::SVD::SVDDigitizerModule::saveDigits
void saveDigits()
Save digits to the DataStore Saves samples of generated waveforms.
Definition: SVDDigitizerModule.cc:649
Belle2::SVD::SensorInfo
Specific implementation of SensorInfo for SVD Sensors which provides additional sensor specific infor...
Definition: SensorInfo.h:35
Belle2::SVD::SVDDigitizerModule::m_noiseFraction
double m_noiseFraction
(derived from SNAdjacent) Fraction of noisy strips per sensor.
Definition: SVDDigitizerModule.h:148
Belle2::SVD::SVDDigitizerModule::driftCharge
void driftCharge(const TVector3 &position, double carriers, SVD::SensorInfo::CarrierType carrierType)
Drift the charge inside the silicon.
Definition: SVDDigitizerModule.cc:445
Belle2::SVD::SVDDigitizerModule::m_rootFile
TFile * m_rootFile
Pointer to the ROOT filename for statistics.
Definition: SVDDigitizerModule.h:235
Belle2::SVD::SVDDigitizerModule::m_relTrueHitSimHitName
std::string m_relTrueHitSimHitName
Name of the relation between SVDTrueHits and SVDSimHits.
Definition: SVDDigitizerModule.h:120
Belle2::SVD::SVDDigitizerModule::m_sensorThickness
double m_sensorThickness
Thickness of current sensor (read from m_currentSensorInfo).
Definition: SVDDigitizerModule.h:201
Belle2::SVD::SVDDigitizerModule::m_currentEventTime
float m_currentEventTime
Current event time.
Definition: SVDDigitizerModule.h:167
Belle2::SVD::SVDDigitizerModule::m_svdEventInfoName
std::string m_svdEventInfoName
Name of the SVDEventInfo object.
Definition: SVDDigitizerModule.h:128
Belle2::SVD::SVDDigitizerModule::m_storeSimHitsName
std::string m_storeSimHitsName
Name of the collection for the SVDSimhits.
Definition: SVDDigitizerModule.h:114
Belle2::SVD::StripSignals
std::map< short int, SVDSignal > StripSignals
Map of all signals in one sensor.
Definition: SVDDigitizerModule.h:43
Belle2::SVD::SVDDigitizerModule::m_histDriftTime_h
TH1D * m_histDriftTime_h
Histogram showing the drift time of h.
Definition: SVDDigitizerModule.h:256
Belle2::SVD::SVDDigitizerModule::m_MaskedStr
SVDFADCMaskedStrips m_MaskedStr
FADC masked strip payload.
Definition: SVDDigitizerModule.h:228
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::SVD::SVDDigitizerModule::m_elNoiseV
double m_elNoiseV
Electronic noise for v-strips.
Definition: SVDDigitizerModule.h:225
Belle2::SVD::SVDDigitizerModule::m_elNoiseU
double m_elNoiseU
ADU equivalent charge for u-strips.
Definition: SVDDigitizerModule.h:223
Belle2::SVD::SVDDigitizerModule::m_histLorentz_v
TH1D * m_histLorentz_v
Histogram showing the Lorentz angles in v (z).
Definition: SVDDigitizerModule.h:261
Belle2::SVD::SVDDigitizerModule
The SVD Digitizer module.
Definition: SVDDigitizerModule.h:59
Belle2::SVD::SVDDigitizerModule::m_xmlFileName
static std::string m_xmlFileName
< channel mapping xml filename
Definition: SVDDigitizerModule.h:229
Belle2::SVD::SVDDigitizerModule::m_storeShaperDigitsName
std::string m_storeShaperDigitsName
Name of the collection for the SVDShaperDigits.
Definition: SVDDigitizerModule.h:122
Belle2::SVD::SVDDigitizerModule::m_histMobility_e
TH1D * m_histMobility_e
Histogram showing the mobility of e-.
Definition: SVDDigitizerModule.h:242
Belle2::SVD::SVDDigitizerModule::m_couplingCapacitanceU
double m_couplingCapacitanceU
The coupling capacitanceU for the sensor.
Definition: SVDDigitizerModule.h:211
Belle2::SVD::SVDDigitizerModule::initialize
virtual void initialize() override
Initialize the module and check module parameters.
Definition: SVDDigitizerModule.cc:123
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SVD::SVDDigitizerModule::m_histChargeSharing_v
TH1D * m_histChargeSharing_v
Histogram showing the charge sharing + diffusion in v (z).
Definition: SVDDigitizerModule.h:239
Belle2::SVD::SVDDigitizerModule::m_storeMCParticlesName
std::string m_storeMCParticlesName
Name of the collection for the MCParticles.
Definition: SVDDigitizerModule.h:112
Belle2::SVD::SVDDigitizerModule::m_currentHit
const SVDSimHit * m_currentHit
Pointer to the SVDSimhit currently digitized.
Definition: SVDDigitizerModule.h:189
Belle2::SVD::SVDDigitizerModule::m_histDistanceToPlane_e
TH1D * m_histDistanceToPlane_e
Histogram showing the distance to plane for e.
Definition: SVDDigitizerModule.h:250
Belle2::SVD::SVDDigitizerModule::beginRun
virtual void beginRun() override
Initialize the list of existing SVD Sensors.
Definition: SVDDigitizerModule.cc:260
Belle2::SVD::SVDDigitizerModule::m_signalsList
std::string m_signalsList
Name of the tab-delimited listing of signals.
Definition: SVDDigitizerModule.h:181
Belle2::SVD::SVDDigitizerModule::m_startSampling
double m_startSampling
Time window start.
Definition: SVDDigitizerModule.h:173
Belle2::SVD::SVDDigitizerModule::m_currentSensor
Sensor * m_currentSensor
Pointer to the sensor in which the current hit occurred.
Definition: SVDDigitizerModule.h:195
Belle2::SVD::SVDDigitizerModule::m_SNAdjacent
double m_SNAdjacent
Zero-suppression cut.
Definition: SVDDigitizerModule.h:142
Belle2::SVD::SVDDigitizerModule::m_signalDist_v
TH1D * m_signalDist_v
Histogram showing the distribution of digit signals in v (z).
Definition: SVDDigitizerModule.h:265
Belle2::SVD::SVDDigitizerModule::m_currentParticle
int m_currentParticle
Index of the particle which caused the current hit.
Definition: SVDDigitizerModule.h:191
Belle2::SVD::SVDDigitizerModule::m_histMobility_h
TH1D * m_histMobility_h
Histogram showing the mobility of h.
Definition: SVDDigitizerModule.h:244
Belle2::SVD::SVDDigitizerModule::m_histVelocity_h
TH1D * m_histVelocity_h
Histogram showing the velocity of h.
Definition: SVDDigitizerModule.h:248
Belle2::SVD::SVDDigitizerModule::m_shapingTime
double m_shapingTime
Shaping time of the APV25 shapers.
Definition: SVDDigitizerModule.h:152
Belle2::SVD::SVDDigitizerModule::m_maxTimeFrame
float m_maxTimeFrame
High edge of randomization time frame.
Definition: SVDDigitizerModule.h:163
Belle2::SVD::SVDDigitizerModule::m_currentTrueHit
int m_currentTrueHit
Index of the TrueHit the current hit belongs to.
Definition: SVDDigitizerModule.h:193
Belle2::SVD::SVDDigitizerModule::m_nSamplesOverZS
unsigned short m_nSamplesOverZS
Keek digit if at least m_nSamplesOverZS are over threshold.
Definition: SVDDigitizerModule.h:146
Belle2::SVD::SVDDigitizerModule::m_histVelocity_e
TH1D * m_histVelocity_e
Histogram showing the velocity of e-.
Definition: SVDDigitizerModule.h:246
Belle2::SVD::SVDDigitizerModule::m_biasVoltage
double m_biasVoltage
The bias voltage on the sensor.
Definition: SVDDigitizerModule.h:205
Belle2::SVD::SVDDigitizerModule::m_applyNoise
bool m_applyNoise
Whether or not to apply Gaussian noise.
Definition: SVDDigitizerModule.h:140
Belle2::SVD::SVDDigitizerModule::m_minTimeFrame
float m_minTimeFrame
Low edge of randomization time frame.
Definition: SVDDigitizerModule.h:161
Belle2::SVD::SVDDigitizerModule::SVDDigitizerModule
SVDDigitizerModule()
Constructor.
Definition: SVDDigitizerModule.cc:60
Belle2::SVD::SensorInfo::CarrierType
CarrierType
Enum to flag charge carriers.
Definition: SensorInfo.h:48
Belle2::SVD::SVDDigitizerModule::processHit
void processHit()
Process one SVDSimHit by dividing the step in smaller steps and drifting the charge.
Definition: SVDDigitizerModule.cc:406
Belle2::SVD::SVDDigitizerModule::m_storeTrueHitsName
std::string m_storeTrueHitsName
Name of the collection for the SVDTrueHits.
Definition: SVDDigitizerModule.h:116
Belle2::SVD::SVDDigitizerModule::terminate
virtual void terminate() override
Terminate the module.
Definition: SVDDigitizerModule.cc:941
Belle2::SVD::SVDDigitizerModule::m_histChargeSharing_u
TH1D * m_histChargeSharing_u
Histogram showing the charge sharing + diffusion in u (r-phi).
Definition: SVDDigitizerModule.h:237
Belle2::SVD::SVDDigitizerModule::m_widthOfDiffusCloud
double m_widthOfDiffusCloud
Width of diffusion cloud for simple drift model (in sigmas)
Definition: SVDDigitizerModule.h:134
Belle2::SVD::SVDDigitizerModule::m_couplingCapacitanceV
double m_couplingCapacitanceV
The coupling capacitanceV for the sensor.
Definition: SVDDigitizerModule.h:217
Belle2::SVD::SVDDigitizerModule::m_depletionVoltage
double m_depletionVoltage
The depletion voltage of the Silicon sensor.
Definition: SVDDigitizerModule.h:203