ATLAS Offline Software
Loading...
Searching...
No Matches
METRoIsUnpackingTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
7
8
10 const std::string& name,
11 const IInterface* parent)
12 : RoIsUnpackingToolBase(type, name, parent) {}
13
14
17 return StatusCode::SUCCESS;
18}
19
20
22 ATH_CHECK(decodeMapping([](const std::string& name){
23 return name.find("TE") == 0 or name.find("XE") == 0 or name.find("XS") == 0;
24 }));
25
26 for ( auto th2chains: m_thresholdToChainMapping ) {
27 m_allMETChains.insert( th2chains.second.begin(), th2chains.second.end() );
28 }
29
30 return StatusCode::SUCCESS;
31}
32
33
34StatusCode METRoIsUnpackingTool::unpack(const EventContext& ctx,
35 const ROIB::RoIBResult& roib,
36 const HLT::IDSet& activeChains) const {
37 using namespace TrigCompositeUtils;
39
40 // Retrieve the L1 menu configuration
42 ATH_CHECK(l1Menu.isValid());
43 ThrVec thresholds;
44 std::optional<ThrVecRef> xeThresholds;
45 std::optional<ThrVecRef> teThresholds;
46 std::optional<ThrVecRef> xsThresholds;
47 ATH_CHECK(getL1Thresholds(*l1Menu, "XE", xeThresholds));
48 ATH_CHECK(getL1Thresholds(*l1Menu, "TE", teThresholds));
49 ATH_CHECK(getL1Thresholds(*l1Menu, "XS", xsThresholds));
50 thresholds.insert(thresholds.end(), xeThresholds.value().get().cbegin(), xeThresholds.value().get().cend());
51 thresholds.insert(thresholds.end(), teThresholds.value().get().cbegin(), teThresholds.value().get().cend());
52 thresholds.insert(thresholds.end(), xsThresholds.value().get().cbegin(), xsThresholds.value().get().cend());
53
54 HLT::IDSet activeMETchains;
55 // see if any chain we care of is active
56 std::set_intersection(activeChains.begin(), activeChains.end(),
57 m_allMETChains.begin(), m_allMETChains.end(),
58 std::inserter(activeMETchains, activeMETchains.end()));
59
60 ATH_MSG_DEBUG("Unpacking MET RoI for " << activeMETchains.size() << " chains");
61
62 // This hltSeedingNodeName() denotes an initial node with no parents
63 auto *decision = TrigCompositeUtils::newDecisionIn( decisionOutput.ptr(), hltSeedingNodeName() );
64 for (const auto& th: thresholds) {
65 addChainsToDecision( HLT::Identifier( th->name() ), decision, activeChains );
66 }
67
68 ATH_MSG_DEBUG("Linking to FS RoI descriptor");
69 decision->setObjectLink( initialRoIString(), ElementLink<TrigRoiDescriptorCollection>( m_fsRoIKey, 0, ctx ) );
70
71 // check the MET RoI, TODO unpack and create L1 MET object (only if turns out to be needed)
72 bool foundMETRoI = false;
73 const std::vector<ROIB::JetEnergyResult>& jetEnergyResult = roib.jetEnergyResult();
74 for ( const ROIB::JetEnergyResult& jeResult: jetEnergyResult ) {
75 for ( const ROIB::JetEnergyRoI& roi: jeResult.roIVec() ) {
76 const LVL1::TrigT1CaloDefs::RoIType roiType = m_jepDecoder.roiType( roi.roIWord() );
78 foundMETRoI = true;
79 break;
80 }
81 }
82 }
83
84 // inconsistency, active MET chains, yet missing MET RoI
85 if ( (not activeMETchains.empty()) and not foundMETRoI) {
86 ATH_MSG_WARNING( "" << activeMETchains.size() << " active MET chains while missing MET RoI" );
87 }
88 return StatusCode::SUCCESS;
89}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#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.
Gaudi::Property< std::string > m_fsRoIKey
LVL1::JEPRoIDecoder m_jepDecoder
virtual StatusCode start() override
virtual StatusCode initialize() override
METRoIsUnpackingTool(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
const std::vector< JetEnergyResult > & jetEnergyResult() const
Gets the jet/energy part of the L1 RDO.
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKey
std::vector< std::shared_ptr< TrigConf::L1Threshold > > ThrVec
RoIsUnpackingToolBase(const std::string &type, const std::string &name, const IInterface *parent)
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
void addChainsToDecision(HLT::Identifier thresholdId, TrigCompositeUtils::Decision *d, const HLT::IDSet &activeChains) const
virtual StatusCode initialize() override
StatusCode getL1Thresholds(const TrigConf::L1Menu &l1Menu, const std::string &thrType, std::optional< ThrVecRef > &thrVec) const
Retrieve a vector of thresholds with type thrType from L1Menu.
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
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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()