Belle II Software  release-05-02-19
eclPackerModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Shebalin Vasily *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 //Framework
13 #include <framework/core/FrameworkExceptions.h>
14 #include <framework/core/Module.h>
15 #include <framework/datastore/StoreArray.h>
16 
17 //ECL
18 #include <ecl/utility/ECLChannelMapper.h>
19 
20 namespace Belle2 {
26  enum {
27  ECL_ADC_SAMPLES_PER_CHANNEL = 31
28  };
29 
30  class ECLDigit;
31  class ECLDsp;
32  class RawECL;
33 
38  class ECLPackerModule : public Module {
39  public:
40  ECLPackerModule();
41  virtual ~ECLPackerModule();
42 
44  virtual void initialize() override;
46  virtual void beginRun() override;
48  virtual void event() override;
50  virtual void endRun() override;
52  virtual void terminate() override;
53 
55  BELLE2_DEFINE_EXCEPTION(Write_adc_samples_error,
56  "Error packing adc samples to buffer");
58  BELLE2_DEFINE_EXCEPTION(eclPacker_internal_error,
59  "Something wrong with ECL Packer");
60 
61  private:
63  int m_EvtNum;
64 
66  int m_bufPos;
67 
69  int m_bufLength;
70 
72  int m_bitPos;
73 
75  int m_ampThreshold;
76 
78  bool m_compressMode;
79 
82 
84  std::string m_eclRawCOPPERsName;
85 
87  std::string m_eclMapperInitFileName;
88 
90  int m_EclWaveformSamples[ECL_ADC_SAMPLES_PER_CHANNEL]; // == 31
91 
94 
97 
99  unsigned int adcBuffer_temp[ECL::ECL_CHANNELS_IN_SHAPER * ECL_ADC_SAMPLES_PER_CHANNEL];
100 
101  // number of hits, masks etc ...
103  int collectorMaskArray[ECL::ECL_CRATES];
105  int shaperMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
107  int shaperADCMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
109  int shaperNWaveform[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
111  int shaperNHits[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
112 
114  int iEclDigIndices[ECL::ECL_TOTAL_CHANNELS];
115 
117  int iEclWfIndices[ECL::ECL_TOTAL_CHANNELS];
118 
119  //DataStore variables
124  void writeNBits(unsigned int* buff, unsigned int value, unsigned int bitsToWrite);
126  void resetBuffPosition();
128  void setBuffLength(int bufLength);
129 
130  };
132 }//namespace Belle2
Belle2::ECLPackerModule::m_eclRawCOPPERs
StoreArray< RawECL > m_eclRawCOPPERs
Output data
Definition: eclPackerModule.h:104
Belle2::ECLPackerModule::m_bufPos
int m_bufPos
position in the data array
Definition: eclPackerModule.h:74
Belle2::ECLPackerModule::event
virtual void event() override
event
Definition: eclPackerModule.cc:77
Belle2::ECLPackerModule::m_compressMode
bool m_compressMode
eneble/disable compression of waveform data
Definition: eclPackerModule.h:86
Belle2::ECLPackerModule::shaperNWaveform
int shaperNWaveform[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE]
Number of waveforms per shaper.
Definition: eclPackerModule.h:117
Belle2::ECLPackerModule::shaperNHits
int shaperNHits[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE]
Number of hits per shaper.
Definition: eclPackerModule.h:119
Belle2::ECLPackerModule::iEclWfIndices
int iEclWfIndices[ECL::ECL_TOTAL_CHANNELS]
indexes of related waveforms
Definition: eclPackerModule.h:125
Belle2::ECLPackerModule::adcBuffer_temp
unsigned int adcBuffer_temp[ECL::ECL_CHANNELS_IN_SHAPER *ECL_ADC_SAMPLES_PER_CHANNEL]
temporary buffer to store ADC data
Definition: eclPackerModule.h:107
Belle2::ECLPackerModule::setBuffLength
void setBuffLength(int bufLength)
set buffer length
Definition: eclPackerModule.cc:374
Belle2::ECLPackerModule::BELLE2_DEFINE_EXCEPTION
BELLE2_DEFINE_EXCEPTION(Write_adc_samples_error, "Error packing adc samples to buffer")
exception for errors during packing ADC data buffer
Belle2::ECLPackerModule::writeNBits
void writeNBits(unsigned int *buff, unsigned int value, unsigned int bitsToWrite)
write N bits to the collector buffer
Definition: eclPackerModule.cc:385
Belle2::ECLPackerModule::m_EvtNum
int m_EvtNum
Event number.
Definition: eclPackerModule.h:71
Belle2::ECLPackerModule::m_EclWaveformSamples
int m_EclWaveformSamples[ECL_ADC_SAMPLES_PER_CHANNEL]
array of ADC samples
Definition: eclPackerModule.h:98
Belle2::ECLPackerModule::endRun
virtual void endRun() override
endRun
Definition: eclPackerModule.cc:365
Belle2::ECLPackerModule::m_bitPos
int m_bitPos
bit position for bit-by-bit data read
Definition: eclPackerModule.h:80
Belle2::ECLPackerModule::iEclDigIndices
int iEclDigIndices[ECL::ECL_TOTAL_CHANNELS]
indexes of related eclDigits
Definition: eclPackerModule.h:122
Belle2::ECL::ECLChannelMapper
This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbo...
Definition: ECLChannelMapper.h:36
Belle2::ECLPackerModule::shaperMaskArray
int shaperMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE]
triggered shapers
Definition: eclPackerModule.h:113
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLPackerModule::beginRun
virtual void beginRun() override
beginRun
Definition: eclPackerModule.cc:66
Belle2::ECLPackerModule::m_eclMapper
ECL::ECLChannelMapper m_eclMapper
channel mapper
Definition: eclPackerModule.h:101
Belle2::ECLPackerModule::m_eclRawCOPPERsName
std::string m_eclRawCOPPERsName
name of output collection for RawCOPPER
Definition: eclPackerModule.h:92
Belle2::ECLPackerModule::resetBuffPosition
void resetBuffPosition()
reset current position in the buffer
Definition: eclPackerModule.cc:379
Belle2::ECLPackerModule::m_eclDsps
StoreArray< ECLDsp > m_eclDsps
ECLDSP dataStore object.
Definition: eclPackerModule.h:129
Belle2::ECLPackerModule::shaperADCMaskArray
int shaperADCMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE]
shapers with ADC data
Definition: eclPackerModule.h:115
Belle2::ECLPackerModule::m_eclMapperInitFileName
std::string m_eclMapperInitFileName
name of the file with correspondence between cellID and crate/shaper/channel numbers
Definition: eclPackerModule.h:95
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::ECLPackerModule::m_WaveformRareFactor
int m_WaveformRareFactor
the rate of writing of the ADC samples
Definition: eclPackerModule.h:89
Belle2::ECLPackerModule::m_ampThreshold
int m_ampThreshold
DSP amplitude threshold.
Definition: eclPackerModule.h:83
Belle2::ECLPackerModule::initialize
virtual void initialize() override
initialize
Definition: eclPackerModule.cc:54
Belle2::ECLPackerModule::m_bufLength
int m_bufLength
length data
Definition: eclPackerModule.h:77
Belle2::ECLPackerModule::terminate
virtual void terminate() override
terminate
Definition: eclPackerModule.cc:370
Belle2::ECLPackerModule::collectorMaskArray
int collectorMaskArray[ECL::ECL_CRATES]
array of triggered collectors
Definition: eclPackerModule.h:111
Belle2::ECLPackerModule::m_eclDigits
StoreArray< ECLDigit > m_eclDigits
ECLDigit dataStore object.
Definition: eclPackerModule.h:128