ATLAS Offline Software
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 // =============================================================================
24 MTCalibPebHypoAlg::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 // =============================================================================
53 StatusCode 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)
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);
70  if (sc == Athena::Status::TIMEOUT) {
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 }
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigCompositeContainer.h:21
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
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
TrigCompositeUtils::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:904
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
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MTCalibPebHypoAlg::initialize
virtual StatusCode initialize() override
Definition: MTCalibPebHypoAlg.cxx:35
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MTCalibPebHypoAlg.h
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
MTCalibPebHypoAlg::finalize
virtual StatusCode finalize() override
Definition: MTCalibPebHypoAlg.cxx:44
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:20
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
MTCalibPebHypoAlg::m_hypoTools
ToolHandleArray< MTCalibPebHypoTool > m_hypoTools
Definition: MTCalibPebHypoAlg.h:27
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
HypoBase
Hypothesis algorithms take the output of reco algorithms and the decision from the preceeding InputMa...
Definition: HypoBase.h:13
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:20
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
Athena::Status::TIMEOUT
@ TIMEOUT
Timeout during event processing.
MTCalibPebHypoAlg::~MTCalibPebHypoAlg
virtual ~MTCalibPebHypoAlg()
Standard destructor.
Definition: MTCalibPebHypoAlg.cxx:30
MTCalibPebHypoAlg::MTCalibPebHypoAlg
MTCalibPebHypoAlg(const std::string &name, ISvcLocator *svcLoc)
Standard constructor.
Definition: MTCalibPebHypoAlg.cxx:24
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
MTCalibPebHypoAlg::execute
virtual StatusCode execute(const EventContext &eventContext) const override
Definition: MTCalibPebHypoAlg.cxx:53
HLTIdentifier.h
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
AthStatusCode.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
MTCalibPebHypoTool::Input
Definition: MTCalibPebHypoTool.h:35