ATLAS Offline Software
Loading...
Searching...
No Matches
FSRoIsUnpackingTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8
10 const std::string& name,
11 const IInterface* parent)
12 : RoIsUnpackingToolBase(type, name, parent) {
13}
14
15
18 return StatusCode::SUCCESS;
19}
20
21
23 ATH_CHECK(decodeMapping([](const std::string& name){
24 return name.find("FS") == 0 or name.empty();
25 }));
26
27 m_allFSChains.clear();
28
29 for ( auto thresholdToChain: m_thresholdToChainMapping ) {
30 m_allFSChains.insert( thresholdToChain.second.begin(), thresholdToChain.second.end() );
31 }
32
36 for ( auto id: m_allFSChains ) {
37 ATH_MSG_DEBUG( "FS Chain " << id );
38 }
39
40 return StatusCode::SUCCESS;
41}
42
43
44StatusCode FSRoIsUnpackingTool::unpack(const EventContext& ctx,
45 const ROIB::RoIBResult& /*roib*/,
46 const HLT::IDSet& activeChains) const {
47 using namespace TrigCompositeUtils;
49 auto *decisionOutput = handle.ptr();
50
51 HLT::IDSet activeFSChains;
52 // see if any chain we care of is active
53 std::set_intersection(activeChains.begin(), activeChains.end(),
54 m_allFSChains.begin(), m_allFSChains.end(),
55 std::inserter(activeFSChains, activeFSChains.end()));
56
57 // This hltSeedingNodeName() denotes an initial node with no parents
58 auto *decision = TrigCompositeUtils::newDecisionIn( decisionOutput, hltSeedingNodeName() );
59 addChainsToDecision( HLT::Identifier( "FSNOSEED" ), decision, activeChains );
60
61 ATH_MSG_DEBUG("Unpacking FS RoI for " << activeFSChains.size() << " chains: " << [&](){
62 TrigCompositeUtils::DecisionIDContainer ids;
63 TrigCompositeUtils::decisionIDs( decision, ids );
64 return std::vector<TrigCompositeUtils::DecisionID>( ids.begin(), ids.end() ); }() );
65
66 auto roiHandle = SG::makeHandle( m_trigRoIsKey, ctx );
67 ATH_CHECK(roiHandle.record( std::make_unique<TrigRoiDescriptorCollection>() ));
69 if ( !m_roiupdater.empty() ) {
70 roiHandle->push_back( m_roiupdater->execute(ctx) );
71 }
72 else {
73 roiHandle->push_back( std::make_unique<TrigRoiDescriptor>( RoiDescriptor::FULLSCAN ) );
74 }
75
76 ATH_MSG_DEBUG("Linking to FS RoI descriptor");
77 decision->setObjectLink( initialRoIString(), ElementLink<TrigRoiDescriptorCollection>( m_trigRoIsKey.key(), 0, ctx ) );
78
79 return StatusCode::SUCCESS;
80}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
virtual StatusCode initialize() override
virtual StatusCode start() override
FSRoIsUnpackingTool(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode unpack(const EventContext &ctx, const ROIB::RoIBResult &roib, const HLT::IDSet &activeChains) const override
Class holding the LVL1 RoIB result build by the RoIBuilder.
Definition RoIBResult.h:47
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKey
ToolHandle< IRoiUpdaterTool > m_roiupdater
RoIsUnpackingToolBase(const std::string &type, const std::string &name, const IInterface *parent)
void addChainsToDecision(HLT::Identifier thresholdId, TrigCompositeUtils::Decision *d, const HLT::IDSet &activeChains) const
virtual StatusCode initialize() override
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_trigRoIsKey
StatusCode decodeMapping(std::function< bool(const std::string &)> &&filter)
Fills mapping from L1 threshold -> to HLT chain.
std::map< HLT::Identifier, HLT::IDVec > m_thresholdToChainMapping
static constexpr bool FULLSCAN
convenient
pointer_type ptr()
Dereference the pointer.
std::set< HLT::Identifier > IDSet
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
const std::string & initialRoIString()
const std::string & hltSeedingNodeName()