ATLAS Offline Software
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TileHid2RESrcID Class Reference

This class provides conversion between fragment ID and RESrcID. More...

#include <TileHid2RESrcID.h>

Collaboration diagram for TileHid2RESrcID:

Public Types

typedef int COLLECTION_ID
 

Public Member Functions

 TileHid2RESrcID (const TileHWID *tileHWID=0, uint32_t runnum=0)
 constrcutor More...
 
void setTileHWID (const TileHWID *tileHWID, uint32_t runnum=0)
 
void initialize (uint32_t runnum)
 
void initializeMuRcv (uint32_t runnum)
 
void initialize (const std::vector< std::vector< uint32_t > > &fullmap)
 
void setROD2ROBmap (const std::vector< std::string > &ROD2ROB, MsgStream &log)
 
void setROD2ROBmap (const eformat::FullEventFragment< const uint32_t * > *event, bool &of2Default, MsgStream &log)
 
void setBSfrag (int frag_id, uint32_t bs_frag)
 
void setDrawerType (int frag_id, uint32_t type)
 
void printSpecial (MsgStream &log)
 
uint32_t getRobFromFragID (int frag_id) const
 make a ROB SrcID for a fragment ID More...
 
uint32_t getRobFromTileMuRcvFragID (int frag_id) const
 
uint32_t getRodID (int frag_id) const
 make a ROD SrcID for a fragment ID More...
 
uint32_t getRodTileMuRcvID (int frag_id) const
 
uint32_t getRobID (uint32_t rod_id) const
 Make a ROB Source ID from a ROD source ID. More...
 
uint32_t getRobID_8 (uint32_t rod_id) const
 
uint32_t getRosID (uint32_t rob_id) const
 Make a ROS Source ID from a ROB source ID. More...
 
uint32_t getRosID_8 (uint32_t rob_id) const
 
uint32_t getDetID (uint32_t ros_id) const
 Make a SubDetector ID from ROS source ID. More...
 
uint32_t getRunNum ()
 Retrieve run number for which hash was initialized. More...
 
int getOfflineFragID (uint32_t bs_frag_id) const
 Retrieve extra info - ByteStream frag ID and drawer typefor a given transient fragment ID. More...
 
uint32_t getBSfragID (int frag_id) const
 
uint32_t getDrawerType (int frag_id) const
 
const std::vector< uint32_t > & getDrawerInfo (int frag_id) const
 

Private Types

typedef std::map< int, uint32_t > FRAGRODMAP
 
typedef std::map< uint32_t, int > BS2OFFLINEMAP
 
typedef std::map< int, std::vector< uint32_t > > FRAGFULLMAP
 

Private Member Functions

void updateBSmap ()
 

Private Attributes

const TileHWIDm_tileHWID
 
FRAGRODMAP m_TileMuRcvFrag2ROD
 
BS2OFFLINEMAP m_bs2offline
 
FRAGFULLMAP m_frag2ROD
 
uint32_t m_runnum
 
uint32_t m_TileMuRcvRunnum = 0U
 
std::vector< uint32_t > m_defaultDrawer
 

Detailed Description

This class provides conversion between fragment ID and RESrcID.

Author
Alexander Solodkov

Fragment ID is the unique ID for every super-drawer. RESrcID is used for identifying each ROD.

Definition at line 28 of file TileHid2RESrcID.h.

Member Typedef Documentation

◆ BS2OFFLINEMAP

typedef std::map<uint32_t, int> TileHid2RESrcID::BS2OFFLINEMAP
private

Definition at line 95 of file TileHid2RESrcID.h.

◆ COLLECTION_ID

Definition at line 32 of file TileHid2RESrcID.h.

◆ FRAGFULLMAP

typedef std::map<int, std::vector<uint32_t> > TileHid2RESrcID::FRAGFULLMAP
private

Definition at line 96 of file TileHid2RESrcID.h.

◆ FRAGRODMAP

typedef std::map<int, uint32_t> TileHid2RESrcID::FRAGRODMAP
private

Definition at line 94 of file TileHid2RESrcID.h.

Constructor & Destructor Documentation

◆ TileHid2RESrcID()

TileHid2RESrcID::TileHid2RESrcID ( const TileHWID tileHWID = 0,
uint32_t  runnum = 0 
)

constrcutor

Definition at line 21 of file TileHid2RESrcID.cxx.

22  : m_runnum(0)
23 {
24  m_tileHWID = tileHWID;
25  if (m_tileHWID) {
26  // make internal maps
29  }
30 }

Member Function Documentation

◆ getBSfragID()

uint32_t TileHid2RESrcID::getBSfragID ( int  frag_id) const

Definition at line 480 of file TileHid2RESrcID.cxx.

