Belle II Software  release-06-02-00
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 //STL
12 #include <vector>
13 
14 //Framework
15 #include <framework/core/Module.h>
16 #include <framework/dataobjects/EventMetaData.h>
17 #include <framework/datastore/StoreArray.h>
18 #include <framework/datastore/StoreObjPtr.h>
19 #include <ecl/dbobjects/ECLDigitWaveformParametersForMC.h>
20 #include <framework/database/DBObjPtr.h>
21 
22 //ECL
23 #include <ecl/digitization/EclConfiguration.h>
24 #include <ecl/utility/ECLChannelMapper.h>
25 
26 namespace Belle2 {
32  class ECLWaveformData;
33  class ECLNoiseData;
34  class ECLWFAlgoParams;
35  class ECLHit;
36  class ECLSimHit;
37  class ECLDigit;
38  class ECLDsp;
39  class ECLDspWithExtraMCInfo;
40  class ECLTrig;
41  class ECLWaveforms;
42 
67  class ECLDigitizerModule : public Module {
68  public:
69 
73 
77 
78 
80  virtual void initialize() override;
81 
83  virtual void beginRun() override;
84 
89  virtual void event() override;
90 
92  virtual void endRun() override;
93 
95  virtual void terminate() override;
96 
97  private:
103  using int_array_192x16_t = fitparams_t::int_array_192x16_t;
105  fitparams_t::int_array_24x16_t;
106  using uint_pair_t = std::pair<unsigned int, unsigned int>;
109  struct crystallinks_t {
110  short unsigned int idn;
111  short unsigned int inoise;
112  short unsigned int ifunc;
113  short unsigned int iss;
114  };
115 
116  std::vector<crystallinks_t> m_tbl;
117 
119  std::vector<algoparams_t> m_idn;
120  std::vector<fitparams_t> m_fitparams;
121  std::vector<ECLNoiseData> m_noise;
122  std::vector<signalsample_t> m_ss;
123  std::vector<signalsample_t> m_ss_HadronShapeSimulations;
126  std::vector<adccounts_t> m_adc;
129  struct calibration_t {
130  float ascale;
131  float tshift;
132  };
134  std::vector<calibration_t> m_calib;
135 
137  std::vector<double> m_Awave;
138 
143  unsigned char m_ttime[ECL::ECL_CRATES] = {};
144 
146  void shapeFitterWrapper(const int j, const int* FitA, const int m_ttrig,
147  int& m_lar, int& m_ltr, int& m_lq, int& m_chi) const ;
148 
151 
154 
156  void readDSPDB();
158  void shapeSignals();
160  void makeWaveforms();
162  void repack(const ECLWFAlgoParams&, algoparams_t&);
166  void makeElectronicNoiseAndPedestal(int j, int* FitA);
167 
170 
190  bool m_inter;
193  unsigned int m_compAlgo;
197  bool m_trigTime;
198  std::string m_eclWaveformsName;
200  };
202 }//Belle2
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
The ECLDigitizer module.
int m_ADCThreshold
ADC threshold for wavefom fits.
std::vector< calibration_t > m_calib
Storage for calibration constants.
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.
StoreObjPtr< ECLWaveforms > m_eclWaveforms
compressed waveforms
std::vector< algoparams_t > m_idn
Fit algorihtm 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.
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...
double m_DspWithExtraMCInfoThreshold
Energy threshold above which to store DSPs with extra information.
StoreArray< ECLTrig > m_eclTrigs
trigger information
virtual void endRun() override
Nothing so far.
virtual void terminate() override
Free memory.
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.
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
fitparams_t::int_array_24x16_t int_array_24x16_t
weighting coefficients amplitude calculation.
virtual void beginRun() override
Nothing so far.
unsigned int m_compAlgo
compression algorithm for background waveforms
bool m_HadronPulseShape
hadron pulse shape flag
bool m_trigTime
Use trigger time from beam background overlay.
std::vector< adccounts_t > m_adc
Storage for adc hits from entire calorimeter (8736 crystals)
StoreArray< ECLDspWithExtraMCInfo > m_eclDspsWithExtraMCInfo
generated waveforms with extra MC information
StoreArray< ECLHit > m_eclHits
input arrays
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.
std::vector< ECLNoiseData > m_noise
parameters for correlated noise simulation
DBObjPtr< ECLDigitWaveformParametersForMC > m_waveformParametersMC
dbobject for 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 ...
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
bool m_inter
internuclear counter effect
std::vector< signalsample_t > m_ss
tabulated shape line
Container for constant parameters used in waveform fits.
ECLWaveformData - container for inverse covariant matrix and shape parameters for time and amplitude ...
This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbo...
Base class for Modules.
Definition: Module.h:72
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:95
Abstract base class for different kinds of events.
calibration constants per channel
a struct for the parameters of the algorithm
a struct for the fit parameters