Belle II Software release-09-00-00
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
41 class CsIDigitizerModule : public Module {
42
43 public:
44
49
51 virtual ~CsIDigitizerModule();
52
54 virtual void initialize() override;
55
57 virtual void beginRun() override;
58
63 virtual void event() override;
64
66 virtual void endRun() override;
67
69 virtual void terminate() override;
70
71
72 private:
73
84 Signal genTimeSignal(double _energy, double _timeAvg, double _timeRMS, int iChannel, bool _save = 0);
85
99 double genTimeSignal(Signal* _output, Signal _energies, Signal _times, int _iChannel, int _dt, int _nsam, bool _save = 0);
100
109 Signal genSignalTemplate(int _n, int _i0, double _t1, double _t2 = 0.0, double _rFastTot = 1.0);
110
111
123 Signal firstOrderResponse(double _gain, Signal _u, double _y0, double _dt, double _tSlow, double _delay);
124
142 uint16_t doChargeIntegration(Signal _u, int _NsamBL, uint16_t* BSL, uint32_t* Q, uint32_t* t,
143 std::vector<uint16_t>* _Waveform, std::vector<uint8_t>* _DPPCIBits,
144 int _Treshold, double _TriggerHoldoff = 0.0, double _GateWidth = 320.0,
145 double _GateOffset = 40.0, bool _recordTraces = false);
146
147
156 int addNoise(Signal* y, double _rms, double _offset);
157
165 DigitalSignal doDigitization(Signal _v, double _LSB);
166
167
177 double f(double fi, double u_i, double u_j, double y, double invtau);
178
179
180
181
184 int getnSamples() const { return m_nSamples; }
185
188 void setnSamples(int nsamples) { m_nSamples = nsamples; }
189
190
191 private:
192
195
196 // Member data objects
197 double m_TrueEdep;
200 double m_dt;
205 uint8_t m_CellId;
206 uint16_t m_Baseline;
207 uint32_t m_Charge;
208 uint16_t m_MaxADC;
209 uint32_t m_Time;
211 std::vector<uint16_t> m_Waveform;
212 std::vector<uint8_t> m_DPPCIBits;
214 const double m_tRisePMT = 2;
215 const double m_tTransitPMT = 48;
216 const double m_Zl = 50;
223 std::vector<double> m_calibConstants;
224 std::vector<double> m_noiseLevels;
225 std::vector<double> m_LY;
226 std::vector<double> m_tRatio;
227 std::vector<double> m_tFast;
228 std::vector<double> m_tSlow;
229 std::vector<double> m_LCE;
230 std::vector<double> m_PmtQE;
231 std::vector<double> m_PmtGain;
236 };
237
238 }
240}
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.