ATLAS Offline Software
Loading...
Searching...
No Matches
TrigCaloDataAccessSvc Class Reference

#include <TrigCaloDataAccessSvc.h>

Inheritance diagram for TrigCaloDataAccessSvc:

Classes

struct  FullDetIDs
 Convenience structure to keep together all ROBs and IdentifierHashes for whole detectors. More...
struct  HLTCaloEventCache
 convience structure to keep together a collection and auxiliar full collection selectors More...

Public Member Functions

 TrigCaloDataAccessSvc (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual StatusCode loadCollections (const EventContext &context, const IRoiDescriptor &roi, const DETID detID, const int sampling, LArTT_Selector< LArCellCont > &loadedCells) override
virtual StatusCode loadCollections (const EventContext &context, const IRoiDescriptor &roi, std::vector< const TileCell * > &loadedCells) override
virtual StatusCode loadMBTS (const EventContext &context, std::vector< const TileCell * > &loadedCells) override
virtual StatusCode loadFullCollections (const EventContext &context, CaloConstCellContainer &cont) override

Private Member Functions

void reset_LArCol (LArCellCollection *coll)
void reset_TileCol (TileCellCollection *col)
unsigned int lateInit (const EventContext &context)
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)
unsigned int convertROBs (const EventContext &context, const std::vector< IdentifierHash > &rIds, TileCellCont *tilecell, TileROD_Decoder::D0CellsHLT *d0cells)
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
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
unsigned int prepareLArCollections (const EventContext &context, const IRoiDescriptor &roi, const int sampling, DETID detector)
 LAr TT collections preparation code.
unsigned int prepareTileCollections (const EventContext &context, const IRoiDescriptor &roi)
unsigned int prepareMBTSCollections (const EventContext &context)
unsigned int prepareFullCollections (const EventContext &context)
unsigned int prepareLArFullCollections (const EventContext &context)
unsigned int prepareTileFullCollections (const EventContext &context)

Private Attributes

PublicToolHandle< LArRodDecoderm_larDecoder { this, "LArDecoderTool", "LArRodDecoder/LArRodDecoder", "Tool to decode LAr raw data" }
PublicToolHandle< TileROD_Decoderm_tileDecoder { this, "TileDecoderTool", "TileROD_Decoder/TileROD_Decoder", "Tool to decode Tile raw data" }
ToolHandle< GenericMonitoringToolm_monTool { this, "MonTool", "", "Tool to monitor performance of the service" }
ServiceHandle< IROBDataProviderSvcm_robDataProvider { this, "ROBDataProvider", "ROBDataProviderSvc/ROBDataProviderSvc", ""}
ToolHandle< IRegSelToolm_regionSelector_TTEM { this, "RegSelToolEM", "RegSelTool/RegSelTool_TTEM" }
ToolHandle< IRegSelToolm_regionSelector_TTHEC { this, "RegSelToolHEC", "RegSelTool/RegSelTool_TTHEC" }
ToolHandle< IRegSelToolm_regionSelector_FCALEM { this, "RegSelToolFCALEM", "RegSelTool/RegSelTool_FCALEM" }
ToolHandle< IRegSelToolm_regionSelector_FCALHAD { this, "RegSelToolFCALHAD", "RegSelTool/RegSelTool_FCALHAD" }
ToolHandle< IRegSelToolm_regionSelector_TILE { this, "RegSelToolTILE", "RegSelTool/RegSelTool_TILE" }
Gaudi::Property< bool > m_applyOffsetCorrection { this, "ApplyOffsetCorrection", true, "Enable offset correction" }
SG::ReadHandleKey< CaloBCIDAveragem_bcidAvgKey
SG::ReadCondHandleKey< LArMCSymm_mcsymKey {this, "MCSymKey", "LArMCSym", "SG Key of LArMCSym object"}
SG::ReadCondHandleKey< LArOnOffIdMappingm_onOffIdMappingKey {this, "CablingKey", "LArOnOffIdMap", "SG Key for LArOnOffIdMapping"}
SG::ReadCondHandleKey< LArFebRodMappingm_febRodMappingKey {this, "RodFebKey", "LArFebRodMap", "SG Key for LArFebRodMapping"}
SG::ReadCondHandleKey< LArBadChannelContm_bcContKey {this, "LArBadChannelKey", "LArBadChannel", "Key of the LArBadChannelCont CDO" }
SG::ReadCondHandleKey< LArRoIMapm_larRoIMapKey {this, "LArRoIMapKey", "LArRoIMap", "Key of the LArRoIMap CDO" }
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" }
SG::ReadCondHandleKey< TileHid2RESrcIDm_tileHid2RESrcIDKey {this, "TileHid2RESrcID", "TileHid2RESrcIDHLT", "SG Key of TileHid2RESrcID object"}
SG::ReadHandleKey< LArDeadOTXFromSCm_deadOTXFromSCKey {this, "LArDeadOTXFromSC", "DeadOTXFromSC", "Key of the DeadOTXFromSC CDO" }
bool m_correctDead
std::vector< unsigned int > m_insertedCells
SG::SlotSpecificObj< HLTCaloEventCachem_hLTCaloSlot
std::mutex m_initMutex
std::mutex m_getCollMutex
std::mutex m_lardecoderProtect
std::mutex m_tiledecoderProtect
bool m_lateInitDone = false
std::vector< uint32_t > m_vrodid32fullDet
std::vector< uint32_t > m_vrodid32tile
std::vector< unsigned int > m_mbts_add_rods
const std::vector< unsigned int > * m_mbts_rods = nullptr
std::vector< IdentifierHashm_rIdstile
std::vector< std::vector< uint32_t > > m_vrodid32fullDetHG
size_t m_nSlots

Detailed Description

Definition at line 35 of file TrigCaloDataAccessSvc.h.

Constructor & Destructor Documentation

◆ TrigCaloDataAccessSvc()

TrigCaloDataAccessSvc::TrigCaloDataAccessSvc ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 13 of file TrigCaloDataAccessSvc.cxx.

14 : base_class( name, pSvcLocator ),
15 m_bcidAvgKey("CaloBCIDAverage"),
16 m_correctDead(false),
17 m_lateInitDone(false), m_nSlots(0)
18{
19}
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey

Member Function Documentation

◆ clearMissing()

void TrigCaloDataAccessSvc::clearMissing ( const std::vector< uint32_t > & request,
const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & response,
LArCellCont * larcell )
private

clear fragments of the collection for which ROBs were not available

Definition at line 641 of file TrigCaloDataAccessSvc.cxx.

643 {
644 std::set<uint32_t> missing;
645 missingROBs( request, response, missing );
646 for ( uint32_t robID : missing ) {
647 const std::vector<LArCellCollection*>::const_iterator it = larcell->find( robID );
648 if ( it != larcell->end() && ( *it )->size()!=0 ) { // Already decoded collection
649 reset_LArCol ( *it );
650 }
651 }
652}
MDT_Response response
const std::vector< LArCellCollection * >::const_iterator find(const HWIdentifier &id) const
Finds a collection by its LArReadoutModuleID.
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
void reset_LArCol(LArCellCollection *coll)

◆ convertROBs() [1/2]

unsigned int TrigCaloDataAccessSvc::convertROBs ( const EventContext & context,
const std::vector< IdentifierHash > & rIds,
TileCellCont * tilecell,
TileROD_Decoder::D0CellsHLT * d0cells )
private

