11 #include <type_traits>
14 : base_class(
name, pSvcLocator ),
15 m_bcidAvgKey(
"CaloBCIDAverage"),
17 m_lateInitDone(false), m_nSlots(0)
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 "
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 "
147 for(
unsigned int i = 0 ;
i < requestHashIDs.size() ;
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;
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;
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;
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++){
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++){
433 if (
cell ) local_cell_copy.push_back(
cell );
436 int ros = (frag_id >> 8);
438 int drawer = (frag_id & 0xFF);
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();
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 );
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,
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){
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"
605 if ( !tilecell->
cached(rIds[
i])){
612 if ( !tilecell->
cached(rIds[
i]))
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;
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;
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;