ATLAS Offline Software
LArLATOMEDecoder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #define DETAIL_DUMP_ON false
6 #define ADC_DUMP_ON false
7 #define VALIDATE_DUMP_ON false
8 
9 #include <byteswap.h>
12 #include "LArByteStream/Mon.h"
13 #include "GaudiKernel/MsgStream.h"
17 
18 static const InterfaceID IID_ILArLATOMEDecoder("LArLATOMEDecoder", 1, 0);
19 
20 using namespace OFFLINE_FRAGMENTS_NAMESPACE;
21 
22 LArLATOMEDecoder::LArLATOMEDecoder(const std::string& type, const std::string& name, const IInterface* parent)
24  m_sc2ccMappingTool("CaloSuperCellIDTool")
25 {
26  declareInterface<LArLATOMEDecoder>(this);
27 }
28 
29 const InterfaceID& LArLATOMEDecoder::interfaceID()
30 {return IID_ILArLATOMEDecoder;}
31 
33 
34  ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnline_SuperCellID"));
35 
36  ATH_CHECK( m_sc2ccMappingTool.retrieve() );
38 
39  return StatusCode::SUCCESS;
40 }
41 
43  const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap,
46  LArLATOMEHeaderContainer* header_coll) const{
47 
48  bool ret = false;
49  // Check fragment validity:
50  try {ret = re->check();}
51  catch (eformat::Issue& ex) {
52  ATH_MSG_WARNING( "Exception while checking eformat fragment validity: " << ex.what() );
53  ret = false;
54  }
55  if (!ret) {
56  ATH_MSG_ERROR( "Got invalid RawEvent fragment" );
57  return StatusCode::FAILURE;
58  }
59  //Build TOC
60  std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> > robIndex;
61  eformat::helper::build_toc(*re, robIndex );
62  for (auto mapit : robIndex) ATH_MSG_DEBUG( "Rob Index subdetgroup is " << std::hex << mapit.first );
63  std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> >::const_iterator robIt = robIndex.find(eformat::LAR);
64  if (robIt!=robIndex.end()) {
65  const std::vector<const uint32_t*>& robs = robIt->second;
66  for (const uint32_t* pRob :robs) {
67  try {
68  ROBFragment robFrag(pRob);
70  uint32_t latomeSourceID = robFrag.rod_source_id();
71  if( !(latomeSourceID & 0x1000) ){
72  ATH_MSG_DEBUG( " discarding non latome source ID " << std::hex << latomeSourceID );
73  continue;
74  }
75  ATH_MSG_DEBUG(" found latome source ID " << std::hex << latomeSourceID);
76  }
77  EventProcess ev(this, 0, 0, 0, 0, accdigits, caccdigits, header_coll);
78  ev.fillCollection(&robFrag, map, onoffmap, clmap);
79  }
80  catch (eformat::Issue& ex) {
81  ATH_MSG_WARNING ( " exception thrown by ROBFragment, badly corrupted event. Abort decoding " );
82  if(accdigits)accdigits->clear();
83  if(caccdigits)caccdigits->clear();
84  if(header_coll)header_coll->clear();
85  break;
86  }
87  }//end loop over robs
88  }//end if got LAr-RODs
89 
90  return StatusCode::SUCCESS;
91 
92 }
93 
94 StatusCode LArLATOMEDecoder::convert(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags, const LArLATOMEMapping *map,
95  LArDigitContainer* adc_coll,
96  LArDigitContainer* adc_bas_coll,
97  LArRawSCContainer* et_coll,
98  LArRawSCContainer* et_id_coll,
99  LArLATOMEHeaderContainer* header_coll) const {
100 
101  // Check fragment validity:
102  //Build TOC
103  if (robFrags.size() > 0) {
104  for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* pRob :robFrags) {
105  try {
106  if(m_protectSourceId){
107  uint32_t latomeSourceID = pRob->rod_source_id();
108  if( !(latomeSourceID & 0x1000) ){
109  ATH_MSG_DEBUG( " discarding non latome source ID " << std::hex << latomeSourceID );
110  continue;
111  }
112  ATH_MSG_DEBUG(" found latome source ID " << std::hex << latomeSourceID);
113  }
114  EventProcess ev(this, adc_coll, adc_bas_coll, et_coll, et_id_coll, 0, 0, header_coll);
115  ev.fillCollection(pRob, map, nullptr, nullptr);
116  }
117  catch (eformat::Issue& ex) {
118  ATH_MSG_WARNING ( " exception thrown by ROBFragment, badly corrupted event. Abort decoding " );
119  if(adc_coll)adc_coll->clear();
120  if(adc_bas_coll)adc_bas_coll->clear();
121  if(et_coll)et_coll->clear();
122  if(et_id_coll)et_id_coll->clear();
123  if(header_coll)header_coll->clear();
124  break;
125  }
126  }//end loop over robs
127  }//end if got LAr-RODs
128  return StatusCode::SUCCESS;
129 }
130 
132  LArDigitContainer* adc_coll,
133  LArDigitContainer* adc_bas_coll,
134  LArRawSCContainer* et_coll,
135  LArRawSCContainer* et_id_coll,
136  LArAccumulatedDigitContainer* accdigits,
138  LArLATOMEHeaderContainer* header_coll)
139  : AthMessaging(Gaudi::svcLocator()->service< IMessageSvc >( "MessageSvc" ), "LArLATOMEDecoder::EventProcess"),
140  m_decoder(decoderInput),
141  m_adc_coll(adc_coll),
142  m_adc_bas_coll(adc_bas_coll),
143  m_et_coll(et_coll),
144  m_et_id_coll(et_id_coll),
145  m_accdigits(accdigits),
146  m_caccdigits(caccdigits),
147  m_header_coll(header_coll)
148 {
149  m_latomeID=0;
150  m_l1ID=0;
151  m_ROBFragSize=0;
152  m_nPackets=0;
153  m_iPacket=0;
155  m_monHeaderSize=0;
156  m_region=0;
157  m_nStreams=0;
158  m_streamNumber=0;
163  m_at0nBC=0;
164  m_at1nBC=0;
165  m_at0BC=0;
166  m_at1BC=0;
167  m_activeSC=0;
168  m_nsc1=0;
169  m_nsc2=0;
170  m_nsc3=0;
171  m_nsc4=0;
172  m_nsc5=0;
173  m_nsc6=0;
174  m_headerDecoded=false;
175 
176  m_nBC_rawADC=0;
177  m_nBC_ADC=0;
178  m_nBC_E=0;
179  m_nBC_EID=0;
180 
181  m_nBC_Averaged=0;
182 
183  m_BC_rawADC=0;
184  m_BC_ADC=0;
185  m_BC_E=0;
186  m_BC_EID=0;
187 
188  m_hasRawAdc=false;
189  m_hasAdc=false;
190  m_hasE=false;
191  m_hasEID=false;
192 
194  m_isAutoCorr = (m_accdigits!=0);
195 
196  if(!m_isAveraged && !m_isAutoCorr){
198  }
199  else{
202  }
203 }
204 
206  if(!compare){
207  param=value;
208  return true;
209  }
210  return param==value;
211 }
212 
215  if(bswap_32(p[offset])!=0xc0ffee00 || bswap_32(p[offset+1]!=0xaaaaaaaa)){
216  ATH_MSG_WARNING( "Problem in trailer at packet " << m_iPacket
217  << " words " << std::hex << bswap_32(p[offset]) << ", "
218  << bswap_32(p[offset+1]) << std::dec );
219  }
221  return offset+m_monTrailerSize;
222 }
223 
224 unsigned int LArLATOMEDecoder::EventProcess::decodeHeader(const uint32_t* p, unsigned int offset) {
225 
227  int monheadererror=0;
228  int monheadererrorbit=0;
229  if(!compareOrSet(m_latomeID, bswap_32(p[0+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
230  Word l1IDtmp=m_l1ID;
231  if(!compareOrSet(l1IDtmp, bswap_32(p[1+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
232  if(l1IDtmp != m_l1ID){
233  ATH_MSG_DEBUG( "Mon header L1ID " << l1IDtmp << " different from rod header L1ID " << m_l1ID );
234  }
235  ATH_MSG_DEBUG( " latomeID: " << m_latomeID << " l1ID: " << m_l1ID );
236 
237  Word monHeaderMarker=bswap_32(p[2+offset]);
238  Word monCheckPoint = bswap_32(p[4+offset]);
239  if(s_monHeaderMarker!=monHeaderMarker){
240  monheadererror |= (1<<monheadererrorbit++);
241  ATH_MSG_WARNING( "Problem in monHeaderMarker: " << monHeaderMarker );
242  }
243  if(s_monCheckPoint!=monCheckPoint){
244  monheadererror |= (1<<monheadererrorbit++);
245  ATH_MSG_WARNING( "Problem in monCheckPoint: " <<monCheckPoint );
246  }
247 
248  if(!compareOrSet(m_nPackets, bswap_32(p[3+offset])>>24, m_headerDecoded )) 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  }
255  else{
256  if(m_headerDecoded)++m_iPacket;
257  else m_iPacket=0;
258  if(!compareOrSet(m_iPacket, (bswap_32(p[3+offset])>>16)&0xf, m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
259  m_nWordsPerPacket = (bswap_32(p[3+offset])&0xffff)/4.;
260  }
261 
262  if(!compareOrSet(m_monHeaderSize, bswap_32(p[5+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
263 
266  if(m_monHeaderSize<18){
267  ATH_MSG_ERROR( " Mon header size should not be less that 18 : =" << m_monHeaderSize << " are you reading old data file?" );
268  return 0;
269  }
270 
271  ATH_MSG_DEBUG( " nPackets: " << m_nPackets << " iPacket: " << m_iPacket
272  << " nWordsPerPacket: " << m_nWordsPerPacket << " monHeaderSize: " << m_monHeaderSize
273  );
274 
276  if(!compareOrSet(m_at0typeRec, bswap_32(p[9+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
277  if(!compareOrSet(m_at1typeRec, bswap_32(p[12+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
278  monheadererrorbit+=2;
279 
280  if(!compareOrSet(m_at0nBC, bswap_32(p[10+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
281  if(!compareOrSet(m_at1nBC, bswap_32(p[13+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
282  if(!compareOrSet(m_at0BC, bswap_32(p[11+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
283  if(!compareOrSet(m_at1BC, bswap_32(p[14+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
284  if(!compareOrSet(m_activeSC, bswap_32(p[15+offset]), m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
285  if(!compareOrSet(m_nsc1, bswap_32(p[16])>>24, m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
286  if(!compareOrSet(m_nsc2, (bswap_32(p[16])>>16)&0xff, m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
287  if(!compareOrSet( m_nsc3, (bswap_32(p[16])>>8)&0xff, m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
288  if(!compareOrSet(m_nsc4, (bswap_32(p[16]))&0xff, m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
289  if(!compareOrSet(m_nsc5, bswap_32(p[17])>>24, m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
290  if(!compareOrSet(m_nsc6, (bswap_32(p[17])>>16)&0xff, m_headerDecoded)) monheadererror |= (1<<monheadererrorbit++);
291 
292  ATH_MSG_DEBUG( " at0type " <<m_at0typeRec
293  << " at1type " <<m_at1typeRec
294  << " at0nBC " <<m_at0nBC
295  << " at1nBC " <<m_at1nBC
296  << " at0BC " <<m_at0BC
297  << " at1BC " <<m_at1BC
298  << " nsc1 " <<m_nsc1
299  << " nsc2 " <<m_nsc2
300  << " nsc3 " <<m_nsc3
301  << " nsc4 " <<m_nsc4
302  << " nsc5 " <<m_nsc5
303  << " nsc6 " <<m_nsc6
304  );
305 
306 
307  if(monheadererror){
308  ATH_MSG_WARNING( " consistency error in mon checker at packet " << m_iPacket << " errorbits " << std::hex<< monheadererror << std::dec );
309  }
310 
311  m_headerDecoded=true;
312  return m_monHeaderSize+m_nWordsPerPacket+offset;
313 
314 }
315 
317 
318  if( energy & (1<<17) )return energy-pow(2,18); else return energy;
319 }
320 
321 
323  unsigned int b=0;
324  if(at0 == MonDataType::Averaged || at0 == MonDataType::AutoCorr) return 8;
325 
327  if(at0!= MonDataType::Invalid) b+=2;
328  if(at1!= MonDataType::Invalid) b+=2;
329  if(at0 == MonDataType::Energy || at1 == MonDataType::Energy ||
331  return b;
332 }
333 
335  ++wordshift;
336  if(m_packetEnd[m_iPacket] == wordshift){
337  ++m_iPacket;
338  wordshift+=(m_monHeaderSize+m_monTrailerSize);
339  ATH_MSG_DEBUG( "switch packet " << m_iPacket << " " << wordshift );
340  }
341 
342 }
343 
344 
345 void LArLATOMEDecoder::EventProcess::increaseByteShift(unsigned int& wordshift, unsigned int& byteshift){
346  ++byteshift;
347  if(byteshift==4){
348  increaseWordShift(wordshift);
349  byteshift=0;
350  }
351 }
352 
353 void LArLATOMEDecoder::EventProcess::decodeByte(unsigned int& byte, unsigned int wordshift, unsigned int byteshift, const uint32_t* p){
354  byte = ((bswap_32(p[wordshift]))>>(8*(4-1-byteshift)))&0xff;
355 }
356 
357 void LArLATOMEDecoder::EventProcess::decodeWord(unsigned int& word, unsigned int& wordshift, unsigned int& byteshift, const uint32_t* p){
358  unsigned int msb=0;
359  unsigned int lsb=0;
360  decodeByte(msb, wordshift, byteshift, p);
361  increaseByteShift(wordshift, byteshift);
362  decodeByte(lsb, wordshift, byteshift, p);
363  increaseByteShift(wordshift, byteshift);
364  word = lsb | (msb<<8);
365 }
366 
367 void LArLATOMEDecoder::EventProcess::decodeChannel(unsigned int& wordshift, unsigned int& byteshift, const uint32_t* p,
368  MonDataType at0, MonDataType at1,
369  unsigned int& at0Data, unsigned int& at1Data, unsigned int& saturation,
370  bool& at0val, bool& at1val){
371 
372  // the structure of data is always consisting of 2,3,4 or 5 bytes depending on the recipe.
373  // 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.
374  // 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 flexible.
375  // use unsigned int everywhere for now since we have 18 bits for energy which does not fit in short, cast later.
376  unsigned int nbytesPerChannel = bytesPerChannel(at0, at1);
377  bool satByte = nbytesPerChannel%2; // do we have satbyte
378 
379  at0val=false;
380  at1val=false;
381  at0Data=0;
382  at1Data=0;
383  unsigned int satData=0;
384  saturation = 0;
385 
386  unsigned int word1=0;
387  unsigned int word2=0;
388  decodeWord(word1, wordshift, byteshift, p);
389  if(nbytesPerChannel>3){
390  decodeWord(word2, wordshift, byteshift, p);
391  }
392  at0Data = word1 & 0x7fff;
393  at0val = word1 & 0x8000;
394  if(nbytesPerChannel>3){
395  at1Data = word2 & 0x7fff;
396  at1val = word2 & 0x8000;
397  }
398  if(satByte){
399  decodeByte(satData, wordshift, byteshift, p);
400  increaseByteShift(wordshift, byteshift);
401  }
402 
406 
408  at0Data = (at0Data<<3) | (satData&0x7);
409  at1Data = (at1Data<<3) | ((satData&0x70)>>4);
410  saturation = ((satData & 0x88) == 0x88);
411  }
412  else if(at1 == MonDataType::Energy && at0 == MonDataType::SelectedEnergy){
413  at0Data = (at0Data<<3) | ((satData&0x70)>>4);
414  at1Data = (at1Data<<3) | (satData&0x7);
415  saturation = ((satData & 0x88) == 0x88);
416  }
417  else{
419  at0Data = (at0Data<<3) | (satData&0x7);
420  saturation = (satData & 0x20);
421  }
423  at1Data = (at1Data<<3) | (satData&0x7);
424  saturation = (satData & 0x20);
425  }
426  }
427 
428 }
429 
430 
431 
433  const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap) {
434  //Mon* mon = new Mon;
435 
437  // const unsigned int rod_Size_words = robFrag->rod_ndata();
438  // const unsigned int rob_Size_words = robFrag->payload_size_word();
439  const unsigned int sourceID = robFrag->rob_source_id();
440  // const unsigned int rod_fragment_size_word = robFrag->rod_fragment_size_word();
441  // const unsigned int rod_header_size_word = robFrag->rod_header_size_word();
442  // const unsigned int rod_trailer_size_word = robFrag->rod_trailer_size_word();
443  // const unsigned int rod_bc_id = robFrag->rod_bc_id();
444  // const unsigned int rod_nstatus = robFrag->rod_nstatus();
445  // const unsigned int rod_status_position = robFrag->rod_status_position();
446  // const uint32_t* rod_start = robFrag->rod_start();
447  m_l1ID = robFrag->rod_lvl1_id();
448  m_ROBFragSize = robFrag->rod_ndata();
449  const uint32_t* p = robFrag->rod_data();
450  const unsigned int n = robFrag->rod_ndata();
451  if(0==n){
453  ATH_MSG_DEBUG( "Empty fragment, skip ");
454  return;
455  }
456  m_latomeBCID = robFrag->rod_bc_id();
457  const uint32_t *rod_status = robFrag->rod_status();
458  const unsigned int rod_nstatus = robFrag->rod_nstatus();
459  if(rod_nstatus != 27){
460  ATH_MSG_WARNING( "Inconsistent number of rod header status elements: nstatus= " << rod_nstatus );
461  return;
462  }
463  if(rod_nstatus>8){
464  uint32_t status8 = rod_status[8];
465  m_at0type = status8 & 0x3;
466  m_at1type = (status8>>2) & 0x3;
467  }
468  m_nthLATOME = robFrag->rod_source_id();
469 
470  LatomeCalibPatterns pat1, pat2, pat3;
471  pat1.DAC=rod_status[9];
472  pat1.delay=rod_status[10];
473  pat1.patterns.resize(4);
474  for(unsigned int i=0; i<4; ++i)pat1.patterns[i]=rod_status[i+11];
475 
476  pat2.DAC=rod_status[15];
477  pat2.delay=rod_status[16];
478  pat2.patterns.resize(4);
479  for(unsigned int i=0; i<4; ++i)pat2.patterns[i]=rod_status[i+17];
480 
481  pat3.DAC=rod_status[21];
482  pat3.delay=rod_status[22];
483  pat3.patterns.resize(4);
484  for(unsigned int i=0; i<4; ++i)pat3.patterns[i]=rod_status[i+23];
485 
486  m_latomeCalibPatternsInEvent = {pat1, pat2, pat3};
487 
488  const HWIdentifier hwidEmpty;
489 
491 
492  unsigned int offset = decodeHeader(p,0);
493 
494  if(m_isAveraged){
495  m_at0type=m_at0typeRec>>24;
496  m_at1type=(int)MonDataType::Invalid;
497  if(m_at0type!=(int)MonDataType::Averaged){
498  ATH_MSG_WARNING( " inconsistant data type with requested averaged decoding at0 type "<< m_at0type << " " << m_at0typeRec << " "
499  << std::hex << m_l1ID << " "<<sourceID << std::dec );
500  return;
501  }
502  }
503  if(m_isAutoCorr){
504  m_at0type=m_at0typeRec>>24;
505  m_at1type=(int)MonDataType::Invalid;
506  if(m_at0type!=(int)MonDataType::AutoCorr){
507  ATH_MSG_WARNING( " inconsistant data type with requested averaged decoding at0 type "<< m_at0type << " " << m_at0typeRec << " "
508  << std::hex << m_l1ID << " "<<sourceID << std::dec );
509  return;
510  }
511  }
512 
513  m_packetEnd.push_back(offset);
514  offset=decodeTrailer(p, offset);
517  for(unsigned int ip=1; ip<m_nPackets; ++ip){
518  offset = decodeHeader(p,offset);
519  m_packetEnd.push_back(offset);
520  offset=decodeTrailer(p, offset);
521  }
522 
523 
524  ATH_MSG_DEBUG( " end of header check computed offset=" << std::dec
525  << offset << " nwords in payload=" << n );
526 
528  m_iPacket=0;
529  if(m_packetEnd[m_nPackets-1]+m_monTrailerSize != n){
530  ATH_MSG_WARNING( "problem in packet size loop "
531  << m_packetEnd[m_nPackets-1] << " != " << n );
532  }
533 
534 
535  std::vector<unsigned int> timeslot_nsc = {m_nsc1, m_nsc2, m_nsc3, m_nsc4, m_nsc5, m_nsc6};
536  std::vector<unsigned int> bc_size;
539 
540  short nBC=0;
541  short nBC1=0;
542  short startBC1=0;
545 
546  if(m_isAveraged || m_isAutoCorr){
547  nBC=m_at0nBC;
548  nBC1=m_at1nBC;
549  m_nBC_Averaged=nBC;
550  startBC1=0;
551  type0=static_cast<MonDataType>(m_at0type);
552  type1=static_cast<MonDataType>(m_at1type);
553  for(auto &val: m_averagedRawValuesInEvent){
554  val.sum.resize(m_nBC_Averaged);
555  val.sumSq.resize(m_nBC_Averaged);
556  val.nTrigValid.resize(m_nBC_Averaged);
557  val.latomeChannel = 99999;
558  }
559  }
560  else{
561  if(m_at1nBC==0){
562  m_at1type=(Word)MonDataType::Invalid;
563  }
564 
565  if(m_at0type!=(Word)MonDataType::Invalid && m_at1type!=(Word)MonDataType::Invalid){
566  if(m_at0nBC>=m_at1nBC){
567  nBC=m_at0nBC;
568  nBC1=m_at1nBC;
569  startBC1=m_at1BC-m_at0BC;
570  type0=static_cast<MonDataType>(m_at0type);
571  type1=static_cast<MonDataType>(m_at1type);
572  }
573  else{
574  nBC1=m_at0nBC;
575  nBC=m_at1nBC;
576  startBC1=m_at0BC-m_at1BC;
577  type1=static_cast<MonDataType>(m_at0type);
578  type0=static_cast<MonDataType>(m_at1type);
579  }
580  }
581  else if(m_at0type!=(Word)MonDataType::Invalid){
582  nBC=m_at0nBC;
583  type0=static_cast<MonDataType>(m_at0type);
584  }
585  else if(m_at1type!=(Word)MonDataType::Invalid){
586  nBC=m_at1nBC;
587  type0=static_cast<MonDataType>(m_at1type);
588  }
589  else{
590  ATH_MSG_ERROR( "No valid data type in Mon Header");
591  return;
592  }
593 
594  switch(type0){
595  case MonDataType::RawADC:
596  m_hasRawAdc=true;
597  m_nBC_rawADC=nBC;
598  break;
599  case MonDataType::ADC:
600  m_hasAdc=true;
601  m_nBC_ADC=nBC;
602  break;
603  case MonDataType::Energy:
604  m_hasE=true;
605  m_nBC_E=nBC;
606  break;
608  m_hasEID=true;
609  m_nBC_EID=nBC;
610  break;
612  break;
613  default:
614  ATH_MSG_ERROR( "wrong mux0 value " <<(Word)type0 );
615  return;
616  }
617 
618  switch(type1){
619  case MonDataType::RawADC:
620  m_hasRawAdc=true;
621  m_nBC_rawADC=nBC1;
622  m_BC_rawADC=startBC1;
623  break;
624  case MonDataType::ADC:
625  m_hasAdc=true;
626  m_nBC_ADC=nBC1;
627  m_BC_ADC=startBC1;
628  break;
629  case MonDataType::Energy:
630  m_hasE=true;
631  m_nBC_E=nBC1;
632  m_BC_E=startBC1;
633  break;
635  m_hasEID=true;
636  m_nBC_EID=nBC1;
637  m_BC_EID=startBC1;
638  break;
640  break;
641  default:
642  ATH_MSG_ERROR( "wrong mux1 value " <<(Word)type1 );
643  return;
644  }
645 
646  for(auto &val: m_rawValuesInEvent){
647  if(m_hasRawAdc)val.adc.resize(m_nBC_rawADC);
648  if(m_hasAdc)val.adc_bas.resize(m_nBC_ADC);
649  if(m_hasE)val.et.resize(m_nBC_E);
650  if(m_hasEID)val.et_id.resize(m_nBC_EID);
651  if(m_hasEID||m_hasE){
652  val.saturation.resize(std::max(m_nBC_EID,m_nBC_E));
653  }
654 
655  val.latomeChannel = 99999;
656  }
657  }
658 
659  m_BCIDsInEvent.resize(nBC);
660 
661  unsigned int s = m_monHeaderSize;
662  unsigned int bcid=s_nBunches;
663 
664  for(short iBC=0;iBC<nBC; ++iBC){
665  MonDataType at0=type0;
666  MonDataType at1=type1;
667  if(type1 != MonDataType::Invalid){
668  if(iBC<startBC1 || iBC>=startBC1+nBC1)at1=MonDataType::Invalid;
669  }
670  unsigned int nbytesPerChannel = bytesPerChannel(at0,at1);
671 
672  int nsc=0;
673  unsigned int oldipacket=0;
674  for(unsigned int itimeslot=0; itimeslot<6; ++itimeslot){
675 
676  unsigned int l_bcid = (bswap_32(p[s]))>>16;
677  if(itimeslot!=0){
678  if(l_bcid!=bcid){
679  ATH_MSG_WARNING( "ERROR: inconsistent BCID between time slots" );
680  }
681  }
682  else{
683  if(bcid!=s_nBunches){
684  unsigned int bcid_c = bcid+1;
686  if(bcid_c==s_nBunches){
687  bcid=0;
688  bcid_c = 0;
689  }
690  if(bcid_c != l_bcid){
691  ATH_MSG_WARNING( "ERROR: BCID not increasing properly between samples, L1ID is: " << m_l1ID << ", BCID is from payload: " << l_bcid << ", expected BCID is: " << bcid_c << ", LATOME channel is: " << nsc );
692  }
693  }
694  m_BCIDsInEvent[iBC] = l_bcid;
695  }
696  bcid=l_bcid;
697 
698  unsigned int mux = ((bswap_32(p[s]))>>8)&0xff;
699  increaseWordShift(s);
701  increaseWordShift(s);
702  if(s>=n) break;
703 
704 
705  unsigned int timeslotsize = timeslot_nsc[itimeslot];
706  unsigned int nbytes = timeslotsize*nbytesPerChannel;
707  unsigned int n64word= nbytes/8;
708  if(nbytes%8) ++n64word;
709  ATH_MSG_DEBUG( " at BC " << iBC<< " timeslot " <<itimeslot
710  << " " << bcid << " " << mux << " n64word " <<n64word
711  << " at0 " << (int)at0 << " at1 " << (int)at1 << " l_bcid " <<bcid );
712 
713  unsigned int wordshift=s;
714  unsigned int byteshift=0;
715 
717  oldipacket=m_iPacket;
718  for( unsigned int ichan=0; ichan<timeslotsize; ++ichan){
719  unsigned int at0Data=0, at1Data=0, satData=0;
720  bool at0val=false, at1val=false;
721 
722  if(!m_isAveraged && !m_isAutoCorr){
723  decodeChannel(wordshift, byteshift, p, at0, at1,
724  at0Data, at1Data, satData, at0val, at1val);
725  ATH_MSG_DEBUG( " wordshift " << wordshift << " byteshift " <<byteshift
726  << " at0data " << at0Data << " at1Data " << at1Data << " satData "
727  << satData << " at0val " << at0val << " at1val " << at1val
728  << " nsc " << nsc );
729 
731  const auto SCID = map ? map->getChannelID(m_nthLATOME, nsc):hwidEmpty;
732  if (SCID == hwidEmpty) {
733  ATH_MSG_DEBUG( "No mapping for ch: " << std::dec << nsc );
734  }
735  int RAWValue0 = -999;
736  if (!at0val && SCID != hwidEmpty && at0!=MonDataType::Invalid) {
737  ATH_MSG_DEBUG( "at0 bad quality bit for SC:" << nsc << " BC " << iBC
738  << " latome " << robFrag->rod_source_id() );
739  } else{
741  RAWValue0 = at0Data;
742  }
743  int defaultADCValue=-1;
744  int defaultEValue=-99999;
745  switch(at0){
746  case MonDataType::RawADC:
747  m_rawValuesInEvent[nsc].adc[iBC] = (at0val)?RAWValue0:defaultADCValue;
748  break;
749  case MonDataType::ADC:
750  m_rawValuesInEvent[nsc].adc_bas[iBC] = (at0val)?RAWValue0:defaultADCValue;
751  break;
752  case MonDataType::Energy:
753  m_rawValuesInEvent[nsc].et[iBC] = (at0val)?signEnergy(RAWValue0):defaultEValue;
754  m_rawValuesInEvent[nsc].saturation[iBC] = satData;
755  break;
757  m_rawValuesInEvent[nsc].et_id[iBC] = (at0val)?signEnergy(RAWValue0):defaultEValue;
758  m_rawValuesInEvent[nsc].saturation[iBC] = satData;
759  break;
761  break;
762  default:
763  ATH_MSG_ERROR( "wrong at0 value " <<(Word)at0 );
764  return;
765  }
766 
767  int RAWValue1 = -999;
768  if (!at1val && SCID != hwidEmpty && at1!=MonDataType::Invalid) {
769  ATH_MSG_DEBUG( "at1 bad quality bit for SC:" << nsc << " BC " << iBC
770  << " latome " << robFrag->rod_source_id() );
771  }else{
773  RAWValue1 = at1Data;
774  }
775  switch(at1){
776  case MonDataType::RawADC:
777  m_rawValuesInEvent[nsc].adc[iBC-startBC1] = (at1val)?RAWValue1:defaultADCValue;
778  break;
779  case MonDataType::ADC:
780  m_rawValuesInEvent[nsc].adc_bas[iBC-startBC1] = (at1val)?RAWValue1:defaultADCValue;
781  break;
782  case MonDataType::Energy:
783  m_rawValuesInEvent[nsc].et[iBC-startBC1] = (at1val)?signEnergy(RAWValue1):defaultEValue;
784  m_rawValuesInEvent[nsc].saturation[iBC-startBC1] = satData;
785  break;
787  m_rawValuesInEvent[nsc].et_id[iBC-startBC1] = (at1val)?signEnergy(RAWValue1):defaultEValue;
788  m_rawValuesInEvent[nsc].saturation[iBC-startBC1] = satData;
789  break;
791  break;
792  default:
793  ATH_MSG_ERROR( "wrong at1 value " <<(Word)at1 );
794  return;
795  }
796 
797  m_rawValuesInEvent[nsc].latomeChannel=nsc;
798 
799  } else{
800  if(wordshift%2){
801  ATH_MSG_ERROR( "inconsistant wordshift in decoding everaged data" );
802  return;
803  }
804  unsigned int averageword=bswap_32(p[wordshift]); wordshift+=1;
805  unsigned int sumSq=bswap_32(p[wordshift]); wordshift+=1;
806  unsigned long long sumsqMSB = averageword>>28;
807  sumsqMSB=sumsqMSB<<32;
808 
809  m_averagedRawValuesInEvent[nsc].sum[iBC]=averageword&0xFFFFF;
810  m_averagedRawValuesInEvent[nsc].sumSq[iBC]= sumSq | sumsqMSB;
811  m_averagedRawValuesInEvent[nsc].nTrigValid[iBC]= (averageword>>20) & 0xFF;
812  m_averagedRawValuesInEvent[nsc].latomeChannel=nsc;
813 
814  }
815 
816  ++nsc;
817 
818  }
819 
821  if((wordshift-s)%2) increaseWordShift(wordshift);
822  if( (wordshift-s-((m_iPacket-oldipacket)*(m_monHeaderSize+m_monTrailerSize))) != n64word*2){
823  ATH_MSG_WARNING( " ERROR: time slice end is not padded properly " << (wordshift-s-m_iPacket*(m_monHeaderSize+m_monTrailerSize)) << "!=" << n64word*2 << " m_ipacket " << m_iPacket );
824  }
825  s=wordshift;
826  oldipacket=m_iPacket;
827  }
828 
829 
830  }
831 
832 
833  if(!m_isAveraged && !m_isAutoCorr){
834  fillRaw(map);
835  } else{
836  if(onoffmap && clmap) {
837  fillCalib(map,onoffmap,clmap);
838  } else {
839  ATH_MSG_ERROR("Do not have mapping !!!");
840  }
841  }
842  fillHeader();
843 }
844 
846  const LArOnOffIdMapping* cablingLeg, const LArCalibLineMapping *clcabling) {
847 
849  uint32_t DAC_value=0;
850  uint16_t delay_value=0;
851  uint16_t isPulsed_value=false;
852  std::unique_ptr<LArCalibParams> calibParams1;
853  std::unique_ptr<LArCalibParams> calibParams2;
854 
855  int pattype=m_nthLATOME>>16;
856  const LArOnOffIdMapping* cabling =0;
857  if(m_caccdigits){
858  m_caccdigits->setDelayScale(25./240.);
859 
861  cabling = {*cablingHdl};
862  if(!cabling) {
863  ATH_MSG_ERROR( "Do not have mapping object " << m_decoder->m_cablingKeySC.key());
864  return;
865  }
866 
867  calibParams1=std::make_unique<LArCalibParams>();
868  calibParams2=std::make_unique<LArCalibParams>();
869 
870  if (pattype > 0x48) {
871  StatusCode sc1 = calibParams1->initialize();
872  StatusCode sc2 = calibParams2->initialize();
873  if (sc1 != StatusCode::SUCCESS || sc2 != StatusCode::SUCCESS) {
874  ATH_MSG_WARNING("could not initialize LArCalibParams, acc calib will not be filled ");
875  return;
876  }
877  if (pattype == 0x49 || pattype == 0x4a) {
878 
880 
882  } else {
883 
885 
887  }
888  } else {
889  StatusCode sc1 = calibParams1->initialize();
890  if (sc1 != StatusCode::SUCCESS) {
891  ATH_MSG_WARNING("could not initialize LArCalibParams, acc calib will not be filled ");
892  return;
893  }
895  }
896  }
897 
898  const HWIdentifier hwidEmpty;
899  for (SuperCell ch = 0; ch < N_LATOME_CHANNELS; ++ch) {
900  LArCalibParams* calibParams=0;
901  auto SCID = map ? map->getChannelID(m_nthLATOME, ch):hwidEmpty;
902  if (SCID == hwidEmpty) {
903  ATH_MSG_DEBUG( "No mapping for ch: " << std::dec << ch );
904  continue;
905  }
906  if( m_decoder->m_ignoreBarrelChannels && m_decoder->m_onlineId->barrel_ec(SCID)==0) continue;
907  if( m_decoder->m_ignoreEndcapChannels && m_decoder->m_onlineId->barrel_ec(SCID)==1) continue;
908 
909  std::vector<uint64_t> sum;
910  std::vector<uint64_t> sum2;
911  unsigned int ntmin=9999999;
913  for(auto nt : m_averagedRawValuesInEvent[ch].nTrigValid){
914  if( nt<ntmin ){
915  ntmin=nt;
916  }
917  }
918  sum.resize(m_averagedRawValuesInEvent[ch].sum.size());
919  sum2.resize(m_averagedRawValuesInEvent[ch].sum.size());
920 
921  for(unsigned int is=0; is<m_averagedRawValuesInEvent[ch].sum.size(); ++is){
922  double fsum = (double)m_averagedRawValuesInEvent[ch].sum[is]/m_averagedRawValuesInEvent[ch].nTrigValid[is]*ntmin;
923  double fsum2 = (double)m_averagedRawValuesInEvent[ch].sumSq[is]/m_averagedRawValuesInEvent[ch].nTrigValid[is]*ntmin;
924  sum[is]= round(fsum);
925  sum2[is]=round(fsum2);
926  }
927  if(m_accdigits){
928 
929  LArAccumulatedDigit *accdigi = new LArAccumulatedDigit(SCID,gain,
930  sum,sum2,ntmin);
931  m_accdigits->push_back(accdigi);
932  }
933  if (m_caccdigits) {
934  if (pattype == 0x49 || pattype == 0x4a) {
935  if (m_decoder->m_onlineId->barrel_ec(SCID) == 0) {
936  calibParams = calibParams1.get();
937  } else {
938  calibParams = calibParams2.get();
939  }
940  } else if (pattype == 0x4b || pattype == 0x4c) {
941  if (m_decoder->m_onlineId->isHECchannel(SCID)) {
942  calibParams = calibParams1.get();
943  } else {
944  calibParams = calibParams2.get();
945  }
946  } else {
947  calibParams = calibParams1.get();
948  }
949  unsigned int eventNb = 0;
950  unsigned int numCL = 0;
951  unsigned int numPulsedLeg = 0;
952  std::vector<Identifier> ccellIds(0);
953  Identifier myofflineID = cabling->cnvToIdentifier(SCID);
954  ccellIds = m_decoder->m_sc2ccMappingTool->superCellToOfflineID(myofflineID);
955  for (Identifier id : ccellIds) { // loop cells in sc
956  HWIdentifier cellLegHWID = cablingLeg->createSignalChannelID(id);
957  const std::vector<HWIdentifier>& calibLineLeg = clcabling->calibSlotLine(cellLegHWID);
958  numCL += calibLineLeg.size();
959  for (HWIdentifier calibLineHWID : calibLineLeg) { // loop legacy calib lines
960  if (calibParams->isPulsed(eventNb, calibLineHWID)) {
961  numPulsedLeg += 1;
962  }
963  }
964  }
965 
966  isPulsed_value = true;
967  if (numPulsedLeg != numCL) {
968  if (m_decoder->m_keepPulsed)
969  continue;
970  isPulsed_value = false;
971  }
972  DAC_value = calibParams->DAC(eventNb, SCID) * numPulsedLeg;
973  // 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
974  // which came from averaging over many cells
975  int ft = m_decoder->m_onlineId->feedthrough(SCID);
976  int slot = m_decoder->m_onlineId->slot(SCID);
977  int channel = m_decoder->m_onlineId->channel(SCID);
978  if (m_decoder->m_onlineId->barrel_ec(SCID) == 1 && (ft == 3 || ft == 10 || ft == 16 || ft == 22)) {
979  // if it's HEC
980  if (slot == 1) {
981  if (channel >= 16 && channel <= 31) { // eta 1.65 bin
982  DAC_value = DAC_value / 1.363;
983  m_decoder->msg(MSG::DEBUG) << "Multiplying DAC for channel " << SCID << "by 1/1.363" << endmsg;
984  } else if (channel >= 32 && channel <= 47) { // eta 1.75 bin
985  DAC_value = DAC_value / 1.206;
986  m_decoder->msg(MSG::DEBUG) << "Multiplying DAC for channel " << SCID << "by 1/1.206" << endmsg;
987  }
988  }
989  }
990 
991  delay_value = calibParams->Delay(eventNb, SCID);
992  LArAccumulatedCalibDigit* accdigi = new LArAccumulatedCalibDigit(SCID, gain, sum, sum2, ntmin, DAC_value, delay_value, isPulsed_value);
993 
994  m_caccdigits->push_back(accdigi);
995  }
996 
997  }
998 }
999 
1000 // Pass ADC values from an event
1002  // const CaloGain::CaloGain dummyGain = CaloGain::LARHIGHGAIN;
1003  const HWIdentifier hwidEmpty;
1004  for (SuperCell ch = 0; ch < N_LATOME_CHANNELS; ++ch) {
1005  const auto SCID = map ? map->getChannelID(m_nthLATOME, ch) : hwidEmpty;
1006  if (SCID == hwidEmpty) {
1007  ATH_MSG_DEBUG("No mapping for ch: " << std::dec << ch);
1008  continue;
1009  }
1010  if (m_decoder->m_ignoreBarrelChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 0)
1011  continue;
1012  if (m_decoder->m_ignoreEndcapChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 1)
1013  continue;
1014 
1015  std::vector<short> adcValues_inChannel_inEvent;
1016 
1017  if (m_hasRawAdc) {
1018  adcValues_inChannel_inEvent = m_rawValuesInEvent[ch].adc;
1019  }
1020 
1021  if (m_hasRawAdc && m_adc_coll) {
1024 
1025  std::vector<unsigned short> bcid_in_event;
1026  for (short b = m_BC_rawADC; b < m_BC_rawADC + m_nBC_rawADC; ++b) {
1027  bcid_in_event.push_back(m_BCIDsInEvent[b]);
1028  }
1029 
1030  LArSCDigit* scDigit = new LArSCDigit(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, adcValues_inChannel_inEvent, bcid_in_event);
1031  m_adc_coll->push_back(scDigit);
1032  }
1033 
1034  if (m_hasAdc && m_adc_bas_coll) {
1035  std::vector<unsigned short> bcid_in_event;
1036  if (m_nBC_ADC == (short)m_BCIDsInEvent.size()) {
1037  bcid_in_event = m_BCIDsInEvent;
1038  } else {
1039  for (short b = m_BC_ADC; b < m_BC_ADC + m_nBC_ADC; ++b) {
1040  bcid_in_event.push_back(m_BCIDsInEvent[b]);
1041  }
1042  }
1043  LArSCDigit* scDigit = new LArSCDigit(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].adc_bas, bcid_in_event);
1044  m_adc_bas_coll->push_back(scDigit);
1045  }
1046 
1047  if (m_hasE && m_et_coll) {
1048  std::vector<unsigned short> bcid_in_event;
1049  if (m_nBC_E == (unsigned short)m_BCIDsInEvent.size()) {
1050  bcid_in_event = m_BCIDsInEvent;
1051  } else {
1052  for (short b = m_BC_E; b < m_BC_E + m_nBC_E; ++b) {
1053  bcid_in_event.push_back(m_BCIDsInEvent[b]);
1054  }
1055  }
1056  LArRawSC* scDigit =
1057  new LArRawSC(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].et, bcid_in_event, m_rawValuesInEvent[ch].saturation);
1058  m_et_coll->push_back(scDigit);
1059  }
1060 
1061  if (m_hasEID && m_et_id_coll) {
1062  std::vector<unsigned short> bcid_in_event;
1063  if (m_nBC_EID == (short)m_BCIDsInEvent.size()) {
1064  bcid_in_event = m_BCIDsInEvent;
1065  } else {
1066  for (short b = m_BC_EID; b < m_BC_EID + m_nBC_EID; ++b) {
1067  bcid_in_event.push_back(m_BCIDsInEvent[b]);
1068  }
1069  }
1070  LArRawSC* scDigit =
1071  new LArRawSC(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].et_id, bcid_in_event, m_rawValuesInEvent[ch].saturation);
1072  m_et_id_coll->push_back(scDigit);
1073  }
1074  }
1075 }
1076 
1078 
1079  if (m_header_coll) {
1080  LArLATOMEHeader* latome = new LArLATOMEHeader(m_nthLATOME, m_latomeID, m_activeSC, m_latomeBCID, m_l1ID, m_ROBFragSize);
1081  m_header_coll->push_back(latome);
1082  }
1083 }
LArLATOMEDecoder::convert
StatusCode convert(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &robFrags, const LArLATOMEMapping *map, LArDigitContainer *adc_coll, LArDigitContainer *adc_bas_coll, LArRawSCContainer *et_coll, LArRawSCContainer *et_id_coll, LArLATOMEHeaderContainer *header_coll) const
Converter.
Definition: LArLATOMEDecoder.cxx:94
LArLATOMEDecoder::EventProcess::m_activeSC
Word m_activeSC
Definition: LArLATOMEDecoder.h:207
LArLATOMEDecoder::EventProcess::m_BC_EID
short m_BC_EID
Definition: LArLATOMEDecoder.h:225
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArLATOMEMapping::getChannelID
HWIdentifier getChannelID(const unsigned int sourceID, const unsigned int chan) const
create a HWIdentifier from an Identifier
Definition: LArLATOMEMapping.h:60
LArLATOMEDecoder
Definition: LArLATOMEDecoder.h:61
LArRawSC
Liquid Argon SuperCell raw data.
Definition: LArRawSC.h:19
LArLATOMEDecoder::EventProcess::m_nsc5
Word m_nsc5
Definition: LArLATOMEDecoder.h:212
LArAccumulatedCalibDigit
Data class for calibration ADC samples preprocessed by the DSP.
Definition: LArAccumulatedCalibDigit.h:42
LArLATOMEDecoder::EventProcess
Definition: LArLATOMEDecoder.h:129
OFFLINE_FRAGMENTS_NAMESPACE
Definition: RawEvent.h:22
et
Extra patterns decribing particle interation process.
Amg::compare
std::pair< int, int > compare(const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
compare two matrices, returns the indices of the first element that fails the condition,...
Definition: EventPrimitivesHelpers.h:109
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
LArLATOMEDecoder::EventProcess::compareOrSet
bool compareOrSet(Word &param, Word value, bool compare)
Definition: LArLATOMEDecoder.cxx:205
PlotCalibFromCool.ft
ft
Definition: PlotCalibFromCool.py:329
LArLATOMEDecoder::m_ignoreBarrelChannels
BooleanProperty m_ignoreBarrelChannels
Definition: LArLATOMEDecoder.h:256
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MonDataType::ADC
@ ADC
LArAccumulatedCalibDigitContainer::setDelayScale
void setDelayScale(const double scale)
set the delay Scale
Definition: LArAccumulatedCalibDigitContainer.h:35
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:82
LATOMEMapping.h
Tool to get LATOME SC and SCID mapping file and fill std::map variable with it.
LArLATOMEDecoder::EventProcess::m_nStreams
Word m_nStreams
Definition: LArLATOMEDecoder.h:197
LArLATOMEDecoder::EventProcess::m_BC_rawADC
short m_BC_rawADC
Definition: LArLATOMEDecoder.h:222
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
LArLATOMEDecoder::EventProcess::m_nWordsPerPacket
Word m_nWordsPerPacket
Definition: LArLATOMEDecoder.h:194
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
LArAccumulatedDigitContainer
Container class for LArAccumulatedDigit.
Definition: LArAccumulatedDigitContainer.h:22
LArLATOMEDecoder::EventProcess::m_hasRawAdc
bool m_hasRawAdc
Definition: LArLATOMEDecoder.h:227
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
LArLATOMEDecoder::EventProcess::m_hasE
bool m_hasE
Definition: LArLATOMEDecoder.h:229
LArLATOMEDecoder::EventProcess::Word
unsigned int Word
this should be the same as how we get the data, otherwise we will have bugs.
Definition: LArLATOMEDecoder.h:133
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LArLATOMEDecoder::m_onlineId
const LArOnline_SuperCellID * m_onlineId
Definition: LArLATOMEDecoder.h:253
patterns
std::vector< std::string > patterns
Definition: listroot.cxx:187
LArRawSCContainer
Container class for LArRawSC.
Definition: LArRawSCContainer.h:17
Issue
Configuration Issue
Definition: PscIssues.h:31
LArCalibLineMapping::calibSlotLine
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
Definition: LArCalibLineMapping.cxx:15
MonDataType
MonDataType
Definition: LArLATOMEDecoder.h:51
LArCalibLineMapping
Definition: LArCalibLineMapping.h:17
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
LArLATOMEDecoder::EventProcess::SuperCell
int SuperCell
Definition: LArLATOMEDecoder.h:136
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
LArLATOMEDecoder::EventProcess::m_region
Word m_region
Definition: LArLATOMEDecoder.h:196
LArLATOMEDecoder::EventProcess::signEnergy
int signEnergy(unsigned int energy)
Definition: LArLATOMEDecoder.cxx:316
LArCalibParams
Definition: LArCalibParams.h:28
MonDataType::SelectedEnergy
@ SelectedEnergy
LArLATOMEDecoder::EventProcess::m_nsc3
Word m_nsc3
Definition: LArLATOMEDecoder.h:210
LArOnlineID_Base::slot
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
Definition: LArOnlineID_Base.cxx:1961
LArLATOMEDecoder::EventProcess::bytesPerChannel
unsigned int bytesPerChannel(MonDataType at0, MonDataType at1)
Definition: LArLATOMEDecoder.cxx:322
LArLATOMEDecoder::EventProcess::m_nsc1
Word m_nsc1
Definition: LArLATOMEDecoder.h:208
athena.value
value
Definition: athena.py:122
LArLATOMEDecoder::EventProcess::m_nsc6
Word m_nsc6
Definition: LArLATOMEDecoder.h:213
LArLATOMEMapping
class to provide SC mapping
Definition: LArLATOMEMapping.h:28
LArLATOMEHeaderContainer
Container class for LArLATOMEHeader.
Definition: LArLATOMEHeaderContainer.h:19
LArLATOMEDecoder::EventProcess::m_ROBFragSize
Word m_ROBFragSize
Definition: LArLATOMEDecoder.h:191
LArLATOMEDecoder::EventProcess::decodeChannel
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)
Definition: LArLATOMEDecoder.cxx:367
LArLATOMEDecoder::EventProcess::m_BC_E
short m_BC_E
Definition: LArLATOMEDecoder.h:224
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
LArLATOMEDecoder::EventProcess::decodeWord
void decodeWord(unsigned int &word, unsigned int &wordshift, unsigned int &byteshift, const uint32_t *p)
Definition: LArLATOMEDecoder.cxx:357
LArOnlineID_Base::barrel_ec
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
Definition: LArOnlineID_Base.cxx:1942
LArLATOMEDecoder::EventProcess::m_at1nBC
Word m_at1nBC
Definition: LArLATOMEDecoder.h:204
LArLATOMEDecoder::LatomeCalibPatterns
Definition: LArLATOMEDecoder.h:121
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
N_LATOME_CHANNELS
#define N_LATOME_CHANNELS
fixed number of channels on one LATOME board
Definition: LArLATOMEMapping.h:22
LArLATOMEDecoder::LArLATOMEDecoder
LArLATOMEDecoder(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: LArLATOMEDecoder.cxx:22
LArLATOMEDecoder::EventProcess::m_nBC_Averaged
short m_nBC_Averaged
Definition: LArLATOMEDecoder.h:220
LArLATOMEDecoder::EventProcess::m_monHeaderSize
Word m_monHeaderSize
Definition: LArLATOMEDecoder.h:195
LArLATOMEDecoder::EventProcess::m_at1BC
Word m_at1BC
Definition: LArLATOMEDecoder.h:206
LArLATOMEDecoder::m_protectSourceId
BooleanProperty m_protectSourceId
Definition: LArLATOMEDecoder.h:258
LArLATOMEDecoder::LatomeCalibPatterns::patterns
std::vector< unsigned int > patterns
Definition: LArLATOMEDecoder.h:126
LArLATOMEDecoder::EventProcess::m_decoder
const LArLATOMEDecoder * m_decoder
Definition: LArLATOMEDecoder.h:234
MonDataType::AutoCorr
@ AutoCorr
LArLATOMEDecoder::EventProcess::m_nsc4
Word m_nsc4
Definition: LArLATOMEDecoder.h:211
LArLATOMEDecoder::EventProcess::m_isAveraged
bool m_isAveraged
Definition: LArLATOMEDecoder.h:231
LArLATOMEDecoder::EventProcess::m_at0nBC
Word m_at0nBC
Definition: LArLATOMEDecoder.h:203
Mon.h
Tool to store LATOME mon header and footer data.
LArOnline_SuperCellID::isHECchannel
bool isHECchannel(const HWIdentifier id) const override final
Definition: LArOnline_SuperCellID.cxx:363
MonDataType::Invalid
@ Invalid
LArOnlineID_Base::channel
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Definition: LArOnlineID_Base.cxx:1967
LArAccumulatedDigit
Data class for ADC samples and autocorr preprocessed by the DSP.
Definition: LArAccumulatedDigit.h:32
ev
int ev
Definition: globals.cxx:25
LArLATOMEDecoder::EventProcess::decodeByte
void decodeByte(unsigned int &byte, unsigned int wordshift, unsigned int byteshift, const uint32_t *p)
Definition: LArLATOMEDecoder.cxx:353
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArLATOMEDecoder::LatomeCalibPatterns::delay
unsigned int delay
Definition: LArLATOMEDecoder.h:125
LArLATOMEDecoder::EventProcess::m_at0BC
Word m_at0BC
Definition: LArLATOMEDecoder.h:205
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
LArLATOMEDecoder::EventProcess::increaseWordShift
void increaseWordShift(unsigned int &wordshift)
Definition: LArLATOMEDecoder.cxx:334
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
lumiFormat.i
int i
Definition: lumiFormat.py:92
LArLATOMEDecoder::EventProcess::m_caccdigits
LArAccumulatedCalibDigitContainer * m_caccdigits
Definition: LArLATOMEDecoder.h:240
LArLATOMEDecoder::EventProcess::m_nBC_E
short m_nBC_E
Definition: LArLATOMEDecoder.h:218
LArLATOMEDecoder::EventProcess::m_nBC_EID
short m_nBC_EID
Definition: LArLATOMEDecoder.h:219
ret
T ret(T t)
Definition: rootspy.cxx:260
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArLATOMEDecoder::EventProcess::m_nBC_ADC
short m_nBC_ADC
Definition: LArLATOMEDecoder.h:217
python.HLT.CommonSequences.EventBuildingSequences.robs
robs
Definition: EventBuildingSequences.py:400
LArLATOMEDecoder::m_ignoreEndcapChannels
BooleanProperty m_ignoreEndcapChannels
Definition: LArLATOMEDecoder.h:257
LArCalibParams::isPulsed
bool isPulsed(const unsigned event, const HWIdentifier calibLineID) const
Definition: LArCalibParams.cxx:167
LArLATOMEDecoder::m_cablingKeySC
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
Definition: LArLATOMEDecoder.h:260
LArLATOMEDecoder::EventProcess::increaseByteShift
void increaseByteShift(unsigned int &wordshift, unsigned int &byteshift)
Definition: LArLATOMEDecoder.cxx:345
LArLATOMEDecoder::interfaceID
static const InterfaceID & interfaceID()
Definition: LArLATOMEDecoder.cxx:29
MonDataType::RawADC
@ RawADC
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
LArLATOMEDecoder::EventProcess::m_streamNumber
Word m_streamNumber
Definition: LArLATOMEDecoder.h:198
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArLATOMEDecoder::EventProcess::m_rawValuesInEvent
std::vector< LatomeRawData > m_rawValuesInEvent
Definition: LArLATOMEDecoder.h:247
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
LArLATOMEDecoder::EventProcess::decodeTrailer
unsigned int decodeTrailer(const uint32_t *p, unsigned int offset)
Definition: LArLATOMEDecoder.cxx:213
LArSCDigit
Base class for LArDigits taken by LATOME.
Definition: LArSCDigit.h:19
DataVector::clear
void clear()
Erase all the elements in the collection.
fitman.mux
mux
Definition: fitman.py:547
LArLATOMEDecoder::EventProcess::m_at1typeRec
Word m_at1typeRec
Definition: LArLATOMEDecoder.h:200
LArLATOMEDecoder::EventProcess::m_hasEID
bool m_hasEID
Definition: LArLATOMEDecoder.h:230
MonDataType::Energy
@ Energy
LArCalibParams::DAC
unsigned DAC(const unsigned event, const HWIdentifier calibLineID) const
Definition: LArCalibParams.cxx:147
defineDB.ichan
int ichan
Definition: JetTagCalibration/share/defineDB.py:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
MonDataType::Averaged
@ Averaged
LArLATOMEDecoder::EventProcess::fillCalib
void fillCalib(const LArLATOMEMapping *map, const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap)
Definition: LArLATOMEDecoder.cxx:845
LArLATOMEDecoder::EventProcess::fillRaw
void fillRaw(const LArLATOMEMapping *map)
Pass ADC values from an event.
Definition: LArLATOMEDecoder.cxx:1001
LArCalibParams::Delay
unsigned Delay(const unsigned event, const HWIdentifier calibLineID) const
Definition: LArCalibParams.cxx:128
LArLATOMEDecoder::EventProcess::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: LArLATOMEDecoder.cxx:131
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
LArLATOMEDecoder::EventProcess::m_at1type
Word m_at1type
Definition: LArLATOMEDecoder.h:202
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
LArLATOMEDecoder::EventProcess::m_nPackets
Word m_nPackets
Definition: LArLATOMEDecoder.h:192
LArLATOMEDecoder::EventProcess::m_averagedRawValuesInEvent
std::vector< LatomeAveragedRawData > m_averagedRawValuesInEvent
Definition: LArLATOMEDecoder.h:248
LArLATOMEDecoder::EventProcess::m_accdigits
LArAccumulatedDigitContainer * m_accdigits
Definition: LArLATOMEDecoder.h:239
LArLATOMEDecoder::EventProcess::fillCollection
void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *pROB, const LArLATOMEMapping *map, const LArOnOffIdMapping *onoffmap=nullptr, const LArCalibLineMapping *clmap=nullptr)
Execute decoding for an event.
Definition: LArLATOMEDecoder.cxx:432
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
LArLATOMEDecoder::EventProcess::m_latomeCalibPatternsInEvent
std::vector< LatomeCalibPatterns > m_latomeCalibPatternsInEvent
Definition: LArLATOMEDecoder.h:249
LArLATOMEHeader
Holds information from the LATOME Header.
Definition: LArLATOMEHeader.h:19
LArOnlineID_Base::feedthrough
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
Definition: LArOnlineID_Base.cxx:1948
LArCalibParams.h
LArLATOMEDecoder::EventProcess::m_BC_ADC
short m_BC_ADC
Definition: LArLATOMEDecoder.h:223
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArLATOMEDecoder::EventProcess::m_nthLATOME
unsigned int m_nthLATOME
Definition: LArLATOMEDecoder.h:244
LArLATOMEDecoder::Word
unsigned int Word
Definition: LArLATOMEDecoder.h:64
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
re
const boost::regex re(r_e)
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LArLATOMEDecoder::EventProcess::m_at0typeRec
Word m_at0typeRec
Definition: LArLATOMEDecoder.h:199
LArLATOMEDecoder::initialize
virtual StatusCode initialize()
Initialize the converter.
Definition: LArLATOMEDecoder.cxx:32
LArCalibParams::initialize
virtual StatusCode initialize()
Definition: LArCalibParams.cxx:17
LArLATOMEDecoder::EventProcess::fillHeader
void fillHeader()
Definition: LArLATOMEDecoder.cxx:1077
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LArLATOMEDecoder::EventProcess::m_headerDecoded
bool m_headerDecoded
Definition: LArLATOMEDecoder.h:214
LArDigitContainer
Container class for LArDigit.
Definition: LArDigitContainer.h:24
LArLATOMEDecoder::EventProcess::m_l1ID
Word m_l1ID
Definition: LArLATOMEDecoder.h:190
Gaudi
=============================================================================
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:273
LArLATOMEDecoder::LatomeCalibPatterns::DAC
unsigned int DAC
Definition: LArLATOMEDecoder.h:124
LArLATOMEDecoder::EventProcess::m_iPacket
Word m_iPacket
Definition: LArLATOMEDecoder.h:193
LArOnline_SuperCellID.h
LArLATOMEDecoder::EventProcess::m_at0type
Word m_at0type
Definition: LArLATOMEDecoder.h:201
LArLATOMEDecoder.h
Byte stream converter of LATOME.
beamspotnt.nt
def nt
Definition: bin/beamspotnt.py:1063
AthAlgTool
Definition: AthAlgTool.h:26
LArLATOMEDecoder::EventProcess::m_nBC_rawADC
short m_nBC_rawADC
Definition: LArLATOMEDecoder.h:216
LArLATOMEDecoder::EventProcess::decodeHeader
unsigned int decodeHeader(const uint32_t *p, unsigned int offset)
Definition: LArLATOMEDecoder.cxx:224
LArLATOMEDecoder::EventProcess::m_hasAdc
bool m_hasAdc
Definition: LArLATOMEDecoder.h:228
LArAccumulatedCalibDigitContainer
Container class for LArAccumulatedCalibDigit.
Definition: LArAccumulatedCalibDigitContainer.h:25
LArLATOMEDecoder::EventProcess::m_nsc2
Word m_nsc2
Definition: LArLATOMEDecoder.h:209
LArLATOMEDecoder::s_nBunches
static const int s_nBunches
Maximum value of BCID.
Definition: LArLATOMEDecoder.h:98
LArLATOMEDecoder::EventProcess::m_latomeID
Word m_latomeID
Definition: LArLATOMEDecoder.h:189
LArCalibParams::set
void set(const HWIdentifier CalibModuleID, const unsigned nTrigger, const std::vector< unsigned > &Pattern, const std::vector< unsigned > &DAC, const std::vector< unsigned > &Delay)
Definition: LArCalibParams.cxx:46
LArLATOMEDecoder::m_sc2ccMappingTool
ToolHandle< ICaloSuperCellIDTool > m_sc2ccMappingTool
Definition: LArLATOMEDecoder.h:254
LAR
@ LAR
Definition: RegSelEnums.h:27
LArLATOMEDecoder::m_keepPulsed
BooleanProperty m_keepPulsed
Definition: LArLATOMEDecoder.h:259
LArLATOMEDecoder::EventProcess::m_isAutoCorr
bool m_isAutoCorr
Definition: LArLATOMEDecoder.h:232