ATLAS Offline Software
Loading...
Searching...
No Matches
LArLATOMEDecoder::EventProcess Class Reference
Inheritance diagram for LArLATOMEDecoder::EventProcess:

Public Types

typedef unsigned int Word
 this should be the same as how we get the data, otherwise we will have bugs.
typedef int NumWord
typedef int Packet
typedef int SuperCell
typedef int Sample
typedef std::string Path

Public Member Functions

 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 fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *pROB, const std::vector< HWIdentifier > *LATOME_Channels, const LArOnOffIdMapping *onoffmap=nullptr, const LArCalibLineMapping *clmap=nullptr)
 Execute decoding for an event.
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Private Types

enum  MODE { MON_HEADER , PAYLOAD , MON_TRAILER }

Private Member Functions

bool compareOrSet (Word &param, Word value, bool compare)
unsigned int decodeTrailer (const uint32_t *p, unsigned int offset)
unsigned int decodeHeader (const uint32_t *p, unsigned int offset)
unsigned int bytesPerChannel (MonDataType at0, MonDataType at1)
void increaseWordShift (unsigned int &wordshift)
void increaseByteShift (unsigned int &wordshift, unsigned int &byteshift)
void decodeByte (unsigned int &byte, unsigned int wordshift, unsigned int byteshift, const uint32_t *p)
void decodeWord (unsigned int &word, unsigned int &wordshift, unsigned int &byteshift, const uint32_t *p)
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)
int signEnergy (unsigned int energy)
void fillRaw (const std::vector< HWIdentifier > *LATOME_Channels)
 Pass ADC values from an event.
void fillCalib (const std::vector< HWIdentifier > *LATOME_Channels, const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap)
void fillHeader ()
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::vector< Word > m_packetEnd
Word m_latomeBCID {}
Word m_latomeID {}
Word m_l1ID {}
Word m_ROBFragSize {}
Word m_LATOMEFW {}
Word m_nPackets {}
Word m_iPacket {}
Word m_nWordsPerPacket {}
Word m_monHeaderSize {}
Word m_region {}
Word m_nStreams {}
Word m_streamNumber {}
Word m_at0at1Swap {}
Word m_at0typeRec {}
Word m_at1typeRec {}
Word m_at0type {}
Word m_at1type {}
Word m_at0nBC {}
Word m_at1nBC {}
Word m_at0BC {}
Word m_at1BC {}
Word m_activeSC {}
Word m_nsc1 {}
Word m_nsc2 {}
Word m_nsc3 {}
Word m_nsc4 {}
Word m_nsc5 {}
Word m_nsc6 {}
bool m_headerDecoded {}
short m_nBC_rawADC {}
short m_nBC_ADC {}
short m_nBC_E {}
short m_nBC_EID {}
short m_nBC_Averaged {}
short m_BC_rawADC {}
short m_BC_ADC {}
short m_BC_E {}
short m_BC_EID {}
bool m_hasRawAdc {}
bool m_hasAdc {}
bool m_hasE {}
bool m_hasEID {}
bool m_isAveraged {}
bool m_isAutoCorr {}
const LArLATOMEDecoder * m_decoder {}
LArDigitContainer * m_adc_coll {}
LArDigitContainer * m_adc_bas_coll {}
LArRawSCContainer * m_et_coll {}
LArRawSCContainer * m_et_id_coll {}
LArAccumulatedDigitContainer * m_accdigits {}
LArAccumulatedCalibDigitContainer * m_caccdigits {}
LArLATOMEHeaderContainer * m_header_coll {}
unsigned int m_nthLATOME = 0
std::vector< unsigned short > m_BCIDsInEvent
std::vector< LatomeRawData > m_rawValuesInEvent
std::vector< LatomeAveragedRawData > m_averagedRawValuesInEvent
std::vector< LatomeCalibPatterns > m_latomeCalibPatternsInEvent
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Static Private Attributes

static const Word m_monTrailerSize =2
 some cached info to ease processing reading from data header
static const Word s_monHeaderMarker =0xff1234ff
 this is fixed and not read from data
static const Word s_monCheckPoint =0xdeadbeef

Detailed Description

Definition at line 126 of file LArLATOMEDecoder.h.

Member Typedef Documentation

◆ NumWord

Definition at line 131 of file LArLATOMEDecoder.h.

◆ Packet

Definition at line 132 of file LArLATOMEDecoder.h.

◆ Path

Definition at line 135 of file LArLATOMEDecoder.h.

◆ Sample

Definition at line 134 of file LArLATOMEDecoder.h.

◆ SuperCell

Definition at line 133 of file LArLATOMEDecoder.h.

◆ Word

this should be the same as how we get the data, otherwise we will have bugs.

use reinterpret_cast later to properly interpret the bit in other format if needed.

Definition at line 130 of file LArLATOMEDecoder.h.

Member Enumeration Documentation

◆ MODE

Enumerator
MON_HEADER 
PAYLOAD 
MON_TRAILER 

Definition at line 171 of file LArLATOMEDecoder.h.

Constructor & Destructor Documentation

◆ EventProcess()

LArLATOMEDecoder::EventProcess::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 )

Definition at line 152 of file LArLATOMEDecoder.cxx.

155 : AthMessaging(Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc"), "LArLATOMEDecoder::EventProcess"),
156 m_decoder(decoderInput),
157 m_adc_coll(adc_coll),
158 m_adc_bas_coll(adc_bas_coll),
159 m_et_coll(et_coll),
160 m_et_id_coll(et_id_coll),
161 m_accdigits(accdigits),
162 m_caccdigits(caccdigits),
163 m_header_coll(header_coll) {
164 m_latomeID = 0;
165 m_l1ID = 0;
166 m_ROBFragSize = 0;
167 m_nPackets = 0;
168 m_iPacket = 0;
170 m_monHeaderSize = 0;
171 m_region = 0;
172 m_nStreams = 0;
173 m_streamNumber = 0;
174 m_at0at1Swap = 0;
179 m_at0nBC = 0;
180 m_at1nBC = 0;
181 m_at0BC = 0;
182 m_at1BC = 0;
183 m_activeSC = 0;
184 m_nsc1 = 0;
185 m_nsc2 = 0;
186 m_nsc3 = 0;
187 m_nsc4 = 0;
188 m_nsc5 = 0;
189 m_nsc6 = 0;
190 m_headerDecoded = false;
191
192 m_nBC_rawADC = 0;
193 m_nBC_ADC = 0;
194 m_nBC_E = 0;
195 m_nBC_EID = 0;
196
197 m_nBC_Averaged = 0;
198
199 m_BC_rawADC = 0;
200 m_BC_ADC = 0;
201 m_BC_E = 0;
202 m_BC_EID = 0;
203
204 m_hasRawAdc = false;
205 m_hasAdc = false;
206 m_hasE = false;
207 m_hasEID = false;
208
209 m_isAveraged = (m_caccdigits != 0);
210 m_isAutoCorr = (m_accdigits != 0);
211
212 if (!m_isAveraged && !m_isAutoCorr) {
214 } else {
217 }
218}
#define N_LATOME_CHANNELS
AthMessaging()
Default constructor:
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
LArAccumulatedDigitContainer * m_accdigits
const LArLATOMEDecoder * m_decoder
LArAccumulatedCalibDigitContainer * m_caccdigits
std::vector< LatomeRawData > m_rawValuesInEvent
std::vector< LatomeAveragedRawData > m_averagedRawValuesInEvent

Member Function Documentation

◆ bytesPerChannel()

unsigned int LArLATOMEDecoder::EventProcess::bytesPerChannel ( MonDataType at0,
MonDataType at1 )
private

Definition at line 344 of file LArLATOMEDecoder.cxx.

344 {
345 unsigned int b = 0;
346 if (at0 == MonDataType::Averaged || at0 == MonDataType::AutoCorr)
347 return 8;
348
350 if (at0 != MonDataType::Invalid)
351 b += 2;
352 if (at1 != MonDataType::Invalid)
353 b += 2;
355 ++b;
356 return b;
357}

◆ compareOrSet()

bool LArLATOMEDecoder::EventProcess::compareOrSet ( Word & param,
Word value,
bool compare )
inlineprivate

Definition at line 220 of file LArLATOMEDecoder.cxx.

220 {
221 if (!compare) {
222 param = value;
223 return true;
224 }
225 return param == value;
226}

◆ decodeByte()

void LArLATOMEDecoder::EventProcess::decodeByte ( unsigned int & byte,
unsigned int wordshift,
unsigned int byteshift,
const uint32_t * p )
inlineprivate

Definition at line 376 of file LArLATOMEDecoder.cxx.

376 {
377 byte = ((std::byteswap(p[wordshift])) >> (8 * (4 - 1 - byteshift))) & 0xff;
378}

◆ decodeChannel()

void LArLATOMEDecoder::EventProcess::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 )
inlineprivate