Definition at line 572 of file TrigCaloDataAccessSvc.cxx.

575 {
576 unsigned int status(0);
577 TileCellCollection* mbts = tilecell->MBTS_collection();
578 const TileHid2RESrcID* hid2re = tilecell->getHashIdToROD();
579
580 size_t listIDsize = rIds.size();
581 std::vector<unsigned int> tile; tile.push_back(0);
582 // Tile likes rob by rob
583 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags1;
584 for (size_t i = 0; i < listIDsize; ++i){
585 tile[0] = tilecell->find_rod(rIds[i]);
586 m_robDataProvider->getROBData(context,tile,robFrags1);
587 // Number of ROBs smaller than requested is below
588 //if ( robFrags1.empty() ) m_error|=0x10000000;
589 // Find the collection to fill
590 const std::vector<TileCellCollection*>::const_iterator it =
591 (tilecell->find(rIds[i]));
592 TileCellCollection* col = *it;
593 if ( robFrags1.size()!=0 && col != nullptr ) {
594 size_t roddatasize = robFrags1[0]->rod_ndata();
595 // insert data into vector (to be removed soon)
596 if (roddatasize < 3) {
597 ATH_MSG_WARNING( "Error reading bytestream"<<
598 "event: Empty ROD block (less than 3 words) : 0x"
599 << std::hex << tile[0] << std::dec );
600 msg(MSG::WARNING) << "Error reading bytestream "
601 << "event: Empty ROD block (less than 3 words) : 0x"
602 << std::hex << tile[0] << std::dec << endmsg;
603 // Data seems corrupted
604 //m_error|=0x20000000;
605 if ( !tilecell->cached(rIds[i])){
606 // resets collection
607 reset_TileCol(col);
608 }
609 robFrags1.clear();
610 } else {// End of if small size
611 std::lock_guard<std::mutex> decoderLock { m_tiledecoderProtect };
612 if ( !tilecell->cached(rIds[i]))
613 m_tileDecoder->fillCollectionHLT(robFrags1[0],*col,*d0cells,mbts,hid2re);
614 m_tileDecoder->mergeD0cellsHLT(*d0cells,*col);
615 // Accumulates superior byte from ROD Decoder
616 //m_error|=m_tileDecoder->report_error();
617 robFrags1.clear();
618 } // end of else
619 } // end of if robFrags1.size
620 } // End of for through RobFrags
621
622 ATH_MSG_DEBUG( "finished decoding" );
623 return status;
624}
#define endmsg
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
unsigned int find_rod(const unsigned int &id) const
const std::vector< TileCellCollection * >::const_iterator find(const unsigned int &id) const
Finds a collection.
const TileCellCollection * MBTS_collection(void) const
bool cached(const unsigned int &rodid)
const TileHid2RESrcID * getHashIdToROD() const
PublicToolHandle< TileROD_Decoder > m_tileDecoder
void reset_TileCol(TileCellCollection *col)
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
status
Definition merge.py:16
MsgStream & msg
Definition testRead.cxx:32

◆ convertROBs() [2/2]

unsigned int TrigCaloDataAccessSvc::convertROBs ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & robFrags,
LArCellCont * larcell,
LArRodBlockStructure *& larRodBlockStructure,
uint16_t rodMinorVersion,
uint32_t robBlockType,
const LArDeadOTXFromSC * dead )
private

Definition at line 495 of file TrigCaloDataAccessSvc.cxx.

497 {
498
499 unsigned int status(0);
500 for ( auto rob: robFrags ) {
501 uint32_t sourceID = rob->source_id();
502 const std::vector<LArCellCollection*>::const_iterator it = larcell->find( sourceID );
503 //TB The find also switches the state of the collection to "decoded" so repeated decoding is avoided
504
505 if ( it != larcell->end() && ( *it )->size() != 0 ) { // Already decoded collection
506
507 // TB if we have entered here it means the decoding did not occur yet ( or failed )
508 //
509 LArCellCollection* coll = *it;
510 ATH_MSG_DEBUG( "ROB of ID " << sourceID << " to be decoded" );
511
512 std::lock_guard<std::mutex> decoderLock( m_lardecoderProtect );
513 //TB next two lines seem danger, as they seem to rely on the decoder state
514 const HWIdentifier& feb_id_local = larcell->findsec( sourceID );
515 m_larDecoder->setsecfeb( feb_id_local );
516 if ( ! m_larDecoder->check_valid( rob, msg() ) ){
517 ATH_MSG_WARNING( "Error reading bytestream"<<
518 "event: Bad ROB block ( eformat checks ) : 0x"
519 << std::hex << sourceID << std::dec );
520 // Data seems corrupted
521 //status |= 0x1; // dummy code
522 reset_LArCol ( coll );
523
524 } else {
525 // Get Rod Data and size of fragment
526 const uint32_t* roddata = 0;
527 rob->rod_data( roddata );
528 size_t roddatasize = rob->rod_ndata();
529 if ( roddatasize < 3 ) {
530 ATH_MSG_WARNING( "Error reading bytestream"<<
531 "event: Empty ROD block ( less than 3 words ) : 0x"
532 << std::hex << sourceID << std::dec );
533 // Data seems corrupted
534 //status |= 0x1; // dummy code
535 reset_LArCol ( coll );
536 } else { // End of if small size
537 //TB the converter has state
538 m_larDecoder->fillCollectionHLT( *rob, roddata, roddatasize, *coll, larRodBlockStructure_per_slot, rodMinorVersion, robBlockType );
539 if ( deadHandle ){
540 if ( deadHandle->isThisOTXdead(feb_id_local) ) {
541 const std::vector<float>& corr = deadHandle->correctionFromThisOTXdead(feb_id_local);
542 // The sizes here are guaranteed by construction
543 for(size_t i=0;i<128;i++) {
544 (*coll)[i+128]->set(corr[i],0,0,0x1000,CaloGain::LARHIGHGAIN);
545 }
546 }
547 HWIdentifier feb_id_local2(larRodBlockStructure_per_slot->getFEBID());
548 if ( deadHandle->isThisOTXdead(feb_id_local2) ) {
549 const std::vector<float>& corr = deadHandle->correctionFromThisOTXdead(feb_id_local2);
550 // The sizes here are guaranteed by construction
551 for(size_t i=0;i<128;i++) (*coll)[i]->set(corr[i],0,0,0x1000,CaloGain::LARHIGHGAIN);
552
553 }
554 }
555
556 // Accumulates inferior byte from ROD Decoder
557 // TB the converter has state
558 //status |= (m_larDecoder->report_error());
559
560 if ( m_applyOffsetCorrection ) larcell->applyBCIDCorrection( sourceID );
561 }
562
563 }
564 } else {
565 ATH_MSG_VERBOSE( "ROB of ID " << sourceID << " already decoded" );
566 }
567 }
568 ATH_MSG_DEBUG( "finished decoding" );
569 return status;
570}
#define ATH_MSG_VERBOSE(x)
void applyBCIDCorrection(const unsigned int &rodid)
method to apply correction based on the luminosity to the energy
HWIdentifier findsec(const unsigned int &id) const
Each Collection contains data from 2 FEBs.
Gaudi::Property< bool > m_applyOffsetCorrection
PublicToolHandle< LArRodDecoder > m_larDecoder
@ LARHIGHGAIN
Definition CaloGain.h:18
setEventNumber uint32_t

