ATLAS Offline Software
Loading...
Searching...
No Matches
TrigStreamerHypoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
5
6#include "Gaudi/Property.h"
10
11using namespace TrigCompositeUtils;
12
14 ISvcLocator* pSvcLocator ) :
15 ::HypoBase( name, pSvcLocator ) {}
16
17
19
20 CHECK( m_hypoTools.retrieve() );
21 return StatusCode::SUCCESS;
22}
23
24StatusCode TrigStreamerHypoAlg::execute( const EventContext& context ) const {
25
26 ATH_MSG_DEBUG ( "Executing " << name() << "..." );
27 auto h_prevDecisions = SG::makeHandle( decisionInput(), context );
28 ATH_CHECK( h_prevDecisions.isValid() );
29 ATH_MSG_DEBUG( "Running with "<< h_prevDecisions->size() <<" previous decisions");
30
31 // Make a new Decisions container which will contain the new Decision object created by this hypo.
33 DecisionContainer* newDecisions = outputHandle.ptr();
34
35 // Struct to pass info on to the HypoTools
36 std::vector< ITrigStreamerHypoTool::HypoInfo > hypoInfo;
37
38 for (const Decision* previousDecision : *h_prevDecisions ) {
39 // Create output Decision object, link it to prevDecision.
40 Decision* newDecision = newDecisionIn(newDecisions, previousDecision, hypoAlgNodeName(), context);
41
42 // Obligatory link to feature. Re-using the initial ROI.
43 // If this happens to be a FullScan ROI, then the following ComboHypo will also pass this leg through without cuts
44 //LinkInfo<TrigRoiDescriptorCollection> featureLinkInfo = findLink<TrigRoiDescriptorCollection>(previousDecision, initialRoIString());
45 //newDecision->setObjectLink(featureString(), featureLinkInfo.link);
46 if (m_featureIsROI) {
47 // Obligatory link to feature. Re-using the initial ROI.
48 // If this happens to be a FullScan ROI, then the following ComboHypo will also pass this leg through without cuts
50 newDecision->setObjectLink(featureString(), featureLinkInfo.link);
51 } else {
52 // Obligatory link to feature. Re-use previous Step's feature.
53 SG::sgkey_t key = 0;
54 uint32_t clid = 0;
56 const Decision* source = nullptr; // Unused
57 ATH_CHECK( typelessFindLink(previousDecision, featureString(), key, clid, index, source) );
58 newDecision->typelessSetObjectLink(featureString(), key, clid, index);
59 }
60
61 hypoInfo.emplace_back(newDecision, previousDecision);
62 }
63
64 for (const auto& tool: m_hypoTools) {
65 ATH_MSG_DEBUG( "About to decide for " << tool->name() );
66 ATH_CHECK(tool->decide(hypoInfo)); // The StreamerHypoTool only contains logical-flow checks
67 }
68
69 // Common debug printing
71
72 return StatusCode::SUCCESS;
73}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
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.
virtual StatusCode initialize() override
TrigStreamerHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandleArray< ITrigStreamerHypoTool > m_hypoTools
Gaudi::Property< bool > m_featureIsROI
virtual StatusCode execute(const EventContext &context) const override
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
void typelessSetObjectLink(const std::string &name, const sgkey_t key, const uint32_t clid, const index_type beginIndex, const index_type endIndex=0)
Add a link without type.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition sgkey_t.h:32
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()
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...
const std::string & initialRoIString()
bool typelessFindLink(const Decision *start, const std::string &linkName, sgkey_t &key, CLID &clid, Decision::index_type &index, const Decision *&source, const bool suppressMultipleLinksWarning)
Perform a recursive search for ElementLinks of any time and name 'linkName', starting from Decision o...
Definition index.py:1
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