now that we have the basic words we can rearrange the bits in case it is energy, ADC do not need further arrangement this is assuming energy lsb is at bit[0-2] and energy-id at [5-7]. Make sure this is the case for all recipe in the firmware. assumptions are in https://its.cern.ch/jira/browse/LDPBFW-2976

Definition at line 390 of file LArLATOMEDecoder.cxx.

391 {
392
393 // the structure of data is always consisting of 2,3,4 or 5 bytes depending on the recipe.
394 // If there is an energy it means there is the quality/saturation byte thus odd number of bytes. Otherwise ADC or Energy spans <mostly> over 2 bytes.
395 // avoid vectors and loops and bitsets to make it faster (can change later if needed but there is only few configurations so no need to make it infinitely
396 // flexible. use unsigned int everywhere for now since we have 18 bits for energy which does not fit in short, cast later.
397 unsigned int nbytesPerChannel = bytesPerChannel(at0, at1);
398 bool satByte = nbytesPerChannel % 2; // do we have satbyte
399
400 at0val = false;
401 at1val = false;
402 at0Data = 0;
403 at1Data = 0;
404 unsigned int satData = 0;
405 saturation = 0;
406
407 unsigned int word1 = 0;
408 unsigned int word2 = 0;
409 decodeWord(word1, wordshift, byteshift, p);
410 if (nbytesPerChannel > 3) {
411 decodeWord(word2, wordshift, byteshift, p);
412 }
413 at0Data = word1 & 0x7fff;
414 at0val = word1 & 0x8000;
415 if (nbytesPerChannel > 3) {
416 at1Data = word2 & 0x7fff;
417 at1val = word2 & 0x8000;
418 }
419 if (satByte) {
420 decodeByte(satData, wordshift, byteshift, p);
421 increaseByteShift(wordshift, byteshift);
422 }
423
427
429 at0Data = (at0Data << 3) | (satData & 0x7);
430 at1Data = (at1Data << 3) | ((satData & 0x70) >> 4);
431 saturation = ((satData & 0x88) == 0x88);
432 } else if (at1 == MonDataType::Energy && at0 == MonDataType::SelectedEnergy) {
433 at0Data = (at0Data << 3) | ((satData & 0x70) >> 4);
434 at1Data = (at1Data << 3) | (satData & 0x7);
435 saturation = ((satData & 0x88) == 0x88);
436 } else {
438 at0Data = (at0Data << 3) | (satData & 0x7);
439 saturation = (satData & 0x20);
440 }
442 at1Data = (at1Data << 3) | (satData & 0x7);
443 saturation = (satData & 0x20);
444 }
445 }
446}
void decodeByte(unsigned int &byte, unsigned int wordshift, unsigned int byteshift, const uint32_t *p)
unsigned int bytesPerChannel(MonDataType at0, MonDataType at1)
void increaseByteShift(unsigned int &wordshift, unsigned int &byteshift)
void decodeWord(unsigned int &word, unsigned int &wordshift, unsigned int &byteshift, const uint32_t *p)

◆ decodeHeader()

unsigned int LArLATOMEDecoder::EventProcess::decodeHeader ( const uint32_t * p,
unsigned int offset )
private

now these are taken from the ROD header but the word are still here (maybe we will use them for something else)

Definition at line 238 of file LArLATOMEDecoder.cxx.

238 {
239
241 int monheadererror = 0;
242 int monheadererrorbit = 0;
243 if (!compareOrSet(m_latomeID, std::byteswap(p[0 + offset]), m_headerDecoded))
244 monheadererror |= (1 << monheadererrorbit++);
245 Word l1IDtmp = m_l1ID;
246 if (!compareOrSet(l1IDtmp, std::byteswap(p[1 + offset]), m_headerDecoded))
247 monheadererror |= (1 << monheadererrorbit++);
248 if (l1IDtmp != m_l1ID) {
249 ATH_MSG_DEBUG("Mon header L1ID " << l1IDtmp << " different from rod header L1ID " << m_l1ID);
250 }
251 ATH_MSG_DEBUG(" latomeID: " << m_latomeID << " l1ID: " << m_l1ID);
252
253 Word monHeaderMarker = std::byteswap(p[2 + offset]);
254 Word monCheckPoint = std::byteswap(p[4 + offset]);
255 if (s_monHeaderMarker != monHeaderMarker) {
256 monheadererror |= (1 << monheadererrorbit++);
257 ATH_MSG_WARNING("Problem in monHeaderMarker: " << monHeaderMarker);
258 }
259 if (s_monCheckPoint != monCheckPoint) {
260 monheadererror |= (1 << monheadererrorbit++);
261 ATH_MSG_WARNING("Problem in monCheckPoint: " << monCheckPoint);
262 }
263
264 if (!compareOrSet(m_nPackets, std::byteswap(p[3 + offset]) >> 24, m_headerDecoded))
265 monheadererror |= (1 << monheadererrorbit++);
266
267 if (m_nPackets == 0xFF) {
268 m_nPackets = 1;
269 m_iPacket = 0;
270 m_nWordsPerPacket = (std::byteswap(p[3 + offset]) & 0xffffff) / 4.;
271 } else {
272 if (m_headerDecoded)
273 ++m_iPacket;
274 else
275 m_iPacket = 0;
276 if (!compareOrSet(m_iPacket, (std::byteswap(p[3 + offset]) >> 16) & 0xf, m_headerDecoded))
277 monheadererror |= (1 << monheadererrorbit++);
278 m_nWordsPerPacket = (std::byteswap(p[3 + offset]) & 0xffff) / 4.;
279 }
280
281 if (!compareOrSet(m_monHeaderSize, std::byteswap(p[5 + offset]), m_headerDecoded))
282 monheadererror |= (1 << monheadererrorbit++);
283
286 if (m_monHeaderSize < 18) {
287 ATH_MSG_WARNING(" Mon header size should not be less that 18 : =" << m_monHeaderSize << " are you reading old data file?");
288 return 0;
289 }
290
291 ATH_MSG_DEBUG(" nPackets: " << m_nPackets << " iPacket: " << m_iPacket << " nWordsPerPacket: " << m_nWordsPerPacket << " monHeaderSize: " << m_monHeaderSize);
292
294 std::ignore = compareOrSet(m_at0at1Swap, (std::byteswap(p[8 + offset])>>30) & 0x1, m_headerDecoded);
295 if (!compareOrSet(m_at0typeRec, std::byteswap(p[9 + offset]), m_headerDecoded))
296 monheadererror |= (1 << monheadererrorbit++);
297 if (!compareOrSet(m_at1typeRec, std::byteswap(p[12 + offset]), m_headerDecoded))
298 monheadererror |= (1 << monheadererrorbit++);
299 monheadererrorbit += 2;
300
301 if (!compareOrSet(m_at0nBC, std::byteswap(p[10 + offset]), m_headerDecoded))
302 monheadererror |= (1 << monheadererrorbit++);
303 if (!compareOrSet(m_at1nBC, std::byteswap(p[13 + offset]), m_headerDecoded))
304 monheadererror |= (1 << monheadererrorbit++);
305 if (!compareOrSet(m_at0BC, std::byteswap(p[11 + offset]), m_headerDecoded))
306 monheadererror |= (1 << monheadererrorbit++);
307 if (!compareOrSet(m_at1BC, std::byteswap(p[14 + offset]), m_headerDecoded))
308 monheadererror |= (1 << monheadererrorbit++);
309 if (!compareOrSet(m_activeSC, std::byteswap(p[15 + offset]), m_headerDecoded))
310 monheadererror |= (1 << monheadererrorbit++);
311 if (!compareOrSet(m_nsc1, std::byteswap(p[16]) >> 24, m_headerDecoded))
312 monheadererror |= (1 << monheadererrorbit++);
313 if (!compareOrSet(m_nsc2, (std::byteswap(p[16]) >> 16) & 0xff, m_headerDecoded))
314 monheadererror |= (1 << monheadererrorbit++);
315 if (!compareOrSet(m_nsc3, (std::byteswap(p[16]) >> 8) & 0xff, m_headerDecoded))
316 monheadererror |= (1 << monheadererrorbit++);
317 if (!compareOrSet(m_nsc4, (std::byteswap(p[16])) & 0xff, m_headerDecoded))
318 monheadererror |= (1 << monheadererrorbit++);
319 if (!compareOrSet(m_nsc5, std::byteswap(p[17]) >> 24, m_headerDecoded))
320 monheadererror |= (1 << monheadererrorbit++);
321 if (!compareOrSet(m_nsc6, (std::byteswap(p[17]) >> 16) & 0xff, m_headerDecoded))
322 monheadererror |= (1 << monheadererrorbit++);
323
324 ATH_MSG_DEBUG("m_at0at1Swap: " << m_at0at1Swap << " at0type " << m_at0typeRec << " at1type " << m_at1typeRec << " at0nBC " << m_at0nBC << " at1nBC " << m_at1nBC << " at0BC " << m_at0BC
325 << " at1BC " << m_at1BC << " nsc1 " << m_nsc1 << " nsc2 " << m_nsc2 << " nsc3 " << m_nsc3 << " nsc4 " << m_nsc4 << " nsc5 "
326 << m_nsc5 << " nsc6 " << m_nsc6);
327
328 if (monheadererror) {
329 ATH_MSG_WARNING(" consistency error in mon checker at packet " << m_iPacket << " errorbits " << std::hex << monheadererror << std::dec);
330 }
331
332 m_headerDecoded = true;
334}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
bool compareOrSet(Word &param, Word value, bool compare)
static const Word s_monHeaderMarker
this is fixed and not read from data

