ATLAS Offline Software
METRoIsUnpackingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "METRoIsUnpackingTool.h"
7 
8 
10  const std::string& name,
11  const IInterface* 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 
34 StatusCode 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 ) );
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 }
METRoIsUnpackingTool::start
virtual StatusCode start() override
Definition: METRoIsUnpackingTool.cxx:21
RoIsUnpackingToolBase
Base class for RoI unpackers.
Definition: RoIsUnpackingToolBase.h:32
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
METRoIsUnpackingTool::m_allMETChains
HLT::IDSet m_allMETChains
Definition: METRoIsUnpackingTool.h:32
RoIBResult.h
ROIB::RoIBResult::jetEnergyResult
const std::vector< JetEnergyResult > & jetEnergyResult() const
Gets the jet/energy part of the L1 RDO.
Definition: RoIBResult.cxx:64
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
JetEnergyResult.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
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
ROIB::JetEnergyRoI
Definition: JetEnergyRoI.h:20
METRoIsUnpackingTool::METRoIsUnpackingTool
METRoIsUnpackingTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: METRoIsUnpackingTool.cxx:9
ROIB::JetEnergyResult
Definition: JetEnergyResult.h:24
METRoIsUnpackingTool::m_jepDecoder
LVL1::JEPRoIDecoder m_jepDecoder
Definition: METRoIsUnpackingTool.h:31
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
LVL1::TrigT1CaloDefs::EnergyRoIWordType0
@ EnergyRoIWordType0
Definition: TrigT1CaloDefs.h:170
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
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
RoIsUnpackingToolBase::m_decisionsKey
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKey
Definition: RoIsUnpackingToolBase.h:51
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:20
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
RoIsUnpackingToolBase::ThrVec
std::vector< std::shared_ptr< TrigConf::L1Threshold > > ThrVec
Definition: RoIsUnpackingToolBase.h:73
RoIsUnpackingToolBase::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition: RoIsUnpackingToolBase.h:60
LVL1::TrigT1CaloDefs::RoIType
RoIType
Definition: TrigT1CaloDefs.h:166
METRoIsUnpackingTool::unpack
StatusCode unpack(const EventContext &ctx, const ROIB::RoIBResult &roib, const HLT::IDSet &activeChains) const override
Definition: METRoIsUnpackingTool.cxx:34
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
METRoIsUnpackingTool::m_fsRoIKey
Gaudi::Property< std::string > m_fsRoIKey
Definition: METRoIsUnpackingTool.h:28
HLT::IDSet
std::set< HLT::Identifier > IDSet
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:63
RoIsUnpackingToolBase::initialize
virtual StatusCode initialize() override
Definition: RoIsUnpackingToolBase.cxx:16
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
METRoIsUnpackingTool::initialize
virtual StatusCode initialize() override
Definition: METRoIsUnpackingTool.cxx:15
RoIsUnpackingToolBase::m_thresholdToChainMapping
std::map< HLT::Identifier, HLT::IDVec > m_thresholdToChainMapping
Definition: RoIsUnpackingToolBase.h:70
set_intersection
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
LVL1::JEPRoIDecoder::roiType
TrigT1CaloDefs::RoIType roiType(unsigned int word) const
Override base method - allows us to handle both Run 1 & Run 2 data for JEP (up to a point)
Definition: JEPRoIDecoder.cxx:33
METRoIsUnpackingTool.h