ATLAS Offline Software
Loading...
Searching...
No Matches
TrigJetCRVARHypoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <algorithm>
10
11using namespace TrigCompositeUtils;
12
14 ISvcLocator* pSvcLocator ) :
15 ::HypoBase( name, pSvcLocator ) { }
16
17
19
20 ATH_CHECK(m_hypoTools.retrieve() );
21 ATH_CHECK(m_cellKey.initialize());
22
23 return StatusCode::SUCCESS;
24}
25
26
27StatusCode TrigJetCRVARHypoAlg::execute( const EventContext& context ) const {
28
29 ATH_MSG_DEBUG ( "Executing " << name() << "..." );
30
31 ATH_MSG_DEBUG("Retrieving HLT decision \"" << decisionInput().key() << "\"");
32 auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context );
33 ATH_CHECK( previousDecisionsHandle.isValid() );
34 const DecisionContainer* prevDecisions = previousDecisionsHandle.get();
35
36 // Creates the mutable output DecisionContainer and registers it to StoreGate.
38 DecisionContainer* decisions = outputHandle.ptr();
39
40
41 ATH_MSG_DEBUG( "Creating new output decision handle");
42
43 // prepare imput for tools
44 std::vector<TrigJetCRVARHypoTool::JetInfo> hypoToolInput;
45
46 // get cells from the key :
47 ATH_MSG_DEBUG( "Getting Cells Handle "<<m_cellKey);
48 auto cellHandle = SG::makeHandle(m_cellKey, context );
49
50 ATH_CHECK( cellHandle.isValid() );
51 const CaloConstCellContainer* cells = cellHandle.get();
52 ATH_MSG_DEBUG ( cells->size() << " cells found" );
53
54
55
56 for (const Decision* previousDecision : *prevDecisions) {
57 // Create a new output Decision object, d, backed by the 'decisions' container.
58 // Links previousDecision as the parent of d.
59 Decision* d = newDecisionIn( decisions, previousDecision, hypoAlgNodeName(), context );
60
61 // Obtain an ElementLink to the jet from the previous step, and set this to be the feature for this step too
62 const LinkInfo<xAOD::JetContainer> jetLinkInfo = findLink<xAOD::JetContainer>(previousDecision, featureString());
63 d->setObjectLink<xAOD::JetContainer>( featureString(), jetLinkInfo.link );
64
65 // Obtain the set of chains which are active in previousDecision
66 DecisionIDContainer previousDecisionIDs;
67 decisionIDs(previousDecision, previousDecisionIDs);
68
69 // Collect all the required information for the tool together in a handy struct
70
71 hypoToolInput.emplace_back( TrigJetCRVARHypoTool::JetInfo{previousDecisionIDs, *(jetLinkInfo.link),cells, d} );
72 }
73
74 //Loop over all hypoToolinputs and get their decisions
75 for ( auto & tool: m_hypoTools ) {
76 ATH_CHECK( tool->decide( hypoToolInput ) );
77 }
78
79 ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
80
81 return StatusCode::SUCCESS;
82
83}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
CaloCellContainer that can accept const cell pointers.
const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > & decisionInput() const
methods for derived classes to access handles of the base class input other read/write handles may be...
Definition HypoBase.cxx:18
const SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > & decisionOutput() const
methods for derived classes to access handles of the base class output other read/write handles may b...
Definition HypoBase.cxx:22
StatusCode hypoBaseOutputProcessing(SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MSG::Level lvl=MSG::DEBUG) const
Base class function to be called once slice specific code has finished. Handles debug printing and va...
Definition HypoBase.cxx:35
HypoBase(const std::string &name, ISvcLocator *pSvcLocator)
constructor, to be called by sub-class constructors
Definition HypoBase.cxx:12
pointer_type ptr()
Dereference the pointer.
ToolHandleArray< TrigJetCRVARHypoTool > m_hypoTools
SG::ReadHandleKey< CaloConstCellContainer > m_cellKey
TrigJetCRVARHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &context) const override
virtual StatusCode initialize() override
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 & featureString()
std::set< DecisionID > DecisionIDContainer
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
const std::string & hypoAlgNodeName()
LinkInfo< T > findLink(const Decision *start, const std::string &linkName, const bool suppressMultipleLinksWarning=false)
Perform a recursive search for ElementLinks of type T and name 'linkName', starting from Decision obj...
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition LinkInfo.h:22
ElementLink< T > link
Link to the feature.
Definition LinkInfo.h:55