◆ decodeTrailer()

unsigned int LArLATOMEDecoder::EventProcess::decodeTrailer ( const uint32_t * p,
unsigned int offset )
private

for now the trailerhas only 2 fixed words, just check them

fixed shift for now but in case we get a dynamic trailer (hopefully not)

Definition at line 228 of file LArLATOMEDecoder.cxx.

228 {
230 if (std::byteswap(p[offset]) != 0xc0ffee00 || std::byteswap(p[offset + 1] != 0xaaaaaaaa)) {
231 ATH_MSG_WARNING("Problem in trailer at packet " << m_iPacket << " words " << std::hex << std::byteswap(p[offset]) << ", " << std::byteswap(p[offset + 1])
232 << std::dec);
233 }
235 return offset + m_monTrailerSize;
236}
static const Word m_monTrailerSize
some cached info to ease processing reading from data header

◆ decodeWord()

void LArLATOMEDecoder::EventProcess::decodeWord ( unsigned int & word,
unsigned int & wordshift,
unsigned int & byteshift,
const uint32_t * p )
inlineprivate

Definition at line 380 of file LArLATOMEDecoder.cxx.

380 {
381 unsigned int msb = 0;
382 unsigned int lsb = 0;
383 decodeByte(msb, wordshift, byteshift, p);
384 increaseByteShift(wordshift, byteshift);
385 decodeByte(lsb, wordshift, byteshift, p);
386 increaseByteShift(wordshift, byteshift);
387 word = lsb | (msb << 8);
388}

◆ fillCalib()

void LArLATOMEDecoder::EventProcess::fillCalib ( const std::vector< HWIdentifier > * LATOME_Channels,
const LArOnOffIdMapping * onoffmap,
const LArCalibLineMapping * clmap )
private

accumulated calib digits requested so decode dac and delay from headers

scale to the min nt since we have only one nt per channel and not by sample as with raw data

for loop on SCs

Definition at line 908 of file LArLATOMEDecoder.cxx.

908 {
909
911 uint32_t DAC_value=0;
912 uint16_t delay_value=0;
913 uint16_t isPulsed_value=false;
914 std::unique_ptr<LArCalibParams> calibParams1;
915 std::unique_ptr<LArCalibParams> calibParams2;
916
917 int pattype = m_nthLATOME >> 16;
918 const LArOnOffIdMapping* cabling = 0;
919 if (m_caccdigits) {
920 m_caccdigits->setDelayScale(25. / 240.);
921
922 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_decoder->m_cablingKeySC};
923 cabling = {*cablingHdl};
924 if (!cabling) {
925 ATH_MSG_ERROR("Do not have mapping object " << m_decoder->m_cablingKeySC.key());
926 return;
927 }
928
929 calibParams1=std::make_unique<LArCalibParams>();
930 calibParams2=std::make_unique<LArCalibParams>();
931
932 if (pattype > 0x48) {
933 StatusCode sc1 = calibParams1->initialize();
934 StatusCode sc2 = calibParams2->initialize();
935 if (sc1 != StatusCode::SUCCESS || sc2 != StatusCode::SUCCESS) {
936 ATH_MSG_WARNING("could not initialize LArCalibParams, acc calib will not be filled ");
937 return;
938 }
939 if (pattype == 0x49 || pattype == 0x4a) {
940
942
944 } else {
945
947
949 }
950 } else {
951 StatusCode sc1 = calibParams1->initialize();
952 if (sc1 != StatusCode::SUCCESS) {
953 ATH_MSG_WARNING("could not initialize LArCalibParams, acc calib will not be filled ");
954 return;
955 }
957 }
958 }
959
960 const HWIdentifier hwidEmpty;
961 unsigned nWarnings = 0;
962 for (SuperCell ch = 0; ch < N_LATOME_CHANNELS; ++ch) {
963 LArCalibParams* calibParams = 0;
964 HWIdentifier SCID = ch < (int) LATOME_Channels->size() ? (*LATOME_Channels)[ch] : hwidEmpty;
965 if (SCID == hwidEmpty) {
966 ATH_MSG_DEBUG("No mapping for ch: " << std::dec << ch);
967 continue;
968 }
969 if (m_decoder->m_ignoreBarrelChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 0)
970 continue;
971 if (m_decoder->m_ignoreEndcapChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 1)
972 continue;
973
974 std::vector<uint64_t> sum;
975 std::vector<uint64_t> sum2;
976 unsigned int ntmin = 9999999;
978 for (auto nt : m_averagedRawValuesInEvent[ch].nTrigValid) {
979 if (nt < ntmin) {
980 ntmin = nt;
981 }
982 }
983 sum.resize(m_averagedRawValuesInEvent[ch].sum.size());
984 sum2.resize(m_averagedRawValuesInEvent[ch].sum.size());
985
986 if (ntmin > 0) {
987 for (unsigned int is = 0; is < m_averagedRawValuesInEvent[ch].sum.size(); ++is) {
988 double fsum = (double)m_averagedRawValuesInEvent[ch].sum[is] / m_averagedRawValuesInEvent[ch].nTrigValid[is] * ntmin;
989 double fsum2 = (double)m_averagedRawValuesInEvent[ch].sumSq[is] / m_averagedRawValuesInEvent[ch].nTrigValid[is] * ntmin;
990 sum[is] = round(fsum);
991 sum2[is] = round(fsum2);
992 }
993 } else {
994 std::fill(sum.begin(), sum.end(), 0);
995 std::fill(sum2.begin(), sum2.end(), 0);
996 if (++nWarnings < 64) {
997 ATH_MSG_WARNING("No valid triggers for supercell " << SCID.getString());
998 }
999 }
1000 if (m_accdigits) {
1001 LArAccumulatedDigit* accdigi = new LArAccumulatedDigit(SCID, gain, sum, sum2, ntmin);
1002 m_accdigits->push_back(accdigi);
1003 }
1004 if (m_caccdigits) {
1005 if (pattype == 0x49 || pattype == 0x4a) {
1006 if (m_decoder->m_onlineId->barrel_ec(SCID) == 0) {
1007 calibParams = calibParams1.get();
1008 } else {
1009 calibParams = calibParams2.get();
1010 }
1011 } else if (pattype == 0x4b || pattype == 0x4c) {
1012 if (m_decoder->m_onlineId->isHECchannel(SCID)) {
1013 calibParams = calibParams1.get();
1014 } else {
1015 calibParams = calibParams2.get();
1016 }
1017 } else {
1018 calibParams = calibParams1.get();
1019 }
1020 unsigned int eventNb = 0;
1021 unsigned int numCL = 0;
1022 unsigned int numPulsedLeg = 0;
1023 std::vector<Identifier> ccellIds(0);
1024 Identifier myofflineID = cabling->cnvToIdentifier(SCID);
1025 ccellIds = m_decoder->m_sc2ccMappingTool->superCellToOfflineID(myofflineID);
1026 for (Identifier id : ccellIds) { // loop cells in sc
1027 HWIdentifier cellLegHWID = cablingLeg->createSignalChannelID(id);
1028 const std::vector<HWIdentifier>& calibLineLeg = clcabling->calibSlotLine(cellLegHWID);
1029 numCL += calibLineLeg.size();
1030 for (HWIdentifier calibLineHWID : calibLineLeg) { // loop legacy calib lines
1031 if (calibParams->isPulsed(eventNb, calibLineHWID)) {
1032 numPulsedLeg += 1;
1033 }
1034 }
1035 }
1036
1037 isPulsed_value = true;
1038 if (numPulsedLeg != numCL) {
1039 if (m_decoder->m_keepPulsed)
1040 continue;
1041 isPulsed_value = false;
1042 }
1043 DAC_value = calibParams->DAC(eventNb, SCID) * numPulsedLeg;
1044 // Here we want to change the DAC value to reflect the incorrect factors applied in HEC, where some of the cells are much smaller yet have DAC2MeV factors
1045 // which came from averaging over many cells
1046 int ft = m_decoder->m_onlineId->feedthrough(SCID);
1047 int slot = m_decoder->m_onlineId->slot(SCID);
1048 int channel = m_decoder->m_onlineId->channel(SCID);
1049 if (m_decoder->m_onlineId->barrel_ec(SCID) == 1 && (ft == 3 || ft == 10 || ft == 16 || ft == 22)) {
1050 // if it's HEC
1051 if (slot == 1) {
1052 if (channel >= 16 && channel <= 31) { // eta 1.65 bin
1053 //DAC_value = DAC_value / 1.363; // measured value
1054 DAC_value = DAC_value / 1.2; // computed from geometry
1055 m_decoder->msg(MSG::DEBUG) << "Multiplying DAC for channel " << SCID << "by 1/1.2" << endmsg;
1056 } else if (channel >= 32 && channel <= 47) { // eta 1.75 bin
1057 //DAC_value = DAC_value / 1.206; // measured value
1058 DAC_value = DAC_value * 7. / 8.; // computed from geometry
1059 m_decoder->msg(MSG::DEBUG) << "Multiplying DAC for channel " << SCID << "by 7./8." << endmsg;
1060 }
1061 }
1062 }
1063
1064 delay_value = calibParams->Delay(eventNb, SCID);
1065 LArAccumulatedCalibDigit* accdigi = new LArAccumulatedCalibDigit(SCID, gain, sum, sum2, ntmin, DAC_value, delay_value, isPulsed_value);
1066
1067 m_caccdigits->push_back(accdigi);
1068 }
1069
1070 }
1071 if (nWarnings > 16) {
1072 ATH_MSG_WARNING("Found " << nWarnings << " supercells with no valid triggers");
1073 }
1074}
#define endmsg
#define ATH_MSG_ERROR(x,...)
std::string getString() const
Provide a string form of the identifier - hexadecimal.
unsigned Delay(const unsigned event, const HWIdentifier calibLineID) const
bool isPulsed(const unsigned event, const HWIdentifier calibLineID) const
unsigned DAC(const unsigned event, const HWIdentifier calibLineID) const
std::vector< std::string > patterns
Definition listroot.cxx:187
@ LARHIGHGAIN
Definition CaloGain.h:18
::StatusCode StatusCode
StatusCode definition for legacy code.
float round(const float toRound, const unsigned int decimals)
Definition Mdt.cxx:27
setWord1 uint16_t
setEventNumber uint32_t

