ATLAS Offline Software
FSRoIsUnpackingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "FSRoIsUnpackingTool.h"
7 
8 
10  const std::string& name,
11  const IInterface* 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 
44 StatusCode 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 ) );
78 
79  return StatusCode::SUCCESS;
80 }
RoIsUnpackingToolBase::m_roiupdater
ToolHandle< IRoiUpdaterTool > m_roiupdater
Definition: RoIsUnpackingToolBase.h:68
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
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
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
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
FSRoIsUnpackingTool.h
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
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
FSRoIsUnpackingTool::initialize
virtual StatusCode initialize() override
Definition: FSRoIsUnpackingTool.cxx:16
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
FSRoIsUnpackingTool::FSRoIsUnpackingTool
FSRoIsUnpackingTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: FSRoIsUnpackingTool.cxx:9
FSRoIsUnpackingTool::unpack
StatusCode unpack(const EventContext &ctx, const ROIB::RoIBResult &roib, const HLT::IDSet &activeChains) const override
Definition: FSRoIsUnpackingTool.cxx:44
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
TrigCompositeContainer.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
RoIsUnpackingToolBase::m_trigRoIsKey
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_trigRoIsKey
Definition: RoIsUnpackingToolBase.h:57
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HLT::IDSet
std::set< HLT::Identifier > IDSet
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:63
RoIsUnpackingToolBase::initialize
virtual StatusCode initialize() override
Definition: RoIsUnpackingToolBase.cxx:16
RoiDescriptor::FULLSCAN
static constexpr bool FULLSCAN
convenient
Definition: RoiDescriptor.h:45
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
RoIsUnpackingToolBase::m_thresholdToChainMapping
std::map< HLT::Identifier, HLT::IDVec > m_thresholdToChainMapping
Definition: RoIsUnpackingToolBase.h:70
FSRoIsUnpackingTool::m_allFSChains
HLT::IDSet m_allFSChains
Definition: FSRoIsUnpackingTool.h:25
set_intersection
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
FSRoIsUnpackingTool::start
virtual StatusCode start() override
Definition: FSRoIsUnpackingTool.cxx:22