481 {
482  // this method returns fragment ID in bytestream for a given transient fragment ID
483 
484  FRAGFULLMAP::const_iterator it = m_frag2ROD.find(frag_id);
485  if(it == m_frag2ROD.end()){
486  if (frag_id < static_cast<int>(TileCalibUtils::FELIX_FRAGID_OFFSET)) {
487  std::cout <<" TileHid2RESrcID invalid FRAG ID 0x"<<std::hex<<frag_id<<std::dec<<std::endl;
488  assert(0);
489  }
490  return 0;
491  }
492 
493  return ((((*it).second.size()>1) ? (*it).second[1] : frag_id) ) ;
494 }

◆ getDetID()

uint32_t TileHid2RESrcID::getDetID ( uint32_t  ros_id) const

Make a SubDetector ID from ROS source ID.

mapping SrcID from ROS to Det

Definition at line 570 of file TileHid2RESrcID.cxx.

571 {
572 // ROS to DET
573 
574  SourceIdentifier id = SourceIdentifier(ros_id);
575  SourceIdentifier id2 = SourceIdentifier(id.subdetector_id(),0);
576  return id2.code();
577 }

◆ getDrawerInfo()

const std::vector< uint32_t > & TileHid2RESrcID::getDrawerInfo ( int  frag_id) const

Definition at line 510 of file TileHid2RESrcID.cxx.

511 {
512  // this method returns drawer type (legacy/demonstrator/...) for a given transient fragment ID
513 
514  FRAGFULLMAP::const_iterator it = m_frag2ROD.find(frag_id);
515  if(it == m_frag2ROD.end()){
516  std::cout <<" TileHid2RESrcID invalid FRAG ID 0x"<<std::hex<<frag_id<<std::dec<<std::endl;
517  assert(0);
518  return m_defaultDrawer;
519  }
520 
521  return (*it).second;
522 }

◆ getDrawerType()

uint32_t TileHid2RESrcID::getDrawerType ( int  frag_id) const

Definition at line 496 of file TileHid2RESrcID.cxx.

497 {
498  // this method returns drawer type (legacy/demonstrator/...) for a given transient fragment ID
499 
500  FRAGFULLMAP::const_iterator it = m_frag2ROD.find(frag_id);
501  if(it == m_frag2ROD.end()){
502  std::cout <<" TileHid2RESrcID invalid FRAG ID 0x"<<std::hex<<frag_id<<std::dec<<std::endl;
503  assert(0);
504  return 0;
505  }
506 
507  return (((*it).second.size()>2) ? (*it).second[2] : 0);
508 }

◆ getOfflineFragID()

int TileHid2RESrcID::getOfflineFragID ( uint32_t  bs_frag_id) const

Retrieve extra info - ByteStream frag ID and drawer typefor a given transient fragment ID.

Definition at line 524 of file TileHid2RESrcID.cxx.

525 {
526  // this method returns offine ID for given bytestream ID
527 
528  BS2OFFLINEMAP::const_iterator it = m_bs2offline.find(bs_frag_id);
529  if(it == m_bs2offline.end()){
530  return -1;
531  }
532 
533  return (*it).second;
534 }

◆ getRobFromFragID()

uint32_t TileHid2RESrcID::getRobFromFragID ( int  frag_id) const

make a ROB SrcID for a fragment ID

Definition at line 457 of file TileHid2RESrcID.cxx.

458 {
459  // this method returns a RESrcID of the ROB, for a given fragment ID
460  // in eformat V3 ROB and ROD IDs are the same
461  return getRodID(frag_id);
462 }

◆ getRobFromTileMuRcvFragID()

uint32_t TileHid2RESrcID::getRobFromTileMuRcvFragID ( int  frag_id) const

Definition at line 579 of file TileHid2RESrcID.cxx.

580 {
581  // this method returns a RESrcID of the ROB, for a given fragment ID
582  // in eformat V3 ROB and ROD IDs are the same
583  return getRodTileMuRcvID(frag_id);
584 }

◆ getRobID()

uint32_t TileHid2RESrcID::getRobID ( uint32_t  rod_id) const

Make a ROB Source ID from a ROD source ID.

mapping SrcID from ROD to ROB

Definition at line 550 of file TileHid2RESrcID.cxx.

551 {
552  // in eformat V3 ROB and ROD IDs are the same
553  return rod_id;
554 }

◆ getRobID_8()

uint32_t TileHid2RESrcID::getRobID_8 ( uint32_t  rod_id) const

◆ getRodID()

uint32_t TileHid2RESrcID::getRodID ( int  frag_id) const

make a ROD SrcID for a fragment ID

Definition at line 464 of file TileHid2RESrcID.cxx.

465 {
466  // this method returns a RESrcID for the ROD, for a given fragment ID
467 
468  FRAGFULLMAP::const_iterator it = m_frag2ROD.find(frag_id);
469  if(it == m_frag2ROD.end()){
470  if (frag_id < static_cast<int>(TileCalibUtils::FELIX_FRAGID_OFFSET)) {
471  std::cout <<" TileHid2RESrcID invalid FRAG ID 0x"<<std::hex<<frag_id<<std::dec<<std::endl;
472  assert(0);
473  }
474  return 0;
475  }
476 
477  return ( (*it).second[0] ) ;
478 }