◆ fillCollection()

void LArLATOMEDecoder::EventProcess::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * pROB,
const std::vector< HWIdentifier > * LATOME_Channels,
const LArOnOffIdMapping * onoffmap = nullptr,
const LArCalibLineMapping * clmap = nullptr )

Execute decoding for an event.

some of this info should be used in the LatomeHeader class and for cross checks also (same as for the mon header)

this is an empty fragment, skip it

not we have the packet size from the first packet, check all packet headers before decoding we can decide later if we drop decoding if we have inconsistency

OK all headers checked and we have all info we need to decode each packet, so lets start

for now just getting the ADCs from AT0 Change later to add energy as well and use the BC shift to determine at which BC there is energy

recipe does not have at1, set at1 mux to invalid

lets start from here

start of packet, bcid still unvalid / should increase by one but take care of rotation at s_nBunches;

the data is packed with 64 bits words. Will be padded with 0s at the end of the timeslot time slot.

lets fill now, using the older code structure but this should be change to support having energy.

Loop over SC

Loop over time slots

Loop over BC

Definition at line 448 of file LArLATOMEDecoder.cxx.

449 {
451 const unsigned int sourceID = robFrag->rob_source_id();
452 m_l1ID = robFrag->rod_lvl1_id();
453 m_ROBFragSize = robFrag->rod_ndata();
454 const uint32_t* p = robFrag->rod_data();
455 const unsigned int n = robFrag->rod_ndata();
456 if (0 == n) {
458 ATH_MSG_DEBUG("Empty fragment, skip ");
459 return;
460 }
461 unsigned int offset = decodeHeader(p, 0);
462
463 m_latomeBCID = robFrag->rod_bc_id();
464 const uint32_t* rod_status = robFrag->rod_status();
465 const unsigned int rod_nstatus = robFrag->rod_nstatus();
466 if (rod_nstatus != 27) {
467 ATH_MSG_WARNING("Inconsistent number of rod header status elements: nstatus= " << rod_nstatus);
468 return;
469 }
470 if (rod_nstatus > 8) {
471 uint32_t status8 = rod_status[8];
472 m_at0type = status8 & 0x3;
473 m_at1type = (status8 >> 2) & 0x3;
474 ATH_MSG_DEBUG("before swap: m_at0type " << m_at0type << ", m_at1type " << m_at1type << "swap value " << m_at0at1Swap);
475 if(m_at0at1Swap==1){
477 ATH_MSG_DEBUG("after swap: m_at0type " << m_at0type << "m_at1type " << m_at1type);
478 }
479
480 }
481 m_nthLATOME = robFrag->rod_source_id();
482 m_LATOMEFW = rod_status[3] & 0x0fff;
483
484 LatomeCalibPatterns pat1, pat2, pat3;
485 pat1.DAC = rod_status[9];
486 pat1.delay = rod_status[10];
487 pat1.patterns.resize(4);
488 for (unsigned int i = 0; i < 4; ++i)
489 pat1.patterns[i] = rod_status[i + 11];
490
491 pat2.DAC = rod_status[15];
492 pat2.delay = rod_status[16];
493 pat2.patterns.resize(4);
494 for (unsigned int i = 0; i < 4; ++i)
495 pat2.patterns[i] = rod_status[i + 17];
496
497 pat3.DAC = rod_status[21];
498 pat3.delay = rod_status[22];
499 pat3.patterns.resize(4);
500 for (unsigned int i = 0; i < 4; ++i)
501 pat3.patterns[i] = rod_status[i + 23];
502
503 m_latomeCalibPatternsInEvent = {std::move(pat1), std::move(pat2), std::move(pat3)};
504
505 const HWIdentifier hwidEmpty;
506
508
509
510 //unsigned int offset = decodeHeader(p, 0);
511 if (offset > m_ROBFragSize) {
512 ATH_MSG_WARNING("Data corruption, offset found at pos 0 (" << offset << ") is larger than the ROB fragment size (" << m_ROBFragSize << "). Ignoring data.");
513 return;
514 }
515
516 if (m_isAveraged) {
517 m_at0type = m_at0typeRec >> 24;
519 if (m_at0type != (int)MonDataType::Averaged) {
520 ATH_MSG_WARNING(" inconsistant data type with requested averaged decoding at0 type " << m_at0type << " " << m_at0typeRec << " " << std::hex << m_l1ID
521 << " " << sourceID << std::dec);
522 return;
523 }
524 }
525 if (m_isAutoCorr) {
526 m_at0type = m_at0typeRec >> 24;
528 if (m_at0type != (int)MonDataType::AutoCorr) {
529 ATH_MSG_WARNING(" inconsistant data type with requested averaged decoding at0 type " << m_at0type << " " << m_at0typeRec << " " << std::hex << m_l1ID
530 << " " << sourceID << std::dec);
531 return;
532 }
533 }
534
535 m_packetEnd.push_back(offset);
536 offset = decodeTrailer(p, offset);
539 for (unsigned int ip = 1; ip < m_nPackets; ++ip) {
540 if (offset > m_ROBFragSize) {
541 ATH_MSG_WARNING("Data corruption, offset found at pos 0 (" << offset << ") is larger than the ROB fragment size (" << m_ROBFragSize << "). Ignoring data.");
542 return;
543 }
544
545 offset = decodeHeader(p, offset);
546 if (offset > m_ROBFragSize) {
547 ATH_MSG_WARNING("Data corruption, offset found at pos 0 (" << offset << ") is larger than the ROB fragment size (" << m_ROBFragSize << "). Ignoring data.");
548 return;
549 }
550 m_packetEnd.push_back(offset);
551 offset = decodeTrailer(p, offset);
552 }
553
554 ATH_MSG_DEBUG(" end of header check computed offset=" << std::dec << offset << " nwords in payload=" << n);
555
557 m_iPacket = 0;
558 if (m_nPackets==0) {
559 ATH_MSG_WARNING("Data corruption, nPackets=0");
560 return;
561 }
562
563 if (m_nPackets>m_packetEnd.size()) {
564 ATH_MSG_WARNING("Data corruption, nPackets " << m_nPackets << " exceeds size " << m_packetEnd.size());
565 return;
566 }
567
568 if (m_packetEnd[m_nPackets - 1] + m_monTrailerSize != n) {
569 ATH_MSG_WARNING("problem in packet size loop " << m_packetEnd[m_nPackets - 1] << " != " << n);
570 }
571
572
573 std::vector<unsigned int> timeslot_nsc = {m_nsc1, m_nsc2, m_nsc3, m_nsc4, m_nsc5, m_nsc6};
574 std::vector<unsigned int> bc_size;
577
578 short nBC = 0;
579 short nBC1 = 0;
580 short startBC1 = 0;
583
584 if (m_isAveraged || m_isAutoCorr) {
585 nBC = m_at0nBC;
586 nBC1 = m_at1nBC;
587 m_nBC_Averaged = nBC;
588 startBC1 = 0;
589 type0 = static_cast<MonDataType>(m_at0type);
590 type1 = static_cast<MonDataType>(m_at1type);
591 for (auto& val : m_averagedRawValuesInEvent) {
592 val.sum.resize(m_nBC_Averaged);
593 val.sumSq.resize(m_nBC_Averaged);
594 val.nTrigValid.resize(m_nBC_Averaged);
595 val.latomeChannel = 99999;
596 }
597 } else {
598 if (m_at1nBC == 0) {
600 }
601
603 if (m_at0nBC >= m_at1nBC) {
604 nBC = m_at0nBC;
605 nBC1 = m_at1nBC;
606 startBC1 = m_at1BC - m_at0BC;
607 type0 = static_cast<MonDataType>(m_at0type);
608 type1 = static_cast<MonDataType>(m_at1type);
609 } else {
610 nBC1 = m_at0nBC;
611 nBC = m_at1nBC;
612 startBC1 = m_at0BC - m_at1BC;
613 type1 = static_cast<MonDataType>(m_at0type);
614 type0 = static_cast<MonDataType>(m_at1type);
615 }
616 } else if (m_at0type != (Word)MonDataType::Invalid) {
617 nBC = m_at0nBC;
618 type0 = static_cast<MonDataType>(m_at0type);
619 } else if (m_at1type != (Word)MonDataType::Invalid) {
620 nBC = m_at1nBC;
621 type0 = static_cast<MonDataType>(m_at1type);
622 } else {
623 ATH_MSG_ERROR("No valid data type in Mon Header");
624 return;
625 }
626
627 switch (type0) {
629 m_hasRawAdc = true;
630 m_nBC_rawADC = nBC;
631 break;
632 case MonDataType::ADC:
633 m_hasAdc = true;
634 m_nBC_ADC = nBC;
635 break;
637 m_hasE = true;
638 m_nBC_E = nBC;
639 break;
641 m_hasEID = true;
642 m_nBC_EID = nBC;
643 break;
645 break;
646 default:
647 ATH_MSG_ERROR("wrong mux0 value " << (Word)type0);
648 return;
649 }
650
651 switch (type1) {
653 m_hasRawAdc = true;
654 m_nBC_rawADC = nBC1;
655 m_BC_rawADC = startBC1;
656 break;
657 case MonDataType::ADC:
658 m_hasAdc = true;
659 m_nBC_ADC = nBC1;
660 m_BC_ADC = startBC1;
661 break;
663 m_hasE = true;
664 m_nBC_E = nBC1;
665 m_BC_E = startBC1;
666 break;
668 m_hasEID = true;
669 m_nBC_EID = nBC1;
670 m_BC_EID = startBC1;
671 break;
673 break;
674 default:
675 ATH_MSG_ERROR("wrong mux1 value " << (Word)type1);
676 return;
677 }
678
679 for (auto& val : m_rawValuesInEvent) {
680 if (m_hasRawAdc)
681 val.adc.resize(m_nBC_rawADC);
682 if (m_hasAdc)
683 val.adc_bas.resize(m_nBC_ADC);
684 if (m_hasE)
685 val.et.resize(m_nBC_E);
686 if (m_hasEID)
687 val.et_id.resize(m_nBC_EID);
688 if (m_hasEID || m_hasE) {
689 val.saturation.resize(std::max(m_nBC_EID, m_nBC_E));
690 }
691
692 val.latomeChannel = 99999;
693 }
694 }
695
696 m_BCIDsInEvent.resize(nBC);
697
698 unsigned int s = m_monHeaderSize;
699 unsigned int bcid = s_nBunches;
700
701 for (short iBC = 0; iBC < nBC; ++iBC) {
702 MonDataType at0 = type0;
703 MonDataType at1 = type1;
704 if (type1 != MonDataType::Invalid) {
705 if (iBC < startBC1 || iBC >= startBC1 + nBC1)
707 }
708 unsigned int nbytesPerChannel = bytesPerChannel(at0, at1);
709
710 int nsc = 0;
711 unsigned int oldipacket = 0;
712 for (unsigned int itimeslot = 0; itimeslot < 6; ++itimeslot) {
713 unsigned int l_bcid = (std::byteswap(p[s]))>>16;
714 if(itimeslot!=0){
715 if(l_bcid!=bcid){
716 ATH_MSG_WARNING( "ERROR: inconsistent BCID between time slots" );
717 }
718 }
719 else{
720 if(bcid!=s_nBunches){
722 unsigned int bcid_c = bcid+1;
723 if(bcid_c==s_nBunches){
724 bcid=0;
725 bcid_c = 0;
726 }
727 if(bcid_c != l_bcid){
728 ATH_MSG_WARNING( "ERROR: BCID not increasing properly between samples, sourceId: " << m_nthLATOME << " L1ID is: " << m_l1ID << ", BCID is from payload: " << l_bcid << ", expected BCID is: " << bcid_c << ", LATOME channel is: " << nsc );
729 }
730 }
731 m_BCIDsInEvent[iBC] = l_bcid;
732 }
733 bcid=l_bcid;
734
735 unsigned int mux = ((std::byteswap(p[s])) >> 8) & 0xff;
739 if (s >= n)
740 break;
741
742 unsigned int timeslotsize = timeslot_nsc[itimeslot];
743 unsigned int nbytes = timeslotsize * nbytesPerChannel;
744 unsigned int n64word = nbytes / 8;
745 if (nbytes % 8)
746 ++n64word;
747 ATH_MSG_DEBUG(" at BC " << iBC << " timeslot " << itimeslot << " " << bcid << " " << mux << " n64word " << n64word << " at0 " << (int)at0 << " at1 "
748 << (int)at1 << " l_bcid " << bcid);
749
750 unsigned int wordshift = s;
751 unsigned int byteshift = 0;
752
754 oldipacket = m_iPacket;
755 for (unsigned int ichan = 0; ichan < timeslotsize; ++ichan) {
756 unsigned int at0Data = 0, at1Data = 0, satData = 0;
757 bool at0val = false, at1val = false;
758
759 // protection against corrupted bytestream data
760 if (nsc > N_LATOME_CHANNELS - 1) {
761 break;
762 // FIXME: should fill some default data to all channels, because clearly this block is corrupted
763 }
764 if (!m_isAveraged && !m_isAutoCorr) {
765 decodeChannel(wordshift, byteshift, p, at0, at1, at0Data, at1Data, satData, at0val, at1val);
766 ATH_MSG_DEBUG(" wordshift " << wordshift << " byteshift " << byteshift << " at0data " << at0Data << " at1Data " << at1Data << " satData " << satData
767 << " at0val " << at0val << " at1val " << at1val << " nsc " << nsc);
768
770 const HWIdentifier SCID = nsc < (int) LATOME_Channels->size() ? (*LATOME_Channels)[nsc] : hwidEmpty;
771 if (SCID == hwidEmpty) {
772 ATH_MSG_DEBUG("No mapping for ch: " << std::dec << nsc);
773 }
774 int RAWValue0 = -999;
775 if (!at0val && SCID != hwidEmpty && at0 != MonDataType::Invalid) {
776 ATH_MSG_DEBUG("at0 bad quality bit for SC:" << nsc << " BC " << iBC << " latome " << robFrag->rod_source_id());
777 } else {
779 RAWValue0 = at0Data;
780 }
781 int defaultADCValue = -1;
782 int defaultEValue = -99999;
783 auto& rawValuesInEvent = m_rawValuesInEvent[nsc];
784 switch (at0) {
786 if ((unsigned)iBC < rawValuesInEvent.adc.size()) {
787 rawValuesInEvent.adc[iBC] = (at0val) ? RAWValue0 : defaultADCValue;
788 }
789 break;
790 case MonDataType::ADC:
791 if ((unsigned)iBC < rawValuesInEvent.adc_bas.size()) {
792 rawValuesInEvent.adc_bas[iBC] = (at0val) ? RAWValue0 : defaultADCValue;
793 }
794 break;
796 if ((unsigned)iBC < rawValuesInEvent.et.size()) {
797 rawValuesInEvent.et[iBC] = (at0val) ? signEnergy(RAWValue0) : defaultEValue;
798 rawValuesInEvent.saturation[iBC] = satData;
799 }
800 break;
802 if ((unsigned)iBC < rawValuesInEvent.et_id.size()) {
803 rawValuesInEvent.et_id[iBC] = (at0val) ? signEnergy(RAWValue0) : defaultEValue;
804 rawValuesInEvent.saturation[iBC] = satData;
805 }
806 break;
808 break;
809 default:
810 ATH_MSG_ERROR("wrong at0 value " << (Word)at0);
811 return;
812 }
813
814 int RAWValue1 = -999;
815 if (!at1val && SCID != hwidEmpty && at1 != MonDataType::Invalid) {
816 ATH_MSG_DEBUG("at1 bad quality bit for SC:" << nsc << " BC " << iBC << " latome " << robFrag->rod_source_id());
817 } else {
819 RAWValue1 = at1Data;
820 }
821
822 const size_t BCidx = iBC - startBC1;
823 switch (at1) {
825 if (BCidx < rawValuesInEvent.adc.size()) {
826 rawValuesInEvent.adc[BCidx] = (at1val) ? RAWValue1 : defaultADCValue;
827 }
828 break;
829 case MonDataType::ADC:
830 if (BCidx < rawValuesInEvent.adc_bas.size()) {
831 rawValuesInEvent.adc_bas[BCidx] = (at1val) ? RAWValue1 : defaultADCValue;
832 }
833 break;
835 if (BCidx < rawValuesInEvent.et.size()) {
836 rawValuesInEvent.et[BCidx] = (at1val) ? signEnergy(RAWValue1) : defaultEValue;
837 rawValuesInEvent.saturation[BCidx] = satData;
838 }
839 break;
841 if (BCidx < rawValuesInEvent.et_id.size()) {
842 m_rawValuesInEvent[nsc].et_id[BCidx] = (at1val) ? signEnergy(RAWValue1) : defaultEValue;
843 m_rawValuesInEvent[nsc].saturation[BCidx] = satData;
844 }
845 break;
847 break;
848 default:
849 ATH_MSG_ERROR("wrong at1 value " << (Word)at1);
850 return;
851 }
852
853 m_rawValuesInEvent[nsc].latomeChannel = nsc;
854
855 } else {
856 if (wordshift % 2) {
857 ATH_MSG_ERROR("inconsistant wordshift in decoding everaged data");
858 return;
859 }
860 unsigned int averageword = std::byteswap(p[wordshift]);
861 wordshift += 1;
862 unsigned int sumSq = std::byteswap(p[wordshift]);
863 wordshift += 1;
864 unsigned long long sumsqMSB = averageword >> 28;
865 sumsqMSB = sumsqMSB << 32;
866
867 m_averagedRawValuesInEvent[nsc].sum[iBC] = averageword & 0xFFFFF;
868 m_averagedRawValuesInEvent[nsc].sumSq[iBC] = sumSq | sumsqMSB;
869 m_averagedRawValuesInEvent[nsc].nTrigValid[iBC] = (averageword >> 20) & 0xFF;
870 m_averagedRawValuesInEvent[nsc].latomeChannel = nsc;
871 }
872
873 ++nsc;
874
875 }
876
878 if(byteshift!=0){
879 increaseWordShift(wordshift);
880 byteshift=0;
881 }
882 ATH_MSG_DEBUG("wordshift before: " << wordshift << ", s: " << s);
883 if ((wordshift - s) % 2)
884 increaseWordShift(wordshift);
885 ATH_MSG_DEBUG("wordshift after : " << wordshift << ", s: " << s);
886 if ((wordshift - s - ((m_iPacket - oldipacket) * (m_monHeaderSize + m_monTrailerSize))) != n64word * 2) {
887 ATH_MSG_WARNING(" ERROR: time slice end is not padded properly " << (wordshift - s - m_iPacket * (m_monHeaderSize + m_monTrailerSize))
888 << "!=" << n64word * 2 << " m_ipacket " << m_iPacket);
889 }
890 s = wordshift;
891 oldipacket = m_iPacket;
892 }
893
894 }
895
896 if (!m_isAveraged && !m_isAutoCorr) {
897 fillRaw(LATOME_Channels);
898 } else {
899 if (onoffmap && clmap) {
900 fillCalib(LATOME_Channels, onoffmap, clmap);
901 } else {
902 ATH_MSG_ERROR("Do not have mapping !!!");
903 }
904 }
905 fillHeader();
906}
MonDataType
int signEnergy(unsigned int energy)
void fillRaw(const std::vector< HWIdentifier > *LATOME_Channels)
Pass ADC values from an event.
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)
unsigned int decodeHeader(const uint32_t *p, unsigned int offset)
std::vector< unsigned short > m_BCIDsInEvent
void increaseWordShift(unsigned int &wordshift)
void fillCalib(const std::vector< HWIdentifier > *LATOME_Channels, const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap)
unsigned int decodeTrailer(const uint32_t *p, unsigned int offset)
static const int s_nBunches
Maximum value of BCID.
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
setEventNumber setTimeStamp bcid

