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 LArLATOMEMapping *map, 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 LArLATOMEMapping *map)
 Pass ADC values from an event.
void fillCalib (const LArLATOMEMapping *map, const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap)
void fillHeader ()
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::vector< Wordm_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 LArLATOMEDecoderm_decoder {}
LArDigitContainerm_adc_coll {}
LArDigitContainerm_adc_bas_coll {}
LArRawSCContainerm_et_coll {}
LArRawSCContainerm_et_id_coll {}
LArAccumulatedDigitContainerm_accdigits {}
LArAccumulatedCalibDigitContainerm_caccdigits {}
LArLATOMEHeaderContainerm_header_coll {}
unsigned int m_nthLATOME = 0
std::vector< unsigned short > m_BCIDsInEvent
std::vector< LatomeRawDatam_rawValuesInEvent
std::vector< LatomeAveragedRawDatam_averagedRawValuesInEvent
std::vector< LatomeCalibPatternsm_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 129 of file LArLATOMEDecoder.h.

Member Typedef Documentation

◆ NumWord

Definition at line 134 of file LArLATOMEDecoder.h.

◆ Packet

Definition at line 135 of file LArLATOMEDecoder.h.

◆ Path

Definition at line 138 of file LArLATOMEDecoder.h.

◆ Sample

Definition at line 137 of file LArLATOMEDecoder.h.

◆ SuperCell

Definition at line 136 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 133 of file LArLATOMEDecoder.h.

Member Enumeration Documentation

◆ MODE

Enumerator
MON_HEADER 
PAYLOAD 
MON_TRAILER 

Definition at line 174 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 135 of file LArLATOMEDecoder.cxx.

138 : AthMessaging(Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc"), "LArLATOMEDecoder::EventProcess"),
139 m_decoder(decoderInput),
140 m_adc_coll(adc_coll),
141 m_adc_bas_coll(adc_bas_coll),
142 m_et_coll(et_coll),
143 m_et_id_coll(et_id_coll),
144 m_accdigits(accdigits),
145 m_caccdigits(caccdigits),
146 m_header_coll(header_coll) {
147 m_latomeID = 0;
148 m_l1ID = 0;
149 m_ROBFragSize = 0;
150 m_nPackets = 0;
151 m_iPacket = 0;
153 m_monHeaderSize = 0;
154 m_region = 0;
155 m_nStreams = 0;
156 m_streamNumber = 0;
157 m_at0at1Swap = 0;
162 m_at0nBC = 0;
163 m_at1nBC = 0;
164 m_at0BC = 0;
165 m_at1BC = 0;
166 m_activeSC = 0;
167 m_nsc1 = 0;
168 m_nsc2 = 0;
169 m_nsc3 = 0;
170 m_nsc4 = 0;
171 m_nsc5 = 0;
172 m_nsc6 = 0;
173 m_headerDecoded = false;
174
175 m_nBC_rawADC = 0;
176 m_nBC_ADC = 0;
177 m_nBC_E = 0;
178 m_nBC_EID = 0;
179
180 m_nBC_Averaged = 0;
181
182 m_BC_rawADC = 0;
183 m_BC_ADC = 0;
184 m_BC_E = 0;
185 m_BC_EID = 0;
186
187 m_hasRawAdc = false;
188 m_hasAdc = false;
189 m_hasE = false;
190 m_hasEID = false;
191
192 m_isAveraged = (m_caccdigits != 0);
193 m_isAutoCorr = (m_accdigits != 0);
194
195 if (!m_isAveraged && !m_isAutoCorr) {
197 } else {
200 }
201}
#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 327 of file LArLATOMEDecoder.cxx.

327 {
328 unsigned int b = 0;
329 if (at0 == MonDataType::Averaged || at0 == MonDataType::AutoCorr)
330 return 8;
331
333 if (at0 != MonDataType::Invalid)
334 b += 2;
335 if (at1 != MonDataType::Invalid)
336 b += 2;
338 ++b;
339 return b;
340}

◆ compareOrSet()

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

Definition at line 203 of file LArLATOMEDecoder.cxx.

203 {
204 if (!compare) {
205 param = value;
206 return true;
207 }
208 return param == value;
209}

◆ decodeByte()

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

Definition at line 359 of file LArLATOMEDecoder.cxx.

359 {
360 byte = ((bswap_32(p[wordshift])) >> (8 * (4 - 1 - byteshift))) & 0xff;
361}

◆ 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 )
private

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 373 of file LArLATOMEDecoder.cxx.