◆ getRodTileMuRcvID()

uint32_t TileHid2RESrcID::getRodTileMuRcvID ( int  frag_id) const

Definition at line 586 of file TileHid2RESrcID.cxx.

587 {
588  // this method returns a RESrcID for the ROD, for a given fragment ID
589 
590  FRAGRODMAP::const_iterator it = m_TileMuRcvFrag2ROD.find(frag_id);
591  if(it == m_TileMuRcvFrag2ROD.end()){
592  std::cout <<" TileHid2RESrcID invalid FRAG ID 0x"<<std::hex<<frag_id<<std::dec<<std::endl;
593  assert(0);
594  return 0;
595  }
596 
597  return ( (*it).second ) ;
598 }

◆ getRosID()

uint32_t TileHid2RESrcID::getRosID ( uint32_t  rob_id) const

Make a ROS Source ID from a ROB source ID.

mapping SrcID from ROB to ROS

Definition at line 558 of file TileHid2RESrcID.cxx.

559 {
560 // Change Module Type to ROS, moduleid = 0
561 
562  SourceIdentifier id = SourceIdentifier(rob_id);
563  SourceIdentifier id2 = SourceIdentifier(id.subdetector_id(),0);
564  return id2.code();
565 
566 }

◆ getRosID_8()

uint32_t TileHid2RESrcID::getRosID_8 ( uint32_t  rob_id) const

◆ getRunNum()

uint32_t TileHid2RESrcID::getRunNum ( )
inline

Retrieve run number for which hash was initialized.

Definition at line 82 of file TileHid2RESrcID.h.

82 { return m_runnum; };

◆ initialize() [1/2]

void TileHid2RESrcID::initialize ( const std::vector< std::vector< uint32_t > > &  fullmap)

Definition at line 43 of file TileHid2RESrcID.cxx.

44 {
45  for (const std::vector<uint32_t>& v : allmap) {
46  if (v.size()>0) {
47  int id = v[0];
48  if (v.size()>1) {
49  std::vector<uint32_t> data(v.begin()+1,v.end());
50  m_frag2ROD[id] = data;
51  } else if ( m_frag2ROD.find(id) != m_frag2ROD.end() ) {
52  m_frag2ROD.erase(id);
53  }
54  }
55  }
56  updateBSmap();
57 }

◆ initialize() [2/2]

void TileHid2RESrcID::initialize ( uint32_t  runnum)

iterator over all drawer Identifiers

Definition at line 60 of file TileHid2RESrcID.cxx.

61 {
62  m_runnum = runnum;
63  eformat::SubDetector detid[6];
64 
65  detid[0] = eformat::TILECAL_LASER_CRATE; // 0x50 - beam crate
66  detid[1] = eformat::TILECAL_BARREL_A_SIDE; // 0x51 - barrel positive
67  detid[2] = eformat::TILECAL_BARREL_C_SIDE; // 0x52 - barrel negative
68  detid[3] = eformat::TILECAL_EXT_A_SIDE; // 0x53 - ext.bar positive
69  detid[4] = eformat::TILECAL_EXT_C_SIDE; // 0x54 - ext.bar negative
70  detid[5] = eformat::TDAQ_BEAM_CRATE; // 0x70 - common beam crate
71 
73  std::vector<HWIdentifier>::const_iterator first = m_tileHWID->drawer_begin();
74  std::vector<HWIdentifier>::const_iterator last = m_tileHWID->drawer_end();
75 
76  for ( ; first!=last; ++first) {
77  int ros = m_tileHWID->ros(*first);
78  int drawer = m_tileHWID->drawer(*first);
79  uint32_t frag = m_tileHWID->frag(*first);
80 
81  uint32_t id = 0; // id is always 0 for Beam ROD (ros=0)
82  if (ros > 0) {
83  if (runnum>318000) {
84  // new frag->ROB mapping since March 2017
85  // put 4 drawers in two subsequent RODs
86  // odd drawers in odd ROD, even drawers in even ROD
87  id = ((drawer & 0xFC) >> 1) | (drawer & 0x1) ;
88  } else {
89  // old mapping
90  // (put 4 drawers in one ROD - remove last 2 bits)
91  id = (drawer >> 2);
92  }
93  } else if (drawer>0x7 && drawer < 0xFF) {
94  ros = 5; // frags from common beam crate
95  }
96 
97  // build ROD id
98  SourceIdentifier sid = SourceIdentifier(detid[ros],id);
99  uint32_t rod_id = sid.code();
100 
101  // add ROD id to the map
102  m_frag2ROD[frag] = {rod_id,frag};
103  }
104 
105  if (runnum>=400000) {
106  // LBA14 is demonstrator in RUN3 - add special flag
107  m_frag2ROD[0x10d].push_back(1);
108 
109  // fragments for EBA61 and EBA63 were swapped in 2021-2023
110  if (runnum<463700) {
111  m_frag2ROD[0x33c][1] = 0x33e;
112  m_frag2ROD[0x33e][1] = 0x33c;
113  }
114  }
115 
116  // laser fragments in specific ROB
117  if (runnum>318000) {
118  // new frag->ROB mapping since March 2017
119  m_frag2ROD[0x16] = {0x520020,0x16};
120  m_frag2ROD[0xff] = {0x520020,0xff};
121  } else {
122  m_frag2ROD[0x16] = {0x520010,0x16};
123  m_frag2ROD[0xff] = {0x520010,0xff};
124  }
125  m_frag2ROD[0x17] = {0,0x17};
126 
127  updateBSmap();
128 }

