ATLAS Offline Software
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>
6 #include "TrigJetCRVARHypoAlg.h"
7 #include "TrigJetCRVARHypoTool.h"
10 
11 using namespace TrigCompositeUtils;
12 
14  ISvcLocator* pSvcLocator ) :
15  ::HypoBase( name, pSvcLocator ) { }
16 
17 
19 
20  ATH_CHECK(m_hypoTools.retrieve() );
22 
23  return StatusCode::SUCCESS;
24 }
25 
26 
27 StatusCode 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 }
TrigJetCRVARHypoTool.h
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
TrigCompositeUtils::LinkInfo::link
ElementLink< T > link
Link to the feature.
Definition: LinkInfo.h:61
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
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TrigCompositeUtils::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:904
DataVector::get
const T * get(size_type n) const
Access an element, as an rvalue.
HypoBase::decisionInput
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:16
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
HypoBase::decisionOutput
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:20
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
TrigJetCRVARHypoAlg.h
TrigCompositeUtils.h
TrigJetCRVARHypoTool::JetInfo
Definition: TrigJetCRVARHypoTool.h:58
TrigJetCRVARHypoAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: TrigJetCRVARHypoAlg.cxx:27
HypoBase::hypoBaseOutputProcessing
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: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
TrigJetCRVARHypoAlg::m_cellKey
SG::ReadHandleKey< CaloConstCellContainer > m_cellKey
Definition: TrigJetCRVARHypoAlg.h:41
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:884
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
TrigCompositeUtils::LinkInfo
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition: LinkInfo.h:28
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
CaloConstCellContainer
CaloCellContainer that can accept const cell pointers.
Definition: CaloConstCellContainer.h:45
HLTIdentifier.h
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
TrigJetCRVARHypoAlg::TrigJetCRVARHypoAlg
TrigJetCRVARHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigJetCRVARHypoAlg.cxx:13
TrigJetCRVARHypoAlg::initialize
virtual StatusCode initialize() override
Definition: TrigJetCRVARHypoAlg.cxx:18
TrigJetCRVARHypoAlg::m_hypoTools
ToolHandleArray< TrigJetCRVARHypoTool > m_hypoTools
Definition: TrigJetCRVARHypoAlg.h:36
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37