Belle II Software development
CsIDigitizerModule.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 <framework/datastore/StoreArray.h>
13#include <beast/csi/dataobjects/CsiDigiHit.h>
14#include <beast/csi/dataobjects/CsiSimHit.h>
15
16#include <vector>
17
18
19
20namespace Belle2 {
25 namespace csi {
26
28 typedef std::vector<double> Signal;
30 typedef std::vector<int> DigitalSignal;
31
38 class CsIDigitizerModule : public Module {
39
40 public:
41
46
48 virtual ~CsIDigitizerModule();
49
51 virtual void initialize() override;
52
54 virtual void beginRun() override;
55
60 virtual void event() override;
61
63 virtual void endRun() override;
64
66 virtual void terminate() override;
67
68
69 private:
70
81 Signal genTimeSignal(double _energy, double _timeAvg, double _timeRMS, int iChannel, bool _save = 0);
82
96 double genTimeSignal(Signal* _output, Signal _energies, Signal _times, int _iChannel, int _dt, int _nsam, bool _save = 0);
97
106 Signal genSignalTemplate(int _n, int _i0, double _t1, double _t2 = 0.0, double _rFastTot = 1.0);
107
108
120 Signal firstOrderResponse(double _gain, Signal _u, double _y0, double _dt, double _tSlow, double _delay);
121
139 uint16_t doChargeIntegration(Signal _u, int _NsamBL, uint16_t* BSL, uint32_t* Q, uint32_t* t,
140 std::vector<uint16_t>* _Waveform, std::vector<uint8_t>* _DPPCIBits,
141 int _Treshold, double _TriggerHoldoff = 0.0, double _GateWidth = 320.0,
142 double _GateOffset = 40.0, bool _recordTraces = false);
143
144
153 int addNoise(Signal* y, double _rms, double _offset);
154
162 DigitalSignal doDigitization(Signal _v, double _LSB);
163
164
174 double f(double fi, double u_i, double u_j, double y, double invtau);
175
176
177
178
181 int getnSamples() const { return m_nSamples; }
182
185 void setnSamples(int nsamples) { m_nSamples = nsamples; }
186
187
188 private:
189
192
193 // Member data objects
194 double m_TrueEdep;
197 double m_dt;
202 uint8_t m_CellId;
203 uint16_t m_Baseline;
204 uint32_t m_Charge;
205 uint16_t m_MaxADC;
206 uint32_t m_Time;
208 std::vector<uint16_t> m_Waveform;
209 std::vector<uint8_t> m_DPPCIBits;
211 const double m_tRisePMT = 2;
212 const double m_tTransitPMT = 48;
213 const double m_Zl = 50;
220 std::vector<double> m_calibConstants;
221 std::vector<double> m_noiseLevels;
222 std::vector<double> m_LY;
223 std::vector<double> m_tRatio;
224 std::vector<double> m_tFast;
225 std::vector<double> m_tSlow;
226 std::vector<double> m_LCE;
227 std::vector<double> m_PmtQE;
228 std::vector<double> m_PmtGain;
233 };
234
235 }
237}
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Digitizer for the BEAST CsI system.
uint16_t m_Baseline
Baseline (pedestal) frozen during charge integration.
int addNoise(Signal *y, double _rms, double _offset)
Adds noise to the signal.
Signal m_SimHitEdeps[16]
Array of signals (each corresponding to one channel)
double m_Resolution
Parameter: Resolution (in mV) of the ACD.
DigitalSignal doDigitization(Signal _v, double _LSB)
Digitizes the signal the signal.
Signal m_CsITlSignalTemplate
Template Signal of a CsITl trace.
double m_TrueEdep
Sum of the MC (true) deposited energies in the event-channel.
std::vector< double > m_noiseLevels
Noise level for each channel (in V)
std::vector< uint16_t > m_Waveform
Saved waveform.
virtual void initialize() override
Register input and output data.
double f(double fi, double u_i, double u_j, double y, double invtau)
This returns the RHS of first order differential equation.
const double m_Zl
Line impedance of the analog chain (to get voltage from anode current)
virtual void event() override
Each event This is where the actual digitization is done, and the hits are written to the DataStore.
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)
virtual void endRun() override
Clean up.
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 ...
StoreArray< CsiSimHit > m_aSimHit
Each simulated particle in the crystal.
int m_nWFcounter
Counter for the number of waveforms to save.
int getnSamples() const
Gets the number of points in the waveforms arrays.
virtual void terminate() override
Final clean up.
double m_dt
Time interval (in ns) (calculated from m_SampleRate.
std::vector< double > m_LCE
Light collection efficiency for each channel.
void setnSamples(int nsamples)
Sets the number of points in the waveforms arrays.
const double m_tTransitPMT
48Mean transit time of the PMT signal (in ns)
std::vector< double > m_LY
Light yield for each channel (gamma per GeV)
int m_nSamples
Number of points requested in the waveform arrays.
virtual ~CsIDigitizerModule()
Default destructor.
virtual void beginRun() override
To do before each runs.
std::vector< double > m_PmtGain
PMT gain for each channel.
std::vector< double > m_PmtQE
PMT quantum efficiency for each channel.
std::vector< uint8_t > m_DPPCIBits
status of the DPP-CI
const double m_tRisePMT
2.6 Rise time of the PMT signal (in ns)
std::vector< double > m_tSlow
Slow time constant for each channel (ns)
std::vector< double > m_calibConstants
Calibration constants for each channel (in V/keV)
std::vector< double > m_tRatio
Ratio fast light / slow light for each channel.
StoreArray< CsiDigiHit > m_aDigiHit
Output: a digitized hit.
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)
Realizes the charge integration of the input signal.
double m_SampleRate
Parameter: Sample rate (in samples/sec) of the ADC.
int m_nWaveforms
Number of waveforms to save.
Signal m_SimHitTimes[16]
Array of signals (each corresponding to one channel)
uint16_t m_MaxADC
Max ACD of the hit (to check saturations)
CsIDigitizerModule()
Constructor: Sets the description, the properties and the parameters of the module.
Signal genSignalTemplate(int _n, int _i0, double _t1, double _t2=0.0, double _rFastTot=1.0)
Generates the template for a signal (obsolete)
uint32_t m_Charge
Integrated Charge.
std::vector< double > m_tFast
Fast time constant for each channel (ns)
std::vector< int > DigitalSignal
Designed to hold a "digital" (limited by the DAQ board rate and resolution) signal
std::vector< double > Signal
Designed to hold a "continuous" (in time and amplitude) signal
Abstract base class for different kinds of events.