◆ initializeMuRcv()

void TileHid2RESrcID::initializeMuRcv ( uint32_t  runnum)

Definition at line 130 of file TileHid2RESrcID.cxx.

131 {
133  eformat::SubDetector detid[6];
134 
135  detid[0] = eformat::TILECAL_LASER_CRATE; // 0x50 - beam crate
136  detid[1] = eformat::TILECAL_BARREL_A_SIDE; // 0x51 - barrel positive
137  detid[2] = eformat::TILECAL_BARREL_C_SIDE; // 0x52 - barrel negative
138  detid[3] = eformat::TILECAL_EXT_A_SIDE; // 0x53 - ext.bar positive
139  detid[4] = eformat::TILECAL_EXT_C_SIDE; // 0x54 - ext.bar negative
140  detid[5] = eformat::TDAQ_BEAM_CRATE; // 0x70 - common beam crate
141 
142  // iterator over all drawer Identifiers
143  std::vector<HWIdentifier>::const_iterator first = m_tileHWID->drawer_begin();
144  std::vector<HWIdentifier>::const_iterator last = m_tileHWID->drawer_end();
145 
146  for ( ; first!=last; ++first) {
147  int ros = m_tileHWID->ros(*first);
148  int drawer = m_tileHWID->drawer(*first);
149  int frag = m_tileHWID->frag(*first);
150  uint32_t id = 0;
151 
152  //std::cout << "TileHid2RESrcID::setTileMuRcvHWID ros:" << ros << " drawer: " << std::hex << drawer << " frag: " << frag << std::dec << std::endl;
153 
154  if (ros>2){
155  // Extended Barrel
156  // (put 8 drawers in one ROD - remove last 3 bits)
157  id = (drawer >> 3) + 0x100;
158  } else {
159  // Long Barrel
160  // (put 4 drawers in one ROD - remove last 2 bits)
161  id = (drawer >> 2) + 0x100;
162  }
163  // build ROD id
164  SourceIdentifier sid = SourceIdentifier(detid[ros],id);
165  uint32_t rod_id = sid.code();
166 
167  // add ROD id to the map
168  m_TileMuRcvFrag2ROD[frag] = rod_id;
169  }
170 }

◆ printSpecial()

void TileHid2RESrcID::printSpecial ( MsgStream &  log)

Definition at line 600 of file TileHid2RESrcID.cxx.

601 {
602  const char * names[] = {"Legacy", "Demo", "DemoEB", "Unknown"};
603  for (const auto& it : m_frag2ROD) {
604  const std::vector<uint32_t> & v = it.second;
605  if (v.size()>1) {
606  if (it.first != static_cast<int>(v[1])) {
607  log << MSG::INFO << "Frag 0x" << std::hex << it.first << " is taken from bytestream frag 0x" << v[1] << std::dec << endmsg;
608  }
609  if (v.size()>2) {
610  log << MSG::INFO << "Frag 0x" << std::hex << it.first << " fragment type is "
611  << std::dec << v[2] << " - " << names[std::min(3U,v[2])] << endmsg;
612  }
613  }
614  }
615 
616 }

◆ setBSfrag()

void TileHid2RESrcID::setBSfrag ( int  frag_id,
uint32_t  bs_frag 
)

Definition at line 421 of file TileHid2RESrcID.cxx.

422 {
423  FRAGFULLMAP::iterator it = m_frag2ROD.find(frag_id);
424  if(it == m_frag2ROD.end()){
425  std::cout <<" TileHid2RESrcID invalid FRAG ID 0x"<<std::hex<<frag_id<<std::dec<<std::endl;
426  assert(0);
427  return;
428  }
429 
430  if (it->second.size() < 2) {
431  it->second.resize(2);
432  }
433  it->second[1] = bs_frag;
434  m_bs2offline[bs_frag] = frag_id;
435 }

◆ setDrawerType()

void TileHid2RESrcID::setDrawerType ( int  frag_id,
uint32_t  type 
)

Definition at line 437 of file TileHid2RESrcID.cxx.