◆ finalize()

StatusCode TrigCaloDataAccessSvc::finalize ( )
overridevirtual

Definition at line 49 of file TrigCaloDataAccessSvc.cxx.

49 {
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}
#define CHECK(...)
Evaluate an expression and check for errors.
std::vector< std::vector< uint32_t > > m_vrodid32fullDetHG
SG::SlotSpecificObj< HLTCaloEventCache > m_hLTCaloSlot
std::vector< unsigned int > m_insertedCells
std::vector< uint32_t > m_vrodid32fullDet
convience structure to keep together a collection and auxiliar full collection selectors

◆ initialize()

StatusCode TrigCaloDataAccessSvc::initialize ( )
overridevirtual

Temporary fix

Definition at line 21 of file TrigCaloDataAccessSvc.cxx.

21 {
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() );
30 CHECK( m_bcidAvgKey.initialize() );
31 CHECK( m_onOffIdMappingKey.initialize() );
32 CHECK( m_larRoIMapKey.initialize() );
33 CHECK( m_febRodMappingKey.initialize() );
34 CHECK( m_regionSelector_TTEM.retrieve() );
35 CHECK( m_mcsymKey.initialize() );
36 CHECK( m_bcContKey.initialize() );
37 CHECK( m_caloMgrKey.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() );
44 ATH_CHECK( m_tileHid2RESrcIDKey.initialize() );
45
46 return StatusCode::SUCCESS;
47}
#define ATH_CHECK
Evaluate an expression and check for errors.
ToolHandle< IRegSelTool > m_regionSelector_TTHEC
SG::ReadCondHandleKey< TileHid2RESrcID > m_tileHid2RESrcIDKey
SG::ReadCondHandleKey< LArFebRodMapping > m_febRodMappingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdMappingKey
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
ToolHandle< IRegSelTool > m_regionSelector_FCALEM
SG::ReadHandleKey< LArDeadOTXFromSC > m_deadOTXFromSCKey
SG::ReadCondHandleKey< LArRoIMap > m_larRoIMapKey
ToolHandle< IRegSelTool > m_regionSelector_TTEM
ToolHandle< IRegSelTool > m_regionSelector_FCALHAD
ToolHandle< IRegSelTool > m_regionSelector_TILE
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
SG::ReadCondHandleKey< LArMCSym > m_mcsymKey

◆ lateInit()

unsigned int TrigCaloDataAccessSvc::lateInit ( const EventContext & context)
private

Definition at line 290 of file TrigCaloDataAccessSvc.cxx.