374 {
375
376 // the structure of data is always consisting of 2,3,4 or 5 bytes depending on the recipe.
377 // 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.
378 // 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
379 // flexible. use unsigned int everywhere for now since we have 18 bits for energy which does not fit in short, cast later.
380 unsigned int nbytesPerChannel = bytesPerChannel(at0, at1);
381 bool satByte = nbytesPerChannel % 2; // do we have satbyte
382
383 at0val = false;
384 at1val = false;
385 at0Data = 0;
386 at1Data = 0;
387 unsigned int satData = 0;
388 saturation = 0;
389
390 unsigned int word1 = 0;
391 unsigned int word2 = 0;
392 decodeWord(word1, wordshift, byteshift, p);
393 if (nbytesPerChannel > 3) {
394 decodeWord(word2, wordshift, byteshift, p);
395 }
396 at0Data = word1 & 0x7fff;
397 at0val = word1 & 0x8000;
398 if (nbytesPerChannel > 3) {
399 at1Data = word2 & 0x7fff;
400 at1val = word2 & 0x8000;
401 }
402 if (satByte) {
403 decodeByte(satData, wordshift, byteshift, p);
404 increaseByteShift(wordshift, byteshift);
405 }
406
410
412 at0Data = (at0Data << 3) | (satData & 0x7);
413 at1Data = (at1Data << 3) | ((satData & 0x70) >> 4);
414 saturation = ((satData & 0x88) == 0x88);
415 } else if (at1 == MonDataType::Energy && at0 == MonDataType::SelectedEnergy) {
416 at0Data = (at0Data << 3) | ((satData & 0x70) >> 4);
417 at1Data = (at1Data << 3) | (satData & 0x7);
418 saturation = ((satData & 0x88) == 0x88);
419 } else {
421 at0Data = (at0Data << 3) | (satData & 0x7);
422 saturation = (satData & 0x20);
423 }
425 at1Data = (at1Data << 3) | (satData & 0x7);
426 saturation = (satData & 0x20);
427 }
428 }
429}
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 221 of file LArLATOMEDecoder.cxx.