438 {
439  FRAGFULLMAP::iterator it = m_frag2ROD.find(frag_id);
440  if(it == m_frag2ROD.end()){
441  std::cout <<" TileHid2RESrcID invalid FRAG ID 0x"<<std::hex<<frag_id<<std::dec<<std::endl;
442  assert(0);
443  return;
444  }
445 
446  size_t siz = it->second.size();
447  if (siz < 3) {
448  it->second.resize(3);
449  if (siz < 2) {
450  it->second[1] = frag_id;
451  m_bs2offline[frag_id] = frag_id;
452  }
453  }
454  it->second[2] = type;
455 }

◆ setROD2ROBmap() [1/2]

void TileHid2RESrcID::setROD2ROBmap ( const eformat::FullEventFragment< const uint32_t * > *  event,
bool &  of2Default,
MsgStream &  log 
)

Definition at line 207 of file TileHid2RESrcID.cxx.

210 {
211 
212  uint32_t runnum = event->run_no();
213  if ( ( (runnum>318000 && m_runnum<=318000) || (runnum<=318000 && m_runnum>318000) ) ) {
214  log << MSG::INFO << "Reinitializing TileHid2RESrcID for run " << runnum << endmsg;
216  }
217 
218  uint32_t nBeamFrag=0, nRODfrag=0, nDataFrag[10]={0,0,0,0,0,0,0,0,0,0}, flags=0xFFFF, flags5=0xFFFF;
219  std::map<int,int> fragMap;
220  std::map<int,int> beamMap;
221  std::vector<int> fragIDs;
222 
223  bool cisparFound = false;
224  uint32_t lascisROB = 0;
225 
226  uint32_t ndet = event->nchildren();
227  for (size_t idet=0; idet<ndet; ++idet) {
228  const uint32_t* fpdet;
229  event->child(fpdet, idet);
230  const eformat::ROBFragment<const uint32_t*> robf(fpdet);
231 
232  uint32_t ROBid = robf.source_id();
233 
234  const auto ROBSubDetID = eformat::helper::SourceIdentifier(ROBid).subdetector_id();
235  const auto ROBSubDetGroup = eformat::helper::SourceIdentifier(ROBid).subdetector_group();
236  if (ROBSubDetGroup == eformat::SubDetectorGroup::TILECAL ||
237  ROBSubDetID == eformat::SubDetector::TDAQ_BEAM_CRATE || ROBSubDetID == 0) { // SubDetID=00 used in testbeam
238 
239  unsigned int source_id = robf.rod_source_id();
240  eformat::helper::SourceIdentifier id = eformat::helper::SourceIdentifier(source_id);
241  unsigned int subdet_id = id.subdetector_id();
242 
243  unsigned int size = robf.rod_ndata();
244  unsigned int max_allowed_size = robf.rod_fragment_size_word();
245  unsigned int delta = robf.rod_header_size_word() + robf.rod_trailer_size_word();
246  if (max_allowed_size > delta) max_allowed_size-=delta; else max_allowed_size=0;
247  if (size > max_allowed_size) size = max_allowed_size;
248  if ( size > 0 ) {
249 
250  const uint32_t * data;
251  if (robf.rod_status_position()==0 &&
252  robf.rod_nstatus() + robf.rod_header_size_word() + robf.rod_trailer_size_word() >= robf.rod_fragment_size_word()) {
253  robf.rod_status(data);
254  } else {
255  robf.rod_data(data);
256  }
257 
258  switch ( subdet_id ) {
259  case TILE_BEAM_ID: // TILE BEAM ROD
260  case COMMON_BEAM_ID: // COMMON BEAM ROD
261  case TILE_POS_ID: // POSITIVE ROD
262  case TILE_NEG_ID: // NEGATIVE ROD
263  case TILE_EBPOS_ID: // POSITIVE EB ROD
264  case TILE_EBNEG_ID: // NEGATIVE EB ROD
265  {
266 
267  unsigned int offset = 0, sizePos = 1, idPos = 2;
268  if ( *(data) != 0xff1234ff ) { // appeared since Sep 2005
269  --sizePos;
270  --idPos;
271  }
272 
273  while ( offset+idPos < size ) {
274 
275  uint32_t fragsize = *(data + offset + sizePos);
276  uint32_t fragid = ( *(data + offset + idPos) ) & 0xFFFF;
277  uint32_t upperhalf = ( *(data + offset + idPos) ) >> 16;
278  offset += fragsize;
279 
280  if ( fragsize <= idPos || fragsize > size) break; // too small or too big frag - ignore and exit
281 
282  int fragtype = upperhalf & 0xFF;
283 
284  if (fragtype >= 0x40 && fragtype < 0x50) { // TMDB fragments
285 
286  int ros = subdet_id&0xF;
287  if (ros>0 && ros<=4) {
288  uint32_t vers = fragid;
289  int nmod = (ros>2)?8:4; // we have 8 modules per fragment in ext.barrel, 4 modules in barrel
290  fragid = (ros<<8) | (source_id&0xF)*nmod;
291 
292  FRAGRODMAP::const_iterator it = m_TileMuRcvFrag2ROD.find(fragid);
293  if(it == m_TileMuRcvFrag2ROD.end()){
294  log << MSG::INFO << "New TMDB frag 0x" << MSG::hex << fragid
295  << " type 0x" << fragtype << " vers 0x"<< vers
296  << " in ROB 0x" << ROBid << MSG::dec << endmsg;
297  } else {
298  if ( (*it).second != ROBid ) {
299  log << MSG::INFO << "TMDB frag 0x" << MSG::hex << fragid
300  << " type 0x" << fragtype << " vers 0x"<< vers
301  << " remapping from ROB 0x" << (*it).second
302  << " to 0x" << ROBid << MSG::dec << endmsg;
303  } else {
304  log << MSG::DEBUG << "TMDB frag 0x" << MSG::hex << fragid
305  << " type 0x" << fragtype << " vers 0x"<< vers
306  << " found in ROB 0x" << (*it).second
307  << " as expected" << MSG::dec << endmsg;
308  }
309  }
310  for (int nf=0; nf<nmod; ++nf) {
311  m_TileMuRcvFrag2ROD[fragid] = ROBid;
312  ++fragid;
313  }
314  }
315  break;
316  }
317 
318  if (fragtype == 6) {
319  fragid += TileCalibUtils::FELIX_FRAGID_OFFSET; // FELIX fragment
320  }
321 
322  FRAGFULLMAP::const_iterator it = m_frag2ROD.find(fragid);
323  if(it == m_frag2ROD.end()){
324  log << MSG::INFO << "New frag 0x" << MSG::hex << fragid
325  << " in ROB 0x" << ROBid << MSG::dec << endmsg;
326  } else {
327  if ( (*it).second[0] != ROBid ) {
328  log << MSG::INFO << "Frag 0x" << MSG::hex << fragid
329  <<" remapping from ROB 0x" << (*it).second[0]
330  << " to 0x" << ROBid << MSG::dec << endmsg;
331  } else {
332  log << MSG::DEBUG << "Frag 0x" << MSG::hex << fragid
333  <<" found in ROB 0x" << (*it).second
334  << " as expected" << MSG::dec << endmsg;
335  }
336  }
337 
338  if (fragid < 0xff) { // all testbeam frags and laser frag
339  ++nBeamFrag;
340  m_frag2ROD[fragid] = {ROBid,fragid};
341  ++beamMap[fragtype];
342  } else if (fragid < 0x100) { // CIS par which can come from two sources
343  ++nBeamFrag;
344  ++beamMap[fragtype];
345  if (fragtype == 0x30) { // CIS par in LAST ROD
346  lascisROB = ROBid;
347  } else {
348  m_frag2ROD[fragid] = {ROBid,fragid}; // separate CIS par in every partition
349  cisparFound = true;
350  }
351  } else if (fragid < 0x500 || fragtype == 6) { // normal drawers
352  ++nRODfrag;
353  int frag_id = this->getOfflineFragID(fragid);
354  if (frag_id < 0) {
355  m_frag2ROD[fragid] = {ROBid,fragid};
356  } else {
357  m_frag2ROD[frag_id][0] = ROBid;
358  }
359  ++fragMap[fragtype];
360  if (fragtype == 4) flags = upperhalf;
361  else if (fragtype == 5) {
362  flags5 = upperhalf;
363  fragIDs.push_back((int)fragid);
364  }
365  }
366  }
367  break;
368  }
369  default:
370  break;
371  }
372  }
373  }
374  }
375  if (!cisparFound) {
376  if (lascisROB) {
377  m_frag2ROD[0xff] = {lascisROB,0xff};
378  log << MSG::INFO << "TileHid2RESrcID: Attention! Taking CISpar from lastROD 0x" << MSG::hex << lascisROB << MSG::dec << endmsg;
379  } else {
380  log << MSG::INFO << "TileHid2RESrcID: no CISpar in the data" << endmsg;
381  }
382  }
383  log << MSG::INFO << "TileHid2RESrcID: " << nBeamFrag << " beam sub-frags (";
384  std::map<int,int>::const_iterator itr=beamMap.begin();
385  std::map<int,int>::const_iterator end=beamMap.end();
386  for (; itr!=end; ++itr) {
387  log << " type=0x" << MSG::hex << itr->first << MSG::dec << " nf="<<itr->second;
388  }
389  log << MSG::INFO << " ) and " << nRODfrag << " ROD sub-frags (";
390  itr=fragMap.begin();
391  end=fragMap.end();
392  for (; itr!=end; ++itr) {
393  log << " type=0x" << MSG::hex << itr->first << MSG::dec << " nf="<<itr->second;
394  if (itr->first < 10) nDataFrag[itr->first]+=itr->second; // id=0 - all digits, id=1 - digits above threshold
395  // id=2,3,4,5 - reco frags
396  }
397  log << " ) was found in the data" << endmsg;
398 
399  if (m_frag2ROD[0x17][0] != 0) m_frag2ROD[0x16] = {m_frag2ROD[0x17][0], 0x16};
400  else if (m_frag2ROD.find(0x16) != m_frag2ROD.end()) m_frag2ROD[0x17][0] = m_frag2ROD[0x16][0];
401 
402  bool of2=true; // default for RUN1 data
403  if (nDataFrag[4]!=0) {
404  if ((flags & 0x3000) < 0x3000) // real data
405  of2 = ((flags & 0x400) != 0);
406  } else if (nDataFrag[5]!=0) {
407  if ((flags5 & 0x3000) < 0x3000) // real data
408  of2 = ((flags5 & 0x400) != 0);
409  }
410  log << MSG::DEBUG << "OF2 flag in data is " << ((of2)?"True":"False") << endmsg;
411 
412  if (of2 != of2Default) {
413  log << MSG::INFO << "Setting OF2 flag in in TileROD_Decoder to " << ((of2) ? "True" : "False")
414  << " instead of " << ((of2Default) ? "True" : "False") << endmsg;
415  of2Default = of2;
416  }
417 
418  updateBSmap();
419 }