290 { // non-const this thing
291
292 std::lock_guard<std::mutex> lock( m_initMutex );
293 if ( m_lateInitDone )
294 return 0x0; // dummy code
295
296 ATH_MSG_DEBUG( "Performing late init" );
297
298 // allocate collections
300
301 // preparing full container list of ROBs - tile will be included soon
302 std::vector<uint32_t> vrodid32lar;
303 std::vector<uint32_t> vrodid32em;
304 std::vector<uint32_t> vrodid32hec;
305 std::vector<uint32_t> vrodid32hec0;
306 std::vector<uint32_t> vrodid32hec1;
307 std::vector<uint32_t> vrodid32hec2;
308 std::vector<uint32_t> vrodid32hec3;
309 std::vector<uint32_t> vrodid32fcalem;
310 std::vector<uint32_t> vrodid32fcalhad;
311
312 TrigRoiDescriptor tmproi(true);
313 std::vector<uint32_t> vrodid32tile;
314 std::vector<IdentifierHash> rIdstile;
315 // TTEM
316 m_regionSelector_TTEM->lookup(context)->ROBIDList(-1,tmproi,vrodid32em);
317 // TTHEC
318 m_regionSelector_TTHEC->lookup(context)->ROBIDList(0,tmproi,vrodid32hec0);
319 m_regionSelector_TTHEC->lookup(context)->ROBIDList(1,tmproi,vrodid32hec1);
320 m_regionSelector_TTHEC->lookup(context)->ROBIDList(2,tmproi,vrodid32hec2);
321 m_regionSelector_TTHEC->lookup(context)->ROBIDList(3,tmproi,vrodid32hec3);
322 // FCALHAD
323 m_regionSelector_FCALEM->lookup(context)->ROBIDList(-1,tmproi,vrodid32fcalem);
324 m_regionSelector_FCALHAD->lookup(context)->ROBIDList(-1,tmproi,vrodid32fcalhad);
325 m_regionSelector_TILE->lookup(context)->ROBIDList(tmproi,vrodid32tile);
326 m_regionSelector_TILE->lookup(context)->HashIDList(tmproi,rIdstile);
327
328 m_vrodid32tile.resize( vrodid32tile.size() );
329 m_rIdstile.resize(rIdstile.size() );
330 // Tile RODs and ID coming from the Tile tables are not unique
331 // iii and iij are local variables helping to clear non-unique IDs
332 auto iii = std::unique_copy(vrodid32tile.begin(),vrodid32tile.end(),m_vrodid32tile.begin());
333 auto iij = std::unique_copy(rIdstile.begin(),rIdstile.end(),m_rIdstile.begin());
334 std::sort( m_vrodid32tile.begin(), iii );
335 std::sort( m_rIdstile.begin(), iij );
336 iii = std::unique_copy(m_vrodid32tile.begin(),iii,m_vrodid32tile.begin());
337 iij = std::unique_copy(m_rIdstile.begin(),iij,m_rIdstile.begin());
338 m_vrodid32tile.resize( std::distance(m_vrodid32tile.begin(), iii) );
339 m_rIdstile.resize( std::distance(m_rIdstile.begin(), iij) );
340
341 vrodid32lar.insert(vrodid32lar.end(),vrodid32em.begin(),vrodid32em.end());
342 vrodid32hec.insert(vrodid32hec.end(),vrodid32hec0.begin(),vrodid32hec0.end());
343 vrodid32lar.insert(vrodid32lar.end(),vrodid32hec.begin(),vrodid32hec.end());
344 vrodid32lar.insert(vrodid32lar.end(),vrodid32fcalhad.begin(),vrodid32fcalhad.end());
345 vrodid32lar.insert(vrodid32lar.end(),vrodid32fcalem.begin(),vrodid32fcalem.end());
346 m_vrodid32fullDet.insert(m_vrodid32fullDet.end(), vrodid32lar.begin(), vrodid32lar.end() );
347
348
349 SG::ReadCondHandle<LArMCSym> mcsym (m_mcsymKey, context);
350 SG::ReadCondHandle<LArFebRodMapping> febrod(m_febRodMappingKey, context);
351 SG::ReadCondHandle<LArBadChannelCont> larBadChan{ m_bcContKey, context };
352 SG::ReadCondHandle<LArOnOffIdMapping> onoff ( m_onOffIdMappingKey, context);
353 SG::ReadCondHandle<LArRoIMap> roimap ( m_larRoIMapKey, context);
354 SG::ReadCondHandle<TileHid2RESrcID> tileHid2RESrcID ( m_tileHid2RESrcIDKey, context);
355
356 unsigned int nFebs=70;
357 unsigned int high_granu = (unsigned int)ceilf(m_vrodid32fullDet.size()/((float)nFebs) );
358 unsigned int jj=0;
359 unsigned int kk=0;
360 m_vrodid32fullDetHG.resize(high_granu);
361 for( unsigned int ii=0; ii<m_vrodid32fullDet.size();ii++){
362 if ( kk >= nFebs ) {
363 kk-=nFebs;
364 jj++;
365 }
366 std::vector<uint32_t> & vec = m_vrodid32fullDetHG.at(jj);
367 vec.push_back(m_vrodid32fullDet[ii]);
368 kk++;
369 }
370 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey, context};
371 const CaloDetDescrManager* theCaloDDM = *caloMgrHandle;
372 const CaloCell_ID* theCaloCCIDM = theCaloDDM->getCaloCell_ID();
373 unsigned int hashMax = theCaloCCIDM->calo_cell_hash_max();
374
375 // Prepare cache containers to be used for LAr unpacking.
376 for ( size_t slot = 0; slot < m_nSlots; ++ slot ) {
377 EventContext ec;
378 ec.setSlot( slot );
379 HLTCaloEventCache *cache = m_hLTCaloSlot.get( ec );
380 cache->larContainer = new LArCellCont();
381 cache->larRodBlockStructure_per_slot = nullptr;
382 if ( cache->larContainer->initialize( **roimap, **onoff, **mcsym, **febrod, **larBadChan, *theCaloDDM).isFailure() )
383 return 0x1; // dummy code
384 std::vector<CaloCell*> local_cell_copy;
385 local_cell_copy.reserve(200000);
386 LArCellCont* larcell = cache->larContainer;
387 cache->lastFSEvent = 0xFFFFFFFF;
388 CaloCellContainer* cachefullcont = new CaloCellContainer(SG::VIEW_ELEMENTS);
389 cachefullcont->reserve(190000);
390 const LArBadChannelCont& badchannel = **larBadChan;
391 for(unsigned int lcidx=0; lcidx < larcell->size(); lcidx++){
392 LArCellCollection* lcc = larcell->at(lcidx);
393 unsigned int lccsize = lcc->size();
394 for(unsigned int lccidx=0; lccidx<lccsize; lccidx++){
395 CaloCell* cell = ((*lcc).at(lccidx));
396 if ( cell && cell->caloDDE() ) {
397 LArBadChannel bc = badchannel.offlineStatus(cell->ID());
398 bool good(true);
399 if (! bc.good() ){
400 // cell has some specific problems
401 if ( bc.unstable() ) good=false;
402 if ( bc.highNoiseHG() ) good=false;
403 if ( bc.highNoiseMG() ) good=false;
404 if ( bc.highNoiseLG() ) good=false;
405 if ( bc.problematicForUnknownReason() ) good=false;
406 }
407 if ( good ) local_cell_copy.push_back( cell );
408 }
409 } // end of loop over cells
410 } // end of loop over collection
411
412// This should stay here as this will be enabled when tile is ready to be decoded as well
413 TileCellCont* tilecell = new TileCellCont();
414 cache->tileContainer = tilecell;
415 tilecell->setHashIdToROD( *tileHid2RESrcID );
416 if( tilecell->initialize().isFailure() ) return 0x1; //dummy code
417 for (unsigned int i=0;i<4;i++) {
418 m_tileDecoder->loadRw2Cell ( i, tilecell->Rw2CellMap(i) );
419 m_tileDecoder->loadRw2Pmt ( i, tilecell->Rw2PmtMap (i) );
420 }
421 m_tileDecoder->loadMBTS( tilecell->MBTS_map(), tilecell->MBTS_channel() );
422 m_mbts_rods = tilecell->MBTS_RODs();
423 for(size_t i = 0 ; i < m_mbts_rods->size(); i++)
424 m_mbts_add_rods.insert(m_mbts_add_rods.end(),(*m_mbts_rods).begin(),(*m_mbts_rods).end());
425 sort(m_mbts_add_rods.begin(),m_mbts_add_rods.end());
427 TileROD_Decoder::D0CellsHLT* d0cellsp = new TileROD_Decoder::D0CellsHLT();
428 for(unsigned int lcidx=0; lcidx < tilecell->size(); lcidx++){
429 TileCellCollection* lcc = tilecell->at(lcidx);
430 unsigned int lccsize = lcc->size();
431 for(unsigned int lccidx=0; lccidx<lccsize; lccidx++){
432 CaloCell* cell = ((*lcc).at(lccidx));
433 if ( cell ) local_cell_copy.push_back( cell );
434 } // end of loop over cells
435 TileRawChannelCollection::ID frag_id = ((*lcc).identify() & 0x0FFF);
436 int ros = (frag_id >> 8);
437 if ( ros == 1 ) { //treatment for d0Cells in barrel
438 int drawer = (frag_id & 0xFF);
439 TileCellCollection::iterator pCell = lcc->begin();
440 pCell+=2;
441 d0cellsp->m_cells[drawer] = *pCell;
442 }
443 } // end of loop over collection
444
445 // d0merge cells
446 cache->d0cells = d0cellsp;
447
448 // For the moment the container has to be completed by hand (again, because of tile)
449 for(unsigned int i=0;i<hashMax;i++){
450 cachefullcont->push_back_fast(nullptr);
451 }
452
453 unsigned int localcellMax = local_cell_copy.size();
454 for(unsigned int i=0;i<localcellMax;i++){
455 unsigned int j = local_cell_copy.at(i)->caloDDE()->calo_hash();
456 if ( j < hashMax ) {
457 cachefullcont->at(j) = local_cell_copy.at(i);
458 }
459 }
460 for(unsigned int i=0;i<hashMax;i++)
461 if ( cachefullcont->at(i) == nullptr ){
462 Identifier id = theCaloCCIDM->cell_id(i);
463 if ( id!=0 ){
464 const CaloDetDescrElement* el = theCaloDDM->get_element(id);
465 if ( el->is_tile() ) {
466 cachefullcont->at(i) = new TileCell(el,0,0,0,0,CaloGain::TILEHIGHHIGH);
467 } else {
468 cachefullcont->at(i) = new LArCell(el,0,0,0,(CaloGain::CaloGain)0);
469 }
470
471 if (slot==0) m_insertedCells.push_back(i);
472 }
473 }
474
475 cachefullcont->setHasCalo(CaloCell_ID::LAREM);
476 cachefullcont->setHasCalo(CaloCell_ID::LARHEC);
477 cachefullcont->setHasCalo(CaloCell_ID::LARFCAL);
478 cachefullcont->setHasCalo(CaloCell_ID::TILE); //lying... But this needs to be checked later
479
480 // make sure this "map" container has a good hashID
481 cachefullcont->order();
482
483 if ( hashMax != cachefullcont->size() )
484 ATH_MSG_ERROR("Problem in the size of the full container");
485 cachefullcont->setIsOrdered(true);
486 cachefullcont->setIsOrderedAndComplete(true);
487 cache->fullcont = cachefullcont;
488
489 local_cell_copy.clear();
490 }
491 m_lateInitDone = true;
492 return 0x0;
493}
#define ATH_MSG_ERROR(x)
std::vector< size_t > vec
LArBadXCont< LArBadChannel > LArBadChannelCont
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Athena::TPCnvVers::Current TrigRoiDescriptor
void push_back_fast(CaloCell *)
reimplementation of push_back to gain speed in readin
void order()
order container
void setHasCalo(const CaloCell_ID::SUBCALO caloNum)
set which calo has been filled.
void setIsOrderedAndComplete(const bool ordered)
indicate that the container is complete and in order
void setIsOrdered(const bool ordered)
indicates that the container is ordered
size_type calo_cell_hash_max() const
cell 'global' hash table max size
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,...
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
const T * at(size_type n) const
Access an element, as an rvalue.
DataModel_detail::iterator< DataVector > iterator
Standard iterator.
Definition DataVector.h:842
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool highNoiseHG() const
bool problematicForUnknownReason() const
bool unstable() const
bool highNoiseMG() const
bool highNoiseLG() const
bool good() const
Returns true if no problems at all (all bits at zero)
LArBC_t offlineStatus(const Identifier id) const
Query the status of a particular channel by offline ID This is the main client access method.
StatusCode initialize(void)
const std::vector< int > & Rw2PmtMap(int section)
int MBTS_channel(void)
const std::vector< int > & Rw2CellMap(int section)
void setHashIdToROD(const TileHid2RESrcID *p)
const std::vector< unsigned int > * MBTS_RODs()
std::map< unsigned int, unsigned int > & MBTS_map(void)
std::vector< unsigned int > m_mbts_add_rods
std::vector< uint32_t > m_vrodid32tile
const std::vector< unsigned int > * m_mbts_rods
std::vector< IdentifierHash > m_rIdstile
@ TILEHIGHHIGH
Definition CaloGain.h:15
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
size_t getNSlots()
Return the number of event slots.
DataModel_detail::iterator< DVL > unique(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of unique for DataVector/List.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ loadCollections() [1/2]

StatusCode TrigCaloDataAccessSvc::loadCollections ( const EventContext & context,
const IRoiDescriptor & roi,
const DETID detID,
const int sampling,
LArTT_Selector< LArCellCont > & loadedCells )
overridevirtual

Definition at line 83 of file TrigCaloDataAccessSvc.cxx.

87 {
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 }
115 SG::ReadCondHandle<LArRoIMap> roimap ( m_larRoIMapKey, context);
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}
@ FCALEM
Definition RegSelEnums.h:35
@ TTHEC
Definition RegSelEnums.h:29
@ FCALHAD
Definition RegSelEnums.h:36
@ TTEM
Definition RegSelEnums.h:28
void setRoIs(const VEC_TT_ID &ids)
void setMap(const LArRoIMap *map)
void setContainer(const CONTAINER *c)
unsigned int prepareLArCollections(const EventContext &context, const IRoiDescriptor &roi, const int sampling, DETID detector)
LAr TT collections preparation code.

