ATLAS Offline Software
Loading...
Searching...
No Matches
MTCalibPebHypoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "MTCalibPebHypoAlg.h"
8
9// TrigCompositeUtils types used here
14
15// TrigCompositeUtils methods used here
20
21// =============================================================================
22// Standard constructor
23// =============================================================================
24MTCalibPebHypoAlg::MTCalibPebHypoAlg(const std::string& name, ISvcLocator* svcLoc)
25: HypoBase(name, svcLoc) {}
26
27// =============================================================================
28// Standard destructor
29// =============================================================================
31
32// =============================================================================
33// Implementation of AthReentrantAlgorithm::initialize
34// =============================================================================
36 ATH_MSG_INFO("Initialising " << name());
37 ATH_CHECK(m_hypoTools.retrieve());
38 return StatusCode::SUCCESS;
39}
40
41// =============================================================================
42// Implementation of AthReentrantAlgorithm::finalize
43// =============================================================================
45 ATH_MSG_INFO("Finalising " << name());
46 ATH_CHECK(m_hypoTools.release());
47 return StatusCode::SUCCESS;
48}
49
50// =============================================================================
51// Implementation of AthReentrantAlgorithm::execute
52// =============================================================================
53StatusCode MTCalibPebHypoAlg::execute(const EventContext& eventContext) const {
54 ATH_MSG_DEBUG("Executing " << name());
55
56 // New output decision container
58 DecisionContainer* decisions = outputHandle.ptr();
59
60 // Create new decision (DecisionContainer* decisions owns the new object)
61 Decision* newd = newDecisionIn(decisions, hypoAlgNodeName());
62
63 // Prepare input for hypo tools
64 MTCalibPebHypoTool::Input toolInput(newd, eventContext);
65
66 // Call the hypo tools
67 for (const auto& tool: m_hypoTools) {
68 ATH_MSG_DEBUG("Calling " << tool);
69 StatusCode sc = tool->decide(toolInput);
71 ATH_MSG_ERROR("Timeout reached in hypo tool " << tool->name());
72 return sc;
73 }
74 else ATH_CHECK(sc);
75 }
76
77 ATH_MSG_DEBUG( "Exiting with "<< outputHandle->size() <<" decisions");
78
79 for (auto outh: *outputHandle) {
80 DecisionIDContainer objDecisions;
81 decisionIDs(outh, objDecisions);
82 ATH_MSG_DEBUG("Number of positive decisions for this input: " << objDecisions.size());
83 for ( DecisionID id : objDecisions ) {
84 ATH_MSG_DEBUG(" --- found new decision " << HLT::Identifier(id));
85 }
86 }
87
88 return StatusCode::SUCCESS;
89}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
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.
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 decisionIDs(const Decision *d, DecisionIDContainer &id)
Extracts DecisionIDs stored in the Decision object.
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
HypoBase(const std::string &name, ISvcLocator *pSvcLocator)
constructor, to be called by sub-class constructors
Definition HypoBase.cxx:12
virtual StatusCode execute(const EventContext &eventContext) const override
ToolHandleArray< MTCalibPebHypoTool > m_hypoTools
virtual StatusCode initialize() override
virtual ~MTCalibPebHypoAlg()
Standard destructor.
MTCalibPebHypoAlg(const std::string &name, ISvcLocator *svcLoc)
Standard constructor.
virtual StatusCode finalize() override
pointer_type ptr()
Dereference the pointer.
@ TIMEOUT
Timeout during event processing.
unsigned int DecisionID
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.
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 decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.