Belle II Software  release-05-02-19
PXDDigitizerModule.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: Martin Ritter, Benjamin Schwenker *
7  * *
8  **************************************************************************/
9 
10 #pragma once
11 
12 #include <framework/core/Module.h>
13 #include <pxd/dataobjects/PXDSimHit.h>
14 #include <pxd/dataobjects/PXDInjectionBGTiming.h>
15 #include <pxd/geometry/SensorInfo.h>
16 #include <framework/dataobjects/RelationElement.h>
17 #include <framework/datastore/StoreObjPtr.h>
18 #include <string>
19 #include <vector>
20 
21 namespace Belle2 {
27  namespace PXD {
28 
30  class Digit {
31  public:
33  Digit(unsigned short u = 0, unsigned short v = 0): m_u(u), m_v(v) {}
35  bool operator<(const Digit& b) const { return v() < b.v() || (v() == b.v() && u() < b.u()); }
37  bool operator==(const Digit& b) const { return v() == b.v() && u() == b.u(); }
39  unsigned short u() const { return m_u; }
41  unsigned short v() const { return m_v; }
42  protected:
44  unsigned short m_u;
46  unsigned short m_v;
47  };
48 
50  class DigitValue {
51  public:
53  typedef std::map<RelationElement::index_type, RelationElement::weight_type> relations_map;
55  DigitValue(): m_charge(0) {}
60  void add(double charge, int particle = -1, int truehit = -1)
61  {
62  if (particle >= 0) m_particles[particle] += charge;
63  if (truehit >= 0) m_truehits[truehit] += charge;
64  m_charge += charge;
65  }
67  double charge() const { return m_charge; }
69  const relations_map& particles() const { return m_particles; }
71  const relations_map& truehits() const { return m_truehits; }
72  protected:
74  double m_charge;
79  };
80 
82  typedef std::map<Digit, DigitValue> Sensor;
84  typedef std::map<VxdID, Sensor> Sensors;
85 
86 
94  class PXDDigitizerModule : public Module {
95  public:
98 
100  void processHit();
109  void driftCharge(const TVector3& position, double electrons);
111  void addNoiseDigits();
115  double addNoise(double charge);
117  void saveDigits();
119  bool checkIfGated(int gate);
120 
121 
123  void initialize() override final;
125  void beginRun() override final;
127  void event() override final;
128 
129  protected:
131  bool m_applyNoise;
133  double m_elNoise;
135  double m_noiseFraction;
136 
140  std::string m_storeDigitsName;
142  std::string m_storeSimHitsName;
144  std::string m_storeTrueHitsName;
146  std::string m_relMCParticleSimHitName;
148  std::string m_relDigitMCParticleName;
150  std::string m_relTrueHitSimHitName;
152  std::string m_relDigitTrueHitName;
153 
154 
156  bool m_applyPoisson;
158  bool m_applyWindow;
159 
165  double m_gatingTime;
167  double m_hwdelay;
168 
174  double m_elStepTime;
176  int m_elMaxSteps;
178  double m_eToADU;
180  double m_gq;
182  double m_ADCUnit;
184  double m_chargeThreshold;
188  double m_pedestalMean;
190  double m_pedestalRMS;
193 
205  TVector3 m_currentBField;
206 
208  int m_nGates;
214  int m_triggerGate;
216  bool m_gated;
218  std::vector<float> m_gatingStartTimes;
220  std::vector<std::pair<int, int> > m_gatedChannelIntervals;
221 
222  private:
225 
226  };//end class declaration
227 
228 
229  } // end namespace PXD
231 } // end namespace Belle2
232 
Belle2::PXD::PXDDigitizerModule::m_applyPoisson
bool m_applyPoisson
Wether or not to apply poission fluctuation of charge.
Definition: PXDDigitizerModule.h:163
Belle2::PXD::PXDDigitizerModule::addNoise
double addNoise(double charge)
Calculate the noise contribution to one pixel with given charge.
Definition: PXDDigitizerModule.cc:474
Belle2::PXD::PXDDigitizerModule::event
void event() override final
Digitize one event.
Definition: PXDDigitizerModule.cc:180
Belle2::PXD::DigitValue::charge
double charge() const
Return the charge collected in the pixel.
Definition: PXDDigitizerModule.h:74
Belle2::PXD::DigitValue::m_charge
double m_charge
charge of the pixel
Definition: PXDDigitizerModule.h:81
Belle2::PXD::PXDDigitizerModule::m_elMaxSteps
int m_elMaxSteps
Maximum number of random walks before abort.
Definition: PXDDigitizerModule.h:183
Belle2::PXD::PXDDigitizerModule::m_currentHit
const PXDSimHit * m_currentHit
Pointer to the PXDSimhit currently digitized.
Definition: PXDDigitizerModule.h:202
Belle2::PXD::PXDDigitizerModule::m_gatingWithoutReadout
bool m_gatingWithoutReadout
Digits from gated rows not sent to DHH.
Definition: PXDDigitizerModule.h:168
Belle2::PXD::DigitValue
Class representing the charge and particle contributions for one pixel.
Definition: PXDDigitizerModule.h:57
Belle2::PXD::Digit::v
unsigned short v() const
Return v (row) ID.
Definition: PXDDigitizerModule.h:48
Belle2::PXD::PXDDigitizerModule::m_currentTrueHit
int m_currentTrueHit
Index of the TrueHit the current hit belongs to.
Definition: PXDDigitizerModule.h:206
Belle2::PXD::Digit::u
unsigned short u() const
Return u (column) ID.
Definition: PXDDigitizerModule.h:46
Belle2::PXD::PXDDigitizerModule::m_pedestalMean
double m_pedestalMean
Mean pedestal in ADU.
Definition: PXDDigitizerModule.h:195
Belle2::PXD::PXDDigitizerModule::m_chargeThresholdElectrons
double m_chargeThresholdElectrons
...
Definition: PXDDigitizerModule.h:193
Belle2::PXD::DigitValue::relations_map
std::map< RelationElement::index_type, RelationElement::weight_type > relations_map
Type to store contributions to pixel charge by different particles.
Definition: PXDDigitizerModule.h:60
Belle2::PXD::PXDDigitizerModule::m_elGroupSize
int m_elGroupSize
Max number of electrons per random walk.
Definition: PXDDigitizerModule.h:179
Belle2::PXD::Digit
Class to represent the coordinates of one pixel.
Definition: PXDDigitizerModule.h:37
Belle2::PXD::PXDDigitizerModule::m_gatedChannelIntervals
std::vector< std::pair< int, int > > m_gatedChannelIntervals
Vector of gated readout channels
Definition: PXDDigitizerModule.h:227
Belle2::PXD::PXDDigitizerModule::m_eToADU
double m_eToADU
ENC equivalent of 1 ADU.
Definition: PXDDigitizerModule.h:185
Belle2::PXD::PXDDigitizerModule::m_relDigitMCParticleName
std::string m_relDigitMCParticleName
Name of the relation between PXDDigits and MCParticles.
Definition: PXDDigitizerModule.h:155
Belle2::PXD::DigitValue::add
void add(double charge, int particle=-1, int truehit=-1)
Add charge to the pixel.
Definition: PXDDigitizerModule.h:67
Belle2::PXD::Digit::m_u
unsigned short m_u
u (column) ID
Definition: PXDDigitizerModule.h:51
Belle2::PXD::PXDDigitizerModule::m_nGates
int m_nGates
Number of readout gates (or total number of Switcher channels)
Definition: PXDDigitizerModule.h:215
Belle2::PXD::PXDDigitizerModule::m_gq
double m_gq
g_q of a pixel in nA/electrons.
Definition: PXDDigitizerModule.h:187
Belle2::PXD::Digit::Digit
Digit(unsigned short u=0, unsigned short v=0)
Constructor.
Definition: PXDDigitizerModule.h:40
Belle2::PXD::PXDDigitizerModule::m_segmentLength
double m_segmentLength
Max.
Definition: PXDDigitizerModule.h:177
Belle2::PXD::PXDDigitizerModule::m_gatingTime
double m_gatingTime
Time window during which the PXD is not collecting charge.
Definition: PXDDigitizerModule.h:172
Belle2::PXD::PXDDigitizerModule::PXDDigitizerModule
PXDDigitizerModule()
Constructor.
Definition: PXDDigitizerModule.cc:43
Belle2::PXD::PXDDigitizerModule::m_chargeThreshold
double m_chargeThreshold
Zero-suppression threshold in ADU.
Definition: PXDDigitizerModule.h:191
Belle2::PXD::DigitValue::m_particles
relations_map m_particles
particle contributions to the charge
Definition: PXDDigitizerModule.h:83
Belle2::PXD::DigitValue::m_truehits
relations_map m_truehits
truehit contributions to the charge
Definition: PXDDigitizerModule.h:85
Belle2::PXD::PXDDigitizerModule::m_sensors
Sensors m_sensors
Structure containing all existing sensors.
Definition: PXDDigitizerModule.h:199
Belle2::PXD::PXDDigitizerModule::m_elStepTime
double m_elStepTime
Timeframe for one random walk step.
Definition: PXDDigitizerModule.h:181
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::PXD::PXDDigitizerModule::m_triggerGate
int m_triggerGate
PXD triggergate.
Definition: PXDDigitizerModule.h:221
Belle2::PXD::PXDDigitizerModule::m_elNoise
double m_elNoise
Amount of noise to apply.
Definition: PXDDigitizerModule.h:140
Belle2::PXD::DigitValue::DigitValue
DigitValue()
Constructor.
Definition: PXDDigitizerModule.h:62
Belle2::PXD::PXDDigitizerModule::beginRun
void beginRun() override final
Initialize the list of existing PXD Sensors.
Definition: PXDDigitizerModule.cc:161
Belle2::PXD::SensorInfo
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition: SensorInfo.h:34
Belle2::PXD::Digit::operator<
bool operator<(const Digit &b) const
Comparison operator to provide unique ordering.
Definition: PXDDigitizerModule.h:42
Belle2::PXD::PXDDigitizerModule::saveDigits
void saveDigits()
Save all digits to the datastore.
Definition: PXDDigitizerModule.cc:527
Belle2::PXD::PXDDigitizerModule::m_relMCParticleSimHitName
std::string m_relMCParticleSimHitName
Name of the relation between MCParticles and PXDSimHits.
Definition: PXDDigitizerModule.h:153
Belle2::PXD::PXDDigitizerModule::m_storeMCParticlesName
std::string m_storeMCParticlesName
Name of the collection for the MCParticles.
Definition: PXDDigitizerModule.h:145
Belle2::PXD::Digit::m_v
unsigned short m_v
v (row) ID
Definition: PXDDigitizerModule.h:53
Belle2::PXD::PXDDigitizerModule::m_relTrueHitSimHitName
std::string m_relTrueHitSimHitName
Name of the relation between PXDTrueHits and PXDSimHits.
Definition: PXDDigitizerModule.h:157
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::PXD::PXDDigitizerModule::m_timePerGate
double m_timePerGate
Time needed to sample and clear a readout gate
Definition: PXDDigitizerModule.h:219
Belle2::PXD::PXDDigitizerModule::processHit
void processHit()
Process one PXDSimHit by dividing the step in smaller steps and drifting the charge.
Definition: PXDDigitizerModule.cc:332
Belle2::PXD::Sensors
std::map< VxdID, Sensor > Sensors
Map of all hits in all Sensors.
Definition: PXDDigitizerModule.h:91
Belle2::PXD::PXDDigitizerModule::m_relDigitTrueHitName
std::string m_relDigitTrueHitName
Name of the relation between PXDDigits and PXDTrueHits.
Definition: PXDDigitizerModule.h:159
Belle2::PXD::PXDDigitizerModule::m_hwdelay
double m_hwdelay
Hardware delay between time of bunch crossing and switching on triggergate in ns.
Definition: PXDDigitizerModule.h:174
Belle2::PXD::PXDDigitizerModule::addNoiseDigits
void addNoiseDigits()
Add pure noise digits to the Sensors.
Definition: PXDDigitizerModule.cc:495
Belle2::PXD::PXDDigitizerModule::m_pxdIntegrationTime
double m_pxdIntegrationTime
Integration time for each gate of the PXD in ns.
Definition: PXDDigitizerModule.h:217
Belle2::PXD::PXDDigitizerModule::m_currentBField
TVector3 m_currentBField
Current magnetic field.
Definition: PXDDigitizerModule.h:212
Belle2::PXD::Sensor
std::map< Digit, DigitValue > Sensor
Map of all hits in one Sensor.
Definition: PXDDigitizerModule.h:89
Belle2::PXD::PXDDigitizerModule::m_storePXDTiming
StoreObjPtr< PXDInjectionBGTiming > m_storePXDTiming
Input array for timings.
Definition: PXDDigitizerModule.h:231
Belle2::PXD::PXDDigitizerModule::initialize
void initialize() override final
Initialize the module and check the parameters.
Definition: PXDDigitizerModule.cc:94
Belle2::PXD::DigitValue::truehits
const relations_map & truehits() const
Return the map containing all truehit contributions to the pixel charge.
Definition: PXDDigitizerModule.h:78
Belle2::PXD::PXDDigitizerModule::m_currentSensor
Sensor * m_currentSensor
Pointer to the sensor in which the current hit occured.
Definition: PXDDigitizerModule.h:208
Belle2::PXD::PXDDigitizerModule::m_noiseFraction
double m_noiseFraction
Fraction of noisy pixels per sensor.
Definition: PXDDigitizerModule.h:142
Belle2::PXD::PXDDigitizerModule::checkIfGated
bool checkIfGated(int gate)
Check if gate was read while in gated mode.
Definition: PXDDigitizerModule.cc:521
Belle2::PXD::PXDDigitizerModule::m_applyWindow
bool m_applyWindow
Wether or not to apply a time window cut.
Definition: PXDDigitizerModule.h:165
Belle2::PXD::Digit::operator==
bool operator==(const Digit &b) const
Equality operator to check for equality.
Definition: PXDDigitizerModule.h:44
Belle2::PXD::PXDDigitizerModule::m_gated
bool m_gated
Gated mode flag.
Definition: PXDDigitizerModule.h:223
Belle2::PXD::PXDDigitizerModule::m_applyNoise
bool m_applyNoise
Wether or not to apply noise.
Definition: PXDDigitizerModule.h:138
Belle2::PXD::PXDDigitizerModule::m_storeDigitsName
std::string m_storeDigitsName
Name of the collection for the PXDDigits.
Definition: PXDDigitizerModule.h:147
Belle2::PXD::PXDDigitizerModule::m_ADCUnit
double m_ADCUnit
Slope of the linear ADC transfer curve in nA/ADU.
Definition: PXDDigitizerModule.h:189
Belle2::PXD::PXDDigitizerModule::driftCharge
void driftCharge(const TVector3 &position, double electrons)
Drift the charge inside the silicon.
Definition: PXDDigitizerModule.cc:425
Belle2::PXD::PXDDigitizerModule::m_gatingWithoutReadoutTime
double m_gatingWithoutReadoutTime
Time window during which digits from gated rows are not sent to DHH.
Definition: PXDDigitizerModule.h:170
Belle2::PXD::PXDDigitizerModule::m_pedestalRMS
double m_pedestalRMS
RMS pedestal in ADU.
Definition: PXDDigitizerModule.h:197
Belle2::PXD::PXDDigitizerModule::m_currentSensorInfo
const SensorInfo * m_currentSensorInfo
Pointer to the SensorInfo of the current sensor.
Definition: PXDDigitizerModule.h:210
Belle2::PXD::PXDDigitizerModule
The PXD Digitizer module.
Definition: PXDDigitizerModule.h:101
Belle2::PXD::DigitValue::particles
const relations_map & particles() const
Return the map containing all particle contributions to the pixel charge.
Definition: PXDDigitizerModule.h:76
Belle2::PXD::PXDDigitizerModule::m_storeSimHitsName
std::string m_storeSimHitsName
Name of the collection for the PXDSimhits.
Definition: PXDDigitizerModule.h:149
Belle2::PXD::PXDDigitizerModule::m_currentParticle
int m_currentParticle
Index of the particle which caused the current hit.
Definition: PXDDigitizerModule.h:204
Belle2::PXD::PXDDigitizerModule::m_storeTrueHitsName
std::string m_storeTrueHitsName
Name of the collection for the PXDTrueHits.
Definition: PXDDigitizerModule.h:151
Belle2::PXD::PXDDigitizerModule::m_gatingStartTimes
std::vector< float > m_gatingStartTimes
Vector of start times for gating.
Definition: PXDDigitizerModule.h:225
Belle2::PXDSimHit
Class PXDSimHit - Geant4 simulated hit for the PXD.
Definition: PXDSimHit.h:28