◆ loadCollections() [2/2]

StatusCode TrigCaloDataAccessSvc::loadCollections ( const EventContext & context,
const IRoiDescriptor & roi,
std::vector< const TileCell * > & loadedCells )
overridevirtual

Definition at line 128 of file TrigCaloDataAccessSvc.cxx.

130 {
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}
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
unsigned int prepareTileCollections(const EventContext &context, const IRoiDescriptor &roi)

◆ loadFullCollections()

StatusCode TrigCaloDataAccessSvc::loadFullCollections ( const EventContext & context,
CaloConstCellContainer & cont )
overridevirtual

Definition at line 173 of file TrigCaloDataAccessSvc.cxx.

174 {
175
176 // Gets all data
177 m_robDataProvider->addROBData( context, m_vrodid32fullDet );
178 m_robDataProvider->addROBData( context, m_vrodid32tile );
179
180 unsigned int sc = prepareLArFullCollections( context );
181 ATH_CHECK( sc == 0 );
182
183 sc = prepareTileFullCollections( context );
184 ATH_CHECK( sc == 0 );
185
186 m_hLTCaloSlot.get(context)->lastFSEvent = context.evt();
187
188 std::lock_guard<std::mutex> getCollClock{ m_getCollMutex };
189 CaloCellContainer* cont_to_copy = m_hLTCaloSlot.get(context)->fullcont ;
190 cont.clear();
191 cont.reserve( cont_to_copy->size() );
192 for( const CaloCell* c : *cont_to_copy ) cont.push_back_fast( c );
193 cont.setIsOrdered(true);
194 cont.setIsOrderedAndComplete(true);
195
196 ATH_CHECK( sc == 0 );
197
198 return StatusCode::SUCCESS;
199}
void setIsOrderedAndComplete(bool ordered)
indicate that the container is complete and in order
void setIsOrdered(bool ordered)
indicates that the container is ordered
void push_back_fast(const CaloCell *cell)
reimplementation of push_back to gain speed in readin
void clear()
Erase all the elements in the collection.
unsigned int prepareLArFullCollections(const EventContext &context)
unsigned int prepareTileFullCollections(const EventContext &context)

◆ loadMBTS()

StatusCode TrigCaloDataAccessSvc::loadMBTS ( const EventContext & context,
std::vector< const TileCell * > & loadedCells )
overridevirtual

Definition at line 781 of file TrigCaloDataAccessSvc.cxx.

782 {
783
784 ATH_MSG_DEBUG( "MBTS requested for event " << context );
785 unsigned int sc = prepareMBTSCollections(context);
786
787 if ( sc ) return StatusCode::FAILURE;
788
789 HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
790 std::lock_guard<std::mutex> collectionLock { cache->mutex };
791 TileCellCont* tilecell = cache->tileContainer;
792 TileCellCollection* mbts = tilecell->MBTS_collection();
793 loadedCells.reserve(mbts->size());
794 for (size_t i=0;i<mbts->size(); ++i)
795 loadedCells.push_back(mbts->at(i));
796 return StatusCode::SUCCESS;
797
798}
unsigned int prepareMBTSCollections(const EventContext &context)

◆ missingROBs()

void TrigCaloDataAccessSvc::missingROBs ( const std::vector< uint32_t > & request,
const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & response,
std::set< uint32_t > & missing ) const
private

fill the set of missing robs given the request and response from RoBDatProvider

Definition at line 626 of file TrigCaloDataAccessSvc.cxx.

628 {
629
630 std::set<uint32_t> receivedROBsSet;
631 for ( auto rob: response )
632 receivedROBsSet.insert( rob->source_id() );
633 std::set<uint32_t> requestedROBsSet( request.begin(), request.end() );
634
635 std::set_difference( requestedROBsSet.begin(), requestedROBsSet.end(),
636 receivedROBsSet.begin(), receivedROBsSet.end(),
637 std::inserter( missing, missing.begin() ) );
638}

◆ prepareFullCollections()

unsigned int TrigCaloDataAccessSvc::prepareFullCollections ( const EventContext & context)
private

Definition at line 76 of file TrigCaloDataAccessSvc.cxx.

76 {
77
78 return prepareLArFullCollections( context );
79
80}

◆ prepareLArCollections()

unsigned int TrigCaloDataAccessSvc::prepareLArCollections ( const EventContext & context,
const IRoiDescriptor & roi,
const int sampling,
DETID detector )
private

LAr TT collections preparation code.

Definition at line 655 of file TrigCaloDataAccessSvc.cxx.