◆ fillHeader()

void LArLATOMEDecoder::EventProcess::fillHeader ( )
private

Definition at line 1153 of file LArLATOMEDecoder.cxx.

1153 {
1154
1155 if (m_header_coll) {
1156 LArLATOMEHeader* latome = new LArLATOMEHeader(m_nthLATOME, m_latomeID, m_activeSC, m_latomeBCID, m_l1ID, m_ROBFragSize, m_LATOMEFW);
1157 m_header_coll->push_back(latome);
1158 }
1159}

◆ fillRaw()

void LArLATOMEDecoder::EventProcess::fillRaw ( const std::vector< HWIdentifier > * LATOME_Channels)
private

Pass ADC values from an event.

don't copy vectors for nothing

need to shift the BCID as well do it at the same time

Definition at line 1077 of file LArLATOMEDecoder.cxx.

1077 {
1078 // const CaloGain::CaloGain dummyGain = CaloGain::LARHIGHGAIN;
1079 const HWIdentifier hwidEmpty;
1080 for (SuperCell ch = 0; ch < N_LATOME_CHANNELS; ++ch) {
1081 const HWIdentifier SCID = ch < (int) LATOME_Channels->size() ? (*LATOME_Channels)[ch] : hwidEmpty;
1082 if (SCID == hwidEmpty) {
1083 ATH_MSG_DEBUG("No mapping for ch: " << std::dec << ch);
1084 continue;
1085 }
1086 if (m_decoder->m_ignoreBarrelChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 0)
1087 continue;
1088 if (m_decoder->m_ignoreEndcapChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 1)
1089 continue;
1090
1091 std::vector<short> adcValues_inChannel_inEvent;
1092
1093 if (m_hasRawAdc) {
1094 adcValues_inChannel_inEvent = m_rawValuesInEvent[ch].adc;
1095 }
1096
1097 if (m_hasRawAdc && m_adc_coll) {
1100
1101 std::vector<unsigned short> bcid_in_event;
1102 for (short b = m_BC_rawADC; b < m_BC_rawADC + m_nBC_rawADC; ++b) {
1103 bcid_in_event.push_back(m_BCIDsInEvent[b]);
1104 }
1105
1106 LArSCDigit* scDigit = new LArSCDigit(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, adcValues_inChannel_inEvent, bcid_in_event);
1107 m_adc_coll->push_back(scDigit);
1108 }
1109
1110 if (m_hasAdc && m_adc_bas_coll) {
1111 std::vector<unsigned short> bcid_in_event;
1112 if (m_nBC_ADC == (short)m_BCIDsInEvent.size()) {
1113 bcid_in_event = m_BCIDsInEvent;
1114 } else {
1115 for (short b = m_BC_ADC; b < m_BC_ADC + m_nBC_ADC; ++b) {
1116 bcid_in_event.push_back(m_BCIDsInEvent[b]);
1117 }
1118 }
1119 LArSCDigit* scDigit = new LArSCDigit(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].adc_bas, bcid_in_event);
1120 m_adc_bas_coll->push_back(scDigit);
1121 }
1122
1123 if (m_hasE && m_et_coll) {
1124 std::vector<unsigned short> bcid_in_event;
1125 if (m_nBC_E == (unsigned short)m_BCIDsInEvent.size()) {
1126 bcid_in_event = m_BCIDsInEvent;
1127 } else {
1128 for (short b = m_BC_E; b < m_BC_E + m_nBC_E; ++b) {
1129 bcid_in_event.push_back(m_BCIDsInEvent[b]);
1130 }
1131 }
1132 LArRawSC* scDigit =
1133 new LArRawSC(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].et, bcid_in_event, m_rawValuesInEvent[ch].saturation);
1134 m_et_coll->push_back(scDigit);
1135 }
1136
1137 if (m_hasEID && m_et_id_coll) {
1138 std::vector<unsigned short> bcid_in_event;
1139 if (m_nBC_EID == (short)m_BCIDsInEvent.size()) {
1140 bcid_in_event = m_BCIDsInEvent;
1141 } else {
1142 for (short b = m_BC_EID; b < m_BC_EID + m_nBC_EID; ++b) {
1143 bcid_in_event.push_back(m_BCIDsInEvent[b]);
1144 }
1145 }
1146 LArRawSC* scDigit =
1147 new LArRawSC(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].et_id, bcid_in_event, m_rawValuesInEvent[ch].saturation);
1148 m_et_id_coll->push_back(scDigit);
1149 }
1150 }
1151}
float et(const xAOD::jFexSRJetRoI *j)