221 {
222
224 int monheadererror = 0;
225 int monheadererrorbit = 0;
226 if (!compareOrSet(m_latomeID, bswap_32(p[0 + offset]), m_headerDecoded))
227 monheadererror |= (1 << monheadererrorbit++);
228 Word l1IDtmp = m_l1ID;
229 if (!compareOrSet(l1IDtmp, bswap_32(p[1 + offset]), m_headerDecoded))
230 monheadererror |= (1 << monheadererrorbit++);
231 if (l1IDtmp != m_l1ID) {
232 ATH_MSG_DEBUG("Mon header L1ID " << l1IDtmp << " different from rod header L1ID " << m_l1ID);
233 }
234 ATH_MSG_DEBUG(" latomeID: " << m_latomeID << " l1ID: " << m_l1ID);
235
236 Word monHeaderMarker = bswap_32(p[2 + offset]);
237 Word monCheckPoint = bswap_32(p[4 + offset]);
238 if (s_monHeaderMarker != monHeaderMarker) {
239 monheadererror |= (1 << monheadererrorbit++);
240 ATH_MSG_WARNING("Problem in monHeaderMarker: " << monHeaderMarker);
241 }
242 if (s_monCheckPoint != monCheckPoint) {
243 monheadererror |= (1 << monheadererrorbit++);
244 ATH_MSG_WARNING("Problem in monCheckPoint: " << monCheckPoint);
245 }
246
247 if (!compareOrSet(m_nPackets, bswap_32(p[3 + offset]) >> 24, m_headerDecoded))
248 monheadererror |= (1 << monheadererrorbit++);
249
250 if (m_nPackets == 0xFF) {
251 m_nPackets = 1;
252 m_iPacket = 0;
253 m_nWordsPerPacket = (bswap_32(p[3 + offset]) & 0xffffff) / 4.;
254 } else {
255 if (m_headerDecoded)
256 ++m_iPacket;
257 else
258 m_iPacket = 0;
259 if (!compareOrSet(m_iPacket, (bswap_32(p[3 + offset]) >> 16) & 0xf, m_headerDecoded))
260 monheadererror |= (1 << monheadererrorbit++);
261 m_nWordsPerPacket = (bswap_32(p[3 + offset]) & 0xffff) / 4.;
262 }
263
264 if (!compareOrSet(m_monHeaderSize, bswap_32(p[5 + offset]), m_headerDecoded))
265 monheadererror |= (1 << monheadererrorbit++);
266
269 if (m_monHeaderSize < 18) {
270 ATH_MSG_WARNING(" Mon header size should not be less that 18 : =" << m_monHeaderSize << " are you reading old data file?");
271 return 0;
272 }
273
274 ATH_MSG_DEBUG(" nPackets: " << m_nPackets << " iPacket: " << m_iPacket << " nWordsPerPacket: " << m_nWordsPerPacket << " monHeaderSize: " << m_monHeaderSize);
275
277 compareOrSet(m_at0at1Swap, (bswap_32(p[8 + offset])>>30) & 0x1, m_headerDecoded);
278 if (!compareOrSet(m_at0typeRec, bswap_32(p[9 + offset]), m_headerDecoded))
279 monheadererror |= (1 << monheadererrorbit++);
280 if (!compareOrSet(m_at1typeRec, bswap_32(p[12 + offset]), m_headerDecoded))
281 monheadererror |= (1 << monheadererrorbit++);
282 monheadererrorbit += 2;
283
284 if (!compareOrSet(m_at0nBC, bswap_32(p[10 + offset]), m_headerDecoded))
285 monheadererror |= (1 << monheadererrorbit++);
286 if (!compareOrSet(m_at1nBC, bswap_32(p[13 + offset]), m_headerDecoded))
287 monheadererror |= (1 << monheadererrorbit++);
288 if (!compareOrSet(m_at0BC, bswap_32(p[11 + offset]), m_headerDecoded))
289 monheadererror |= (1 << monheadererrorbit++);
290 if (!compareOrSet(m_at1BC, bswap_32(p[14 + offset]), m_headerDecoded))
291 monheadererror |= (1 << monheadererrorbit++);
292 if (!compareOrSet(m_activeSC, bswap_32(p[15 + offset]), m_headerDecoded))
293 monheadererror |= (1 << monheadererrorbit++);
294 if (!compareOrSet(m_nsc1, bswap_32(p[16]) >> 24, m_headerDecoded))
295 monheadererror |= (1 << monheadererrorbit++);
296 if (!compareOrSet(m_nsc2, (bswap_32(p[16]) >> 16) & 0xff, m_headerDecoded))
297 monheadererror |= (1 << monheadererrorbit++);
298 if (!compareOrSet(m_nsc3, (bswap_32(p[16]) >> 8) & 0xff, m_headerDecoded))
299 monheadererror |= (1 << monheadererrorbit++);
300 if (!compareOrSet(m_nsc4, (bswap_32(p[16])) & 0xff, m_headerDecoded))
301 monheadererror |= (1 << monheadererrorbit++);
302 if (!compareOrSet(m_nsc5, bswap_32(p[17]) >> 24, m_headerDecoded))
303 monheadererror |= (1 << monheadererrorbit++);
304 if (!compareOrSet(m_nsc6, (bswap_32(p[17]) >> 16) & 0xff, m_headerDecoded))
305 monheadererror |= (1 << monheadererrorbit++);
306
307 ATH_MSG_DEBUG("m_at0at1Swap: " << m_at0at1Swap << " at0type " << m_at0typeRec << " at1type " << m_at1typeRec << " at0nBC " << m_at0nBC << " at1nBC " << m_at1nBC << " at0BC " << m_at0BC
308 << " at1BC " << m_at1BC << " nsc1 " << m_nsc1 << " nsc2 " << m_nsc2 << " nsc3 " << m_nsc3 << " nsc4 " << m_nsc4 << " nsc5 "
309 << m_nsc5 << " nsc6 " << m_nsc6);
310
311 if (monheadererror) {
312 ATH_MSG_WARNING(" consistency error in mon checker at packet " << m_iPacket << " errorbits " << std::hex << monheadererror << std::dec);
313 }
314
315 m_headerDecoded = true;
317}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(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 211 of file LArLATOMEDecoder.cxx.

211 {
213 if (bswap_32(p[offset]) != 0xc0ffee00 || bswap_32(p[offset + 1] != 0xaaaaaaaa)) {
214 ATH_MSG_WARNING("Problem in trailer at packet " << m_iPacket << " words " << std::hex << bswap_32(p[offset]) << ", " << bswap_32(p[offset + 1])
215 << std::dec);
216 }
218 return offset + m_monTrailerSize;
219}
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 )
private