658 {
659
660 // If the full event was already unpacked, don't need to unpack RoI
661 if ( !m_lateInitDone && lateInit(context) ) {
662 return 0x1; // dummy code
663 }
664 HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
665 if ( cache->lastFSEvent == context.evt() ) return 0x0;
666
667 std::vector<uint32_t> requestROBs;
668
669 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
670 switch ( detector ) {
671 case TTEM: {m_regionSelector_TTEM->lookup(context)->ROBIDList( sampling, roi, requestROBs ); break; }
672 case TTHEC: {m_regionSelector_TTHEC->lookup(context)->ROBIDList( sampling, roi, requestROBs ); break; }
673 case FCALEM: {m_regionSelector_FCALEM->lookup(context)->ROBIDList( sampling, roi, requestROBs ); break; }
674 case FCALHAD: {m_regionSelector_FCALHAD->lookup(context)->ROBIDList( sampling, roi, requestROBs ); break; }
675 default: break;
676 }
677
678 m_robDataProvider->addROBData( context, requestROBs );
679 m_robDataProvider->getROBData( context, requestROBs, robFrags );
680 if ( robFrags.empty() && (!requestROBs.empty()) ) {
681 return 0x0; // dummy code
682 }
683
684 auto lockTime = Monitored::Timer ( "TIME_locking_LAr_RoI" );
685 std::lock_guard<std::mutex> collectionLock { cache->mutex };
686 lockTime.stop();
687
688 // TB, what would happen from now inside the collection unapcking
689 // if this event number is different than the one for each collection the unpacking will happen,
690 // if it is the same the unpacking will not be repeated
691 // same in prepareLArFullCollections
692 cache->larContainer->eventNumber( context.evt() );
693 if ( m_applyOffsetCorrection && cache->larContainer->lumiBCIDCheck( context ) ) {
694 SG::ReadHandle<CaloBCIDAverage> avg (m_bcidAvgKey, context);
695 SG::ReadCondHandle<LArOnOffIdMapping> onoff ( m_onOffIdMappingKey, context);
696 const CaloBCIDAverage* avgPtr = avg.cptr();
697 const LArOnOffIdMapping* onoffPtr = onoff.cptr();
698 if ( avgPtr && onoffPtr ) cache->larContainer->updateBCID( *avgPtr, *onoffPtr );
699 }
700
701 const LArDeadOTXFromSC* deadHandle = nullptr;
702 if ( m_correctDead ){
703 SG::ReadHandle<LArDeadOTXFromSC> deadHdl(m_deadOTXFromSCKey, context);
704 if ( !deadHdl.isValid() ){
705 ATH_MSG_WARNING("Should not try to use LArDEADOTXFromSC" );
706 } else {
707 deadHandle = deadHdl.cptr();
708 }
709 }
710
711 unsigned int status = convertROBs( robFrags, ( cache->larContainer ), (cache->larRodBlockStructure_per_slot), cache->rodMinorVersion, cache->robBlockType, deadHandle );
712
713 if ( requestROBs.size() != robFrags.size() ) {
714 ATH_MSG_DEBUG( "Missing ROBs, requested " << requestROBs.size() << " obtained " << robFrags.size() );
715 //status |= 0x1; // dummy code
716 clearMissing( requestROBs, robFrags, ( cache->larContainer ) );
717 }
718 auto roiROBs = Monitored::Scalar( "roiROBs_LAr", robFrags.size() );
719 auto roiEta = Monitored::Scalar( "roiEta_LAr", roi.eta() );
720 auto roiPhi = Monitored::Scalar( "roiPhi_LAr", roi.phi() );
721
722 Monitored::Group( m_monTool, lockTime, roiEta, roiPhi, roiROBs );
723 return status;
724}
virtual double eta() const =0
virtual double phi() const =0
Methods to retrieve data members.
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
ToolHandle< GenericMonitoringTool > m_monTool
unsigned int lateInit(const EventContext &context)
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)
constexpr float roiPhi(const AnyRoIPointer &roi)
avg(a, b)
Definition Recovery.py:79
setTeId setLumiBlock setRoiId setRoiSubsystem setRoiNumber roiEta

◆ prepareLArFullCollections()

unsigned int TrigCaloDataAccessSvc::prepareLArFullCollections ( const EventContext & context)
private

Definition at line 202 of file TrigCaloDataAccessSvc.cxx.

202 {
203
204 ATH_MSG_DEBUG( "Full Col " << " requested for event " << context );
205 if ( !m_lateInitDone && lateInit(context) ) {
206 ATH_MSG_ERROR("Could not execute late init");
207 return 0x1; // dummy code
208 }
209
210 HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
211
212 auto lockTime = Monitored::Timer ( "TIME_locking_LAr_FullDet" );
213 std::lock_guard<std::mutex> collectionLock { cache->mutex };
214 lockTime.stop();
215
216 if ( cache->lastFSEvent == context.evt() ) return 0x0; // dummy code
217 cache->larContainer->eventNumber( context.evt() ) ;
218 if ( m_applyOffsetCorrection && cache->larContainer->lumiBCIDCheck( context ) ) {
219 SG::ReadHandle<CaloBCIDAverage> avg (m_bcidAvgKey, context);
220 SG::ReadCondHandle<LArOnOffIdMapping> onoff ( m_onOffIdMappingKey, context);
221 const CaloBCIDAverage* avgPtr = avg.cptr();
222 const LArOnOffIdMapping* onoffPtr = onoff.cptr();
223 if ( avgPtr && onoffPtr ) cache->larContainer->updateBCID( *avgPtr, *onoffPtr );
224 }
225
226
227 unsigned int status(0);
228
229 const LArDeadOTXFromSC* deadHandle = nullptr;
230 if ( m_correctDead ){
231 SG::ReadHandle<LArDeadOTXFromSC> deadHdl(m_deadOTXFromSCKey, context);
232 if ( !deadHdl.isValid() ){
233 ATH_MSG_WARNING("Should not try to use LArDEADOTXFromSC" );
234 } else {
235 deadHandle = deadHdl.cptr();
236 }
237 }
238
239 for( size_t ii=0;ii<m_vrodid32fullDetHG.size();ii++) {
240 std::vector<uint32_t>& vrodid32fullDet = m_vrodid32fullDetHG[ii];
241 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
242 m_robDataProvider->addROBData( context, vrodid32fullDet );
243 m_robDataProvider->getROBData( context, vrodid32fullDet, robFrags );
244
245 status |= convertROBs( robFrags, ( cache->larContainer ), (cache->larRodBlockStructure_per_slot), cache->rodMinorVersion, cache->robBlockType, deadHandle );
246
247 if ( vrodid32fullDet.size() != robFrags.size() ) {
248 ATH_MSG_DEBUG( "Missing ROBs, requested " << vrodid32fullDet.size() << " obtained " << robFrags.size() );
249 //status |= 0x1; // dummy code
250 clearMissing( vrodid32fullDet, robFrags, ( cache->larContainer ) );
251 }
252 } // end of for m_vrodid32fullDetHG.size()
253
254 int detid(0);
255 auto detidMon = Monitored::Scalar<int>( "det", detid );
256
257 Monitored::Group( m_monTool, lockTime, detidMon );
258 return status;
259}

◆ prepareMBTSCollections()

unsigned int TrigCaloDataAccessSvc::prepareMBTSCollections ( const EventContext & context)
private

Definition at line 754 of file TrigCaloDataAccessSvc.cxx.

