ATLAS Offline Software
Loading...
Searching...
No Matches
MURoIsUnpackingTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
7
10
11
13 const std::string& name,
14 const IInterface* parent )
15 : RoIsUnpackingToolBase ( type, name, parent ) {}
16
17
20 CHECK( m_recRoIsKey.initialize(SG::AllowEmpty) );
21 CHECK( m_recRpcRoITool.retrieve() );
22 CHECK( m_recTgcRoITool.retrieve() );
23 return StatusCode::SUCCESS;
24}
25
26
28 ATH_CHECK( decodeMapping([](const std::string& name){
29 return name.find("MU") == 0 or name.find(getProbeThresholdName("MU")) == 0;
30 }));
31 return StatusCode::SUCCESS;
32}
33
34
35StatusCode MURoIsUnpackingTool::unpack(const EventContext& ctx,
36 const ROIB::RoIBResult& roib,
37 const HLT::IDSet& activeChains ) const {
38 using namespace TrigCompositeUtils;
39
40 // create and record the collections needed
45
46 // Retrieve the L1 menu configuration
48 ATH_CHECK(l1Menu.isValid());
49 std::optional<ThrVecRef> muThresholds;
50 ATH_CHECK(getL1Thresholds(*l1Menu, "MU", muThresholds));
51
52 for ( const auto & roi : roib.muCTPIResult().roIVec() ) {
53 const uint32_t roIWord = roi.roIWord();
54 unsigned int thresholdNumber = roi.pt();
55 ATH_MSG_DEBUG( "MUON RoI with the threshold number: " << thresholdNumber );
56 if ( thresholdNumber < 1 or thresholdNumber > 6 ) {
57 ATH_MSG_WARNING( "Incorrect threshold number, should be between 1 and 6 but is: "
58 << thresholdNumber << ", force setting it to 1" );
59 thresholdNumber = 1;
60 }
61
62 recRoIs->push_back(std::make_unique<LVL1::RecMuonRoI>(roIWord,
63 m_recRpcRoITool.get(),
64 m_recTgcRoITool.get(),
65 l1Menu.cptr()));
66 const LVL1::RecMuonRoI* recRoI = recRoIs->back();
67
68 trigRoIs->push_back( std::make_unique<TrigRoiDescriptor>(
69 roIWord, 0u ,0u,
70 recRoI->eta(), recRoI->eta()-m_roIWidth, recRoI->eta()+m_roIWidth,
71 recRoI->phi(), recRoI->phi()-m_roIWidth, recRoI->phi()+m_roIWidth) );
72
73 ATH_MSG_DEBUG( "RoI word: 0x" << MSG::hex << std::setw( 8 ) << roIWord );
74
75 // The hltSeedingNodeName() denotes an initial node with no parents
76 Decision* decisionMain = TrigCompositeUtils::newDecisionIn( decisionOutput.ptr(), hltSeedingNodeName() );
77 decisionMain->setObjectLink( initialRoIString(),
78 ElementLink<TrigRoiDescriptorCollection>(m_trigRoIsKey.key(), trigRoIs->size()-1, ctx) );
79 decisionMain->setObjectLink( initialRecRoIString(),
80 ElementLink<DataVector<LVL1::RecMuonRoI>>(m_recRoIsKey.key(), recRoIs->size()-1, ctx) );
81
82 Decision* decisionProbe = TrigCompositeUtils::newDecisionIn( decisionOutputProbe.ptr(), hltSeedingNodeName() );
83 decisionProbe->setObjectLink( initialRoIString(),
84 ElementLink<TrigRoiDescriptorCollection>(m_trigRoIsKey.key(), trigRoIs->size()-1, ctx) );
85 decisionProbe->setObjectLink( initialRecRoIString(),
86 ElementLink<DataVector<LVL1::RecMuonRoI>>(m_recRoIsKey.key(), recRoIs->size()-1, ctx) );
87
88 std::vector<TrigCompositeUtils::DecisionID> passedThresholdIDs;
89
90 for (const auto& th : muThresholds.value().get()) {
91 if ( th->mapping() < thresholdNumber ) {
92 //th->thresholdNumber() is defined to be [0,5] and thresholdNumber [0,6]
93 passedThresholdIDs.push_back(HLT::Identifier(th->name()));
94 const std::string thresholdProbeName = getProbeThresholdName(th->name());
95 ATH_MSG_DEBUG( "Passed Threshold names " << th->name() << " and " << thresholdProbeName);
96 addChainsToDecision( HLT::Identifier( th->name() ), decisionMain, activeChains );
97 addChainsToDecision( HLT::Identifier(thresholdProbeName ), decisionProbe, activeChains );
98 }
99 }
100
101 decisionMain->setDetail("thresholds", passedThresholdIDs);
102 decisionProbe->setDetail("thresholds", passedThresholdIDs);
103 }
104
105 // monitoring
106 {
107 auto RoIsCount = Monitored::Scalar( "count", trigRoIs->size() );
108 auto RoIsPhi = Monitored::Collection( "phi", *trigRoIs, &TrigRoiDescriptor::phi );
109 auto RoIsEta = Monitored::Collection( "eta", *trigRoIs, &TrigRoiDescriptor::eta );
110 Monitored::Group( m_monTool, RoIsCount, RoIsEta, RoIsPhi );
111 }
112 return StatusCode::SUCCESS;
113}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
Header file to be included by clients of the Monitored infrastructure.
Handle class for reading a decoration on an object.
Derived DataVector<T>.
Definition DataVector.h:795
virtual double eta() const =0
virtual double phi() const =0
Methods to retrieve data members.
This class defines the reconstructed Muon ROI.
Definition RecMuonRoI.h:60
virtual double eta() const
returns eta coord of ROI
Definition RecMuonRoI.h:117
virtual double phi() const
returns phi coord of ROI
Definition RecMuonRoI.h:114
MURoIsUnpackingTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Property< float > m_roIWidth
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_recTgcRoITool
SG::WriteHandleKey< DataVector< LVL1::RecMuonRoI > > m_recRoIsKey
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_recRpcRoITool
virtual StatusCode initialize() override
virtual StatusCode unpack(const EventContext &ctx, const ROIB::RoIBResult &roib, const HLT::IDSet &activeChains) const override
virtual StatusCode start() override
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
const std::vector< MuCTPIRoI > & roIVec() const
Member function returning the RoI vector.
Class holding the LVL1 RoIB result build by the RoIBuilder.
Definition RoIBResult.h:47
const MuCTPIResult & muCTPIResult() const
Gets the MuCTPI part of the L1 RDO.
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKey
RoIsUnpackingToolBase(const std::string &type, const std::string &name, const IInterface *parent)
ToolHandle< GenericMonitoringTool > m_monTool
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
void addChainsToDecision(HLT::Identifier thresholdId, TrigCompositeUtils::Decision *d, const HLT::IDSet &activeChains) const
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKeyProbe
virtual StatusCode initialize() override
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_trigRoIsKey
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.
static std::string getProbeThresholdName(const std::string &thresholdName)
Concatenate the probe identifier string with the threshold name string.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
pointer_type ptr()
Dereference the pointer.
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
bool setDetail(const std::string &name, const TYPE &value)
Set an TYPE detail on the object.
std::set< HLT::Identifier > IDSet
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
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 & initialRecRoIString()
const std::string & initialRoIString()
const std::string & hltSeedingNodeName()