11 #include <type_traits>
14 : base_class(
name, pSvcLocator ),
15 m_bcidAvgKey(
"CaloBCIDAverage"),
16 m_lateInitDone(false), m_nSlots(0)
23 m_autoRetrieveTools =
false;
24 m_checkToolDeps =
false;
43 return StatusCode::SUCCESS;
53 for (
size_t slot = 0; slot <
m_nSlots; ++ slot ) {
68 return StatusCode::SUCCESS;
85 std::vector<IdentifierHash> requestHashIDs;
87 ATH_MSG_DEBUG(
"LArTT requested for event " << context <<
" and RoI " << roi );
90 if (
sc )
return StatusCode::FAILURE;
94 std::lock_guard<std::mutex> getCollClock{
m_hLTCaloSlot.get( context )->mutex };
104 ATH_MSG_DEBUG(
"requestHashIDs.size() in LoadColl = " << requestHashIDs.size() <<
" hash checksum "
108 for(
unsigned int i = 0 ;
i < requestHashIDs.size() ;
i++ )
113 loadedCells.
setMap( *roimap );
117 std::lock_guard<std::mutex> getCollClock{
m_hLTCaloSlot.get( context )->mutex };
118 loadedCells.
setRoIs( requestHashIDs );
120 if (
sc )
return StatusCode::FAILURE;
121 else return StatusCode::SUCCESS;
126 std::vector<const TileCell*>& loadedCells ) {
127 std::vector<IdentifierHash> requestHashIDs;
129 ATH_MSG_DEBUG(
"Tile requested for event " << context <<
" and RoI " << roi );
132 if (
sc )
return StatusCode::FAILURE;
136 std::lock_guard<std::mutex> getCollClock{
m_hLTCaloSlot.get( context )->mutex };
139 ATH_MSG_DEBUG(
"requestHashIDs.size() in LoadColl = " << requestHashIDs.size() <<
" hash checksum "
143 for(
unsigned int i = 0 ;
i < requestHashIDs.size() ;
i++ )
146 size_t listIDsize = requestHashIDs.size();
149 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
151 for (
size_t i = 0;
i < listIDsize; ++
i){
153 const std::vector<TileCellCollection*>::const_iterator
it =
154 (tilecell->
find(requestHashIDs[
i]));
156 if (
col == NULL )
continue;
159 for (;itt!=End;++itt){
161 loadedCells.push_back(
cell );
165 return StatusCode::SUCCESS;
200 return StatusCode::SUCCESS;
206 ATH_MSG_DEBUG(
"Full Col " <<
" requested for event " << context );
215 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
218 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
232 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
242 if ( vrodid32fullDet.size() != robFrags.size() ) {
243 ATH_MSG_DEBUG(
"Missing ROBs, requested " << vrodid32fullDet.size() <<
" obtained " << robFrags.size() );
258 ATH_MSG_DEBUG(
"Full Col " <<
" requested for event " << context );
267 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
270 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
297 std::vector<uint32_t> vrodid32lar;
298 std::vector<uint32_t> vrodid32em;
299 std::vector<uint32_t> vrodid32hec;
300 std::vector<uint32_t> vrodid32hec0;
301 std::vector<uint32_t> vrodid32hec1;
302 std::vector<uint32_t> vrodid32hec2;
303 std::vector<uint32_t> vrodid32hec3;
304 std::vector<uint32_t> vrodid32fcalem;
305 std::vector<uint32_t> vrodid32fcalhad;
308 std::vector<uint32_t> vrodid32tile;
309 std::vector<IdentifierHash> rIdstile;
327 auto iii = std::unique_copy(vrodid32tile.begin(),vrodid32tile.end(),
m_vrodid32tile.begin());
328 auto iij = std::unique_copy(rIdstile.begin(),rIdstile.end(),
m_rIdstile.begin());
336 vrodid32lar.insert(vrodid32lar.end(),vrodid32em.begin(),vrodid32em.end());
337 vrodid32hec.insert(vrodid32hec.end(),vrodid32hec0.begin(),vrodid32hec0.end());
338 vrodid32lar.insert(vrodid32lar.end(),vrodid32hec.begin(),vrodid32hec.end());
339 vrodid32lar.insert(vrodid32lar.end(),vrodid32fcalhad.begin(),vrodid32fcalhad.end());
340 vrodid32lar.insert(vrodid32lar.end(),vrodid32fcalem.begin(),vrodid32fcalem.end());
351 unsigned int nFebs=70;
371 for (
size_t slot = 0; slot <
m_nSlots; ++ slot ) {
377 if ( cache->
larContainer->
initialize( **roimap, **onoff, **mcsym, **febrod, **larBadChan, *theCaloDDM).isFailure() )
379 std::vector<CaloCell*> local_cell_copy;
380 local_cell_copy.reserve(200000);
384 cachefullcont->
reserve(190000);
386 for(
unsigned int lcidx=0; lcidx < larcell->size(); lcidx++){
388 unsigned int lccsize = lcc->
size();
389 for(
unsigned int lccidx=0; lccidx<lccsize; lccidx++){
402 if (
good ) local_cell_copy.push_back(
cell );
411 if( tilecell->
initialize().isFailure() )
return 0x1;
412 for (
unsigned int i=0;
i<4;
i++) {
423 for(
unsigned int lcidx=0; lcidx < tilecell->size(); lcidx++){
425 unsigned int lccsize = lcc->
size();
426 for(
unsigned int lccidx=0; lccidx<lccsize; lccidx++){
428 if (
cell ) local_cell_copy.push_back(
cell );
431 int ros = (frag_id >> 8);
433 int drawer = (frag_id & 0xFF);
444 for(
unsigned int i=0;
i<hashMax;
i++){
448 unsigned int localcellMax = local_cell_copy.size();
449 for(
unsigned int i=0;
i<localcellMax;
i++){
450 unsigned int j = local_cell_copy.at(
i)->caloDDE()->calo_hash();
452 cachefullcont->
at(j) = local_cell_copy.at(
i);
455 for(
unsigned int i=0;
i<hashMax;
i++)
456 if ( cachefullcont->
at(
i) == nullptr ){
460 if (
el->is_tile() ) {
474 cachefullcont->
order();
476 if ( hashMax != cachefullcont->
size() )
482 local_cell_copy.clear();
493 for (
auto rob: robFrags ) {
494 uint32_t sourceID = rob->source_id();
495 const std::vector<LArCellCollection*>::const_iterator
it = larcell->
find( sourceID );
498 if (
it != larcell->end() && ( *it )->size() != 0 ) {
503 ATH_MSG_DEBUG(
"ROB of ID " << sourceID <<
" to be decoded" );
510 "event: Bad ROB block ( eformat checks ) : 0x"
511 << std::hex << sourceID << std::dec );
519 rob->rod_data( roddata );
520 size_t roddatasize = rob->rod_ndata();
521 if ( roddatasize < 3 ) {
523 "event: Empty ROD block ( less than 3 words ) : 0x"
524 << std::hex << sourceID << std::dec );
530 m_larDecoder->fillCollectionHLT( *rob, roddata, roddatasize, *coll, larRodBlockStructure_per_slot, rodMinorVersion, robBlockType );
549 const std::vector<IdentifierHash>& rIds,
556 size_t listIDsize = rIds.size();
557 std::vector<unsigned int>
tile;
tile.push_back(0);
559 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags1;
560 for (
size_t i = 0;
i < listIDsize; ++
i){
566 const std::vector<TileCellCollection*>::const_iterator
it =
567 (tilecell->
find(rIds[
i]));
569 if ( robFrags1.size()!=0 &&
col != NULL ) {
570 size_t roddatasize = robFrags1[0]->rod_ndata();
572 if (roddatasize < 3) {
574 "event: Empty ROD block (less than 3 words) : 0x"
575 << std::hex <<
tile[0] << std::dec );
576 msg(MSG::WARNING) <<
"Error reading bytestream "
577 <<
"event: Empty ROD block (less than 3 words) : 0x"
581 if ( !tilecell->
cached(rIds[
i])){
588 if ( !tilecell->
cached(rIds[
i]))
603 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>&
response,
604 std::set<uint32_t>& missing )
const {
606 std::set<uint32_t> receivedROBsSet;
608 receivedROBsSet.insert( rob->source_id() );
609 std::set<uint32_t> requestedROBsSet( request.begin(), request.end() );
611 std::set_difference( requestedROBsSet.begin(), requestedROBsSet.end(),
612 receivedROBsSet.begin(), receivedROBsSet.end(),
613 std::inserter( missing, missing.begin() ) );
618 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>&
response,
620 std::set<uint32_t> missing;
623 const std::vector<LArCellCollection*>::const_iterator
it = larcell->
find( robID );
624 if (
it != larcell->end() && ( *it )->size()!=0 ) {
641 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
643 std::vector<uint32_t> requestROBs;
645 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
659 if ( robFrags.empty() && (!requestROBs.empty()) ) {
664 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
682 if ( requestROBs.size() != robFrags.size() ) {
683 ATH_MSG_DEBUG(
"Missing ROBs, requested " << requestROBs.size() <<
" obtained " << robFrags.size() );
703 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
705 std::vector<uint32_t> requestROBs;
706 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
707 std::vector<IdentifierHash> rIds;
716 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
733 if ( cache->
lastFSEvent == context.evt() )
return 0x0;
735 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
740 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
746 const std::vector<unsigned int>*
ids = tilecell->
MBTS_IDs();
747 std::vector<IdentifierHash> tileIds;
748 for(
size_t i=0;
i<
ids->size();
i++) tileIds.push_back( (*
ids)[
i] );
757 std::vector<const TileCell*>& loadedCells ) {
762 if (
sc )
return StatusCode::FAILURE;
765 std::lock_guard<std::mutex> collectionLock { cache->
mutex };
768 loadedCells.reserve(
mbts->size());
769 for (
size_t i=0;
i<
mbts->size(); ++
i)
770 loadedCells.push_back(
mbts->at(
i));
771 return StatusCode::SUCCESS;