◆ setROD2ROBmap() [2/2]

void TileHid2RESrcID::setROD2ROBmap ( const std::vector< std::string > &  ROD2ROB,
MsgStream &  log 
)

Definition at line 172 of file TileHid2RESrcID.cxx.

174 {
175  // overwrite ROD IDs for some frags if they are set in jobOptions
176  // vector ROB2ROD contains (frag,ROB) pairs (note in eformat V3 ROD == ROB ! )
177  int size=ROD2ROB.size();
178  int fragCount = 0;
179  for (int i=1; i<size; i+=2) {
180  uint32_t frag = strtol(ROD2ROB[i-1].data(),NULL,0);
181  uint32_t rob = strtol(ROD2ROB[i].data(),NULL,0) & 0xFFFFFF;
182  if ( frag < 0x2000 ) {
183  // this is actually remapping for fragments inside ROB, bypassing ROD ID
184  int frag_id = this->getOfflineFragID(frag);
185  if (frag_id < 0) {
186  m_frag2ROD[frag] = {rob, frag%0x1000};
187  } else {
188  m_frag2ROD[frag_id][0] = rob;
189  }
190  log << MSG::INFO << "TileHid2RESrcID:: mapping frag 0x"<< MSG::hex
191  << frag << " to ROB 0x" << rob << MSG::dec << endmsg;
192  ++fragCount;
193  } else {
194  log << MSG::ERROR << "You are using obsolete ROD to ROB mapping" << endmsg;
195  log << MSG::ERROR << "Please, replace it by frag -> ROB mapping" << endmsg;
196  assert(0);
197  }
198  }
199  if (fragCount > 0)
200  log << MSG::INFO << "TileHid2RESrcID:: " << fragCount
201  << " frag to ROD remappings set via jobOptions" << endmsg;
202 
203  if (m_frag2ROD[0x17][0] != 0) m_frag2ROD[0x16] = {m_frag2ROD[0x17][0], 0x16};
204  else if (m_frag2ROD.find(0x16) != m_frag2ROD.end()) m_frag2ROD[0x17][0] = m_frag2ROD[0x16][0];
205 }

