ATLAS Offline Software
Loading...
Searching...
No Matches
TrigGenericHypoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
7
8TrigGenericHypoAlg::TrigGenericHypoAlg(const std::string& name, ISvcLocator* pSvcLocator) :
9 ::HypoBase(name, pSvcLocator) {}
10
12 ATH_CHECK( m_hypoTools.retrieve() );
13 ATH_CHECK(m_trigCompKey.initialize());
14 return StatusCode::SUCCESS;
15}
16
17StatusCode TrigGenericHypoAlg::execute(const EventContext& context) const {
18
19 // Retrieve previous decision
20 auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context );
21 ATH_CHECK( previousDecisionsHandle.isValid() );
22 ATH_MSG_DEBUG( "Running with "<< previousDecisionsHandle->size() <<" previous decisions");
23
26 TrigCompositeUtils::DecisionContainer* decisions = outputHandle.ptr();
27
28 std::vector<TrigGenericHypoTool::HypoToolInfo> hypoToolInput;
29 for (const TrigCompositeUtils::Decision* previousDecision: *previousDecisionsHandle) {
31 TrigCompositeUtils::decisionIDs(previousDecision, previousDecisionIDs);
32
34 if(trigComposite->size()==0) continue;
35 if(trigComposite->size() > 1){
36 ATH_MSG_ERROR("Expect at most 1 TrigComposite, but received: "<<trigComposite->size());//should have at most 1 trig composite
37 return StatusCode::FAILURE;
38 }
39 const xAOD::TrigComposite* tc = trigComposite->at(0);
41
43 hypoToolInput.emplace_back(newd, tc, previousDecision );
44 newd -> setObjectLink( TrigCompositeUtils::featureString(), featureLink );
45 TrigCompositeUtils::linkToPrevious( newd, previousDecision, context );
46 }
47
48 for ( auto & tool: m_hypoTools ) {
49 ATH_CHECK( tool->decide( hypoToolInput ) );
50 }
51
52 ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
53 return StatusCode::SUCCESS;
54}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
static Double_t tc
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
ToolHandleArray< TrigGenericHypoTool > m_hypoTools
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_trigCompKey
TrigGenericHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &context) const 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()
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
ElementLink< DecisionContainer > decisionToElementLink(const Decision *d, const EventContext &ctx)
Takes a raw pointer to a Decision and returns an ElementLink to the Decision.
TrigComposite_v1 TrigComposite
Declare the latest version of the class.