754 {
755
756 // If the full event was already unpacked, don't need to unpack RoI
757 if ( !m_lateInitDone && lateInit(context) ) {
758 return 0x0; // dummy code
759 }
760 HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
761 if ( cache->lastFSEvent == context.evt() ) return 0x0;
762
763 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
764 m_robDataProvider->addROBData( context, m_mbts_add_rods );
765 std::lock_guard<std::mutex> collectionLock { cache->mutex };
766 TileCellCont* tilecell = cache->tileContainer;
767 if ( cache->tileContainer->eventNumber() != context.evt() )
768 cache->d0cells->clear();
769 cache->tileContainer->eventNumber( context.evt() );
770
771 const std::vector<unsigned int>* ids = tilecell->MBTS_IDs();
772 std::vector<IdentifierHash> tileIds;
773 for(size_t i=0;i<ids->size(); i++) tileIds.push_back( (*ids)[i] );
774 unsigned int status = convertROBs( context, tileIds, cache->tileContainer, cache->d0cells );
775
776 return status;
777}
const std::vector< unsigned int > * MBTS_IDs()

◆ prepareTileCollections()

unsigned int TrigCaloDataAccessSvc::prepareTileCollections ( const EventContext & context,
const IRoiDescriptor & roi )
private

Definition at line 726 of file TrigCaloDataAccessSvc.cxx.

727 {
728
729 // If the full event was already unpacked, don't need to unpack RoI
730 if ( !m_lateInitDone && lateInit(context) ) {
731 return 0x1; // dummy code
732 }
733 HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
734 if ( cache->lastFSEvent == context.evt() ) return 0x0;
735
736 std::vector<uint32_t> requestROBs;
737 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
738 std::vector<IdentifierHash> rIds;
739 m_regionSelector_TILE->lookup(context)->ROBIDList( 0, roi, requestROBs );
740 m_regionSelector_TILE->lookup(context)->HashIDList(roi, rIds);
741 m_robDataProvider->addROBData( context, requestROBs );
742
743
744 std::lock_guard<std::mutex> collectionLock { cache->mutex };
745 if ( cache->tileContainer->eventNumber() != context.evt() )
746 cache->d0cells->clear();
747 cache->tileContainer->eventNumber( context.evt() );
748
749 unsigned int status = convertROBs( context, rIds, cache->tileContainer, cache->d0cells );
750
751 return status;
752}

◆ prepareTileFullCollections()

unsigned int TrigCaloDataAccessSvc::prepareTileFullCollections ( const EventContext & context)
private

Definition at line 261 of file TrigCaloDataAccessSvc.cxx.

261 {
262
263 ATH_MSG_DEBUG( "Full Col " << " requested for event " << context );
264 if ( !m_lateInitDone && lateInit(context) ) {
265 ATH_MSG_ERROR("Could not execute late init");
266 return 0x1; // dummy code
267 }
268
269 HLTCaloEventCache* cache = m_hLTCaloSlot.get( context );
270
271 auto lockTime = Monitored::Timer ( "TIME_locking_LAr_FullDet" );
272 std::lock_guard<std::mutex> collectionLock { cache->mutex };
273 lockTime.stop();
274
275 if ( cache->lastFSEvent == context.evt() ) return 0x0;
276 if ( cache->tileContainer->eventNumber() != context.evt() )
277 cache->d0cells->clear();
278 cache->tileContainer->eventNumber( context.evt() );
279
280 unsigned int status(0);
281 convertROBs( context, m_rIdstile, cache->tileContainer, cache->d0cells );
282
283 int detid(0);
284 auto detidMon = Monitored::Scalar<int>( "det", detid );
285
286 Monitored::Group( m_monTool, lockTime, detidMon );
287 return status;
288}

◆ reset_LArCol()

void TrigCaloDataAccessSvc::reset_LArCol ( LArCellCollection * coll)
inlineprivate

Definition at line 98 of file TrigCaloDataAccessSvc.h.

98 {
99 for(LArCellCollection::iterator ii=coll->begin();ii!=coll->end();++ii)
100 (*ii)->setEnergyFast(0.0);
101 }
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.

◆ reset_TileCol()

void TrigCaloDataAccessSvc::reset_TileCol ( TileCellCollection * col)
inlineprivate

Definition at line 102 of file TrigCaloDataAccessSvc.h.

102 {
103 for ( TileCell* tr: *col ) {
104 (tr)->setEnergy_nonvirt(0.0F, 0.0F, 0, CaloGain::INVALIDGAIN);
105 (tr)->setTime_nonvirt(-100.0F);
106 (tr)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 0);
107 (tr)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 1);
108 } // end of for all channels
109 }
@ INVALIDGAIN
Definition CaloGain.h:18

Member Data Documentation

◆ m_applyOffsetCorrection

Gaudi::Property<bool> TrigCaloDataAccessSvc::m_applyOffsetCorrection { this, "ApplyOffsetCorrection", true, "Enable offset correction" }
private

Definition at line 77 of file TrigCaloDataAccessSvc.h.

77{ this, "ApplyOffsetCorrection", true, "Enable offset correction" };

◆ m_bcContKey

SG::ReadCondHandleKey<LArBadChannelCont> TrigCaloDataAccessSvc::m_bcContKey {this, "LArBadChannelKey", "LArBadChannel", "Key of the LArBadChannelCont CDO" }
private

Definition at line 86 of file TrigCaloDataAccessSvc.h.

87{this, "LArBadChannelKey", "LArBadChannel", "Key of the LArBadChannelCont CDO" };

◆ m_bcidAvgKey

SG::ReadHandleKey<CaloBCIDAverage> TrigCaloDataAccessSvc::m_bcidAvgKey
private

