ATLAS Offline Software
Loading...
Searching...
No Matches
TrigJetCRVARHypoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10using namespace TrigCompositeUtils;
11
13 ISvcLocator* pSvcLocator ) :
14 ::HypoBase( name, pSvcLocator ) { }
15
16
18
19 ATH_CHECK(m_hypoTools.retrieve() );
20 ATH_CHECK(m_cellKey.initialize());
21
22 return StatusCode::SUCCESS;
23}
24
25
26StatusCode TrigJetCRVARHypoAlg::execute( const EventContext& context ) const {
27
28 ATH_MSG_DEBUG ( "Executing " << name() << "..." );
29
30 ATH_MSG_DEBUG("Retrieving HLT decision \"" << decisionInput().key() << "\"");
31 auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context );
32 ATH_CHECK( previousDecisionsHandle.isValid() );
33 const DecisionContainer* prevDecisions = previousDecisionsHandle.get();
34
35 // Creates the mutable output DecisionContainer and registers it to StoreGate.
37 DecisionContainer* decisions = outputHandle.ptr();
38
39
40 ATH_MSG_DEBUG( "Creating new output decision handle");
41
42 // prepare imput for tools
43 std::vector<TrigJetCRVARHypoTool::JetInfo> hypoToolInput;
44
45 // get cells from the key :
46 ATH_MSG_DEBUG( "Getting Cells Handle "<<m_cellKey);
47 auto cellHandle = SG::makeHandle(m_cellKey, context );
48
49 ATH_CHECK( cellHandle.isValid() );
50 const CaloConstCellContainer* cells = cellHandle.get();
51 ATH_MSG_DEBUG ( cells->size() << " cells found" );
52
53
54
55 for (const Decision* previousDecision : *prevDecisions) {
56 // Create a new output Decision object, d, backed by the 'decisions' container.
57 // Links previousDecision as the parent of d.
58 Decision* d = newDecisionIn( decisions, previousDecision, hypoAlgNodeName(), context );
59
60 // Obtain an ElementLink to the jet from the previous step, and set this to be the feature for this step too
61 const LinkInfo<xAOD::JetContainer> jetLinkInfo = findLink<xAOD::JetContainer>(context, previousDecision, featureString());
62 d->setObjectLink<xAOD::JetContainer>( featureString(), jetLinkInfo.link );
63
64 // Obtain the set of chains which are active in previousDecision
65 DecisionIDContainer previousDecisionIDs;
66 decisionIDs(previousDecision, previousDecisionIDs);
67
68 // Collect all the required information for the tool together in a handy struct
69
70 hypoToolInput.emplace_back( TrigJetCRVARHypoTool::JetInfo{std::move(previousDecisionIDs), *(jetLinkInfo.link),cells, d} );
71 }
72
73 //Loop over all hypoToolinputs and get their decisions
74 for ( auto & tool: m_hypoTools ) {
75 ATH_CHECK( tool->decide( hypoToolInput ) );
76 }
77
78 ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
79
80 return StatusCode::SUCCESS;
81
82}
#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())
xAOD::TrigComposite Decision
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 EventContext &ctx, 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...
xAOD::TrigCompositeContainer DecisionContainer
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