◆ increaseByteShift()

void LArLATOMEDecoder::EventProcess::increaseByteShift ( unsigned int & wordshift,
unsigned int & byteshift )
inlineprivate

Definition at line 368 of file LArLATOMEDecoder.cxx.

368 {
369 ++byteshift;
370 if (byteshift == 4) {
371 increaseWordShift(wordshift);
372 byteshift = 0;
373 }
374}

◆ increaseWordShift()

void LArLATOMEDecoder::EventProcess::increaseWordShift ( unsigned int & wordshift)
inlineprivate

Definition at line 359 of file LArLATOMEDecoder.cxx.

359 {
360 ++wordshift;
361 if (m_packetEnd[m_iPacket] == wordshift) {
362 ++m_iPacket;
363 wordshift += (m_monHeaderSize + m_monTrailerSize);
364 ATH_MSG_DEBUG("switch packet " << m_iPacket << " " << wordshift);
365 }
366}

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)
int outputLevel(const IMessageSvc *ims, const std::string &source)

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels).
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ signEnergy()

int LArLATOMEDecoder::EventProcess::signEnergy ( unsigned int energy)
inlineprivate

Definition at line 336 of file LArLATOMEDecoder.cxx.

336 {
337
338 if (energy & (1 << 17))
339 return energy - pow(2, 18);
340 else
341 return energy;
342}
constexpr int pow(int x)
Definition conifer.h:27

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging).

