Belle II Software development
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
9#pragma once
10
11/* ECL headers. */
12#include <ecl/mapper/ECLChannelMapper.h>
13
14/* Basf2 headers. */
15#include <framework/core/FrameworkExceptions.h>
16#include <framework/core/Module.h>
17#include <framework/dataobjects/EventMetaData.h>
18#include <framework/datastore/StoreArray.h>
19#include <framework/datastore/StoreObjPtr.h>
20
21namespace Belle2 {
27 enum {
28 ECL_ADC_SAMPLES_PER_CHANNEL = 31
29 };
30
31 class ECLDigit;
32 class ECLDsp;
33 class RawECL;
34
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 = 0;
62
65
68
71
74
77
80
83
86
89
91 int m_EclWaveformSamples[ECL_ADC_SAMPLES_PER_CHANNEL]; // == 31
92
95
98
100 unsigned int adcBuffer_temp[static_cast<int>(ECL::ECL_CHANNELS_IN_SHAPER) * static_cast<int>(ECL_ADC_SAMPLES_PER_CHANNEL)];
101
102 // number of hits, masks etc ...
104 int collectorMaskArray[ECL::ECL_CRATES];
106 int shaperMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
108 int shaperADCMaskArray[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
110 int shaperNWaveform[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
112 int shaperNHits[ECL::ECL_CRATES][ECL::ECL_BARREL_SHAPERS_IN_CRATE];
113
115 int iEclDigIndices[ECL::ECL_TOTAL_CHANNELS];
116
118 int iEclWfIndices[ECL::ECL_TOTAL_CHANNELS];
119
120 //DataStore variables
125
127 void writeNBits(unsigned int* buff, unsigned int value, unsigned int bitsToWrite);
129 void resetBuffPosition();
131 void setBuffLength(int bufLength);
132
133 };
135}//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.
StoreObjPtr< EventMetaData > m_eventMetaData
store objptr for EventMetaData
std::string m_eclMapperInitFileName
name of the file with correspondence between cellID and crate/shaper/channel numbers
bool m_pcie40Data
true-pack data in PCIe40 format, false-pack data in COPPER format
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 appeared
unsigned int adcBuffer_temp[static_cast< int >(ECL::ECL_CHANNELS_IN_SHAPER) *static_cast< int >(ECL_ADC_SAMPLES_PER_CHANNEL)]
temporary buffer to store ADC data
bool m_compressMode
enable/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
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:96
Abstract base class for different kinds of events.