Definition at line 363 of file LArLATOMEDecoder.cxx.

363 {
364 unsigned int msb = 0;
365 unsigned int lsb = 0;
366 decodeByte(msb, wordshift, byteshift, p);
367 increaseByteShift(wordshift, byteshift);
368 decodeByte(lsb, wordshift, byteshift, p);
369 increaseByteShift(wordshift, byteshift);
370 word = lsb | (msb << 8);
371}

◆ fillCalib()

void LArLATOMEDecoder::EventProcess::fillCalib ( const LArLATOMEMapping * map,
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 902 of file LArLATOMEDecoder.cxx.

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

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

1147 {
1148
1149 if (m_header_coll) {
1150 LArLATOMEHeader* latome = new LArLATOMEHeader(m_nthLATOME, m_latomeID, m_activeSC, m_latomeBCID, m_l1ID, m_ROBFragSize, m_LATOMEFW);
1151 m_header_coll->push_back(latome);
1152 }
1153}

◆ fillRaw()

void LArLATOMEDecoder::EventProcess::fillRaw ( const LArLATOMEMapping * map)
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 1071 of file LArLATOMEDecoder.cxx.

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

◆ increaseByteShift()

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

Definition at line 351 of file LArLATOMEDecoder.cxx.

351 {
352 ++byteshift;
353 if (byteshift == 4) {
354 increaseWordShift(wordshift);
355 byteshift = 0;
356 }
357}

◆ increaseWordShift()

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

Definition at line 342 of file LArLATOMEDecoder.cxx.

342 {
343 ++wordshift;
344 if (m_packetEnd[m_iPacket] == wordshift) {
345 ++m_iPacket;
346 wordshift += (m_monHeaderSize + m_monTrailerSize);
347 ATH_MSG_DEBUG("switch packet " << m_iPacket << " " << wordshift);
348 }
349}

◆ 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)

◆ 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)
private

Definition at line 319 of file LArLATOMEDecoder.cxx.

319 {
320
321 if (energy & (1 << 17))
322 return energy - pow(2, 18);
323 else
324 return energy;
325}
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 241 of file LArLATOMEDecoder.h.

241{};

◆ m_activeSC

Word LArLATOMEDecoder::EventProcess::m_activeSC {}
private

Definition at line 209 of file LArLATOMEDecoder.h.

209{};

◆ m_adc_bas_coll

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

Definition at line 238 of file LArLATOMEDecoder.h.

238{};

◆ m_adc_coll

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

Definition at line 237 of file LArLATOMEDecoder.h.

237{};

◆ m_at0at1Swap

Word LArLATOMEDecoder::EventProcess::m_at0at1Swap {}
private

Definition at line 200 of file LArLATOMEDecoder.h.

200{};

◆ m_at0BC

Word LArLATOMEDecoder::EventProcess::m_at0BC {}
private

Definition at line 207 of file LArLATOMEDecoder.h.

207{};

◆ m_at0nBC

Word LArLATOMEDecoder::EventProcess::m_at0nBC {}
private

Definition at line 205 of file LArLATOMEDecoder.h.