◆ setTileHWID()

void TileHid2RESrcID::setTileHWID ( const TileHWID tileHWID,
uint32_t  runnum = 0 
)

Definition at line 32 of file TileHid2RESrcID.cxx.

33 {
34  if ( m_tileHWID != tileHWID || m_runnum != runnum) {
35  m_tileHWID = tileHWID;
36  if (m_tileHWID) {
37  // make internal maps
39  }
40  }
41 }

◆ updateBSmap()

void TileHid2RESrcID::updateBSmap ( )
private

Definition at line 536 of file TileHid2RESrcID.cxx.

537 {
538  m_bs2offline.clear();
539  for (auto v : m_frag2ROD) {
540  if (v.second.size()>1) {
541  m_bs2offline[v.second[1]] = v.first;
542  } else {
543  m_bs2offline[v.first] = v.first;
544  }
545  }
546 }

Member Data Documentation

◆ m_bs2offline

BS2OFFLINEMAP TileHid2RESrcID::m_bs2offline
private

Definition at line 98 of file TileHid2RESrcID.h.

◆ m_defaultDrawer

std::vector<uint32_t> TileHid2RESrcID::m_defaultDrawer
private

Definition at line 101 of file TileHid2RESrcID.h.

◆ m_frag2ROD

FRAGFULLMAP TileHid2RESrcID::m_frag2ROD
private

