Belle II Software development
ECLDigitizerModule.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/* ECL headers. */
12#include <ecl/dbobjects/ECLCrystalCalib.h>
13#include <ecl/dbobjects/ECLDigitWaveformParametersForMC.h>
14#include <ecl/digitization/EclConfiguration.h>
15#include <ecl/mapper/ECLChannelMapper.h>
16
17/* Basf2 headers. */
18#include <framework/core/Module.h>
19#include <framework/dataobjects/EventMetaData.h>
20#include <framework/database/DBObjPtr.h>
21#include <framework/datastore/StoreArray.h>
22#include <framework/datastore/StoreObjPtr.h>
23
24/* C++ headers. */
25#include <vector>
26
27class TTree;
28
29namespace Belle2 {
34
35 class ECLWaveformData;
36 class ECLNoiseData;
37 class ECLWFAlgoParams;
38 class ECLHit;
39 class ECLSimHit;
40 class ECLDigit;
41 class ECLDsp;
43 class ECLTrig;
44 class ECLWaveforms;
45
70 class ECLDigitizerModule : public Module {
71 public:
72
76
79 ~ECLDigitizerModule() override;
80
81
83 virtual void initialize() override;
84
86 virtual void beginRun() override;
87
92 virtual void event() override;
93
94 private:
99
103 using uint_pair_t = std::pair<unsigned int, unsigned int>;
104
108 short unsigned int idn;
110 short unsigned int inoise;
112 short unsigned int ifunc;
114 short unsigned int iss;
115 };
116
118 std::vector<crystallinks_t> m_tbl;
119
121 std::vector<algoparams_t> m_idn;
122 std::vector<fitparams_t> m_fitparams;
123 std::vector<ECLNoiseData> m_noise;
124 std::vector<signalsample_t> m_ss;
125 std::vector<signalsample_t> m_ss_HadronShapeSimulations;
126
128 std::vector<adccounts_t> m_adc;
129
132 float ascale;
133 float tshift;
134 };
135
136 std::vector<calibration_t> m_calib;
137
139 std::vector<double> m_Awave;
140
145 unsigned char m_ttime[ECL::ECL_CRATES] = {};
146
148 void shapeFitterWrapper(const int j, const int* FitA, const int m_ttrig,
149 int& m_lar, int& m_ltr, int& m_lq, int& m_chi) const ;
150
152 bool m_loadOnce = true;
153
156
158 void readDSPDB();
160 void shapeSignals();
162 void makeWaveforms();
164 void repack(const ECLWFAlgoParams&, algoparams_t&);
168 void makeElectronicNoiseAndPedestal(int j, int* FitA);
169
172
175
178
181
184
187
190
193
196
199
201 DBObjPtr<ECLCrystalCalib> m_FPGAWaveform{"ECL_FPGA_StoreWaveform"};
202
205
206 /* Input arrays. */
207
210
213
216
219
221
224
227
230
233
236
240 bool m_inter;
243 unsigned int m_compAlgo;
248 std::string m_eclWaveformsName;
250
262 };
263
264}//Belle2
Class for accessing objects in the database.
Definition DBObjPtr.h:21
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
Definition ECLDigit.h:25
int m_ADCThreshold
ADC threshold for wavefom fits.
std::vector< calibration_t > m_calib
Storage for calibration constants.
double m_unitscale
Normalization coefficient for ECL signal shape.
StoreArray< ECLDsp > m_eclDsps
Generated waveforms.
void callbackHadronSignalShapes()
callback hadron signal shapes from database
void shapeSignals()
Emulate response of energy deposition in a crystal and attached photodiode and make waveforms.
ECL::ECLChannelMapper m_eclMapper
Channel Mapper.
DBObjPtr< TTree > m_algoParameters
Shape fitting algorithm parameters.
StoreObjPtr< ECLWaveforms > m_eclWaveforms
Compressed waveforms.
std::vector< algoparams_t > m_idn
Fit algorithm parameters shared by group of crystals.
StoreArray< ECLHit > m_eclDiodeHits
Diode hits array.
std::pair< unsigned int, unsigned int > uint_pair_t
a pair of unsigned ints
bool m_dspDataTest
DSP data usage flag.
std::vector< fitparams_t > m_fitparams
Pairs of (waveform parameters, fit parameters)
virtual void initialize() override
Initialize variables.
virtual void event() override
Actual digitization of all hits in the ECL.
double m_WaveformThresholdOverride
If gt 0, value will override ECL_FPGA_StoreWaveform and apply value (in GeV) as threshold for all cry...
DBObjPtr< ECLCrystalCalib > m_CrateTimeOffset
Crate time offset.
DBObjPtr< TTree > m_waveformParameters
CellID-specific signal shapes.
double m_DspWithExtraMCInfoThreshold
Energy threshold above which to store DSPs with extra information.
StoreArray< ECLTrig > m_eclTrigs
Trigger information.
DBObjPtr< ECLCrystalCalib > m_MCTimeOffset
MC time offset.
StoreArray< ECLSimHit > m_eclSimHits
SimHits array.
bool m_background
Module parameters.
StoreArray< ECLDigit > m_eclDigits
Output Arrays.
void getfitparams(const ECLWaveformData &, const ECLWFAlgoParams &, fitparams_t &)
load waveform fit parameters for the shapeFitter function
void shapeFitterWrapper(const int j, const int *FitA, const int m_ttrig, int &m_lar, int &m_ltr, int &m_lq, int &m_chi) const
function wrapper for waveform fit
std::vector< double > m_Awave
Storage for waveform saving thresholds.
DBObjPtr< ECLCrystalCalib > m_CrystalElectronicsTime
Crystal electronics time.
std::vector< signalsample_t > m_ss_HadronShapeSimulations
tabulated shape line for hadron shape simulations
fitparams_t::int_array_192x16_t int_array_192x16_t
weighting coefficients for time and amplitude calculation
DBObjPtr< ECLCrystalCalib > m_CrystalElectronics
Crystal electronics.
virtual void beginRun() override
Nothing so far.
unsigned int m_compAlgo
compression algorithm for background waveforms
bool m_HadronPulseShape
hadron pulse shape flag
DBObjPtr< ECLCrystalCalib > m_CrystalEnergy
Crystal energy.
ECL::EclConfiguration::adccounts_t adccounts_t
ADC counts.
bool m_trigTime
Use trigger time from beam background overlay.
std::vector< crystallinks_t > m_tbl
Lookup table for ECL channels.
std::vector< adccounts_t > m_adc
Storage for adc hits from entire calorimeter (8736 crystals)
ECL::EclConfiguration::signalsample_t signalsample_t
signal sample
StoreArray< ECLDspWithExtraMCInfo > m_eclDspsWithExtraMCInfo
Generated waveforms with extra MC information.
StoreArray< ECLHit > m_eclHits
Hits array.
bool m_useWaveformParameters
If true, use m_waveformParameters, m_algoParameters, m_noiseParameters.
~ECLDigitizerModule() override
Destructor.
DBObjPtr< ECLCrystalCalib > m_FPGAWaveform
FPGA waveform.
bool m_calibration
calibration flag
bool m_storeDspWithExtraMCInfo
DSP with extra info flag.
unsigned char m_ttime[ECL::ECL_CRATES]
storage for trigger time in each ECL.
DBObjPtr< TTree > m_noiseParameters
Electronics noise covariance matrix.
bool m_loadOnce
Always load waveform parameters at least once.
std::vector< ECLNoiseData > m_noise
parameters for correlated noise simulation
DBObjPtr< ECLDigitWaveformParametersForMC > m_waveformParametersMC
Hadron signal shapes.
void repack(const ECLWFAlgoParams &, algoparams_t &)
repack waveform fit parameters from ROOT format to plain array of unsigned short for the shapeFitter ...
ECL::EclConfiguration::fitparams_t fitparams_t
fit parameters
fitparams_t::int_array_24x16_t int_array_24x16_t
weighting coefficients amplitude calculation.
void makeWaveforms()
Produce and compress waveforms for beam background overlay.
bool m_waveformMaker
produce only waveform digits
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
void readDSPDB()
read Shaper-DSP data from root file
void makeElectronicNoiseAndPedestal(int j, int *FitA)
fill the waveform array FitA by electronic noise and bias it for channel J [0-8735]
std::string m_eclWaveformsName
name of background waveforms storage
ECL::EclConfiguration::algoparams_t algoparams_t
algorithm parameters
DBObjPtr< ECLCrystalCalib > m_CrystalTimeOffset
Crystal time offset.
bool m_inter
internuclear counter effect
std::vector< signalsample_t > m_ss
tabulated shape line
Class to store ECL ShaperDSP waveform ADC data and additional information for ML studies.
Class to store ECL ShaperDSP waveform ADC data.
Definition ECLDsp.h:25
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
Definition ECLHit.h:25
Container for constant matrix used to generate electronic noise.
ClassECLSimHit - Geant4 simulated hit for the ECL.
Definition ECLSimHit.h:29
Class to store ECLTrig, still need to be study relation to ECLHit filled in ecl/modules/eclDigitizer/...
Definition ECLTrig.h:25
Container for constant parameters used in waveform fits.
ECLWaveformData - container for inverse covariant matrix and shape parameters for time and amplitude ...
Class to store ECL waveforms for entire calorimeter.
This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbo...
Module()
Constructor.
Definition Module.cc:30
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Abstract base class for different kinds of events.
calibration constants per channel
a struct for the parameters of the algorithm
int int_array_192x16_t[2 *m_ndt][16]
Array for DSP coefs in normal fit.
int int_array_24x16_t[m_ndt/4][16]
Array for DSP coefs in fast fit.