ATLAS Offline Software
Loading...
Searching...
No Matches
TrigJetCRHypoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <algorithm>
6#include "TrigJetCRHypoAlg.h"
7#include "TrigJetCRHypoTool.h"
10
11using namespace TrigCompositeUtils;
12
13
14TrigJetCRHypoAlg::TrigJetCRHypoAlg( const std::string& name,
15 ISvcLocator* pSvcLocator ) :
16 ::HypoBase( name, pSvcLocator ) { }
17
18
20
21 ATH_CHECK(m_hypoTools.retrieve() );
22 ATH_CHECK(m_trackParticleKey.initialize());
23 ATH_CHECK(m_cellKey.initialize());
24
25 return StatusCode::SUCCESS;
26}
27
28
29StatusCode TrigJetCRHypoAlg::execute( const EventContext& context ) const {
30
31 ATH_MSG_DEBUG( "Executing " << name() << "..." );
32
33 ATH_MSG_DEBUG("Retrieving HLT decision \"" << decisionInput().key() << "\"");
34 auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context );
35 ATH_CHECK( previousDecisionsHandle.isValid() );
36 const DecisionContainer* prevDecisions = previousDecisionsHandle.get();
37
38 // Creates the mutable output DecisionContainer and registers it to StoreGate.
40 DecisionContainer* decisions = outputHandle.ptr();
41
42
43 ATH_MSG_DEBUG( "Creating new output decision handle");
44
45 // prepare imput for tools
46 std::vector<TrigJetCRHypoTool::JetInfo> hypoToolInput;
47
48 // get tracks from the key :
49 ATH_MSG_DEBUG( "Getting Track Handle "<<m_trackParticleKey);
50 auto trackHandle = SG::makeHandle(m_trackParticleKey, context );
51
52 ATH_CHECK( trackHandle.isValid() );
53 const xAOD::TrackParticleContainer* allTracks = trackHandle.get();
54 ATH_MSG_DEBUG ( allTracks->size() << " tracks found" );
55
56 // get cells from the key :
57 ATH_MSG_DEBUG( "Getting Cells Handle "<<m_cellKey);
58 auto cellHandle = SG::makeHandle(m_cellKey, context );
59
60 ATH_CHECK( cellHandle.isValid() );
61 const CaloConstCellContainer* cells = cellHandle.get();
62 ATH_MSG_DEBUG ( cells->size() << " cells found" );
63
64 for (const Decision* previousDecision : *prevDecisions) {
65 // Create a new output Decision object, d, backed by the 'decisions' container.
66 // Links previousDecision as the parent of d.
67
68 Decision* d = newDecisionIn( decisions, previousDecision, hypoAlgNodeName(), context );
69
70
71 const std::vector<LinkInfo< xAOD::JetContainer > >jetELs =
73 d->setObjectLink<xAOD::JetContainer>( featureString(), jetELs.at(0).link );
74 DecisionIDContainer previousDecisionIDs;
75 decisionIDs(previousDecision, previousDecisionIDs);
76
77 for (const LinkInfo< xAOD::JetContainer> & jetLinkInfo: jetELs){
78 // Collect all the required information for the tool together in a handy struct
79 hypoToolInput.emplace_back( TrigJetCRHypoTool::JetInfo{previousDecisionIDs, *(jetLinkInfo.link), allTracks, cells, d} );
80 }
81 // Obtain the set of chains which are active in previousDecision
82 }
83
84
85 //Loop over all hypoToolinputs and get their decisions
86 for ( auto & tool: m_hypoTools ) {
87 ATH_CHECK( tool->decide( hypoToolInput ) );
88 }
89
90 ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
91
92 return StatusCode::SUCCESS;
93
94}
95
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
CaloCellContainer that can accept const cell pointers.
size_type size() const noexcept
Returns the number of elements in the collection.
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.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleKey
TrigJetCRHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &context) const override
virtual StatusCode initialize() override
ToolHandleArray< TrigJetCRHypoTool > m_hypoTools
SG::ReadHandleKey< CaloConstCellContainer > m_cellKey
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.
void findLinks(const Decision *start, const std::string &linkName, std::vector< LinkInfo< T > > &links, unsigned int behaviour=TrigDefs::allFeaturesOfType, std::set< const xAOD::TrigComposite * > *fullyExploredFrom=nullptr)
search back the TC links for the object of type T linked to the one of TC (recursively) Populates pro...
const std::string & hypoAlgNodeName()
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
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