205{};

◆ m_at0type

Word LArLATOMEDecoder::EventProcess::m_at0type {}
private

Definition at line 203 of file LArLATOMEDecoder.h.

203{};

◆ m_at0typeRec

Word LArLATOMEDecoder::EventProcess::m_at0typeRec {}
private

Definition at line 201 of file LArLATOMEDecoder.h.

201{};

◆ m_at1BC

Word LArLATOMEDecoder::EventProcess::m_at1BC {}
private

Definition at line 208 of file LArLATOMEDecoder.h.

208{};

◆ m_at1nBC

Word LArLATOMEDecoder::EventProcess::m_at1nBC {}
private

Definition at line 206 of file LArLATOMEDecoder.h.

206{};

◆ m_at1type

Word LArLATOMEDecoder::EventProcess::m_at1type {}
private

Definition at line 204 of file LArLATOMEDecoder.h.

204{};

◆ m_at1typeRec

Word LArLATOMEDecoder::EventProcess::m_at1typeRec {}
private

Definition at line 202 of file LArLATOMEDecoder.h.

202{};

◆ m_averagedRawValuesInEvent

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

Definition at line 250 of file LArLATOMEDecoder.h.

◆ m_BC_ADC

short LArLATOMEDecoder::EventProcess::m_BC_ADC {}
private

Definition at line 225 of file LArLATOMEDecoder.h.

225{};

◆ m_BC_E

short LArLATOMEDecoder::EventProcess::m_BC_E {}
private

Definition at line 226 of file LArLATOMEDecoder.h.

226{};

◆ m_BC_EID

short LArLATOMEDecoder::EventProcess::m_BC_EID {}
private

Definition at line 227 of file LArLATOMEDecoder.h.

227{};

◆ m_BC_rawADC

short LArLATOMEDecoder::EventProcess::m_BC_rawADC {}
private

Definition at line 224 of file LArLATOMEDecoder.h.

224{};

◆ m_BCIDsInEvent

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

Definition at line 248 of file LArLATOMEDecoder.h.

◆ m_caccdigits

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

Definition at line 242 of file LArLATOMEDecoder.h.

242{};

◆ m_decoder

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

Definition at line 236 of file LArLATOMEDecoder.h.

236{};

◆ m_et_coll

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

Definition at line 239 of file LArLATOMEDecoder.h.

239{};

◆ m_et_id_coll

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

Definition at line 240 of file LArLATOMEDecoder.h.

240{};

◆ m_hasAdc

bool LArLATOMEDecoder::EventProcess::m_hasAdc {}
private

Definition at line 230 of file LArLATOMEDecoder.h.

230{};

◆ m_hasE

bool LArLATOMEDecoder::EventProcess::m_hasE {}
private

Definition at line 231 of file LArLATOMEDecoder.h.

231{};

◆ m_hasEID

bool LArLATOMEDecoder::EventProcess::m_hasEID {}
private

Definition at line 232 of file LArLATOMEDecoder.h.

232{};

◆ m_hasRawAdc

bool LArLATOMEDecoder::EventProcess::m_hasRawAdc {}
private

Definition at line 229 of file LArLATOMEDecoder.h.

229{};

◆ m_header_coll

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

Definition at line 243 of file LArLATOMEDecoder.h.

243{};

◆ m_headerDecoded

bool LArLATOMEDecoder::EventProcess::m_headerDecoded {}
private

Definition at line 216 of file LArLATOMEDecoder.h.

216{};

◆ 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 194 of file LArLATOMEDecoder.h.

194{};

◆ m_isAutoCorr

bool LArLATOMEDecoder::EventProcess::m_isAutoCorr {}
private

Definition at line 234 of file LArLATOMEDecoder.h.

234{};

◆ m_isAveraged

bool LArLATOMEDecoder::EventProcess::m_isAveraged {}
private

Definition at line 233 of file LArLATOMEDecoder.h.

233{};

◆ m_l1ID

Word LArLATOMEDecoder::EventProcess::m_l1ID {}
private

Definition at line 190 of file LArLATOMEDecoder.h.

190{};

◆ m_latomeBCID

