Belle II Software development
PXDDigitizerModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/core/Module.h>
12#include <pxd/dataobjects/PXDSimHit.h>
13#include <pxd/dataobjects/PXDInjectionBGTiming.h>
14#include <pxd/geometry/SensorInfo.h>
15#include <framework/dataobjects/RelationElement.h>
16#include <framework/datastore/StoreObjPtr.h>
17#include <string>
18#include <vector>
19
20namespace Belle2 {
26 namespace PXD {
27
29 class Digit {
30 public:
32 Digit(unsigned short u = 0, unsigned short v = 0): m_u(u), m_v(v) {}
34 bool operator<(const Digit& b) const { return v() < b.v() || (v() == b.v() && u() < b.u()); }
36 bool operator==(const Digit& b) const { return v() == b.v() && u() == b.u(); }
38 unsigned short u() const { return m_u; }
40 unsigned short v() const { return m_v; }
41 protected:
43 unsigned short m_u;
45 unsigned short m_v;
46 };
47
49 class DigitValue {
50 public:
52 typedef std::map<RelationElement::index_type, RelationElement::weight_type> relations_map;
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;
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
91 class PXDDigitizerModule : public Module {
92 public:
95
97 void processHit();
106 void driftCharge(const ROOT::Math::XYZVector& position, double electrons);
108 void addNoiseDigits();
112 double addNoise(double charge);
114 void saveDigits();
116 bool checkIfGated(int gate);
117
118
120 void initialize() override final;
122 void beginRun() override final;
124 void event() override final;
125
126 protected:
130 double m_elNoise;
133
137 std::string m_storeDigitsName;
150
151
156
164 double m_hwdelay;
165
175 double m_eToADU;
177 double m_gq;
179 double m_ADCUnit;
190
202 ROOT::Math::XYZVector m_currentBField;
203
215 std::vector<float> m_gatingStartTimes;
217 std::vector<std::pair<int, int> > m_gatedChannelIntervals;
218
219 private:
222
223 };//end class declaration
224
225
226 } // end namespace PXD
228} // end namespace Belle2
229
Base class for Modules.
Definition: Module.h:72
Class PXDSimHit - Geant4 simulated hit for the PXD.
Definition: PXDSimHit.h:24
Class representing the charge and particle contributions for one pixel.
relations_map m_truehits
truehit contributions to the charge
const relations_map & truehits() const
Return the map containing all truehit contributions to the pixel charge.
relations_map m_particles
particle contributions to the charge
void add(double charge, int particle=-1, int truehit=-1)
Add charge to the pixel.
const relations_map & particles() const
Return the map containing all particle contributions to the pixel charge.
double m_charge
charge of the pixel
double charge() const
Return the charge collected in the pixel.
std::map< RelationElement::index_type, RelationElement::weight_type > relations_map
Type to store contributions to pixel charge by different particles.
Class to represent the coordinates of one pixel.
bool operator<(const Digit &b) const
Comparison operator to provide unique ordering.
bool operator==(const Digit &b) const
Equality operator to check for equality.
unsigned short v() const
Return v (row) ID.
Digit(unsigned short u=0, unsigned short v=0)
Constructor.
unsigned short m_u
u (column) ID
unsigned short u() const
Return u (column) ID.
unsigned short m_v
v (row) ID
The PXD Digitizer module.
double m_pedestalRMS
RMS pedestal in ADU.
void processHit()
Process one PXDSimHit by dividing the step in smaller steps and drifting the charge.
double m_pxdIntegrationTime
Integration time for each gate of the PXD in ns.
double m_pedestalMean
Mean pedestal in ADU.
bool m_gatingWithoutReadout
Digits from gated rows not sent to DHH.
void initialize() override final
Initialize the module and check the parameters.
std::string m_relTrueHitSimHitName
Name of the relation between PXDTrueHits and PXDSimHits.
void saveDigits()
Save all digits to the datastore.
int m_currentParticle
Index of the particle which caused the current hit.
double m_ADCUnit
Slope of the linear ADC transfer curve in nA/ADU.
Sensors m_sensors
Structure containing all existing sensors.
double m_elStepTime
Timeframe for one random walk step.
std::string m_relDigitMCParticleName
Name of the relation between PXDDigits and MCParticles.
int m_elMaxSteps
Maximum number of random walks before abort.
bool m_applyWindow
Wether or not to apply a time window cut.
std::string m_storeTrueHitsName
Name of the collection for the PXDTrueHits.
double m_timePerGate
Time needed to sample and clear a readout gate
double m_gatingWithoutReadoutTime
Time window during which digits from gated rows are not sent to DHH.
void driftCharge(const ROOT::Math::XYZVector &position, double electrons)
Drift the charge inside the silicon.
const PXDSimHit * m_currentHit
Pointer to the PXDSimhit currently digitized.
std::vector< float > m_gatingStartTimes
Vector of start times for gating.
std::string m_storeMCParticlesName
Name of the collection for the MCParticles.
double m_noiseFraction
Fraction of noisy pixels per sensor.
bool m_applyNoise
Wether or not to apply noise.
void addNoiseDigits()
Add pure noise digits to the Sensors.
void event() override final
Digitize one event.
int m_nGates
Number of readout gates (or total number of Switcher channels)
double m_chargeThreshold
Zero-suppression threshold in ADU.
bool m_applyPoisson
Wether or not to apply poission fluctuation of charge.
Sensor * m_currentSensor
Pointer to the sensor in which the current hit occured.
double m_chargeThresholdElectrons
... and its equivalent in electrons
std::vector< std::pair< int, int > > m_gatedChannelIntervals
Vector of gated readout channels
ROOT::Math::XYZVector m_currentBField
Current magnetic field.
double m_elNoise
Amount of noise to apply.
std::string m_storeDigitsName
Name of the collection for the PXDDigits.
const SensorInfo * m_currentSensorInfo
Pointer to the SensorInfo of the current sensor.
std::string m_relDigitTrueHitName
Name of the relation between PXDDigits and PXDTrueHits.
double m_gatingTime
Time window during which the PXD is not collecting charge.
void beginRun() override final
Initialize the list of existing PXD Sensors.
double m_eToADU
ENC equivalent of 1 ADU.
bool checkIfGated(int gate)
Check if gate was read while in gated mode.
double m_gq
g_q of a pixel in nA/electrons.
StoreObjPtr< PXDInjectionBGTiming > m_storePXDTiming
Input array for timings.
double m_hwdelay
Hardware delay between time of bunch crossing and switching on triggergate in ns.
int m_elGroupSize
Max number of electrons per random walk.
int m_currentTrueHit
Index of the TrueHit the current hit belongs to.
std::string m_relMCParticleSimHitName
Name of the relation between MCParticles and PXDSimHits.
double addNoise(double charge)
Calculate the noise contribution to one pixel with given charge.
std::string m_storeSimHitsName
Name of the collection for the PXDSimhits.
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition: SensorInfo.h:23
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
std::map< Digit, DigitValue > Sensor
Map of all hits in one Sensor.
std::map< VxdID, Sensor > Sensors
Map of all hits in all Sensors.
Abstract base class for different kinds of events.