Belle II Software  release-05-02-19
ECLDigitizerModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Poyuan Chen *
7  * Guglielmo De Nardo (denardo@na.infn.it) *
8  * Alex Bobrov *
9  * Alexei Sibidanov *
10  * This software is provided "as is" without any warranty. *
11  **************************************************************************/
12 
13 #pragma once
14 
15 //STL
16 #include <vector>
17 
18 //Framework
19 #include <framework/core/Module.h>
20 #include <framework/datastore/StoreArray.h>
21 #include <framework/datastore/StoreObjPtr.h>
22 #include <ecl/dbobjects/ECLDigitWaveformParametersForMC.h>
23 #include <framework/database/DBObjPtr.h>
24 
25 //ECL
26 #include <ecl/digitization/EclConfiguration.h>
27 
28 namespace Belle2 {
34  class ECLWaveformData;
35  class ECLNoiseData;
36  class ECLWFAlgoParams;
37  class ECLHit;
38  class ECLSimHit;
39  class ECLDigit;
40  class ECLDsp;
41  class ECLDspWithExtraMCInfo;
42  class ECLTrig;
43  class ECLWaveforms;
44 
69  class ECLDigitizerModule : public Module {
70  public:
71 
75 
79 
80 
82  virtual void initialize() override;
83 
85  virtual void beginRun() override;
86 
91  virtual void event() override;
92 
94  virtual void endRun() override;
95 
97  virtual void terminate() override;
98 
99  private:
105  using int_array_192x16_t = fitparams_t::int_array_192x16_t;
106  using int_array_24x16_t =
107  fitparams_t::int_array_24x16_t;
108  using uint_pair_t = std::pair<unsigned int, unsigned int>;
111  struct crystallinks_t {
112  short unsigned int idn;
113  short unsigned int inoise;
114  short unsigned int ifunc;
115  short unsigned int iss;
116  };
117 
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;
128  std::vector<adccounts_t> m_adc;
131  struct calibration_t {
132  float ascale;
133  float tshift;
134  };
136  std::vector<calibration_t> m_calib;
137 
139  std::vector<double> m_Awave;
140 
142  void shapeFitterWrapper(const int j, const int* FitA, const int m_ttrig,
143  int& m_lar, int& m_ltr, int& m_lq, int& m_chi) const ;
144 
147 
150 
152  void readDSPDB();
154  int shapeSignals();
158  void repack(const ECLWFAlgoParams&, algoparams_t&);
162  void makeElectronicNoiseAndPedestal(int j, int* FitA);
163 
169  bool m_HadronPulseShape;
180  bool m_inter;
181  bool m_waveformMaker;
183  unsigned int m_compAlgo;
187  std::string m_eclWaveformsName;
189  };
191 }//Belle2
Belle2::ECLDigitizerModule::initialize
virtual void initialize() override
Initialize variables
Definition: ECLDigitizerModule.cc:88
Belle2::ECLDigitizerModule::event
virtual void event() override
Actual digitization of all hits in the ECL.
Definition: ECLDigitizerModule.cc:356
Belle2::ECLDigitizerModule::m_eclDspsWithExtraMCInfo
StoreArray< ECLDspWithExtraMCInfo > m_eclDspsWithExtraMCInfo
generated waveforms with extra MC information
Definition: ECLDigitizerModule.h:184
Belle2::ECLDigitizerModule::m_eclSimHits
StoreArray< ECLSimHit > m_eclSimHits
SimHits array
Definition: ECLDigitizerModule.h:177
Belle2::ECLDigitizerModule::m_eclDiodeHits
StoreArray< ECLHit > m_eclDiodeHits
diode hits array
Definition: ECLDigitizerModule.h:176
Belle2::ECLDigitizerModule::uint_pair_t
std::pair< unsigned int, unsigned int > uint_pair_t
a pair of unsigned ints
Definition: ECLDigitizerModule.h:118
Belle2::ECLDigitizerModule::m_eclHits
StoreArray< ECLHit > m_eclHits
input arrays
Definition: ECLDigitizerModule.h:175
Belle2::ECLDigitizerModule::getfitparams
void getfitparams(const ECLWaveformData &, const ECLWFAlgoParams &, fitparams_t &)
load waveform fit parameters for the shapeFitter function
Definition: ECLDigitizerModule.cc:667
Belle2::ECLDigitizerModule::m_noise
std::vector< ECLNoiseData > m_noise
parameters for correlated noise simulation
Definition: ECLDigitizerModule.h:133
Belle2::ECLDigitizerModule::m_ss
std::vector< signalsample_t > m_ss
tabulated shape line
Definition: ECLDigitizerModule.h:134
Belle2::ECLDigitizerModule::int_array_24x16_t
fitparams_t::int_array_24x16_t int_array_24x16_t
weighting coefficients amplitude calculation.
Definition: ECLDigitizerModule.h:117
Belle2::ECL::EclConfiguration::algoparams_t
a struct for the parameters of the algorithm
Definition: EclConfiguration.h:97
Belle2::ECLDigitizerModule::m_eclWaveformsName
std::string m_eclWaveformsName
name of background waveforms storage
Definition: ECLDigitizerModule.h:197
Belle2::ECLDigitizerModule::makeElectronicNoiseAndPedestal
void makeElectronicNoiseAndPedestal(int j, int *FitA)
fill the waveform array FitA by electronic noise and bias it for channel J [0-8735]
Definition: ECLDigitizerModule.cc:317
Belle2::ECL::EclConfiguration::signalsample_t
a struct for a signal sample
Definition: EclConfiguration.h:65
Belle2::ECLDigitizerModule::shapeFitterWrapper
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
Definition: ECLDigitizerModule.cc:161
Belle2::ECLDigitizerModule::m_Awave
std::vector< double > m_Awave
Storage for waveform saving thresholds.
Definition: ECLDigitizerModule.h:149
Belle2::ECLDigitizerModule::beginRun
virtual void beginRun() override
Nothing so far.
Definition: ECLDigitizerModule.cc:124
Belle2::ECLDigitizerModule::m_inter
bool m_inter
internuclear counter effect
Definition: ECLDigitizerModule.h:190
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::ECLDigitizerModule::m_adc
std::vector< adccounts_t > m_adc
Storage for adc hits from entire calorimeter (8736 crystals)
Definition: ECLDigitizerModule.h:138
Belle2::ECLDigitizerModule::m_storeDspWithExtraMCInfo
bool m_storeDspWithExtraMCInfo
DSP with extra info flag.
Definition: ECLDigitizerModule.h:192
Belle2::ECLDigitizerModule::callbackHadronSignalShapes
void callbackHadronSignalShapes()
callback hadron signal shapes from database
Definition: ECLDigitizerModule.cc:475
Belle2::ECLDigitizerModule::m_ss_HadronShapeSimulations
std::vector< signalsample_t > m_ss_HadronShapeSimulations
tabulated shape line for hadron shape simulations
Definition: ECLDigitizerModule.h:135
Belle2::ECLDigitizerModule::m_dspDataTest
bool m_dspDataTest
DSP data usage flag.
Definition: ECLDigitizerModule.h:198
Belle2::ECLDigitizerModule::m_idn
std::vector< algoparams_t > m_idn
Fit algorihtm parameters shared by group of crystals.
Definition: ECLDigitizerModule.h:131
Belle2::ECLDigitizerModule::repack
void repack(const ECLWFAlgoParams &, algoparams_t &)
repack waveform fit parameters from ROOT format to plain array of unsigned short for the shapeFitter ...
Definition: ECLDigitizerModule.cc:639
Belle2::ECLDigitizerModule::m_eclDsps
StoreArray< ECLDsp > m_eclDsps
generated waveforms
Definition: ECLDigitizerModule.h:183
Belle2::ECL::EclConfiguration::fitparams_t
a struct for the fit parameters
Definition: EclConfiguration.h:89
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLDigitizerModule::int_array_192x16_t
fitparams_t::int_array_192x16_t int_array_192x16_t
weighting coefficients for time and amplitude calculation
Definition: ECLDigitizerModule.h:115
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::ECLDigitizerModule::m_eclWaveforms
StoreObjPtr< ECLWaveforms > m_eclWaveforms
compressed waveforms
Definition: ECLDigitizerModule.h:178
Belle2::ECLDigitizerModule::calibration_t::ascale
float ascale
amplitude scale
Definition: ECLDigitizerModule.h:142
Belle2::ECLDigitizerModule::m_compAlgo
unsigned int m_compAlgo
compression algorithm for background waveforms
Definition: ECLDigitizerModule.h:193
Belle2::ECLDigitizerModule::readDSPDB
void readDSPDB()
read Shaper-DSP data from root file
Definition: ECLDigitizerModule.cc:501
Belle2::ECLDigitizerModule::m_WaveformThresholdOverride
double m_WaveformThresholdOverride
If gt 0, value will override ECL_FPGA_StoreWaveform and apply value (in GeV) as threshold for all cry...
Definition: ECLDigitizerModule.h:195
Belle2::ECLDigitizerModule::m_calibration
bool m_calibration
calibration flag
Definition: ECLDigitizerModule.h:189
Belle2::ECLDigitizerModule::m_waveformParametersMC
DBObjPtr< ECLDigitWaveformParametersForMC > m_waveformParametersMC
dbobject for hadron signal shapes
Definition: ECLDigitizerModule.h:156
Belle2::ECLWaveformData
ECLWaveformData - container for inverse covariant matrix and shape parameters for time and amplitude ...
Definition: ECLWaveformData.h:39
Belle2::ECLDigitizerModule::makeWaveforms
void makeWaveforms()
Produce and compress waveforms for beam background overlay.
Definition: ECLDigitizerModule.cc:327
Belle2::ECLDigitizerModule::m_eclDigits
StoreArray< ECLDigit > m_eclDigits
Output Arrays.
Definition: ECLDigitizerModule.h:182
Belle2::ECLDigitizerModule::m_calib
std::vector< calibration_t > m_calib
Storage for calibration constants.
Definition: ECLDigitizerModule.h:146
Belle2::ECLDigitizerModule::ECLDigitizerModule
ECLDigitizerModule()
Constructor.
Definition: ECLDigitizerModule.cc:54
Belle2::ECLDigitizerModule::terminate
virtual void terminate() override
Free memory.
Definition: ECLDigitizerModule.cc:471
Belle2::ECLDigitizerModule::m_eclTrigs
StoreArray< ECLTrig > m_eclTrigs
trigger information
Definition: ECLDigitizerModule.h:185
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::ECLDigitizerModule::m_HadronPulseShape
bool m_HadronPulseShape
hadron pulse shape flag
Definition: ECLDigitizerModule.h:179
Belle2::ECLDigitizerModule::calibration_t
calibration constants per channel
Definition: ECLDigitizerModule.h:141
Belle2::ECLDigitizerModule::endRun
virtual void endRun() override
Nothing so far.
Definition: ECLDigitizerModule.cc:467
Belle2::ECL::EclConfiguration::adccounts_t
a struct for the ADC count
Definition: EclConfiguration.h:75
Belle2::ECLDigitizerModule::shapeSignals
int shapeSignals()
Emulate response of energy deposition in a crystal and attached photodiode and make waveforms.
Definition: ECLDigitizerModule.cc:232
Belle2::ECLDigitizerModule::m_DspWithExtraMCInfoThreshold
double m_DspWithExtraMCInfoThreshold
Energy threshold above which to store DSPs with extra information.
Definition: ECLDigitizerModule.h:196
Belle2::ECLWFAlgoParams
Container for constant parameters used in waveform fits.
Definition: ECLWaveformData.h:150
Belle2::ECLDigitizerModule::m_ADCThreshold
int m_ADCThreshold
ADC threshold for wavefom fits.
Definition: ECLDigitizerModule.h:194
Belle2::ECLDigitizerModule::m_waveformMaker
bool m_waveformMaker
produce only waveform digits
Definition: ECLDigitizerModule.h:191
Belle2::ECLDigitizerModule::~ECLDigitizerModule
~ECLDigitizerModule()
Destructor.
Definition: ECLDigitizerModule.cc:84
Belle2::ECLDigitizerModule::calibration_t::tshift
float tshift
time shift
Definition: ECLDigitizerModule.h:143
Belle2::ECLDigitizerModule::m_background
bool m_background
Module parameters.
Definition: ECLDigitizerModule.h:188