ATLAS Offline Software
Loading...
Searching...
No Matches
MbtsHypoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "MbtsHypoAlg.h"
14
15MbtsHypoAlg::MbtsHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
16 : ::HypoBase(name, pSvcLocator)
17{
18}
19
21{
22 ATH_CHECK(m_hypoTools.retrieve());
23 ATH_CHECK(m_MbtsBitsKey.initialize());
24 ATH_CHECK(m_hypoTools.retrieve());
25 return StatusCode::SUCCESS;
26}
27
28StatusCode MbtsHypoAlg::execute(const EventContext &context) const
29{
30 ATH_MSG_DEBUG("Executing ...");
31
32 SG::ReadHandle<DecisionContainer> previousDecisionsHandle = SG::makeHandle(decisionInput(), context);
33 ATH_CHECK(previousDecisionsHandle.isValid());
34 auto bitsHandle = SG::makeHandle(m_MbtsBitsKey, context);
36 TrigCompositeUtils::decisionIDs(previousDecisionsHandle->at(0), prev);
37
38 ATH_MSG_DEBUG("Obtained input");
39
41 auto decisions = outputHandle.ptr();
42 auto d = newDecisionIn(decisions, hypoAlgNodeName());
43 linkToPrevious(d, decisionInput().key(), 0);
44 d->setObjectLink(featureString(), ElementLink<xAOD::TrigT2MbtsBitsContainer>(*bitsHandle, 0, context));
45 MbtsHypoTool::MbtsHypoInfo info = {std::move(prev), bitsHandle.cptr()->at(0), d};
46
47 for (const auto &tool : m_hypoTools)
48 {
49 ATH_CHECK(tool->decide(info));
50 }
51
52 return StatusCode::SUCCESS;
53}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
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()
const std::string & featureString()
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
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
HypoBase(const std::string &name, ISvcLocator *pSvcLocator)
constructor, to be called by sub-class constructors
Definition HypoBase.cxx:12
virtual StatusCode execute(const EventContext &context) const override
MbtsHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandleArray< MbtsHypoTool > m_hypoTools
Definition MbtsHypoAlg.h:27
virtual StatusCode initialize() override
SG::ReadHandleKey< xAOD::TrigT2MbtsBitsContainer > m_MbtsBitsKey
Definition MbtsHypoAlg.h:28
virtual bool isValid() override final
Can the handle be successfully dereferenced?
pointer_type ptr()
Dereference the pointer.
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.