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-2023 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
19#include <stdint.h>
29#include "CxxUtils/unused.h"
30#include "eformat/Version.h"
31#include "eformat/Issue.h"
32#include <vector>
33#include <string>
34#include <fstream>
35#include "eformat/index.h"
40
41
42
48
50
60
62
63public:
64 typedef unsigned int Word;
65 typedef int NumWord;
66 typedef int Packet;
67 typedef int SuperCell;
68 typedef int Sample;
69 typedef int NumLATOME;
70 typedef std::string Path;
71
73 LArLATOMEDecoder(const std::string& type, const std::string& name, const IInterface* parent);
74 static const InterfaceID& interfaceID();
76 virtual ~LArLATOMEDecoder() = default;
78 virtual StatusCode initialize();
80 virtual StatusCode finalize() {return StatusCode::SUCCESS;};
82 StatusCode convert(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags, const LArLATOMEMapping *map,
83 LArDigitContainer* adc_coll,
84 LArDigitContainer* adc_bas_coll,
85 LArRawSCContainer* et_coll,
86 LArRawSCContainer* et_id_coll,
87 LArLATOMEHeaderContainer* header_coll) const;
88
89 StatusCode convert(const RawEvent* re, const LArLATOMEMapping *map,
90 const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap,
93 LArLATOMEHeaderContainer* header_coll) const;
94
95private:
96
98 static const int s_nBunches = 3564;
100
102
103 public:
104 std::vector<short> adc;
105 std::vector<short> adc_bas;
106 std::vector<int> et;
107 std::vector<int> et_id;
108 std::vector<bool> saturation;
109 unsigned int latomeChannel{};
110 };
111
113
114 public:
115 std::vector<unsigned long long> sum;
116 std::vector<unsigned long long> sumSq;
117 std::vector<unsigned int> nTrigValid;
118 unsigned int latomeChannel{};
119 };
120
122
123 public:
124 unsigned int DAC=0;
125 unsigned int delay=0;
126 std::vector<unsigned int> patterns;
127 };
128
129 class EventProcess : public AthMessaging {
130 public:
133 typedef unsigned int Word;
134 typedef int NumWord;
135 typedef int Packet;
136 typedef int SuperCell;
137 typedef int Sample;
138 typedef std::string Path;
139
140 EventProcess(const LArLATOMEDecoder* decoderInput,
141 LArDigitContainer* adc_coll,
142 LArDigitContainer* adc_bas_coll,
143 LArRawSCContainer* et_coll,
144 LArRawSCContainer* et_id_coll,
147 LArLATOMEHeaderContainer* header_coll);
148
150
152 const LArOnOffIdMapping *onoffmap=nullptr, const LArCalibLineMapping *clmap=nullptr);
153
154 private:
155 bool compareOrSet(Word& param, Word value, bool compare);
156 unsigned int decodeTrailer(const uint32_t* p, unsigned int offset);
157 unsigned int decodeHeader(const uint32_t* p, unsigned int offset);
158 unsigned int bytesPerChannel(MonDataType at0, MonDataType at1);
159 void increaseWordShift(unsigned int& wordshift);
160 void increaseByteShift(unsigned int& wordshift, unsigned int& byteshift);
161 void decodeByte(unsigned int& byte, unsigned int wordshift, unsigned int byteshift, const uint32_t* p);
162 void decodeWord(unsigned int& word, unsigned int& wordshift, unsigned int& byteshift, const uint32_t* p);
163 void decodeChannel(unsigned int& wordshift, unsigned int& byteshift, const uint32_t* p,
164 MonDataType at0, MonDataType at1,
165 unsigned int& at0Data, unsigned int& at1Data, unsigned int& satData,
166 bool& at0val, bool& at1val);
167 int signEnergy(unsigned int energy);
169 void fillRaw(const LArLATOMEMapping *map);
170 void fillCalib(const LArLATOMEMapping *map,
171 const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap);
172 void fillHeader();
173
177
180 // 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.
181 static const Word m_monTrailerSize=2;
182 static const Word s_monHeaderMarker=0xff1234ff;
183 static const Word s_monCheckPoint=0xdeadbeef;
184 std::vector<Word> m_packetEnd;
185
186 // rod header
216
218 short m_nBC_ADC{};
219 short m_nBC_E{};
220 short m_nBC_EID{};
222
223 short m_BC_rawADC{};
224 short m_BC_ADC{};
225 short m_BC_E{};
226 short m_BC_EID{};
227
229 bool m_hasAdc{};
230 bool m_hasE{};
231 bool m_hasEID{};
234
243
244 // LATOME source ID is stored here:
245 unsigned int m_nthLATOME = 0;
246
247 std::vector<unsigned short> m_BCIDsInEvent;
248 std::vector<LatomeRawData> m_rawValuesInEvent;
249 std::vector<LatomeAveragedRawData> m_averagedRawValuesInEvent;
250 std::vector<LatomeCalibPatterns> m_latomeCalibPatternsInEvent;
251 };
252
253 // propary of tool
255 ToolHandle<ICaloSuperCellIDTool> m_sc2ccMappingTool;
256
257 BooleanProperty m_ignoreBarrelChannels{this, "IgnoreBarrelChannels", false};
258 BooleanProperty m_ignoreEndcapChannels{this, "IgnoreEndcapChannels", false};
259 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"};
260 BooleanProperty m_keepPulsed{this, "KeepOnlyPulsed", true};
261 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKeySC{this,"ScCablingKey","LArOnOffIdMapSC","SG Key of SC LArOnOffIdMapping object"};
262
263};
264
265#endif // LARBYTESTREAM_LARLATOMEDDECODER_H
266
const boost::regex re(r_e)
std::vector< double > Energy
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
Macro to mark a member as unused.