Belle II Software  release-06-00-14
eclPackerModule.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 #pragma once
9 
10 //Framework
11 #include <framework/core/FrameworkExceptions.h>
12 #include <framework/core/Module.h>
13 #include <framework/datastore/StoreArray.h>
14 
15 //ECL
16 #include <ecl/utility/ECLChannelMapper.h>
17 
18 namespace Belle2 {
24  enum {
25  ECL_ADC_SAMPLES_PER_CHANNEL = 31
26  };
27 
28  class ECLDigit;
29  class ECLDsp;
30  class RawECL;
31 
36  class ECLPackerModule : public Module {
37  public:
39  virtual ~ECLPackerModule();
40 
42  virtual void initialize() override;
44  virtual void beginRun() override;
46  virtual void event() override;
48  virtual void endRun() override;
50  virtual void terminate() override;
51 
53  BELLE2_DEFINE_EXCEPTION(Write_adc_samples_error,
54  "Error packing adc samples to buffer");
56  BELLE2_DEFINE_EXCEPTION(eclPacker_internal_error,
57  "Something wrong with ECL Packer");
58 
59  private:
61  int m_EvtNum;
62 
64  int m_bufPos;
65 
68 
70  int m_bitPos;
71 
74 
77 
80 
82  std::string m_eclRawCOPPERsName;
83 
86 
88  int m_EclWaveformSamples[ECL_ADC_SAMPLES_PER_CHANNEL]; // == 31
89 
92 
95 
97  unsigned int adcBuffer_temp[ECL::ECL_CHANNELS_IN_SHAPER * ECL_ADC_SAMPLES_PER_CHANNEL];
98 
99  // number of hits, masks etc ...
101  int collectorMaskArray[ECL::ECL_CRATES];
103  int shaperMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
105  int shaperADCMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
107  int shaperNWaveform[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
109  int shaperNHits[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
110 
112  int iEclDigIndices[ECL::ECL_TOTAL_CHANNELS];
113 
115  int iEclWfIndices[ECL::ECL_TOTAL_CHANNELS];
116 
117  //DataStore variables
122  void writeNBits(unsigned int* buff, unsigned int value, unsigned int bitsToWrite);
124  void resetBuffPosition();
126  void setBuffLength(int bufLength);
127 
128  };
130 }//namespace Belle2
Module that pack's MC info into a dataformat that comes from the detector.
StoreArray< ECLDsp > m_eclDsps
ECLDSP dataStore object.
int m_ampThreshold
DSP amplitude threshold.
int iEclDigIndices[ECL::ECL_TOTAL_CHANNELS]
indexes of related eclDigits
int shaperNHits[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE]
Number of hits per shaper.
int shaperMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE]
triggered shapers
int m_EvtNum
Event number.
ECL::ECLChannelMapper m_eclMapper
channel mapper
int iEclWfIndices[ECL::ECL_TOTAL_CHANNELS]
indexes of related waveforms
int shaperADCMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE]
shapers with ADC data
virtual void initialize() override
initialize
int m_bufPos
position in the data array
int m_EclWaveformSamples[ECL_ADC_SAMPLES_PER_CHANNEL]
array of ADC samples
virtual void event() override
event
int shaperNWaveform[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE]
Number of waveforms per shaper.
int m_WaveformRareFactor
the rate of writing of the ADC samples
virtual void endRun() override
endRun
int m_bitPos
bit position for bit-by-bit data read
virtual void terminate() override
terminate
StoreArray< ECLDigit > m_eclDigits
ECLDigit dataStore object.
std::string m_eclMapperInitFileName
name of the file with correspondence between cellID and crate/shaper/channel numbers
void setBuffLength(int bufLength)
set buffer length
virtual void beginRun() override
beginRun
StoreArray< RawECL > m_eclRawCOPPERs
Output data
BELLE2_DEFINE_EXCEPTION(eclPacker_internal_error, "Something wrong with ECL Packer")
wrong indexes for ShaperDSP, channel or crate are apperared
bool m_compressMode
eneble/disable compression of waveform data
int m_bufLength
length data
int collectorMaskArray[ECL::ECL_CRATES]
array of triggered collectors
BELLE2_DEFINE_EXCEPTION(Write_adc_samples_error, "Error packing adc samples to buffer")
exception for errors during packing ADC data buffer
void writeNBits(unsigned int *buff, unsigned int value, unsigned int bitsToWrite)
write N bits to the collector buffer
void resetBuffPosition()
reset current position in the buffer
std::string m_eclRawCOPPERsName
name of output collection for RawCOPPER
unsigned int adcBuffer_temp[ECL::ECL_CHANNELS_IN_SHAPER *ECL_ADC_SAMPLES_PER_CHANNEL]
temporary buffer to store ADC data
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
Abstract base class for different kinds of events.