ATLAS Offline Software
Loading...
Searching...
No Matches
LArLATOMEDecoder.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5*/
6
13
14#ifndef LARBYTESTREAM_LARLATOMEDDECODER_H
15#define LARBYTESTREAM_LARLATOMEDDECODER_H
16
17#define N_LATOME_CHANNELS 320
18
20#include "LArRawEvent/LArRawSCContainer.h" //why?
22#include "ByteStreamData/RawEvent.h" //for OFFLINE_FRAGMENTS_NAMESPACE
23
26#include <vector>
27#include <string>
28#include <fstream>
29#include <stdint.h>
30
31
32
33
39
46
47
57
59
60public:
61 typedef unsigned int Word;
62 typedef int NumWord;
63 typedef int Packet;
64 typedef int SuperCell;
65 typedef int Sample;
66 typedef int NumLATOME;
67 typedef std::string Path;
68
70 LArLATOMEDecoder(const std::string& type, const std::string& name, const IInterface* parent);
71 static const InterfaceID& interfaceID();
73 virtual ~LArLATOMEDecoder() = default;
75 virtual StatusCode initialize();
77 virtual StatusCode finalize() {return StatusCode::SUCCESS;};
79 StatusCode convert(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags, const LArLATOMEMapping *map,
80 LArDigitContainer* adc_coll,
81 LArDigitContainer* adc_bas_coll,
82 LArRawSCContainer* et_coll,
83 LArRawSCContainer* et_id_coll,
84 LArLATOMEHeaderContainer* header_coll) const;
85
86 StatusCode convert(const RawEvent* re, const LArLATOMEMapping *map,
87 const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap,
90 LArLATOMEHeaderContainer* header_coll) const;
91
92private:
93
95 static const int s_nBunches = 3564;
97
99
100 public:
101 std::vector<short> adc;
102 std::vector<short> adc_bas;
103 std::vector<int> et;
104 std::vector<int> et_id;
105 std::vector<bool> saturation;
106 unsigned int latomeChannel{};
107 };
108
110
111 public:
112 std::vector<unsigned long long> sum;
113 std::vector<unsigned long long> sumSq;
114 std::vector<unsigned int> nTrigValid;
115 unsigned int latomeChannel{};
116 };
117
119
120 public:
121 unsigned int DAC=0;
122 unsigned int delay=0;
123 std::vector<unsigned int> patterns;
124 };
125
126 class EventProcess : public AthMessaging {
127 public:
130 typedef unsigned int Word;
131 typedef int NumWord;
132 typedef int Packet;
133 typedef int SuperCell;
134 typedef int Sample;
135 typedef std::string Path;
136
137 EventProcess(const LArLATOMEDecoder* decoderInput,
138 LArDigitContainer* adc_coll,
139 LArDigitContainer* adc_bas_coll,
140 LArRawSCContainer* et_coll,
141 LArRawSCContainer* et_id_coll,
144 LArLATOMEHeaderContainer* header_coll);
145
147
149 const LArOnOffIdMapping *onoffmap=nullptr, const LArCalibLineMapping *clmap=nullptr);
150
151 private:
152 bool compareOrSet(Word& param, Word value, bool compare);
153 unsigned int decodeTrailer(const uint32_t* p, unsigned int offset);
154 unsigned int decodeHeader(const uint32_t* p, unsigned int offset);
155 unsigned int bytesPerChannel(MonDataType at0, MonDataType at1);
156 void increaseWordShift(unsigned int& wordshift);
157 void increaseByteShift(unsigned int& wordshift, unsigned int& byteshift);
158 void decodeByte(unsigned int& byte, unsigned int wordshift, unsigned int byteshift, const uint32_t* p);
159 void decodeWord(unsigned int& word, unsigned int& wordshift, unsigned int& byteshift, const uint32_t* p);
160 void decodeChannel(unsigned int& wordshift, unsigned int& byteshift, const uint32_t* p,
161 MonDataType at0, MonDataType at1,
162 unsigned int& at0Data, unsigned int& at1Data, unsigned int& satData,
163 bool& at0val, bool& at1val);
164 int signEnergy(unsigned int energy);
166 void fillRaw(const LArLATOMEMapping *map);
167 void fillCalib(const LArLATOMEMapping *map,
168 const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap);
169 void fillHeader();
170
174
177 // some of this values (in addition to some values from the rod header) should go to a LatomeHeader class (that replaces the current Mon class) and this class should be moved to another package and percistified (written into disk with pool format). This is not urgent and can be done later.
178 static const Word m_monTrailerSize=2;
179 static const Word s_monHeaderMarker=0xff1234ff;
180 static const Word s_monCheckPoint=0xdeadbeef;
181 std::vector<Word> m_packetEnd;
182
183 // rod header
214
216 short m_nBC_ADC{};
217 short m_nBC_E{};
218 short m_nBC_EID{};
220
221 short m_BC_rawADC{};
222 short m_BC_ADC{};
223 short m_BC_E{};
224 short m_BC_EID{};
225
227 bool m_hasAdc{};
228 bool m_hasE{};
229 bool m_hasEID{};
232
241
242 // LATOME source ID is stored here:
243 unsigned int m_nthLATOME = 0;
244
245 std::vector<unsigned short> m_BCIDsInEvent;
246 std::vector<LatomeRawData> m_rawValuesInEvent;
247 std::vector<LatomeAveragedRawData> m_averagedRawValuesInEvent;
248 std::vector<LatomeCalibPatterns> m_latomeCalibPatternsInEvent;
249 };
250
251 // propary of tool
253 ToolHandle<ICaloSuperCellIDTool> m_sc2ccMappingTool;
254
255 BooleanProperty m_ignoreBarrelChannels{this, "IgnoreBarrelChannels", false};
256 BooleanProperty m_ignoreEndcapChannels{this, "IgnoreEndcapChannels", false};
257 BooleanProperty m_protectSourceId{this, "ProtectSourceId", true, "discard main readout sourceID, should be false for reading all files from the mon path with old source IDs"};
258 BooleanProperty m_keepPulsed{this, "KeepOnlyPulsed", true};
259 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKeySC{this,"ScCablingKey","LArOnOffIdMapSC","SG Key of SC LArOnOffIdMapping object"};
260
261};
262
263#endif // LARBYTESTREAM_LARLATOMEDDECODER_H
264
const boost::regex re(r_e)
MonDataType
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Container class for LArAccumulatedCalibDigit.
Container class for LArAccumulatedDigit.
Container class for LArDigit.
int signEnergy(unsigned int energy)
static const Word m_monTrailerSize
some cached info to ease processing reading from data header
std::vector< LatomeCalibPatterns > m_latomeCalibPatternsInEvent
unsigned int Word
this should be the same as how we get the data, otherwise we will have bugs.
LArLATOMEHeaderContainer * m_header_coll
EventProcess(const LArLATOMEDecoder *decoderInput, LArDigitContainer *adc_coll, LArDigitContainer *adc_bas_coll, LArRawSCContainer *et_coll, LArRawSCContainer *et_id_coll, LArAccumulatedDigitContainer *accdigits, LArAccumulatedCalibDigitContainer *caccdigits, LArLATOMEHeaderContainer *header_coll)
void decodeChannel(unsigned int &wordshift, unsigned int &byteshift, const uint32_t *p, MonDataType at0, MonDataType at1, unsigned int &at0Data, unsigned int &at1Data, unsigned int &satData, bool &at0val, bool &at1val)
void decodeByte(unsigned int &byte, unsigned int wordshift, unsigned int byteshift, const uint32_t *p)
void fillCalib(const LArLATOMEMapping *map, const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap)
LArAccumulatedDigitContainer * m_accdigits
const LArLATOMEDecoder * m_decoder
unsigned int bytesPerChannel(MonDataType at0, MonDataType at1)
LArAccumulatedCalibDigitContainer * m_caccdigits
bool compareOrSet(Word &param, Word value, bool compare)
void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *pROB, const LArLATOMEMapping *map, const LArOnOffIdMapping *onoffmap=nullptr, const LArCalibLineMapping *clmap=nullptr)
Execute decoding for an event.
void fillRaw(const LArLATOMEMapping *map)
Pass ADC values from an event.
static const Word s_monHeaderMarker
this is fixed and not read from data
std::vector< LatomeRawData > m_rawValuesInEvent
std::vector< LatomeAveragedRawData > m_averagedRawValuesInEvent
unsigned int decodeHeader(const uint32_t *p, unsigned int offset)
std::vector< unsigned short > m_BCIDsInEvent
void increaseByteShift(unsigned int &wordshift, unsigned int &byteshift)
void decodeWord(unsigned int &word, unsigned int &wordshift, unsigned int &byteshift, const uint32_t *p)
void increaseWordShift(unsigned int &wordshift)
unsigned int decodeTrailer(const uint32_t *p, unsigned int offset)
std::vector< unsigned long long > sum
std::vector< unsigned long long > sumSq
std::vector< unsigned int > nTrigValid
std::vector< unsigned int > patterns
4th bit should be this value if the word indicate ADC value.
static const InterfaceID & interfaceID()
BooleanProperty m_keepPulsed
StatusCode convert(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &robFrags, const LArLATOMEMapping *map, LArDigitContainer *adc_coll, LArDigitContainer *adc_bas_coll, LArRawSCContainer *et_coll, LArRawSCContainer *et_id_coll, LArLATOMEHeaderContainer *header_coll) const
Converter.
LArLATOMEDecoder(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
virtual StatusCode initialize()
Initialize the converter.
virtual StatusCode finalize()
Finalize the converter.
BooleanProperty m_ignoreBarrelChannels
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
virtual ~LArLATOMEDecoder()=default
Destructor.
const LArOnline_SuperCellID * m_onlineId
static const int s_nBunches
Maximum value of BCID.
ToolHandle< ICaloSuperCellIDTool > m_sc2ccMappingTool
BooleanProperty m_ignoreEndcapChannels
BooleanProperty m_protectSourceId
Container class for LArLATOMEHeader.
class to provide SC mapping
Container class for LArRawSC.
STL class.
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27