Word LArLATOMEDecoder::EventProcess::m_latomeBCID {}
private

Definition at line 187 of file LArLATOMEDecoder.h.

187{};

◆ m_latomeCalibPatternsInEvent

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

Definition at line 251 of file LArLATOMEDecoder.h.

◆ m_LATOMEFW

Word LArLATOMEDecoder::EventProcess::m_LATOMEFW {}
private

Definition at line 192 of file LArLATOMEDecoder.h.

192{};

◆ m_latomeID

Word LArLATOMEDecoder::EventProcess::m_latomeID {}
private

Definition at line 189 of file LArLATOMEDecoder.h.

189{};

◆ 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 196 of file LArLATOMEDecoder.h.

196{};

◆ m_monTrailerSize

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

some cached info to ease processing reading from data header

Definition at line 181 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 219 of file LArLATOMEDecoder.h.

219{};

◆ m_nBC_Averaged

short LArLATOMEDecoder::EventProcess::m_nBC_Averaged {}
private

Definition at line 222 of file LArLATOMEDecoder.h.

222{};

◆ m_nBC_E

short LArLATOMEDecoder::EventProcess::m_nBC_E {}
private

Definition at line 220 of file LArLATOMEDecoder.h.

220{};

◆ m_nBC_EID

short LArLATOMEDecoder::EventProcess::m_nBC_EID {}
private

Definition at line 221 of file LArLATOMEDecoder.h.

221{};

◆ m_nBC_rawADC

short LArLATOMEDecoder::EventProcess::m_nBC_rawADC {}
private

Definition at line 218 of file LArLATOMEDecoder.h.

218{};

◆ 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 193 of file LArLATOMEDecoder.h.

193{};

◆ m_nsc1

Word LArLATOMEDecoder::EventProcess::m_nsc1 {}
private

Definition at line 210 of file LArLATOMEDecoder.h.

210{};

◆ m_nsc2

Word LArLATOMEDecoder::EventProcess::m_nsc2 {}
private

Definition at line 211 of file LArLATOMEDecoder.h.

211{};

◆ m_nsc3

Word LArLATOMEDecoder::EventProcess::m_nsc3 {}
private

Definition at line 212 of file LArLATOMEDecoder.h.

212{};

◆ m_nsc4

Word LArLATOMEDecoder::EventProcess::m_nsc4 {}
private

Definition at line 213 of file LArLATOMEDecoder.h.

213{};

◆ m_nsc5

Word LArLATOMEDecoder::EventProcess::m_nsc5 {}
private

Definition at line 214 of file LArLATOMEDecoder.h.

214{};

◆ m_nsc6

Word LArLATOMEDecoder::EventProcess::m_nsc6 {}
private

Definition at line 215 of file LArLATOMEDecoder.h.

215{};

◆ m_nStreams

Word LArLATOMEDecoder::EventProcess::m_nStreams {}
private

Definition at line 198 of file LArLATOMEDecoder.h.

198{};

◆ m_nthLATOME

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

Definition at line 246 of file LArLATOMEDecoder.h.

◆ m_nWordsPerPacket

Word LArLATOMEDecoder::EventProcess::m_nWordsPerPacket {}
private

Definition at line 195 of file LArLATOMEDecoder.h.

195{};

◆ m_packetEnd

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

Definition at line 184 of file LArLATOMEDecoder.h.

◆ m_rawValuesInEvent

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

Definition at line 249 of file LArLATOMEDecoder.h.

◆ m_region

Word LArLATOMEDecoder::EventProcess::m_region {}
private

Definition at line 197 of file LArLATOMEDecoder.h.

197{};

◆ m_ROBFragSize

Word LArLATOMEDecoder::EventProcess::m_ROBFragSize {}
private

Definition at line 191 of file LArLATOMEDecoder.h.

191{};

◆ m_streamNumber

Word LArLATOMEDecoder::EventProcess::m_streamNumber {}
private

Definition at line 199 of file LArLATOMEDecoder.h.

199{};

◆ s_monCheckPoint

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

Definition at line 183 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 182 of file LArLATOMEDecoder.h.


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