Definition at line 79 of file TrigCaloDataAccessSvc.h.

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> TrigCaloDataAccessSvc::m_caloMgrKey {this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" }
private

Definition at line 90 of file TrigCaloDataAccessSvc.h.

91{this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" };

◆ m_correctDead

bool TrigCaloDataAccessSvc::m_correctDead
private

Definition at line 96 of file TrigCaloDataAccessSvc.h.

◆ m_deadOTXFromSCKey

SG::ReadHandleKey<LArDeadOTXFromSC> TrigCaloDataAccessSvc::m_deadOTXFromSCKey {this, "LArDeadOTXFromSC", "DeadOTXFromSC", "Key of the DeadOTXFromSC CDO" }
private

Definition at line 94 of file TrigCaloDataAccessSvc.h.

95{this, "LArDeadOTXFromSC", "DeadOTXFromSC", "Key of the DeadOTXFromSC CDO" };

◆ m_febRodMappingKey

SG::ReadCondHandleKey<LArFebRodMapping> TrigCaloDataAccessSvc::m_febRodMappingKey {this, "RodFebKey", "LArFebRodMap", "SG Key for LArFebRodMapping"}
private

Definition at line 84 of file TrigCaloDataAccessSvc.h.

85{this, "RodFebKey", "LArFebRodMap", "SG Key for LArFebRodMapping"} ;

◆ m_getCollMutex

std::mutex TrigCaloDataAccessSvc::m_getCollMutex
private

Definition at line 149 of file TrigCaloDataAccessSvc.h.

◆ m_hLTCaloSlot

SG::SlotSpecificObj< HLTCaloEventCache > TrigCaloDataAccessSvc::m_hLTCaloSlot
private

Definition at line 146 of file TrigCaloDataAccessSvc.h.

◆ m_initMutex

std::mutex TrigCaloDataAccessSvc::m_initMutex
private

Definition at line 148 of file TrigCaloDataAccessSvc.h.

◆ m_insertedCells

std::vector<unsigned int> TrigCaloDataAccessSvc::m_insertedCells
private

Definition at line 144 of file TrigCaloDataAccessSvc.h.

◆ m_larDecoder

PublicToolHandle<LArRodDecoder> TrigCaloDataAccessSvc::m_larDecoder { this, "LArDecoderTool", "LArRodDecoder/LArRodDecoder", "Tool to decode LAr raw data" }
private

Definition at line 65 of file TrigCaloDataAccessSvc.h.

65{ this, "LArDecoderTool", "LArRodDecoder/LArRodDecoder", "Tool to decode LAr raw data" };

◆ m_lardecoderProtect

std::mutex TrigCaloDataAccessSvc::m_lardecoderProtect
private

Definition at line 150 of file TrigCaloDataAccessSvc.h.

◆ m_larRoIMapKey

SG::ReadCondHandleKey<LArRoIMap> TrigCaloDataAccessSvc::m_larRoIMapKey {this, "LArRoIMapKey", "LArRoIMap", "Key of the LArRoIMap CDO" }
private

Definition at line 88 of file TrigCaloDataAccessSvc.h.

89{this, "LArRoIMapKey", "LArRoIMap", "Key of the LArRoIMap CDO" };

◆ m_lateInitDone

bool TrigCaloDataAccessSvc::m_lateInitDone = false
private

Definition at line 154 of file TrigCaloDataAccessSvc.h.

◆ m_mbts_add_rods

std::vector<unsigned int> TrigCaloDataAccessSvc::m_mbts_add_rods
private

Definition at line 194 of file TrigCaloDataAccessSvc.h.

◆ m_mbts_rods

const std::vector<unsigned int>* TrigCaloDataAccessSvc::m_mbts_rods = nullptr
private

Definition at line 195 of file TrigCaloDataAccessSvc.h.

◆ m_mcsymKey

SG::ReadCondHandleKey<LArMCSym> TrigCaloDataAccessSvc::m_mcsymKey {this, "MCSymKey", "LArMCSym", "SG Key of LArMCSym object"}
private

Definition at line 80 of file TrigCaloDataAccessSvc.h.

81{this, "MCSymKey", "LArMCSym", "SG Key of LArMCSym object"} ;

◆ m_monTool

ToolHandle<GenericMonitoringTool> TrigCaloDataAccessSvc::m_monTool { this, "MonTool", "", "Tool to monitor performance of the service" }
private

Definition at line 68 of file TrigCaloDataAccessSvc.h.

68{ this, "MonTool", "", "Tool to monitor performance of the service" };

◆ m_nSlots

size_t TrigCaloDataAccessSvc::m_nSlots
private

Definition at line 198 of file TrigCaloDataAccessSvc.h.

◆ m_onOffIdMappingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> TrigCaloDataAccessSvc::m_onOffIdMappingKey {this, "CablingKey", "LArOnOffIdMap", "SG Key for LArOnOffIdMapping"}
private

Definition at line 82 of file TrigCaloDataAccessSvc.h.

83{this, "CablingKey", "LArOnOffIdMap", "SG Key for LArOnOffIdMapping"} ;

◆ m_regionSelector_FCALEM

ToolHandle<IRegSelTool> TrigCaloDataAccessSvc::m_regionSelector_FCALEM { this, "RegSelToolFCALEM", "RegSelTool/RegSelTool_FCALEM" }
private

Definition at line 73 of file TrigCaloDataAccessSvc.h.

73{ this, "RegSelToolFCALEM", "RegSelTool/RegSelTool_FCALEM" };

◆ m_regionSelector_FCALHAD

ToolHandle<IRegSelTool> TrigCaloDataAccessSvc::m_regionSelector_FCALHAD { this, "RegSelToolFCALHAD", "RegSelTool/RegSelTool_FCALHAD" }
private

Definition at line 74 of file TrigCaloDataAccessSvc.h.

74{ this, "RegSelToolFCALHAD", "RegSelTool/RegSelTool_FCALHAD" };

◆ m_regionSelector_TILE

ToolHandle<IRegSelTool> TrigCaloDataAccessSvc::m_regionSelector_TILE { this, "RegSelToolTILE", "RegSelTool/RegSelTool_TILE" }
private

Definition at line 75 of file TrigCaloDataAccessSvc.h.

75{ this, "RegSelToolTILE", "RegSelTool/RegSelTool_TILE" };

◆ m_regionSelector_TTEM

ToolHandle<IRegSelTool> TrigCaloDataAccessSvc::m_regionSelector_TTEM { this, "RegSelToolEM", "RegSelTool/RegSelTool_TTEM" }
private

Definition at line 71 of file TrigCaloDataAccessSvc.h.

71{ this, "RegSelToolEM", "RegSelTool/RegSelTool_TTEM" };

◆ m_regionSelector_TTHEC

ToolHandle<IRegSelTool> TrigCaloDataAccessSvc::m_regionSelector_TTHEC { this, "RegSelToolHEC", "RegSelTool/RegSelTool_TTHEC" }
private

Definition at line 72 of file TrigCaloDataAccessSvc.h.

72{ this, "RegSelToolHEC", "RegSelTool/RegSelTool_TTHEC" };

◆ m_rIdstile

std::vector<IdentifierHash> TrigCaloDataAccessSvc::m_rIdstile
private

Definition at line 196 of file TrigCaloDataAccessSvc.h.

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> TrigCaloDataAccessSvc::m_robDataProvider { this, "ROBDataProvider", "ROBDataProviderSvc/ROBDataProviderSvc", ""}
private

Definition at line 70 of file TrigCaloDataAccessSvc.h.

70{ this, "ROBDataProvider", "ROBDataProviderSvc/ROBDataProviderSvc", ""};

◆ m_tileDecoder

PublicToolHandle<TileROD_Decoder> TrigCaloDataAccessSvc::m_tileDecoder { this, "TileDecoderTool", "TileROD_Decoder/TileROD_Decoder", "Tool to decode Tile raw data" }
private

Definition at line 66 of file TrigCaloDataAccessSvc.h.

66{ this, "TileDecoderTool", "TileROD_Decoder/TileROD_Decoder", "Tool to decode Tile raw data" };

◆ m_tiledecoderProtect

std::mutex TrigCaloDataAccessSvc::m_tiledecoderProtect
private

Definition at line 151 of file TrigCaloDataAccessSvc.h.

◆ m_tileHid2RESrcIDKey

SG::ReadCondHandleKey<TileHid2RESrcID> TrigCaloDataAccessSvc::m_tileHid2RESrcIDKey {this, "TileHid2RESrcID", "TileHid2RESrcIDHLT", "SG Key of TileHid2RESrcID object"}
private

Definition at line 92 of file TrigCaloDataAccessSvc.h.

93{this, "TileHid2RESrcID", "TileHid2RESrcIDHLT", "SG Key of TileHid2RESrcID object"} ;

◆ m_vrodid32fullDet

std::vector<uint32_t> TrigCaloDataAccessSvc::m_vrodid32fullDet
private

Definition at line 192 of file TrigCaloDataAccessSvc.h.

◆ m_vrodid32fullDetHG

std::vector<std::vector<uint32_t> > TrigCaloDataAccessSvc::m_vrodid32fullDetHG
private

Definition at line 197 of file TrigCaloDataAccessSvc.h.

◆ m_vrodid32tile

std::vector<uint32_t> TrigCaloDataAccessSvc::m_vrodid32tile
private

Definition at line 193 of file TrigCaloDataAccessSvc.h.


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