14 : base_class( name, pSvcLocator ),
24 m_autoRetrieveTools =
false;
25 m_checkToolDeps =
false;
46 return StatusCode::SUCCESS;
56 for (
size_t slot = 0; slot <
m_nSlots; ++ slot ) {
72 return StatusCode::SUCCESS;
89 std::vector<IdentifierHash> requestHashIDs;
91 ATH_MSG_DEBUG(
"LArTT requested for event " << context <<
" and RoI " << roi );
94 if (
sc )
return StatusCode::FAILURE;
98 std::lock_guard<std::mutex> getCollClock{
m_hLTCaloSlot.get( context )->mutex };
108 ATH_MSG_DEBUG(
"requestHashIDs.size() in LoadColl = " << requestHashIDs.size() <<
" hash checksum "
109 << std::accumulate( requestHashIDs.begin(), requestHashIDs.end(),
IdentifierHash( 0 ),
111 if ( msgLvl( MSG::VERBOSE ) ) {
112 for(
unsigned int i = 0 ; i < requestHashIDs.size() ; i++ )
117 loadedCells.
setMap( *roimap );
121 std::lock_guard<std::mutex> getCollClock{
m_hLTCaloSlot.get( context )->mutex };
122 loadedCells.
setRoIs( requestHashIDs );
124 if (
sc )
return StatusCode::FAILURE;
125 else return StatusCode::SUCCESS;
130 std::vector<const TileCell*>& loadedCells ) {
131 std::vector<IdentifierHash> requestHashIDs;
133 ATH_MSG_DEBUG(
"Tile requested for event " << context <<
" and RoI " << roi );
136 if (
sc )
return StatusCode::FAILURE;
140 std::lock_guard<std::mutex> getCollClock{
m_hLTCaloSlot.get( context )->mutex };
143 ATH_MSG_DEBUG(
"requestHashIDs.size() in LoadColl = " << requestHashIDs.size() <<
" hash checksum "
144 << std::accumulate( requestHashIDs.begin(), requestHashIDs.end(),
IdentifierHash( 0 ),
146 if ( msgLvl( MSG::VERBOSE ) ) {
147 for(
unsigned int i = 0 ; i < requestHashIDs.size() ; i++ )
148 ATH_MSG_VERBOSE(
"requestHashIDs[" << i <<
"]=" << requestHashIDs[i] );
150 size_t listIDsize = requestHashIDs.size();
153 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
155 for (
size_t i = 0; i < listIDsize; ++i){
157 const std::vector<TileCellCollection*>::const_iterator it =
158 (tilecell->
find(requestHashIDs[i]));
160 if ( col ==
nullptr )
continue;
163 for (;itt!=End;++itt){
165 loadedCells.push_back( cell );
169 return StatusCode::SUCCESS;
198 return StatusCode::SUCCESS;
204 ATH_MSG_DEBUG(
"Full Col " <<
" requested for event " << context );
213 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
216 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
227 unsigned int status(0);
235 deadHandle = deadHdl.
cptr();
241 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
247 if ( vrodid32fullDet.size() != robFrags.size() ) {
248 ATH_MSG_DEBUG(
"Missing ROBs, requested " << vrodid32fullDet.size() <<
" obtained " << robFrags.size() );
263 ATH_MSG_DEBUG(
"Full Col " <<
" requested for event " << context );
272 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
275 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
280 unsigned int status(0);
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;
313 std::vector<uint32_t> vrodid32tile;
314 std::vector<IdentifierHash> rIdstile;
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());
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());
356 unsigned int nFebs=70;
357 unsigned int high_granu = (
unsigned int)ceilf(
m_vrodid32fullDet.size()/((
float)nFebs) );
376 for (
size_t slot = 0; slot <
m_nSlots; ++ slot ) {
382 if ( cache->
larContainer->
initialize( **roimap, **onoff, **mcsym, **febrod, **larBadChan, *theCaloDDM).isFailure() )
384 std::vector<CaloCell*> local_cell_copy;
385 local_cell_copy.reserve(200000);
389 cachefullcont->
reserve(190000);
391 for(
unsigned int lcidx=0; lcidx < larcell->size(); 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() ) {
407 if ( good ) local_cell_copy.push_back( cell );
416 if( tilecell->
initialize().isFailure() )
return 0x1;
417 for (
unsigned int i=0;i<4;i++) {
428 for(
unsigned int lcidx=0; lcidx < tilecell->size(); 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 );
436 int ros = (frag_id >> 8);
438 int drawer = (frag_id & 0xFF);
441 d0cellsp->
m_cells[drawer] = *pCell;
449 for(
unsigned int i=0;i<hashMax;i++){
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();
457 cachefullcont->
at(j) = local_cell_copy.at(i);
460 for(
unsigned int i=0;i<hashMax;i++)
461 if ( cachefullcont->
at(i) ==
nullptr ){
465 if ( el->is_tile() ) {
481 cachefullcont->
order();
483 if ( hashMax != cachefullcont->
size() )
489 local_cell_copy.clear();
497 uint16_t rodMinorVersion, uint32_t robBlockType,
const LArDeadOTXFromSC* deadHandle ) {
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 );
505 if ( it != larcell->end() && ( *it )->size() != 0 ) {
510 ATH_MSG_DEBUG(
"ROB of ID " << sourceID <<
" to be decoded" );
518 "event: Bad ROB block ( eformat checks ) : 0x"
519 << std::hex << sourceID << std::dec );
526 const uint32_t* roddata = 0;
527 rob->rod_data( roddata );
528 size_t roddatasize = rob->rod_ndata();
529 if ( roddatasize < 3 ) {
531 "event: Empty ROD block ( less than 3 words ) : 0x"
532 << std::hex << sourceID << std::dec );
538 m_larDecoder->fillCollectionHLT( *rob, roddata, roddatasize, *coll, larRodBlockStructure_per_slot, rodMinorVersion, robBlockType );
543 for(
size_t i=0;i<128;i++) {
573 const std::vector<IdentifierHash>& rIds,
576 unsigned int status(0);
580 size_t listIDsize = rIds.size();
581 std::vector<unsigned int> tile; tile.push_back(0);
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]);
590 const std::vector<TileCellCollection*>::const_iterator it =
591 (tilecell->
find(rIds[i]));
593 if ( robFrags1.size()!=0 && col !=
nullptr ) {
594 size_t roddatasize = robFrags1[0]->rod_ndata();
596 if (roddatasize < 3) {
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;
605 if ( !tilecell->
cached(rIds[i])){
612 if ( !tilecell->
cached(rIds[i]))
613 m_tileDecoder->fillCollectionHLT(robFrags1[0],*col,*d0cells,mbts,hid2re);
627 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>&
response,
628 std::set<uint32_t>& missing )
const {
630 std::set<uint32_t> receivedROBsSet;
632 receivedROBsSet.insert( rob->source_id() );
633 std::set<uint32_t> requestedROBsSet( request.begin(), request.end() );
635 std::set_difference( requestedROBsSet.begin(), requestedROBsSet.end(),
636 receivedROBsSet.begin(), receivedROBsSet.end(),
637 std::inserter( missing, missing.begin() ) );
642 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>&
response,
644 std::set<uint32_t> 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 ) {
665 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
667 std::vector<uint32_t> requestROBs;
669 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
670 switch ( detector ) {
680 if ( robFrags.empty() && (!requestROBs.empty()) ) {
685 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
707 deadHandle = deadHdl.
cptr();
713 if ( requestROBs.size() != robFrags.size() ) {
714 ATH_MSG_DEBUG(
"Missing ROBs, requested " << requestROBs.size() <<
" obtained " << robFrags.size() );
734 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
736 std::vector<uint32_t> requestROBs;
737 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
738 std::vector<IdentifierHash> rIds;
744 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
761 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
763 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
765 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
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] );
782 std::vector<const TileCell*>& loadedCells ) {
787 if (
sc )
return StatusCode::FAILURE;
790 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
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;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Definition of CaloDetDescrManager.
std::vector< size_t > vec
#define CHECK(...)
Evaluate an expression and check for errors.
LArBadXCont< LArBadChannel > LArBadChannelCont
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Header file to be included by clients of the Monitored infrastructure.
DETID
An enum to define subdetector names.
Container class for CaloCell.
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,...
Helper class for offline cell identifiers.
Data object for each calorimeter readout cell.
CaloCellContainer that can accept const cell pointers.
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
This class groups all DetDescr information related to a CaloCell.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
void clear()
Erase all the elements in the collection.
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
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.
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.
Describes the API of the Region of Ineterest geometry.
virtual double eta() const =0
virtual double phi() const =0
Methods to retrieve data members.
This is a "hash" representation of an Identifier.
bool problematicForUnknownReason() 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.
Container Class for LArCell in a ROB used by EF.
Class which contains statically allocated LArCellCollections.
StatusCode initialize(const LArRoIMap &roiMap, const LArOnOffIdMapping &onOffMap, const LArMCSym &mcsym, const LArFebRodMapping &febrod, const LArBadChannelCont &badchannel, const CaloDetDescrManager &ddm)
initialize method.
const std::vector< LArCellCollection * >::const_iterator find(const HWIdentifier &id) const
Finds a collection by its LArReadoutModuleID.
void applyBCIDCorrection(const unsigned int &rodid)
method to apply correction based on the luminosity to the energy
void eventNumber(const unsigned int eN)
sets Event Number
void updateBCID(const CaloBCIDAverage &, const LArOnOffIdMapping &)
update BCID dependent correction table for MT case
HWIdentifier findsec(const unsigned int &id) const
Each Collection contains data from 2 FEBs.
StatusCode finalize(void)
finalize method.
bool lumiBCIDCheck(const EventContext &context)
Data object for LAr calorimeter readout cell.
const std::vector< float > & correctionFromThisOTXdead(HWIdentifier febid) const
bool isThisOTXdead(HWIdentifier febid) const
uint32_t getFEBID() const
void setRoIs(const VEC_TT_ID &ids)
void setMap(const LArRoIMap *map)
void setContainer(const CONTAINER *c)
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
const_pointer_type cptr()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
This class builds the Tile cells.
StatusCode initialize(void)
const std::vector< int > & Rw2PmtMap(int section)
void eventNumber(const unsigned int eN)
unsigned int find_rod(const unsigned int &id) const
const std::vector< int > & Rw2CellMap(int section)
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)
void setHashIdToROD(const TileHid2RESrcID *p)
StatusCode finalize(void)
const TileHid2RESrcID * getHashIdToROD() const
const std::vector< unsigned int > * MBTS_IDs()
const std::vector< unsigned int > * MBTS_RODs()
std::map< unsigned int, unsigned int > & MBTS_map(void)
This class provides conversion between fragment ID and RESrcID.
PublicToolHandle< TileROD_Decoder > m_tileDecoder
std::vector< unsigned int > m_mbts_add_rods
ToolHandle< IRegSelTool > m_regionSelector_TTHEC
unsigned int prepareLArFullCollections(const EventContext &context)
SG::ReadCondHandleKey< TileHid2RESrcID > m_tileHid2RESrcIDKey
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
std::mutex m_lardecoderProtect
void reset_TileCol(TileCellCollection *col)
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
SG::ReadCondHandleKey< LArFebRodMapping > m_febRodMappingKey
Gaudi::Property< bool > m_applyOffsetCorrection
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdMappingKey
std::vector< uint32_t > m_vrodid32tile
std::mutex m_tiledecoderProtect
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
PublicToolHandle< LArRodDecoder > m_larDecoder
ToolHandle< GenericMonitoringTool > m_monTool
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
virtual StatusCode initialize() override
virtual StatusCode loadCollections(const EventContext &context, const IRoiDescriptor &roi, const DETID detID, const int sampling, LArTT_Selector< LArCellCont > &loadedCells) override
TrigCaloDataAccessSvc(const std::string &name, ISvcLocator *pSvcLocator)
std::mutex m_getCollMutex
ToolHandle< IRegSelTool > m_regionSelector_FCALEM
unsigned int lateInit(const EventContext &context)
SG::ReadHandleKey< LArDeadOTXFromSC > m_deadOTXFromSCKey
virtual StatusCode loadMBTS(const EventContext &context, std::vector< const TileCell * > &loadedCells) override
unsigned int prepareTileFullCollections(const EventContext &context)
SG::ReadCondHandleKey< LArRoIMap > m_larRoIMapKey
std::vector< std::vector< uint32_t > > m_vrodid32fullDetHG
ToolHandle< IRegSelTool > m_regionSelector_TTEM
SG::SlotSpecificObj< HLTCaloEventCache > m_hLTCaloSlot
std::vector< unsigned int > m_insertedCells
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
std::vector< uint32_t > m_vrodid32fullDet
const std::vector< unsigned int > * m_mbts_rods
ToolHandle< IRegSelTool > m_regionSelector_FCALHAD
unsigned int prepareLArCollections(const EventContext &context, const IRoiDescriptor &roi, const int sampling, DETID detector)
LAr TT collections preparation code.
ToolHandle< IRegSelTool > m_regionSelector_TILE
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)
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
unsigned int prepareFullCollections(const EventContext &context)
SG::ReadCondHandleKey< LArMCSym > m_mcsymKey
void reset_LArCol(LArCellCollection *coll)
virtual StatusCode finalize() override
unsigned int prepareTileCollections(const EventContext &context, const IRoiDescriptor &roi)
std::vector< IdentifierHash > m_rIdstile
virtual StatusCode loadFullCollections(const EventContext &context, CaloConstCellContainer &cont) override
unsigned int prepareMBTSCollections(const EventContext &context)
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
@ 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.
convience structure to keep together a collection and auxiliar full collection selectors
LArCellCont * larContainer
LArRodBlockStructure * larRodBlockStructure_per_slot
CaloCellContainer * fullcont
TileCellCont * tileContainer
TileROD_Decoder::D0CellsHLT * d0cells