Belle II Software  release-05-02-19
CsIDigitizerModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: beaulieu *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef CSIDIGITIZERMODULE_H
12 #define CSIDIGITIZERMODULE_H
13 
14 #include <framework/core/Module.h>
15 #include <framework/datastore/StoreArray.h>
16 #include <beast/csi/dataobjects/CsiDigiHit.h>
17 #include <beast/csi/dataobjects/CsiSimHit.h>
18 #include <beast/csi/dataobjects/CsiHit.h>
19 
20 #include <vector>
21 
22 
23 
24 namespace Belle2 {
29  namespace csi {
30 
32  typedef std::vector<double> Signal;
34  typedef std::vector<int> DigitalSignal;
35 
45  class CsIDigitizerModule : public Module {
46 
47  public:
48 
53 
55  virtual ~CsIDigitizerModule();
56 
58  virtual void initialize() override;
59 
61  virtual void beginRun() override;
62 
67  virtual void event() override;
68 
70  virtual void endRun() override;
71 
73  virtual void terminate() override;
74 
75 
76  private:
77 
84  Signal genTimeSignal(double _energy, double _timeAvg, double _timeRMS, int iChannel, bool _save = 0);
85 
93  double genTimeSignal(Signal* _output, Signal _energies, Signal _times, int _iChannel, int _dt, int _nsam, bool _save = 0);
94 
103  Signal genSignalTemplate(int _n, int _i0, double _t1, double _t2 = 0.0, double _rFastTot = 1.0);
104 
105 
117  Signal firstOrderResponse(double _gain, Signal _u, double _y0, double _dt, double _tSlow, double _delay);
118 
119 
124  // Signal firstOrderResponse(double _gain, Signal _u, double _y0, double _dt, double _tSlow, double _delay, double _tRatio, double _tFast);
125 
126 
127 
144  uint16_t doChargeIntegration(Signal _u, int _NsamBL, uint16_t* BSL, uint32_t* Q, uint32_t* t,
145  std::vector<uint16_t>* _Waveform, std::vector<uint8_t>* _DPPCIBits,
146  int _Treshold, double _TriggerHoldoff = 0.0, double _GateWidth = 320.0,
147  double _GateOffset = 40.0, bool _recordTraces = false);
148 
149 
158  int addNoise(Signal* y, double _rms, double _offset);
159 
167  DigitalSignal doDigitization(Signal _v, double _LSB);
168 
169 
179  double f(double fi, double u_i, double u_j, double y, double invtau);
180 
181 
182 
183 
186  int getnSamples() const { return m_nSamples; }
187 
190  void setnSamples(int nsamples) { m_nSamples = nsamples; }
191 
192 
193  private:
194 
196  int m_hitNum;
197 
198  // Member data objects
199  double m_TrueEdep;
200  double m_Resolution;
201  double m_SampleRate;
202  double m_dt;
203  int m_nWaveforms;
207  uint8_t m_CellId;
208  uint16_t m_Baseline;
209  uint32_t m_Charge;
210  uint16_t m_MaxADC;
211  uint32_t m_Time;
213  std::vector<uint16_t> m_Waveform;
214  std::vector<uint8_t> m_DPPCIBits;
216  const double m_tRisePMT = 2;
217  const double m_tTransitPMT = 48;
218  const double m_Zl = 50;
226  std::vector<double> m_calibConstants;
227  std::vector<double> m_noiseLevels;
228  std::vector<double> m_LY;
229  std::vector<double> m_tRatio;
230  std::vector<double> m_tFast;
231  std::vector<double> m_tSlow;
232  std::vector<double> m_LCE;
233  std::vector<double> m_PmtQE;
234  std::vector<double> m_PmtGain;
239  };
240 
241  }
243 }
244 
245 #endif /* CSIDIGITIZERMODULE_H */
Belle2::csi::CsIDigitizerModule::firstOrderResponse
Signal firstOrderResponse(double _gain, Signal _u, double _y0, double _dt, double _tSlow, double _delay)
Calculates the time response of a first order system (such as crystal, PMT, etc)
Definition: CsIDigitizerModule.cc:493
Belle2::csi::CsIDigitizerModule::m_Resolution
double m_Resolution
Parameter: Resolution (in mV) of the ACD.
Definition: CsIDigitizerModule.h:208
Belle2::csi::CsIDigitizerModule::m_tFast
std::vector< double > m_tFast
Fast time constant for each channel (ns)
Definition: CsIDigitizerModule.h:238
Belle2::csi::CsIDigitizerModule::m_hitNum
int m_hitNum
index of csiHit
Definition: CsIDigitizerModule.h:204
Belle2::csi::CsIDigitizerModule::m_Baseline
uint16_t m_Baseline
Baseline (pedestal) frozen during charge integration.
Definition: CsIDigitizerModule.h:216
Belle2::csi::CsIDigitizerModule::addNoise
int addNoise(Signal *y, double _rms, double _offset)
Adds noise to the signal.
Definition: CsIDigitizerModule.cc:467
Belle2::csi::CsIDigitizerModule::m_SimHitEdeps
Signal m_SimHitEdeps[16]
Array of signals (each corresponding to one channel)
Definition: CsIDigitizerModule.h:245
Belle2::csi::CsIDigitizerModule::m_aHit
StoreArray< CsiHit > m_aHit
Time-accumulated hits...
Definition: CsIDigitizerModule.h:228
Belle2::csi::CsIDigitizerModule::m_noiseLevels
std::vector< double > m_noiseLevels
Noise level for each channel (in V)
Definition: CsIDigitizerModule.h:235
Belle2::csi::CsIDigitizerModule::doDigitization
DigitalSignal doDigitization(Signal _v, double _LSB)
Digitizes the signal the signal.
Definition: CsIDigitizerModule.cc:369
Belle2::csi::CsIDigitizerModule::m_tRisePMT
const double m_tRisePMT
2.6 Rise time of the PMT signal (in ns)
Definition: CsIDigitizerModule.h:224
Belle2::csi::CsIDigitizerModule::m_LCE
std::vector< double > m_LCE
Light collection efficiency for each channel.
Definition: CsIDigitizerModule.h:240
Belle2::csi::CsIDigitizerModule::m_Waveform
std::vector< uint16_t > m_Waveform
Saved waveform.
Definition: CsIDigitizerModule.h:221
Belle2::csi::CsIDigitizerModule::event
virtual void event() override
Each event This is where the actual digitization is done, and the hits are written to the DataStore.
Definition: CsIDigitizerModule.cc:105
Belle2::csi::CsIDigitizerModule::f
double f(double fi, double u_i, double u_j, double y, double invtau)
This returns the RHS of first order differential equation.
Definition: CsIDigitizerModule.cc:546
Belle2::csi::CsIDigitizerModule::genSignalTemplate
Signal genSignalTemplate(int _n, int _i0, double _t1, double _t2=0.0, double _rFastTot=1.0)
Generates the template for a signal (obsolete)
Belle2::csi::CsIDigitizerModule::m_nWFcounter
int m_nWFcounter
Counter for the number of waveforms to save.
Definition: CsIDigitizerModule.h:212
Belle2::csi::CsIDigitizerModule::m_nSamples
int m_nSamples
Number of points requested in the waveform arrays.
Definition: CsIDigitizerModule.h:220
Belle2::csi::CsIDigitizerModule::m_tRatio
std::vector< double > m_tRatio
Ratio fast light / slow light for each channel.
Definition: CsIDigitizerModule.h:237
Belle2::csi::CsIDigitizerModule::setnSamples
void setnSamples(int nsamples)
Sets the number of points in the waveforms arrays.
Definition: CsIDigitizerModule.h:198
Belle2::csi::CsIDigitizerModule::terminate
virtual void terminate() override
Final clean up.
Definition: CsIDigitizerModule.cc:208
Belle2::csi::CsIDigitizerModule::m_Time
uint32_t m_Time
Trigger Time.
Definition: CsIDigitizerModule.h:219
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::csi::CsIDigitizerModule::getnSamples
int getnSamples() const
Gets the number of points in the waveforms arrays.
Definition: CsIDigitizerModule.h:194
Belle2::csi::CsIDigitizerModule::m_DPPCIBits
std::vector< uint8_t > m_DPPCIBits
status of the DPP-CI
Definition: CsIDigitizerModule.h:222
Belle2::csi::CsIDigitizerModule::initialize
virtual void initialize() override
Register input and output data.
Definition: CsIDigitizerModule.cc:69
Belle2::csi::DigitalSignal
std::vector< int > DigitalSignal
Designed to hold a "digital" (limited by the DAQ board rate and resolution) signal
Definition: CsIDigitizerModule.h:42
Belle2::csi::CsIDigitizerModule::m_CsITlSignalTemplate
Signal m_CsITlSignalTemplate
Template Signal of a CsITl trace.
Definition: CsIDigitizerModule.h:232
Belle2::csi::CsIDigitizerModule::m_Zl
const double m_Zl
Line impedance of the analog chain (to get voltage from anode current)
Definition: CsIDigitizerModule.h:226
Belle2::csi::CsIDigitizerModule::m_aSimHit
StoreArray< CsiSimHit > m_aSimHit
Each simulated particle in the crystal.
Definition: CsIDigitizerModule.h:229
Belle2::csi::CsIDigitizerModule::m_LY
std::vector< double > m_LY
Light yield for each channel (gamma per GeV)
Definition: CsIDigitizerModule.h:236
Belle2::csi::CsIDigitizerModule::m_CellId
uint8_t m_CellId
Cell ID.
Definition: CsIDigitizerModule.h:215
Belle2::csi::CsIDigitizerModule::m_PmtQE
std::vector< double > m_PmtQE
PMT quantum efficiency for each channel.
Definition: CsIDigitizerModule.h:241
Belle2::csi::CsIDigitizerModule::m_Charge
uint32_t m_Charge
Integrated Charge.
Definition: CsIDigitizerModule.h:217
Belle2::csi::CsIDigitizerModule::m_PmtGain
std::vector< double > m_PmtGain
PMT gain for each channel.
Definition: CsIDigitizerModule.h:242
Belle2::csi::CsIDigitizerModule::m_TrueEdep
double m_TrueEdep
Sum of the MC (true) deposited energies in the event-channel.
Definition: CsIDigitizerModule.h:207
Belle2::csi::CsIDigitizerModule::endRun
virtual void endRun() override
Clean up.
Definition: CsIDigitizerModule.cc:204
Belle2::csi::CsIDigitizerModule::doChargeIntegration
uint16_t doChargeIntegration(Signal _u, int _NsamBL, uint16_t *BSL, uint32_t *Q, uint32_t *t, std::vector< uint16_t > *_Waveform, std::vector< uint8_t > *_DPPCIBits, int _Treshold, double _TriggerHoldoff=0.0, double _GateWidth=320.0, double _GateOffset=40.0, bool _recordTraces=false)
Method to use when crystal has two light components.
Definition: CsIDigitizerModule.cc:212
Belle2::csi::CsIDigitizerModule::m_aDigiHit
StoreArray< CsiDigiHit > m_aDigiHit
Output: a digitized hit.
Definition: CsIDigitizerModule.h:230
Belle2::csi::CsIDigitizerModule::beginRun
virtual void beginRun() override
To do before each runs.
Definition: CsIDigitizerModule.cc:100
Belle2::csi::CsIDigitizerModule::m_MaxADC
uint16_t m_MaxADC
Max ACD of the hit (to check saturations)
Definition: CsIDigitizerModule.h:218
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::csi::CsIDigitizerModule::m_nWaveforms
int m_nWaveforms
Number of waveforms to save.
Definition: CsIDigitizerModule.h:211
Belle2::csi::CsIDigitizerModule::m_SimHitTimes
Signal m_SimHitTimes[16]
Array of signals (each corresponding to one channel)
Definition: CsIDigitizerModule.h:244
Belle2::csi::CsIDigitizerModule::m_calibConstants
std::vector< double > m_calibConstants
Calibration constants for each channel (in V/keV)
Definition: CsIDigitizerModule.h:234
Belle2::csi::CsIDigitizerModule::CsIDigitizerModule
CsIDigitizerModule()
Constructor: Sets the description, the properties and the parameters of the module.
Definition: CsIDigitizerModule.cc:42
Belle2::csi::CsIDigitizerModule::genTimeSignal
Signal genTimeSignal(double _energy, double _timeAvg, double _timeRMS, int iChannel, bool _save=0)
Generates a time signal for a mean energy deposit The energy deposit is modelled at a Gaussian whose ...
Belle2::csi::CsIDigitizerModule::~CsIDigitizerModule
virtual ~CsIDigitizerModule()
Default destructor.
Definition: CsIDigitizerModule.cc:65
Belle2::csi::CsIDigitizerModule::m_tSlow
std::vector< double > m_tSlow
Slow time constant for each channel (ns)
Definition: CsIDigitizerModule.h:239
Belle2::csi::CsIDigitizerModule::m_SampleRate
double m_SampleRate
Parameter: Sample rate (in samples/sec) of the ADC.
Definition: CsIDigitizerModule.h:209
Belle2::csi::CsIDigitizerModule::m_dt
double m_dt
Time interval (in ns) (calculated from m_SampleRate.
Definition: CsIDigitizerModule.h:210
Belle2::csi::Signal
std::vector< double > Signal
Designed to hold a "continuous" (in time and amplitude) signal
Definition: CsIDigitizerModule.h:40
Belle2::csi::CsIDigitizerModule::m_tTransitPMT
const double m_tTransitPMT
48Mean transit time of the PMT signal (in ns)
Definition: CsIDigitizerModule.h:225