ATLAS Offline Software
TrigCaloDataAccessSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
9 
10 #include <sstream>
11 #include <type_traits>
12 
13 TrigCaloDataAccessSvc::TrigCaloDataAccessSvc( const std::string& name, ISvcLocator* pSvcLocator )
14  : base_class( name, pSvcLocator ),
15  m_bcidAvgKey("CaloBCIDAverage"),
16  m_correctDead(false),
17  m_lateInitDone(false), m_nSlots(0)
18 {
19 }
20 
22 
24  m_autoRetrieveTools = false;
25  m_checkToolDeps = false;
26 
27  CHECK( m_larDecoder.retrieve() );
28  CHECK( m_tileDecoder.retrieve() );
29  CHECK( m_robDataProvider.retrieve() );
34  CHECK( m_regionSelector_TTEM.retrieve() );
36  CHECK( m_bcContKey.initialize() );
38  CHECK( m_regionSelector_TTHEC.retrieve() );
39  CHECK( m_regionSelector_FCALEM.retrieve() );
40  CHECK( m_regionSelector_FCALHAD.retrieve() );
41  CHECK( m_regionSelector_TILE.retrieve() );
45 
46  return StatusCode::SUCCESS;
47 }
48 
50 
51  std::lock_guard<std::mutex> lock( m_initMutex ); // use the initMutex to finalize
52  if ( m_lateInitDone ) { // otherwise nothing to delete
53  m_vrodid32fullDet.clear();
54  for( size_t ii=0;ii<m_vrodid32fullDetHG.size();ii++) { m_vrodid32fullDetHG[ii].clear(); }
55  m_vrodid32fullDetHG.clear();
56  for ( size_t slot = 0; slot < m_nSlots; ++ slot ) {
57  EventContext ec;
58  ec.setSlot( slot );
59  HLTCaloEventCache *cache = m_hLTCaloSlot.get( ec );
60  CHECK( cache->larContainer->finalize() );
61  delete cache->larContainer;
62  CHECK( cache->tileContainer->finalize() );
63  delete cache->tileContainer;
64  cache->d0cells->clear();
65  delete cache->d0cells;
66  cache->lastFSEvent = 0xFFFFFFFF;
67  for (unsigned int i : m_insertedCells) delete cache->fullcont->at(i);
68  delete cache->fullcont;
69  } // end of for slots
70  } // end of m_lateInitDone
71  m_lateInitDone=false;
72  return StatusCode::SUCCESS;
73 }
74 
75 
76 unsigned int TrigCaloDataAccessSvc::prepareFullCollections( const EventContext& context ) {
77 
78  return prepareLArFullCollections( context );
79 
80 }
81 
82 
83 StatusCode TrigCaloDataAccessSvc::loadCollections ( const EventContext& context,
84  const IRoiDescriptor& roi,
85  const DETID detID,
86  const int sampling,
87  LArTT_Selector<LArCellCont>& loadedCells ) {
88 
89  std::vector<IdentifierHash> requestHashIDs;
90 
91  ATH_MSG_DEBUG( "LArTT requested for event " << context << " and RoI " << roi );
92  unsigned int sc = prepareLArCollections( context, roi, sampling, detID );
93 
94  if ( sc ) return StatusCode::FAILURE;
95 
96  {
97  // this has to be guarded because getTT called on the LArCollection bu other threads updates internal map
98  std::lock_guard<std::mutex> getCollClock{ m_hLTCaloSlot.get( context )->mutex };
99  switch ( detID ) {
100  case TTEM: {m_regionSelector_TTEM->lookup(context)->HashIDList( sampling, roi, requestHashIDs ); break; }
101  case TTHEC: {m_regionSelector_TTHEC->lookup(context)->HashIDList( sampling, roi, requestHashIDs ); break; }
102  case FCALEM: {m_regionSelector_FCALEM->lookup(context)->HashIDList( sampling, roi, requestHashIDs ); break; }
103  case FCALHAD: {m_regionSelector_FCALHAD->lookup(context)->HashIDList( sampling, roi, requestHashIDs ); break; }
104  default: break;
105  }
106  }
107 
108  ATH_MSG_DEBUG( "requestHashIDs.size() in LoadColl = " << requestHashIDs.size() << " hash checksum "
109  << std::accumulate( requestHashIDs.begin(), requestHashIDs.end(), IdentifierHash( 0 ),
110  []( IdentifierHash h1, IdentifierHash h2 ){ return h1+h2; } ) );
111  if ( msgLvl( MSG::VERBOSE ) ) {
112  for( unsigned int i = 0 ; i < requestHashIDs.size() ; i++ )
113  ATH_MSG_VERBOSE( "m_rIds[" << i << "]=" << requestHashIDs[i] );
114  }
116  loadedCells.setContainer( ( m_hLTCaloSlot.get( context )->larContainer ) );
117  loadedCells.setMap( *roimap );
118 
119  {
120  // this has to be guarded because getTT called on the LArCollection bu other threads updates internal map
121  std::lock_guard<std::mutex> getCollClock{ m_hLTCaloSlot.get( context )->mutex };
122  loadedCells.setRoIs( requestHashIDs );
123  }
124  if ( sc ) return StatusCode::FAILURE;
125  else return StatusCode::SUCCESS;
126 }
127 
129  const IRoiDescriptor& roi,
130  std::vector<const TileCell*>& loadedCells ) {
131  std::vector<IdentifierHash> requestHashIDs;
132 
133  ATH_MSG_DEBUG( "Tile requested for event " << context << " and RoI " << roi );
134  unsigned int sc = prepareTileCollections( context, roi );
135 
136  if ( sc ) return StatusCode::FAILURE;
137 
138  {
139  // this has to be guarded because getTT called on the LArCollection bu other threads updates internal map
140  std::lock_guard<std::mutex> getCollClock{ m_hLTCaloSlot.get( context )->mutex };
141  m_regionSelector_TILE->lookup(context)->HashIDList( roi, requestHashIDs );
142  }
143  ATH_MSG_DEBUG( "requestHashIDs.size() in LoadColl = " << requestHashIDs.size() << " hash checksum "
144  << std::accumulate( requestHashIDs.begin(), requestHashIDs.end(), IdentifierHash( 0 ),
145  []( IdentifierHash h1, IdentifierHash h2 ){ return h1+h2; } ) );
146  if ( msgLvl( MSG::VERBOSE ) ) {
147  for( unsigned int i = 0 ; i < requestHashIDs.size() ; i++ )
148  ATH_MSG_VERBOSE( "requestHashIDs[" << i << "]=" << requestHashIDs[i] );
149  }
150  size_t listIDsize = requestHashIDs.size();
151  HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
152  TileCellCont* tilecell = cache->tileContainer;
153  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
154  loadedCells.clear(); // should reserve
155  for (size_t i = 0; i < listIDsize; ++i){
156  // Find the collection to dump
157  const std::vector<TileCellCollection*>::const_iterator it =
158  (tilecell->find(requestHashIDs[i]));
159  TileCellCollection* col = *it;
160  if ( col == nullptr ) continue;
161  TileCellCollection::const_iterator itt = (*it)->begin();
162  TileCellCollection::const_iterator End = (*it)->end();
163  for (;itt!=End;++itt){
164  const TileCell* cell = (const TileCell*)*itt;
165  loadedCells.push_back( cell );
166  } // End of for printout cells
167  }
168 
169  return StatusCode::SUCCESS;
170 }
171 
172 
174  CaloConstCellContainer& cont ) {
175 
176  // Gets all data
177  {
178  std::lock_guard<std::mutex> dataPrepLock { m_dataPrepMutex };
179  m_robDataProvider->addROBData( context, m_vrodid32fullDet );
180  }
181  {
182  std::lock_guard<std::mutex> dataPrepLock { m_dataPrepMutex };
183  m_robDataProvider->addROBData( context, m_vrodid32tile );
184  }
185 
186  unsigned int sc = prepareLArFullCollections( context );
187  ATH_CHECK( sc == 0 );
188 
189  sc = prepareTileFullCollections( context );
190  ATH_CHECK( sc == 0 );
191 
192  m_hLTCaloSlot.get(context)->lastFSEvent = context.evt();
193 
194  std::lock_guard<std::mutex> getCollClock{ m_getCollMutex };
195  CaloCellContainer* cont_to_copy = m_hLTCaloSlot.get(context)->fullcont ;
196  cont.clear();
197  cont.reserve( cont_to_copy->size() );
198  for( const CaloCell* c : *cont_to_copy ) cont.push_back_fast( c );
199  cont.setIsOrdered(true);
200  cont.setIsOrderedAndComplete(true);
201 
202  ATH_CHECK( sc == 0 );
203 
204  return StatusCode::SUCCESS;
205 }
206 
207 
208 unsigned int TrigCaloDataAccessSvc::prepareLArFullCollections( const EventContext& context) {
209 
210  ATH_MSG_DEBUG( "Full Col " << " requested for event " << context );
211  if ( !m_lateInitDone && lateInit(context) ) {
212  ATH_MSG_ERROR("Could not execute late init");
213  return 0x1; // dummy code
214  }
215 
216  HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
217 
218  auto lockTime = Monitored::Timer ( "TIME_locking_LAr_FullDet" );
219  std::lock_guard<std::mutex> collectionLock { cache->mutex };
220  lockTime.stop();
221 
222  if ( cache->lastFSEvent == context.evt() ) return 0x0; // dummy code
223  cache->larContainer->eventNumber( context.evt() ) ;
224  if ( m_applyOffsetCorrection && cache->larContainer->lumiBCIDCheck( context ) ) {
227  const CaloBCIDAverage* avgPtr = avg.cptr();
228  const LArOnOffIdMapping* onoffPtr = onoff.cptr();
229  if ( avgPtr && onoffPtr ) cache->larContainer->updateBCID( *avgPtr, *onoffPtr );
230  }
231 
232 
233  unsigned int status(0);
234 
235  const LArDeadOTXFromSC* deadHandle = nullptr;
236  if ( m_correctDead ){
238  if ( !deadHdl.isValid() ){
239  ATH_MSG_WARNING("Should not try to use LArDEADOTXFromSC" );
240  } else {
241  deadHandle = deadHdl.cptr();
242  }
243  }
244 
245  for( size_t ii=0;ii<m_vrodid32fullDetHG.size();ii++) {
246  std::vector<uint32_t>& vrodid32fullDet = m_vrodid32fullDetHG[ii];
247  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
248  {
249  std::lock_guard<std::mutex> dataPrepLock { m_dataPrepMutex };
250  // To be confirmed whether we need this or not
251  m_robDataProvider->addROBData( context, vrodid32fullDet );
252  m_robDataProvider->getROBData( context, vrodid32fullDet, robFrags );
253  }
254 
255  status |= convertROBs( robFrags, ( cache->larContainer ), (cache->larRodBlockStructure_per_slot), cache->rodMinorVersion, cache->robBlockType, deadHandle );
256 
257  if ( vrodid32fullDet.size() != robFrags.size() ) {
258  ATH_MSG_DEBUG( "Missing ROBs, requested " << vrodid32fullDet.size() << " obtained " << robFrags.size() );
259  //status |= 0x1; // dummy code
260  clearMissing( vrodid32fullDet, robFrags, ( cache->larContainer ) );
261  }
262  } // end of for m_vrodid32fullDetHG.size()
263 
264  int detid(0);
265  auto detidMon = Monitored::Scalar<int>( "det", detid );
266 
267  Monitored::Group( m_monTool, lockTime, detidMon );
268  return status;
269 }
270 
271 unsigned int TrigCaloDataAccessSvc::prepareTileFullCollections( const EventContext& context) {
272 
273  ATH_MSG_DEBUG( "Full Col " << " requested for event " << context );
274  if ( !m_lateInitDone && lateInit(context) ) {
275  ATH_MSG_ERROR("Could not execute late init");
276  return 0x1; // dummy code
277  }
278 
279  HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
280 
281  auto lockTime = Monitored::Timer ( "TIME_locking_LAr_FullDet" );
282  std::lock_guard<std::mutex> collectionLock { cache->mutex };
283  lockTime.stop();
284 
285  if ( cache->lastFSEvent == context.evt() ) return 0x0;
286  if ( cache->tileContainer->eventNumber() != context.evt() )
287  cache->d0cells->clear();
288  cache->tileContainer->eventNumber( context.evt() );
289 
290  unsigned int status(0);
291  convertROBs( context, m_rIdstile, cache->tileContainer, cache->d0cells );
292 
293  int detid(0);
294  auto detidMon = Monitored::Scalar<int>( "det", detid );
295 
296  Monitored::Group( m_monTool, lockTime, detidMon );
297  return status;
298 }
299 
300 unsigned int TrigCaloDataAccessSvc::lateInit(const EventContext& context) { // non-const this thing
301 
302  std::lock_guard<std::mutex> lock( m_initMutex );
303  if ( m_lateInitDone )
304  return 0x0; // dummy code
305 
306  ATH_MSG_DEBUG( "Performing late init" );
307 
308  // allocate collections
310 
311  // preparing full container list of ROBs - tile will be included soon
312  std::vector<uint32_t> vrodid32lar;
313  std::vector<uint32_t> vrodid32em;
314  std::vector<uint32_t> vrodid32hec;
315  std::vector<uint32_t> vrodid32hec0;
316  std::vector<uint32_t> vrodid32hec1;
317  std::vector<uint32_t> vrodid32hec2;
318  std::vector<uint32_t> vrodid32hec3;
319  std::vector<uint32_t> vrodid32fcalem;
320  std::vector<uint32_t> vrodid32fcalhad;
321 
322  TrigRoiDescriptor tmproi(true);
323  std::vector<uint32_t> vrodid32tile;
324  std::vector<IdentifierHash> rIdstile;
325  // TTEM
326  m_regionSelector_TTEM->lookup(context)->ROBIDList(-1,tmproi,vrodid32em);
327  // TTHEC
328  m_regionSelector_TTHEC->lookup(context)->ROBIDList(0,tmproi,vrodid32hec0);
329  m_regionSelector_TTHEC->lookup(context)->ROBIDList(1,tmproi,vrodid32hec1);
330  m_regionSelector_TTHEC->lookup(context)->ROBIDList(2,tmproi,vrodid32hec2);
331  m_regionSelector_TTHEC->lookup(context)->ROBIDList(3,tmproi,vrodid32hec3);
332  // FCALHAD
333  m_regionSelector_FCALEM->lookup(context)->ROBIDList(-1,tmproi,vrodid32fcalem);
334  m_regionSelector_FCALHAD->lookup(context)->ROBIDList(-1,tmproi,vrodid32fcalhad);
335  m_regionSelector_TILE->lookup(context)->ROBIDList(tmproi,vrodid32tile);
336  m_regionSelector_TILE->lookup(context)->HashIDList(tmproi,rIdstile);
337 
338  m_vrodid32tile.resize( vrodid32tile.size() );
339  m_rIdstile.resize(rIdstile.size() );
340  // Tile RODs and ID coming from the Tile tables are not unique
341  // iii and iij are local variables helping to clear non-unique IDs
342  auto iii = std::unique_copy(vrodid32tile.begin(),vrodid32tile.end(),m_vrodid32tile.begin());
343  auto iij = std::unique_copy(rIdstile.begin(),rIdstile.end(),m_rIdstile.begin());
344  std::sort( m_vrodid32tile.begin(), iii );
345  std::sort( m_rIdstile.begin(), iij );
346  iii = std::unique_copy(m_vrodid32tile.begin(),iii,m_vrodid32tile.begin());
347  iij = std::unique_copy(m_rIdstile.begin(),iij,m_rIdstile.begin());
348  m_vrodid32tile.resize( std::distance(m_vrodid32tile.begin(), iii) );
349  m_rIdstile.resize( std::distance(m_rIdstile.begin(), iij) );
350 
351  vrodid32lar.insert(vrodid32lar.end(),vrodid32em.begin(),vrodid32em.end());
352  vrodid32hec.insert(vrodid32hec.end(),vrodid32hec0.begin(),vrodid32hec0.end());
353  vrodid32lar.insert(vrodid32lar.end(),vrodid32hec.begin(),vrodid32hec.end());
354  vrodid32lar.insert(vrodid32lar.end(),vrodid32fcalhad.begin(),vrodid32fcalhad.end());
355  vrodid32lar.insert(vrodid32lar.end(),vrodid32fcalem.begin(),vrodid32fcalem.end());
356  m_vrodid32fullDet.insert(m_vrodid32fullDet.end(), vrodid32lar.begin(), vrodid32lar.end() );
357 
358 
359  SG::ReadCondHandle<LArMCSym> mcsym (m_mcsymKey, context);
361  SG::ReadCondHandle<LArBadChannelCont> larBadChan{ m_bcContKey, context };
364  SG::ReadCondHandle<TileHid2RESrcID> tileHid2RESrcID ( m_tileHid2RESrcIDKey, context);
365 
366  unsigned int nFebs=70;
367  unsigned int high_granu = (unsigned int)ceilf(m_vrodid32fullDet.size()/((float)nFebs) );
368  unsigned int jj=0;
369  unsigned int kk=0;
370  m_vrodid32fullDetHG.resize(high_granu);
371  for( unsigned int ii=0; ii<m_vrodid32fullDet.size();ii++){
372  if ( kk >= nFebs ) {
373  kk-=nFebs;
374  jj++;
375  }
376  std::vector<uint32_t> & vec = m_vrodid32fullDetHG.at(jj);
377  vec.push_back(m_vrodid32fullDet[ii]);
378  kk++;
379  }
381  const CaloDetDescrManager* theCaloDDM = *caloMgrHandle;
382  const CaloCell_ID* theCaloCCIDM = theCaloDDM->getCaloCell_ID();
383  unsigned int hashMax = theCaloCCIDM->calo_cell_hash_max();
384 
385  // Prepare cache containers to be used for LAr unpacking.
386  for ( size_t slot = 0; slot < m_nSlots; ++ slot ) {
387  EventContext ec;
388  ec.setSlot( slot );
389  HLTCaloEventCache *cache = m_hLTCaloSlot.get( ec );
390  cache->larContainer = new LArCellCont();
391  cache->larRodBlockStructure_per_slot = nullptr;
392  if ( cache->larContainer->initialize( **roimap, **onoff, **mcsym, **febrod, **larBadChan, *theCaloDDM).isFailure() )
393  return 0x1; // dummy code
394  std::vector<CaloCell*> local_cell_copy;
395  local_cell_copy.reserve(200000);
396  LArCellCont* larcell = cache->larContainer;
397  cache->lastFSEvent = 0xFFFFFFFF;
399  cachefullcont->reserve(190000);
400  const LArBadChannelCont& badchannel = **larBadChan;
401  for(unsigned int lcidx=0; lcidx < larcell->size(); lcidx++){
402  LArCellCollection* lcc = larcell->at(lcidx);
403  unsigned int lccsize = lcc->size();
404  for(unsigned int lccidx=0; lccidx<lccsize; lccidx++){
405  CaloCell* cell = ((*lcc).at(lccidx));
406  if ( cell && cell->caloDDE() ) {
407  LArBadChannel bc = badchannel.offlineStatus(cell->ID());
408  bool good(true);
409  if (! bc.good() ){
410  // cell has some specific problems
411  if ( bc.unstable() ) good=false;
412  if ( bc.highNoiseHG() ) good=false;
413  if ( bc.highNoiseMG() ) good=false;
414  if ( bc.highNoiseLG() ) good=false;
415  if ( bc.problematicForUnknownReason() ) good=false;
416  }
417  if ( good ) local_cell_copy.push_back( cell );
418  }
419  } // end of loop over cells
420  } // end of loop over collection
421 
422 // This should stay here as this will be enabled when tile is ready to be decoded as well
423  TileCellCont* tilecell = new TileCellCont();
424  cache->tileContainer = tilecell;
425  tilecell->setHashIdToROD( *tileHid2RESrcID );
426  if( tilecell->initialize().isFailure() ) return 0x1; //dummy code
427  for (unsigned int i=0;i<4;i++) {
428  m_tileDecoder->loadRw2Cell ( i, tilecell->Rw2CellMap(i) );
429  m_tileDecoder->loadRw2Pmt ( i, tilecell->Rw2PmtMap (i) );
430  }
431  m_tileDecoder->loadMBTS( tilecell->MBTS_map(), tilecell->MBTS_channel() );
432  m_mbts_rods = tilecell->MBTS_RODs();
433  for(size_t i = 0 ; i < m_mbts_rods->size(); i++)
434  m_mbts_add_rods.insert(m_mbts_add_rods.end(),(*m_mbts_rods).begin(),(*m_mbts_rods).end());
435  sort(m_mbts_add_rods.begin(),m_mbts_add_rods.end());
436  m_mbts_add_rods.erase(std::unique(m_mbts_add_rods.begin(),m_mbts_add_rods.end()),m_mbts_add_rods.end());
438  for(unsigned int lcidx=0; lcidx < tilecell->size(); lcidx++){
439  TileCellCollection* lcc = tilecell->at(lcidx);
440  unsigned int lccsize = lcc->size();
441  for(unsigned int lccidx=0; lccidx<lccsize; lccidx++){
442  CaloCell* cell = ((*lcc).at(lccidx));
443  if ( cell ) local_cell_copy.push_back( cell );
444  } // end of loop over cells
445  TileRawChannelCollection::ID frag_id = ((*lcc).identify() & 0x0FFF);
446  int ros = (frag_id >> 8);
447  if ( ros == 1 ) { //treatment for d0Cells in barrel
448  int drawer = (frag_id & 0xFF);
449  TileCellCollection::iterator pCell = lcc->begin();
450  pCell+=2;
451  d0cellsp->m_cells[drawer] = *pCell;
452  }
453  } // end of loop over collection
454 
455  // d0merge cells
456  cache->d0cells = d0cellsp;
457 
458  // For the moment the container has to be completed by hand (again, because of tile)
459  for(unsigned int i=0;i<hashMax;i++){
460  cachefullcont->push_back_fast(nullptr);
461  }
462 
463  unsigned int localcellMax = local_cell_copy.size();
464  for(unsigned int i=0;i<localcellMax;i++){
465  unsigned int j = local_cell_copy.at(i)->caloDDE()->calo_hash();
466  if ( j < hashMax ) {
467  cachefullcont->at(j) = local_cell_copy.at(i);
468  }
469  }
470  for(unsigned int i=0;i<hashMax;i++)
471  if ( cachefullcont->at(i) == nullptr ){
472  Identifier id = theCaloCCIDM->cell_id(i);
473  if ( id!=0 ){
474  const CaloDetDescrElement* el = theCaloDDM->get_element(id);
475  if ( el->is_tile() ) {
476  cachefullcont->at(i) = new TileCell(el,0,0,0,0,CaloGain::TILEHIGHHIGH);
477  } else {
478  cachefullcont->at(i) = new LArCell(el,0,0,0,(CaloGain::CaloGain)0);
479  }
480 
481  if (slot==0) m_insertedCells.push_back(i);
482  }
483  }
484 
485  cachefullcont->setHasCalo(CaloCell_ID::LAREM);
486  cachefullcont->setHasCalo(CaloCell_ID::LARHEC);
487  cachefullcont->setHasCalo(CaloCell_ID::LARFCAL);
488  cachefullcont->setHasCalo(CaloCell_ID::TILE); //lying... But this needs to be checked later
489 
490  // make sure this "map" container has a good hashID
491  cachefullcont->order();
492 
493  if ( hashMax != cachefullcont->size() )
494  ATH_MSG_ERROR("Problem in the size of the full container");
495  cachefullcont->setIsOrdered(true);
496  cachefullcont->setIsOrderedAndComplete(true);
497  cache->fullcont = cachefullcont;
498 
499  local_cell_copy.clear();
500  }
501  m_lateInitDone = true;
502  return 0x0;
503 }
504 
505 unsigned int TrigCaloDataAccessSvc::convertROBs( const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags,
506  LArCellCont* larcell, LArRodBlockStructure*& larRodBlockStructure_per_slot,
507  uint16_t rodMinorVersion, uint32_t robBlockType, const LArDeadOTXFromSC* deadHandle ) {
508 
509  unsigned int status(0);
510  for ( auto rob: robFrags ) {
511  uint32_t sourceID = rob->source_id();
512  const std::vector<LArCellCollection*>::const_iterator it = larcell->find( sourceID );
513  //TB The find also switches the state of the collection to "decoded" so repeated decoding is avoided
514 
515  if ( it != larcell->end() && ( *it )->size() != 0 ) { // Already decoded collection
516 
517  // TB if we have entered here it means the decoding did not occur yet ( or failed )
518  //
519  LArCellCollection* coll = *it;
520  ATH_MSG_DEBUG( "ROB of ID " << sourceID << " to be decoded" );
521 
522  std::lock_guard<std::mutex> decoderLock( m_lardecoderProtect );
523  //TB next two lines seem danger, as they seem to rely on the decoder state
524  const HWIdentifier& feb_id_local = larcell->findsec( sourceID );
525  m_larDecoder->setsecfeb( feb_id_local );
526  if ( ! m_larDecoder->check_valid( rob, msg() ) ){
527  ATH_MSG_WARNING( "Error reading bytestream"<<
528  "event: Bad ROB block ( eformat checks ) : 0x"
529  << std::hex << sourceID << std::dec );
530  // Data seems corrupted
531  //status |= 0x1; // dummy code
532  reset_LArCol ( coll );
533 
534  } else {
535  // Get Rod Data and size of fragment
536  const uint32_t* roddata = 0;
537  rob->rod_data( roddata );
538  size_t roddatasize = rob->rod_ndata();
539  if ( roddatasize < 3 ) {
540  ATH_MSG_WARNING( "Error reading bytestream"<<
541  "event: Empty ROD block ( less than 3 words ) : 0x"
542  << std::hex << sourceID << std::dec );
543  // Data seems corrupted
544  //status |= 0x1; // dummy code
545  reset_LArCol ( coll );
546  } else { // End of if small size
547  //TB the converter has state
548  m_larDecoder->fillCollectionHLT( *rob, roddata, roddatasize, *coll, larRodBlockStructure_per_slot, rodMinorVersion, robBlockType );
549  if ( deadHandle ){
550  if ( deadHandle->isThisOTXdead(feb_id_local) ) {
551  const std::vector<float>& corr = deadHandle->correctionFromThisOTXdead(feb_id_local);
552  // The sizes here are guaranteed by construction
553  for(size_t i=0;i<128;i++) {
554  (*coll)[i+128]->set(corr[i],0,0,0x1000,CaloGain::LARHIGHGAIN);
555  }
556  }
557  HWIdentifier feb_id_local2(larRodBlockStructure_per_slot->getFEBID());
558  if ( deadHandle->isThisOTXdead(feb_id_local2) ) {
559  const std::vector<float>& corr = deadHandle->correctionFromThisOTXdead(feb_id_local2);
560  // The sizes here are guaranteed by construction
561  for(size_t i=0;i<128;i++) (*coll)[i]->set(corr[i],0,0,0x1000,CaloGain::LARHIGHGAIN);
562 
563  }
564  }
565 
566  // Accumulates inferior byte from ROD Decoder
567  // TB the converter has state
568  //status |= (m_larDecoder->report_error());
569 
570  if ( m_applyOffsetCorrection ) larcell->applyBCIDCorrection( sourceID );
571  }
572 
573  }
574  } else {
575  ATH_MSG_VERBOSE( "ROB of ID " << sourceID << " already decoded" );
576  }
577  }
578  ATH_MSG_DEBUG( "finished decoding" );
579  return status;
580 }
581 
582 unsigned int TrigCaloDataAccessSvc::convertROBs( const EventContext& context,
583  const std::vector<IdentifierHash>& rIds,
584  TileCellCont* tilecell,
585  TileROD_Decoder::D0CellsHLT* d0cells) {
586  unsigned int status(0);
587  TileCellCollection* mbts = tilecell->MBTS_collection();
588  const TileHid2RESrcID* hid2re = tilecell->getHashIdToROD();
589 
590  size_t listIDsize = rIds.size();
591  std::vector<unsigned int> tile; tile.push_back(0);
592  // Tile likes rob by rob
593  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags1;
594  for (size_t i = 0; i < listIDsize; ++i){
595  tile[0] = tilecell->find_rod(rIds[i]);
596  m_robDataProvider->getROBData(context,tile,robFrags1);
597  // Number of ROBs smaller than requested is below
598  //if ( robFrags1.empty() ) m_error|=0x10000000;
599  // Find the collection to fill
600  const std::vector<TileCellCollection*>::const_iterator it =
601  (tilecell->find(rIds[i]));
602  TileCellCollection* col = *it;
603  if ( robFrags1.size()!=0 && col != nullptr ) {
604  size_t roddatasize = robFrags1[0]->rod_ndata();
605  // insert data into vector (to be removed soon)
606  if (roddatasize < 3) {
607  ATH_MSG_WARNING( "Error reading bytestream"<<
608  "event: Empty ROD block (less than 3 words) : 0x"
609  << std::hex << tile[0] << std::dec );
610  msg(MSG::WARNING) << "Error reading bytestream "
611  << "event: Empty ROD block (less than 3 words) : 0x"
612  << std::hex << tile[0] << std::dec << endmsg;
613  // Data seems corrupted
614  //m_error|=0x20000000;
615  if ( !tilecell->cached(rIds[i])){
616  // resets collection
617  reset_TileCol(col);
618  }
619  robFrags1.clear();
620  } else {// End of if small size
621  std::lock_guard<std::mutex> decoderLock { m_tiledecoderProtect };
622  if ( !tilecell->cached(rIds[i]))
623  m_tileDecoder->fillCollectionHLT(robFrags1[0],*col,*d0cells,mbts,hid2re);
624  m_tileDecoder->mergeD0cellsHLT(*d0cells,*col);
625  // Accumulates superior byte from ROD Decoder
626  //m_error|=m_tileDecoder->report_error();
627  robFrags1.clear();
628  } // end of else
629  } // end of if robFrags1.size
630  } // End of for through RobFrags
631 
632  ATH_MSG_DEBUG( "finished decoding" );
633  return status;
634 }
635 
636 void TrigCaloDataAccessSvc::missingROBs( const std::vector<uint32_t>& request,
637  const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
638  std::set<uint32_t>& missing ) const {
639 
640  std::set<uint32_t> receivedROBsSet;
641  for ( auto rob: response )
642  receivedROBsSet.insert( rob->source_id() );
643  std::set<uint32_t> requestedROBsSet( request.begin(), request.end() );
644 
645  std::set_difference( requestedROBsSet.begin(), requestedROBsSet.end(),
646  receivedROBsSet.begin(), receivedROBsSet.end(),
647  std::inserter( missing, missing.begin() ) );
648 }
649 
650 
651 void TrigCaloDataAccessSvc::clearMissing( const std::vector<uint32_t>& request,
652  const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
653  LArCellCont* larcell ) {
654  std::set<uint32_t> missing;
655  missingROBs( request, response, missing );
656  for ( uint32_t robID : missing ) {
657  const std::vector<LArCellCollection*>::const_iterator it = larcell->find( robID );
658  if ( it != larcell->end() && ( *it )->size()!=0 ) { // Already decoded collection
659  reset_LArCol ( *it );
660  }
661  }
662 }
663 
664 
665 unsigned int TrigCaloDataAccessSvc::prepareLArCollections( const EventContext& context,
666  const IRoiDescriptor& roi,
667  const int sampling,
668  DETID detector ) {
669 
670  // If the full event was already unpacked, don't need to unpack RoI
671  if ( !m_lateInitDone && lateInit(context) ) {
672  return 0x1; // dummy code
673  }
674  HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
675  if ( cache->lastFSEvent == context.evt() ) return 0x0;
676 
677  std::vector<uint32_t> requestROBs;
678 
679  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
680  {
681  std::lock_guard<std::mutex> dataPrepLock { m_dataPrepMutex };
682  switch ( detector ) {
683  case TTEM: {m_regionSelector_TTEM->lookup(context)->ROBIDList( sampling, roi, requestROBs ); break; }
684  case TTHEC: {m_regionSelector_TTHEC->lookup(context)->ROBIDList( sampling, roi, requestROBs ); break; }
685  case FCALEM: {m_regionSelector_FCALEM->lookup(context)->ROBIDList( sampling, roi, requestROBs ); break; }
686  case FCALHAD: {m_regionSelector_FCALHAD->lookup(context)->ROBIDList( sampling, roi, requestROBs ); break; }
687  default: break;
688  }
689 
690  m_robDataProvider->addROBData( context, requestROBs );
691  m_robDataProvider->getROBData( context, requestROBs, robFrags );
692  }
693  if ( robFrags.empty() && (!requestROBs.empty()) ) {
694  return 0x0; // dummy code
695  }
696 
697  auto lockTime = Monitored::Timer ( "TIME_locking_LAr_RoI" );
698  std::lock_guard<std::mutex> collectionLock { cache->mutex };
699  lockTime.stop();
700 
701  // TB, what would happen from now inside the collection unapcking
702  // if this event number is different than the one for each collection the unpacking will happen,
703  // if it is the same the unpacking will not be repeated
704  // same in prepareLArFullCollections
705  cache->larContainer->eventNumber( context.evt() );
706  if ( m_applyOffsetCorrection && cache->larContainer->lumiBCIDCheck( context ) ) {
709  const CaloBCIDAverage* avgPtr = avg.cptr();
710  const LArOnOffIdMapping* onoffPtr = onoff.cptr();
711  if ( avgPtr && onoffPtr ) cache->larContainer->updateBCID( *avgPtr, *onoffPtr );
712  }
713 
714  const LArDeadOTXFromSC* deadHandle = nullptr;
715  if ( m_correctDead ){
717  if ( !deadHdl.isValid() ){
718  ATH_MSG_WARNING("Should not try to use LArDEADOTXFromSC" );
719  } else {
720  deadHandle = deadHdl.cptr();
721  }
722  }
723 
724  unsigned int status = convertROBs( robFrags, ( cache->larContainer ), (cache->larRodBlockStructure_per_slot), cache->rodMinorVersion, cache->robBlockType, deadHandle );
725 
726  if ( requestROBs.size() != robFrags.size() ) {
727  ATH_MSG_DEBUG( "Missing ROBs, requested " << requestROBs.size() << " obtained " << robFrags.size() );
728  //status |= 0x1; // dummy code
729  clearMissing( requestROBs, robFrags, ( cache->larContainer ) );
730  }
731  auto roiROBs = Monitored::Scalar( "roiROBs_LAr", robFrags.size() );
732  auto roiEta = Monitored::Scalar( "roiEta_LAr", roi.eta() );
733  auto roiPhi = Monitored::Scalar( "roiPhi_LAr", roi.phi() );
734 
735  Monitored::Group( m_monTool, lockTime, roiEta, roiPhi, roiROBs );
736  return status;
737 }
738 
739 unsigned int TrigCaloDataAccessSvc::prepareTileCollections( const EventContext& context,
740  const IRoiDescriptor& roi) {
741 
742  // If the full event was already unpacked, don't need to unpack RoI
743  if ( !m_lateInitDone && lateInit(context) ) {
744  return 0x1; // dummy code
745  }
746  HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
747  if ( cache->lastFSEvent == context.evt() ) return 0x0;
748 
749  std::vector<uint32_t> requestROBs;
750  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
751  std::vector<IdentifierHash> rIds;
752  {
753  std::lock_guard<std::mutex> dataPrepLock { m_dataPrepMutex };
754  m_regionSelector_TILE->lookup(context)->ROBIDList( 0, roi, requestROBs );
755  m_regionSelector_TILE->lookup(context)->HashIDList(roi, rIds);
756  m_robDataProvider->addROBData( context, requestROBs );
757  }
758 
759 
760  std::lock_guard<std::mutex> collectionLock { cache->mutex };
761  if ( cache->tileContainer->eventNumber() != context.evt() )
762  cache->d0cells->clear();
763  cache->tileContainer->eventNumber( context.evt() );
764 
765  unsigned int status = convertROBs( context, rIds, cache->tileContainer, cache->d0cells );
766 
767  return status;
768 }
769 
770 unsigned int TrigCaloDataAccessSvc::prepareMBTSCollections( const EventContext& context) {
771 
772  // If the full event was already unpacked, don't need to unpack RoI
773  if ( !m_lateInitDone && lateInit(context) ) {
774  return 0x0; // dummy code
775  }
776  HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
777  if ( cache->lastFSEvent == context.evt() ) return 0x0;
778 
779  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
780  {
781  std::lock_guard<std::mutex> dataPrepLock { m_dataPrepMutex };
782  m_robDataProvider->addROBData( context, m_mbts_add_rods );
783  }
784  std::lock_guard<std::mutex> collectionLock { cache->mutex };
785  TileCellCont* tilecell = cache->tileContainer;
786  if ( cache->tileContainer->eventNumber() != context.evt() )
787  cache->d0cells->clear();
788  cache->tileContainer->eventNumber( context.evt() );
789 
790  const std::vector<unsigned int>* ids = tilecell->MBTS_IDs();
791  std::vector<IdentifierHash> tileIds;
792  for(size_t i=0;i<ids->size(); i++) tileIds.push_back( (*ids)[i] );
793  unsigned int status = convertROBs( context, tileIds, cache->tileContainer, cache->d0cells );
794 
795  return status;
796 }
797 
798 
799 
800 StatusCode TrigCaloDataAccessSvc::loadMBTS ( const EventContext& context,
801  std::vector<const TileCell*>& loadedCells ) {
802 
803  ATH_MSG_DEBUG( "MBTS requested for event " << context );
804  unsigned int sc = prepareMBTSCollections(context);
805 
806  if ( sc ) return StatusCode::FAILURE;
807 
808  HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
809  std::lock_guard<std::mutex> collectionLock { cache->mutex };
810  TileCellCont* tilecell = cache->tileContainer;
811  TileCellCollection* mbts = tilecell->MBTS_collection();
812  loadedCells.reserve(mbts->size());
813  for (size_t i=0;i<mbts->size(); ++i)
814  loadedCells.push_back(mbts->at(i));
815  return StatusCode::SUCCESS;
816 
817 }
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
LArRodBlockStructure
Definition: LArRodBlockStructure.h:48
TileCellCont::find_rod
unsigned int find_rod(const unsigned int &id) const
Definition: TileCellCont.cxx:221
TileCell
Definition: TileCell.h:57
IRoiDescriptor::phi
virtual double phi() const =0
Methods to retrieve data members.
TrigCaloDataAccessSvc::reset_TileCol
void reset_TileCol(TileCellCollection *col)
Definition: TrigCaloDataAccessSvc.h:102
TrigCaloDataAccessSvc::HLTCaloEventCache::mutex
std::mutex mutex
Definition: TrigCaloDataAccessSvc.h:132
TrigCaloDataAccessSvc::m_onOffIdMappingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdMappingKey
Definition: TrigCaloDataAccessSvc.h:83
TTHEC
@ TTHEC
Definition: RegSelEnums.h:29
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:43
TrigCaloDataAccessSvc::m_regionSelector_TILE
ToolHandle< IRegSelTool > m_regionSelector_TILE
Definition: TrigCaloDataAccessSvc.h:75
TrigCaloDataAccessSvc::m_insertedCells
std::vector< unsigned int > m_insertedCells
Definition: TrigCaloDataAccessSvc.h:144
TrigCaloDataAccessSvc::m_regionSelector_TTEM
ToolHandle< IRegSelTool > m_regionSelector_TTEM
Definition: TrigCaloDataAccessSvc.h:71
LArBadChannel::good
bool good() const
Returns true if no problems at all (all bits at zero)
Definition: LArBadChannel.h:91
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TileCellCont::MBTS_RODs
const std::vector< unsigned int > * MBTS_RODs()
Definition: TileCellCont.h:56
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
TrigCaloDataAccessSvc::m_tileHid2RESrcIDKey
SG::ReadCondHandleKey< TileHid2RESrcID > m_tileHid2RESrcIDKey
Definition: TrigCaloDataAccessSvc.h:93
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
TileCellCollection
Definition: TileCellCollection.h:12
HLTSeedingRoIToolDefs::roiPhi
constexpr float roiPhi(const AnyRoIPointer &roi)
Definition: HLTSeedingRoIToolDefs.h:167
TrigCaloDataAccessSvc::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigCaloDataAccessSvc.h:68
TrigCaloDataAccessSvc::HLTCaloEventCache::larContainer
LArCellCont * larContainer
Definition: TrigCaloDataAccessSvc.h:133
LArTT_Selector::setContainer
void setContainer(const CONTAINER *c)
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
TrigCaloDataAccessSvc::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: TrigCaloDataAccessSvc.h:91
TrigCaloDataAccessSvc::clearMissing
void clearMissing(const std::vector< uint32_t > &request, const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &response, LArCellCont *larcell)
clear fragments of the collection for which ROBs were not available
Definition: TrigCaloDataAccessSvc.cxx:651
TrigCaloDataAccessSvc::m_lardecoderProtect
std::mutex m_lardecoderProtect
Definition: TrigCaloDataAccessSvc.h:151
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
response
MDT_Response response
Definition: MDT_ResponseTest.cxx:28
TrigCaloDataAccessSvc::m_getCollMutex
std::mutex m_getCollMutex
Definition: TrigCaloDataAccessSvc.h:150
TileCellCont::getHashIdToROD
const TileHid2RESrcID * getHashIdToROD() const
Definition: TileCellCont.h:67
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
TRTCalib_cfilter.detector
detector
Definition: TRTCalib_cfilter.py:241
LArCellCont::lumiBCIDCheck
bool lumiBCIDCheck(const EventContext &context)
Definition: LArCellCont.cxx:270
TrigCaloDataAccessSvc::HLTCaloEventCache::lastFSEvent
unsigned int lastFSEvent
Definition: TrigCaloDataAccessSvc.h:140
LArBadXCont
Conditions-Data class holding LAr Bad Channel or Bad Feb information.
Definition: LArBadChannelCont.h:28
CaloCellContainer::setIsOrdered
void setIsOrdered(const bool ordered)
indicates that the container is ordered
Definition: CaloCellContainer.cxx:204
CaloCellContainer::setHasCalo
void setHasCalo(const CaloCell_ID::SUBCALO caloNum)
set which calo has been filled.
Definition: CaloCellContainer.cxx:213
LArCellCont::find
const std::vector< LArCellCollection * >::const_iterator find(const HWIdentifier &id) const
Finds a collection by its LArReadoutModuleID.
Definition: LArCellCont.cxx:201
FCALEM
@ FCALEM
Definition: RegSelEnums.h:35
TrigCaloDataAccessSvc::m_tiledecoderProtect
std::mutex m_tiledecoderProtect
Definition: TrigCaloDataAccessSvc.h:152
TrigCaloDataAccessSvc::prepareFullCollections
unsigned int prepareFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:76
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
TrigCaloDataAccessSvc::HLTCaloEventCache::d0cells
TileROD_Decoder::D0CellsHLT * d0cells
Definition: TrigCaloDataAccessSvc.h:139
TrigCaloDataAccessSvc::initialize
virtual StatusCode initialize() override
Definition: TrigCaloDataAccessSvc.cxx:21
TrigCaloDataAccessSvc::m_febRodMappingKey
SG::ReadCondHandleKey< LArFebRodMapping > m_febRodMappingKey
Definition: TrigCaloDataAccessSvc.h:85
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
skel.it
it
Definition: skel.GENtoEVGEN.py:407
TrigCaloDataAccessSvc::m_nSlots
size_t m_nSlots
Definition: TrigCaloDataAccessSvc.h:199
TrigCaloDataAccessSvc::m_hLTCaloSlot
SG::SlotSpecificObj< HLTCaloEventCache > m_hLTCaloSlot
Definition: TrigCaloDataAccessSvc.h:146
TrigCaloDataAccessSvc::convertROBs
unsigned int convertROBs(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &robFrags, LArCellCont *larcell, LArRodBlockStructure *&larRodBlockStructure, uint16_t rodMinorVersion, uint32_t robBlockType, const LArDeadOTXFromSC *dead)
Definition: TrigCaloDataAccessSvc.cxx:505
TileCellCont::Rw2PmtMap
const std::vector< int > & Rw2PmtMap(int section)
Definition: TileCellCont.h:79
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:43
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
xAOD::roiEta
setTeId setLumiBlock setRoiId setRoiSubsystem setRoiNumber roiEta
Definition: L2StandAloneMuon_v2.cxx:344
LArCellCont
Class which contains statically allocated LArCellCollections.
Definition: LArCellCont.h:40
LArDeadOTXFromSC
Definition: LArDeadOTXFromSC.h:12
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
LArBadChannel::highNoiseHG
bool highNoiseHG() const
Definition: LArBadChannel.h:118
python.RatesEmulationExample.lock
lock
Definition: RatesEmulationExample.py:148
FCALHAD
@ FCALHAD
Definition: RegSelEnums.h:36
TrigCaloDataAccessSvc::m_regionSelector_FCALHAD
ToolHandle< IRegSelTool > m_regionSelector_FCALHAD
Definition: TrigCaloDataAccessSvc.h:74
TrigCaloDataAccessSvc::m_correctDead
bool m_correctDead
Definition: TrigCaloDataAccessSvc.h:96
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
LArCellCont::findsec
HWIdentifier findsec(const unsigned int &id) const
Each Collection contains data from 2 FEBs.
Definition: LArCellCont.cxx:238
TrigCaloDataAccessSvc::TrigCaloDataAccessSvc
TrigCaloDataAccessSvc(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigCaloDataAccessSvc.cxx:13
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
HWIdentifier
Definition: HWIdentifier.h:13
LArBadXCont::offlineStatus
LArBC_t offlineStatus(const Identifier id) const
Query the status of a particular channel by offline ID This is the main client access method.
TileCellCont::setHashIdToROD
void setHashIdToROD(const TileHid2RESrcID *p)
Definition: TileCellCont.h:64
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
ReadCondHandle.h
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TileHid2RESrcID
This class provides conversion between fragment ID and RESrcID.
Definition: TileHid2RESrcID.h:28
RunTileMonitoring.mbts
mbts
Definition: RunTileMonitoring.py:133
TrigCaloDataAccessSvc::loadMBTS
virtual StatusCode loadMBTS(const EventContext &context, std::vector< const TileCell * > &loadedCells) override
Definition: TrigCaloDataAccessSvc.cxx:800
TileCellCont::find
const std::vector< TileCellCollection * >::const_iterator find(const unsigned int &id) const
Finds a collection.
Definition: TileCellCont.cxx:194
RunTileCalibRec.CaloCellContainer
CaloCellContainer
Definition: RunTileCalibRec.py:423
ReadCellNoiseFromCool.tile
tile
Definition: ReadCellNoiseFromCool.py:92
DETID
DETID
An enum to define subdetector names.
Definition: RegSelEnums.h:23
CaloGain::TILEHIGHHIGH
@ TILEHIGHHIGH
Definition: CaloGain.h:15
CaloConstCellContainer::setIsOrdered
void setIsOrdered(bool ordered)
indicates that the container is ordered
LArDeadOTXFromSC::correctionFromThisOTXdead
const std::vector< float > & correctionFromThisOTXdead(HWIdentifier febid) const
Definition: LArDeadOTXFromSC.h:19
TrigCaloDataAccessSvc::m_deadOTXFromSCKey
SG::ReadHandleKey< LArDeadOTXFromSC > m_deadOTXFromSCKey
Definition: TrigCaloDataAccessSvc.h:95
python.changerun.kk
list kk
Definition: changerun.py:39
IRoiDescriptor::eta
virtual double eta() const =0
TileRawChannelCollection::ID
MyBase::ID ID
Definition: TileRawChannelCollection.h:17
LArCellCont::applyBCIDCorrection
void applyBCIDCorrection(const unsigned int &rodid)
method to apply correction based on the luminosity to the energy
Definition: LArCellCont.cxx:219
ConstDataVector::clear
void clear()
Erase all the elements in the collection.
TrigCaloDataAccessSvc::prepareTileCollections
unsigned int prepareTileCollections(const EventContext &context, const IRoiDescriptor &roi)
Definition: TrigCaloDataAccessSvc.cxx:739
TileROD_Decoder::D0CellsHLT::clear
void clear()
Definition: TileROD_Decoder.cxx:4182
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigCaloDataAccessSvc::HLTCaloEventCache::robBlockType
uint32_t robBlockType
Definition: TrigCaloDataAccessSvc.h:136
TileROD_Decoder::D0CellsHLT
Definition: TileROD_Decoder.h:123
TTEM
@ TTEM
Definition: RegSelEnums.h:28
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
TileCellCont::eventNumber
void eventNumber(const unsigned int eN)
Definition: TileCellCont.h:70
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max() const
cell 'global' hash table max size
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigCaloDataAccessSvc::m_mbts_add_rods
std::vector< unsigned int > m_mbts_add_rods
Definition: TrigCaloDataAccessSvc.h:195
LArBadChannel::problematicForUnknownReason
bool problematicForUnknownReason() const
Definition: LArBadChannel.h:128
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
CaloConstCellContainer::setIsOrderedAndComplete
void setIsOrderedAndComplete(bool ordered)
indicate that the container is complete and in order
Recovery.avg
def avg(a, b)
Definition: Recovery.py:79
IRoiDescriptor
Describes the API of the Region of Ineterest geometry.
Definition: IRoiDescriptor.h:23
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloConstCellContainer::push_back_fast
void push_back_fast(const CaloCell *cell)
reimplementation of push_back to gain speed in readin
TrigCaloDataAccessSvc::m_lateInitDone
bool m_lateInitDone
Definition: TrigCaloDataAccessSvc.h:155
TileCellCont::Rw2CellMap
const std::vector< int > & Rw2CellMap(int section)
Definition: TileCellCont.h:47
LArBadChannel
Definition: LArBadChannel.h:10
TileCellCont
This class builds the Tile cells.
Definition: TileCellCont.h:25
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
TrigCaloDataAccessSvc::loadCollections
virtual StatusCode loadCollections(const EventContext &context, const IRoiDescriptor &roi, const DETID detID, const int sampling, LArTT_Selector< LArCellCont > &loadedCells) override
Definition: TrigCaloDataAccessSvc.cxx:83
TrigCaloDataAccessSvc::prepareLArFullCollections
unsigned int prepareLArFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:208
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloBCIDAverage
Definition: CaloBCIDAverage.h:16
LArTT_Selector::setRoIs
void setRoIs(const VEC_TT_ID &ids)
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
LArRodBlockStructure::getFEBID
uint32_t getFEBID() const
Definition: LArRodBlockStructure.h:297
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:43
TileCellCont::MBTS_collection
const TileCellCollection * MBTS_collection(void) const
Definition: TileCellCont.h:50
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
TrigCaloDataAccessSvc::prepareTileFullCollections
unsigned int prepareTileFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:271
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TrigCaloDataAccessSvc::HLTCaloEventCache
convience structure to keep together a collection and auxiliar full collection selectors
Definition: TrigCaloDataAccessSvc.h:131
TrigCaloDataAccessSvc::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: TrigCaloDataAccessSvc.h:70
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TrigCaloDataAccessSvc::finalize
virtual StatusCode finalize() override
Definition: TrigCaloDataAccessSvc.cxx:49
TrigCaloDataAccessSvc::HLTCaloEventCache::fullcont
CaloCellContainer * fullcont
Definition: TrigCaloDataAccessSvc.h:138
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigCaloDataAccessSvc::m_regionSelector_TTHEC
ToolHandle< IRegSelTool > m_regionSelector_TTHEC
Definition: TrigCaloDataAccessSvc.h:72
TrigCaloDataAccessSvc::m_rIdstile
std::vector< IdentifierHash > m_rIdstile
Definition: TrigCaloDataAccessSvc.h:197
TrigCaloDataAccessSvc::m_dataPrepMutex
std::mutex m_dataPrepMutex
Definition: TrigCaloDataAccessSvc.h:149
TrigCaloDataAccessSvc::HLTCaloEventCache::tileContainer
TileCellCont * tileContainer
Definition: TrigCaloDataAccessSvc.h:137
TileCellCont::cached
bool cached(const unsigned int &rodid)
Definition: TileCellCont.h:72
TrigCaloDataAccessSvc::reset_LArCol
void reset_LArCol(LArCellCollection *coll)
Definition: TrigCaloDataAccessSvc.h:98
CaloCellContainer::push_back_fast
void push_back_fast(CaloCell *)
reimplementation of push_back to gain speed in readin
Definition: CaloCellContainer.cxx:102
LArDeadOTXFromSC::isThisOTXdead
bool isThisOTXdead(HWIdentifier febid) const
Definition: LArDeadOTXFromSC.h:16
TrigCaloDataAccessSvc::prepareLArCollections
unsigned int prepareLArCollections(const EventContext &context, const IRoiDescriptor &roi, const int sampling, DETID detector)
LAr TT collections preparation code.
Definition: TrigCaloDataAccessSvc.cxx:665
TileCellCont::MBTS_channel
int MBTS_channel(void)
Definition: TileCellCont.h:60
LArCellCollection
Container Class for LArCell in a ROB used by EF.
Definition: LArCellCollection.h:28
TileROD_Decoder::D0CellsHLT::m_cells
TileCell * m_cells[64]
Definition: TileROD_Decoder.h:133
TrigCaloDataAccessSvc::m_regionSelector_FCALEM
ToolHandle< IRegSelTool > m_regionSelector_FCALEM
Definition: TrigCaloDataAccessSvc.h:73
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
TrigCaloDataAccessSvc::m_applyOffsetCorrection
Gaudi::Property< bool > m_applyOffsetCorrection
Definition: TrigCaloDataAccessSvc.h:77
LArCellCont::initialize
StatusCode initialize(const LArRoIMap &roiMap, const LArOnOffIdMapping &onOffMap, const LArMCSym &mcsym, const LArFebRodMapping &febrod, const LArBadChannelCont &badchannel, const CaloDetDescrManager &ddm)
initialize method.
Definition: LArCellCont.cxx:22
CaloCellContainer::order
void order()
order container
Definition: CaloCellContainer.cxx:474
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArCell
Data object for LAr calorimeter readout cell.
Definition: LArCell.h:53
LArBadChannel::highNoiseLG
bool highNoiseLG() const
Definition: LArBadChannel.h:124
LArTT_Selector< LArCellCont >
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
TrigCaloDataAccessSvc::loadFullCollections
virtual StatusCode loadFullCollections(const EventContext &context, CaloConstCellContainer &cont) override
Definition: TrigCaloDataAccessSvc.cxx:173
LArCellCont::updateBCID
void updateBCID(const CaloBCIDAverage &, const LArOnOffIdMapping &)
update BCID dependent correction table for MT case
Definition: LArCellCont.cxx:253
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloCell_Base_ID::cell_id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
TrigCaloDataAccessSvc::m_vrodid32fullDet
std::vector< uint32_t > m_vrodid32fullDet
Definition: TrigCaloDataAccessSvc.h:193
TileCellCont::MBTS_map
std::map< unsigned int, unsigned int > & MBTS_map(void)
Definition: TileCellCont.h:54
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
TrigCaloDataAccessSvc::m_mcsymKey
SG::ReadCondHandleKey< LArMCSym > m_mcsymKey
Definition: TrigCaloDataAccessSvc.h:81
TrigCaloDataAccessSvc::m_mbts_rods
const std::vector< unsigned int > * m_mbts_rods
Definition: TrigCaloDataAccessSvc.h:196
TrigCaloDataAccessSvc::m_vrodid32fullDetHG
std::vector< std::vector< uint32_t > > m_vrodid32fullDetHG
Definition: TrigCaloDataAccessSvc.h:198
runIDAlign.accumulate
accumulate
Update flags based on parser line args.
Definition: runIDAlign.py:107
ReadBchFromCool.good
good
Definition: ReadBchFromCool.py:433
TrigCaloDataAccessSvc::m_initMutex
std::mutex m_initMutex
Definition: TrigCaloDataAccessSvc.h:148
TrigCaloDataAccessSvc::m_bcidAvgKey
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
Definition: TrigCaloDataAccessSvc.h:79
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
LArBadChannel::unstable
bool unstable() const
Definition: LArBadChannel.h:115
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
TrigCaloDataAccessSvc::m_bcContKey
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
Definition: TrigCaloDataAccessSvc.h:87
CaloConstCellContainer
CaloCellContainer that can accept const cell pointers.
Definition: CaloConstCellContainer.h:45
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TrigCaloDataAccessSvc::prepareMBTSCollections
unsigned int prepareMBTSCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:770
LArTT_Selector::setMap
void setMap(const LArRoIMap *map)
SG::getNSlots
size_t getNSlots()
Return the number of event slots.
Definition: SlotSpecificObj.cxx:64
TileCellCont::initialize
StatusCode initialize(void)
Definition: TileCellCont.cxx:39
LArBadChannel::highNoiseMG
bool highNoiseMG() const
Definition: LArBadChannel.h:121
CaloDetDescrManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:1590
TrigCaloDataAccessSvc.h
TrigRoiDescriptor.h
merge.status
status
Definition: merge.py:16
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
TrigCaloDataAccessSvc::m_larDecoder
PublicToolHandle< LArRodDecoder > m_larDecoder
Definition: TrigCaloDataAccessSvc.h:65
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:43
TrigCaloDataAccessSvc::m_vrodid32tile
std::vector< uint32_t > m_vrodid32tile
Definition: TrigCaloDataAccessSvc.h:194
TrigCaloDataAccessSvc::HLTCaloEventCache::larRodBlockStructure_per_slot
LArRodBlockStructure * larRodBlockStructure_per_slot
Definition: TrigCaloDataAccessSvc.h:134
TileCellCont::MBTS_IDs
const std::vector< unsigned int > * MBTS_IDs()
Definition: TileCellCont.h:58
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
python.compressB64.c
def c
Definition: compressB64.py:93
TrigCaloDataAccessSvc::lateInit
unsigned int lateInit(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:300
TileCellCont::finalize
StatusCode finalize(void)
Definition: TileCellCont.cxx:198
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
CaloCellContainer::setIsOrderedAndComplete
void setIsOrderedAndComplete(const bool ordered)
indicate that the container is complete and in order
Definition: CaloCellContainer.cxx:165
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
TrigCaloDataAccessSvc::HLTCaloEventCache::rodMinorVersion
uint16_t rodMinorVersion
Definition: TrigCaloDataAccessSvc.h:135
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32
TrigCaloDataAccessSvc::missingROBs
void missingROBs(const std::vector< uint32_t > &request, const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &response, std::set< uint32_t > &missing) const
fill the set of missing robs given the request and response from RoBDatProvider
Definition: TrigCaloDataAccessSvc.cxx:636
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
python.LArMinBiasAlgConfig.float
float
Definition: LArMinBiasAlgConfig.py:65
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
TrigCaloDataAccessSvc::m_larRoIMapKey
SG::ReadCondHandleKey< LArRoIMap > m_larRoIMapKey
Definition: TrigCaloDataAccessSvc.h:89
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:71
LArCellCont::finalize
StatusCode finalize(void)
finalize method.
Definition: LArCellCont.cxx:181
LArCellCont::eventNumber
void eventNumber(const unsigned int eN)
sets Event Number
Definition: LArCellCont.h:83
TrigCaloDataAccessSvc::m_tileDecoder
PublicToolHandle< TileROD_Decoder > m_tileDecoder
Definition: TrigCaloDataAccessSvc.h:66
Identifier
Definition: IdentifierFieldParser.cxx:14