Definition at line 141 of file AthMessaging.h.

◆ m_accdigits

LArAccumulatedDigitContainer* LArLATOMEDecoder::EventProcess::m_accdigits {}
private

Definition at line 238 of file LArLATOMEDecoder.h.

238{};

◆ m_activeSC

Word LArLATOMEDecoder::EventProcess::m_activeSC {}
private

Definition at line 206 of file LArLATOMEDecoder.h.

206{};

◆ m_adc_bas_coll

LArDigitContainer* LArLATOMEDecoder::EventProcess::m_adc_bas_coll {}
private

Definition at line 235 of file LArLATOMEDecoder.h.

235{};

◆ m_adc_coll

LArDigitContainer* LArLATOMEDecoder::EventProcess::m_adc_coll {}
private

Definition at line 234 of file LArLATOMEDecoder.h.

234{};

◆ m_at0at1Swap

Word LArLATOMEDecoder::EventProcess::m_at0at1Swap {}
private

Definition at line 197 of file LArLATOMEDecoder.h.

197{};

◆ m_at0BC

Word LArLATOMEDecoder::EventProcess::m_at0BC {}
private

Definition at line 204 of file LArLATOMEDecoder.h.

204{};

◆ m_at0nBC

Word LArLATOMEDecoder::EventProcess::m_at0nBC {}
private

Definition at line 202 of file LArLATOMEDecoder.h.

202{};

◆ m_at0type

Word LArLATOMEDecoder::EventProcess::m_at0type {}
private

Definition at line 200 of file LArLATOMEDecoder.h.

200{};

◆ m_at0typeRec

Word LArLATOMEDecoder::EventProcess::m_at0typeRec {}
private

Definition at line 198 of file LArLATOMEDecoder.h.

198{};

◆ m_at1BC

Word LArLATOMEDecoder::EventProcess::m_at1BC {}
private

Definition at line 205 of file LArLATOMEDecoder.h.

205{};

◆ m_at1nBC

Word LArLATOMEDecoder::EventProcess::m_at1nBC {}
private

Definition at line 203 of file LArLATOMEDecoder.h.

203{};

◆ m_at1type

Word LArLATOMEDecoder::EventProcess::m_at1type {}
private

Definition at line 201 of file LArLATOMEDecoder.h.

201{};

◆ m_at1typeRec

Word LArLATOMEDecoder::EventProcess::m_at1typeRec {}
private

Definition at line 199 of file LArLATOMEDecoder.h.

199{};

◆ m_averagedRawValuesInEvent

std::vector<LatomeAveragedRawData> LArLATOMEDecoder::EventProcess::m_averagedRawValuesInEvent
private

Definition at line 247 of file LArLATOMEDecoder.h.

◆ m_BC_ADC

short LArLATOMEDecoder::EventProcess::m_BC_ADC {}
private

Definition at line 222 of file LArLATOMEDecoder.h.

222{};

◆ m_BC_E

short LArLATOMEDecoder::EventProcess::m_BC_E {}
private

Definition at line 223 of file LArLATOMEDecoder.h.

223{};

◆ m_BC_EID

short LArLATOMEDecoder::EventProcess::m_BC_EID {}
private

Definition at line 224 of file LArLATOMEDecoder.h.

224{};

