ATLAS Offline Software
MURoIsUnpackingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "MURoIsUnpackingTool.h"
7 
10 
11 
13  const std::string& name,
14  const IInterface* parent )
16 
17 
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 
35 StatusCode 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(),
79  decisionMain->setObjectLink( initialRecRoIString(),
81 
82  Decision* decisionProbe = TrigCompositeUtils::newDecisionIn( decisionOutputProbe.ptr(), hltSeedingNodeName() );
83  decisionProbe->setObjectLink( initialRoIString(),
85  decisionProbe->setObjectLink( initialRecRoIString(),
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 }
MURoIsUnpackingTool::m_recRoIsKey
SG::WriteHandleKey< DataVector< LVL1::RecMuonRoI > > m_recRoIsKey
Definition: MURoIsUnpackingTool.h:37
xAOD::TrigComposite_v1::setDetail
bool setDetail(const std::string &name, const TYPE &value)
Set an TYPE detail on the object.
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
RoIsUnpackingToolBase
Base class for RoI unpackers.
Definition: RoIsUnpackingToolBase.h:32
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
ROIB::RoIBResult
Class holding the LVL1 RoIB result build by the RoIBuilder.
Definition: RoIBResult.h:47
TrigCompositeUtils::hltSeedingNodeName
const std::string & hltSeedingNodeName()
Definition: TrigCompositeUtilsRoot.cxx:892
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
RoIBResult.h
TrigCompositeUtils::newDecisionIn
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.
Definition: TrigCompositeUtilsRoot.cxx:46
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MURoIsUnpackingTool::m_roIWidth
Gaudi::Property< float > m_roIWidth
Definition: MURoIsUnpackingTool.h:43
RoIsUnpackingToolBase::addChainsToDecision
void addChainsToDecision(HLT::Identifier thresholdId, TrigCompositeUtils::Decision *d, const HLT::IDSet &activeChains) const
Definition: RoIsUnpackingToolBase.cxx:88
TrigCompositeUtils::createAndStore
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
Definition: TrigCompositeUtilsRoot.cxx:30
TrigCompositeUtils::initialRecRoIString
const std::string & initialRecRoIString()
Definition: TrigCompositeUtilsRoot.cxx:872
MURoIsUnpackingTool::unpack
virtual StatusCode unpack(const EventContext &ctx, const ROIB::RoIBResult &roib, const HLT::IDSet &activeChains) const override
Definition: MURoIsUnpackingTool.cxx:35
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
LVL1::RecMuonRoI::eta
virtual double eta() const
returns eta coord of ROI
Definition: RecMuonRoI.h:117
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
MURoIsUnpackingTool::MURoIsUnpackingTool
MURoIsUnpackingTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition: MURoIsUnpackingTool.cxx:12
TrigCompositeUtils.h
RoIsUnpackingToolBase::m_decisionsKeyProbe
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKeyProbe
Definition: RoIsUnpackingToolBase.h:54
python.TriggerHandler.th
th
Definition: TriggerHandler.py:296
RoIsUnpackingToolBase::decodeMapping
StatusCode decodeMapping(std::function< bool(const std::string &)> &&filter)
Fills mapping from L1 threshold -> to HLT chain.
Definition: RoIsUnpackingToolBase.cxx:52
LVL1::RecMuonRoI
This class defines the reconstructed Muon ROI.
Definition: RecMuonRoI.h:60
xAOD::TrigComposite_v1::setObjectLink
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
TrigCompositeUtils::initialRoIString
const std::string & initialRoIString()
Definition: TrigCompositeUtilsRoot.cxx:868
RoIsUnpackingToolBase::getL1Thresholds
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.
Definition: RoIsUnpackingToolBase.cxx:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
MURoIsUnpackingTool::m_recRpcRoITool
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_recRpcRoITool
Definition: MURoIsUnpackingTool.h:49
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TrigCompositeUtils::createAndStoreNoAux
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Creates and right away records the Container CONT with the key.
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
RoIsUnpackingToolBase::m_decisionsKey
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKey
Definition: RoIsUnpackingToolBase.h:51
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:20
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
LVL1::RecMuonRoI::phi
virtual double phi() const
returns phi coord of ROI
Definition: RecMuonRoI.h:114
RoIsUnpackingToolBase::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: RoIsUnpackingToolBase.h:67
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
RoIsUnpackingToolBase::m_trigRoIsKey
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_trigRoIsKey
Definition: RoIsUnpackingToolBase.h:57
RoIsUnpackingToolBase::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition: RoIsUnpackingToolBase.h:60
SG::WriteHandle< TrigRoiDescriptorCollection >
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
RoiDescriptor::phi
virtual double phi() const override final
Methods to retrieve data members.
Definition: RoiDescriptor.h:100
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ROIB::MuCTPIResult::roIVec
const std::vector< MuCTPIRoI > & roIVec() const
Member function returning the RoI vector.
Definition: MuCTPIResult.cxx:69
HLT::IDSet
std::set< HLT::Identifier > IDSet
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:63
RoIsUnpackingToolBase::initialize
virtual StatusCode initialize() override
Definition: RoIsUnpackingToolBase.cxx:16
RoiDescriptor::eta
virtual double eta() const override final
Definition: RoiDescriptor.h:101
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
MURoIsUnpackingTool.h
ReadDecorHandle.h
Handle class for reading a decoration on an object.
MURoIsUnpackingTool::initialize
virtual StatusCode initialize() override
Definition: MURoIsUnpackingTool.cxx:18
ROIB::RoIBResult::muCTPIResult
const MuCTPIResult & muCTPIResult() const
Gets the MuCTPI part of the L1 RDO.
Definition: RoIBResult.cxx:56
MURoIsUnpackingTool::m_recTgcRoITool
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_recTgcRoITool
Definition: MURoIsUnpackingTool.h:51
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
MURoIsUnpackingTool::start
virtual StatusCode start() override
Definition: MURoIsUnpackingTool.cxx:27
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
RoIsUnpackingToolBase::getProbeThresholdName
static std::string getProbeThresholdName(const std::string &thresholdName)
Concatenate the probe identifier string with the threshold name string.
Definition: RoIsUnpackingToolBase.cxx:47