Definition at line 99 of file TileHid2RESrcID.h.

◆ m_runnum

uint32_t TileHid2RESrcID::m_runnum
private

Definition at line 100 of file TileHid2RESrcID.h.

◆ m_tileHWID

const TileHWID* TileHid2RESrcID::m_tileHWID
private

Definition at line 93 of file TileHid2RESrcID.h.

◆ m_TileMuRcvFrag2ROD

FRAGRODMAP TileHid2RESrcID::m_TileMuRcvFrag2ROD
private

Definition at line 97 of file TileHid2RESrcID.h.

◆ m_TileMuRcvRunnum

uint32_t TileHid2RESrcID::m_TileMuRcvRunnum = 0U
private

Definition at line 100 of file TileHid2RESrcID.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TileHid2RESrcID::initialize
void initialize(uint32_t runnum)
Definition: TileHid2RESrcID.cxx:60
python.utils.AtlRunQueryDQUtils.runnum
runnum
Definition: AtlRunQueryDQUtils.py:214
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TileHid2RESrcID::getRodTileMuRcvID
uint32_t getRodTileMuRcvID(int frag_id) const
Definition: TileHid2RESrcID.cxx:586
TileHid2RESrcID::getOfflineFragID
int getOfflineFragID(uint32_t bs_frag_id) const
Retrieve extra info - ByteStream frag ID and drawer typefor a given transient fragment ID.
Definition: TileHid2RESrcID.cxx:524
TILE_NEG_ID
#define TILE_NEG_ID
Definition: TileTBFrag.h:16
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileHid2RESrcID::m_TileMuRcvRunnum
uint32_t m_TileMuRcvRunnum
Definition: TileHid2RESrcID.h:100
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TileHid2RESrcID::updateBSmap
void updateBSmap()
Definition: TileHid2RESrcID.cxx:536
python.LArRecUtilsConfig.flags5
flags5
Definition: LArRecUtilsConfig.py:201
TileHWID::frag
int frag(const HWIdentifier &id) const
extract frag field from HW identifier
Definition: TileHWID.h:181
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TileHWID::ros
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
Definition: TileHWID.h:167
TILE_EBPOS_ID
#define TILE_EBPOS_ID
Definition: TileTBFrag.h:17
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TileHid2RESrcID::m_defaultDrawer
std::vector< uint32_t > m_defaultDrawer
Definition: TileHid2RESrcID.h:101
TileHid2RESrcID::getRodID
uint32_t getRodID(int frag_id) const
make a ROD SrcID for a fragment ID
Definition: TileHid2RESrcID.cxx:464
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
eformat::ROBFragment< const uint32_t * >
lumiFormat.i
int i
Definition: lumiFormat.py:85
TILE_EBNEG_ID
#define TILE_EBNEG_ID
Definition: TileTBFrag.h:18
TileHid2RESrcID::m_bs2offline
BS2OFFLINEMAP m_bs2offline
Definition: TileHid2RESrcID.h:98
TileHWID::drawer_begin
std::vector< HWIdentifier >::const_iterator drawer_begin(void) const
begin iterator for drawer Identifiers
Definition: TileHWID.h:290
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
python.subdetectors.mmg.names
names
Definition: mmg.py:8
TileHid2RESrcID::initializeMuRcv
void initializeMuRcv(uint32_t runnum)
Definition: TileHid2RESrcID.cxx:130
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileHid2RESrcID::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileHid2RESrcID.h:93
TILE_BEAM_ID
#define TILE_BEAM_ID
definition of various fragments expected in BS files from testbeam
Definition: TileTBFrag.h:14
TileCalibUtils::FELIX_FRAGID_OFFSET
static const unsigned int FELIX_FRAGID_OFFSET
Offset for frag ID used for FELIX in frag ID to ROB ID map.
Definition: TileCalibUtils.h:157
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
TILE_POS_ID
#define TILE_POS_ID
Definition: TileTBFrag.h:15
python.PyAthena.v
v
Definition: PyAthena.py:154
TileHid2RESrcID::m_TileMuRcvFrag2ROD
FRAGRODMAP m_TileMuRcvFrag2ROD
Definition: TileHid2RESrcID.h:97
RunTileTBMonitoring.fragIDs
fragIDs
Definition: RunTileTBMonitoring.py:212
TileHWID::drawer
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
Definition: TileHWID.h:171
TileHid2RESrcID::m_frag2ROD
FRAGFULLMAP m_frag2ROD
Definition: TileHid2RESrcID.h:99
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:536
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
TileHWID::drawer_end
std::vector< HWIdentifier >::const_iterator drawer_end(void) const
end iterator for drawer Identifiers
Definition: TileHWID.h:294
COMMON_BEAM_ID
#define COMMON_BEAM_ID
Definition: TileTBFrag.h:19
TileHid2RESrcID::m_runnum
uint32_t m_runnum
Definition: TileHid2RESrcID.h:100