◆ m_BC_rawADC

short LArLATOMEDecoder::EventProcess::m_BC_rawADC {}
private

Definition at line 221 of file LArLATOMEDecoder.h.

221{};

◆ m_BCIDsInEvent

std::vector<unsigned short> LArLATOMEDecoder::EventProcess::m_BCIDsInEvent
private

Definition at line 245 of file LArLATOMEDecoder.h.

◆ m_caccdigits

LArAccumulatedCalibDigitContainer* LArLATOMEDecoder::EventProcess::m_caccdigits {}
private

Definition at line 239 of file LArLATOMEDecoder.h.

239{};

◆ m_decoder

const LArLATOMEDecoder* LArLATOMEDecoder::EventProcess::m_decoder {}
private

Definition at line 233 of file LArLATOMEDecoder.h.

233{};

◆ m_et_coll

LArRawSCContainer* LArLATOMEDecoder::EventProcess::m_et_coll {}
private

Definition at line 236 of file LArLATOMEDecoder.h.

236{};

◆ m_et_id_coll

LArRawSCContainer* LArLATOMEDecoder::EventProcess::m_et_id_coll {}
private

Definition at line 237 of file LArLATOMEDecoder.h.

237{};

◆ m_hasAdc

bool LArLATOMEDecoder::EventProcess::m_hasAdc {}
private

Definition at line 227 of file LArLATOMEDecoder.h.

227{};

◆ m_hasE

bool LArLATOMEDecoder::EventProcess::m_hasE {}
private

Definition at line 228 of file LArLATOMEDecoder.h.

228{};

◆ m_hasEID

bool LArLATOMEDecoder::EventProcess::m_hasEID {}
private

Definition at line 229 of file LArLATOMEDecoder.h.

229{};

◆ m_hasRawAdc

bool LArLATOMEDecoder::EventProcess::m_hasRawAdc {}
private

Definition at line 226 of file LArLATOMEDecoder.h.

226{};

◆ m_header_coll

LArLATOMEHeaderContainer* LArLATOMEDecoder::EventProcess::m_header_coll {}
private

Definition at line 240 of file LArLATOMEDecoder.h.

240{};

◆ m_headerDecoded

bool LArLATOMEDecoder::EventProcess::m_headerDecoded {}
private

Definition at line 213 of file LArLATOMEDecoder.h.

213{};

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_iPacket

Word LArLATOMEDecoder::EventProcess::m_iPacket {}
private

Definition at line 191 of file LArLATOMEDecoder.h.

191{};

◆ m_isAutoCorr

bool LArLATOMEDecoder::EventProcess::m_isAutoCorr {}
private

Definition at line 231 of file LArLATOMEDecoder.h.

231{};

◆ m_isAveraged

bool LArLATOMEDecoder::EventProcess::m_isAveraged {}
private

Definition at line 230 of file LArLATOMEDecoder.h.

230{};

◆ m_l1ID

Word LArLATOMEDecoder::EventProcess::m_l1ID {}
private

Definition at line 187 of file LArLATOMEDecoder.h.

187{};

◆ m_latomeBCID

Word LArLATOMEDecoder::EventProcess::m_latomeBCID {}
private

Definition at line 184 of file LArLATOMEDecoder.h.

184{};

◆ m_latomeCalibPatternsInEvent

std::vector<LatomeCalibPatterns> LArLATOMEDecoder::EventProcess::m_latomeCalibPatternsInEvent
private

Definition at line 248 of file LArLATOMEDecoder.h.

◆ m_LATOMEFW

Word LArLATOMEDecoder::EventProcess::m_LATOMEFW {}
private

Definition at line 189 of file LArLATOMEDecoder.h.

189{};

◆ m_latomeID

Word LArLATOMEDecoder::EventProcess::m_latomeID {}
private

Definition at line 186 of file LArLATOMEDecoder.h.

186{};

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_monHeaderSize

Word LArLATOMEDecoder::EventProcess::m_monHeaderSize {}
private

Definition at line 193 of file LArLATOMEDecoder.h.

193{};

◆ m_monTrailerSize

const Word LArLATOMEDecoder::EventProcess::m_monTrailerSize =2
staticprivate

some cached info to ease processing reading from data header

Definition at line 178 of file LArLATOMEDecoder.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_nBC_ADC

short LArLATOMEDecoder::EventProcess::m_nBC_ADC {}
private

Definition at line 216 of file LArLATOMEDecoder.h.

216{};

◆ m_nBC_Averaged

short LArLATOMEDecoder::EventProcess::m_nBC_Averaged {}
private

Definition at line 219 of file LArLATOMEDecoder.h.

219{};

◆ m_nBC_E

short LArLATOMEDecoder::EventProcess::m_nBC_E {}
private

Definition at line 217 of file LArLATOMEDecoder.h.

217{};

◆ m_nBC_EID

short LArLATOMEDecoder::EventProcess::m_nBC_EID {}
private

Definition at line 218 of file LArLATOMEDecoder.h.

218{};

◆ m_nBC_rawADC

short LArLATOMEDecoder::EventProcess::m_nBC_rawADC {}
private

Definition at line 215 of file LArLATOMEDecoder.h.

215{};

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_nPackets

Word LArLATOMEDecoder::EventProcess::m_nPackets {}
private

Definition at line 190 of file LArLATOMEDecoder.h.

190{};

◆ m_nsc1

Word LArLATOMEDecoder::EventProcess::m_nsc1 {}
private

Definition at line 207 of file LArLATOMEDecoder.h.

207{};

◆ m_nsc2

Word LArLATOMEDecoder::EventProcess::m_nsc2 {}
private

Definition at line 208 of file LArLATOMEDecoder.h.

208{};

◆ m_nsc3

Word LArLATOMEDecoder::EventProcess::m_nsc3 {}
private

Definition at line 209 of file LArLATOMEDecoder.h.

209{};

◆ m_nsc4

Word LArLATOMEDecoder::EventProcess::m_nsc4 {}
private

Definition at line 210 of file LArLATOMEDecoder.h.

210{};

◆ m_nsc5

Word LArLATOMEDecoder::EventProcess::m_nsc5 {}
private

Definition at line 211 of file LArLATOMEDecoder.h.

211{};

◆ m_nsc6

Word LArLATOMEDecoder::EventProcess::m_nsc6 {}
private

Definition at line 212 of file LArLATOMEDecoder.h.

212{};

◆ m_nStreams

Word LArLATOMEDecoder::EventProcess::m_nStreams {}
private

Definition at line 195 of file LArLATOMEDecoder.h.

195{};

◆ m_nthLATOME

unsigned int LArLATOMEDecoder::EventProcess::m_nthLATOME = 0
private

Definition at line 243 of file LArLATOMEDecoder.h.

◆ m_nWordsPerPacket

Word LArLATOMEDecoder::EventProcess::m_nWordsPerPacket {}
private

Definition at line 192 of file LArLATOMEDecoder.h.

192{};

◆ m_packetEnd

std::vector<Word> LArLATOMEDecoder::EventProcess::m_packetEnd
private

Definition at line 181 of file LArLATOMEDecoder.h.

◆ m_rawValuesInEvent

std::vector<LatomeRawData> LArLATOMEDecoder::EventProcess::m_rawValuesInEvent
private

Definition at line 246 of file LArLATOMEDecoder.h.

◆ m_region

Word LArLATOMEDecoder::EventProcess::m_region {}
private

Definition at line 194 of file LArLATOMEDecoder.h.

194{};

◆ m_ROBFragSize

Word LArLATOMEDecoder::EventProcess::m_ROBFragSize {}
private

Definition at line 188 of file LArLATOMEDecoder.h.

188{};

◆ m_streamNumber

Word LArLATOMEDecoder::EventProcess::m_streamNumber {}
private

Definition at line 196 of file LArLATOMEDecoder.h.

196{};

◆ s_monCheckPoint

const Word LArLATOMEDecoder::EventProcess::s_monCheckPoint =0xdeadbeef
staticprivate

Definition at line 180 of file LArLATOMEDecoder.h.

◆ s_monHeaderMarker

const Word LArLATOMEDecoder::EventProcess::s_monHeaderMarker =0xff1234ff
staticprivate

this is fixed and not read from data

Definition at line 179 of file LArLATOMEDecoder.h.


The documentation for this class was generated from the following files: