ATLAS Offline Software
Loading...
Searching...
No Matches
TrigZVertexHypoAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
15
16TrigZVertexHypoAlg::TrigZVertexHypoAlg(const std::string& name, ISvcLocator* pSvcLocator) :
17 ::HypoBase(name, pSvcLocator)
18{
19}
20
24
26{
27 ATH_CHECK(m_hypoTools.retrieve());
28 ATH_CHECK(m_zVertexCollKey.initialize());
30 return StatusCode::SUCCESS;
31}
32
34{
35 return StatusCode::SUCCESS;
36}
37
38StatusCode TrigZVertexHypoAlg::execute(const EventContext& context) const
39{
40
41 ATH_MSG_DEBUG("Executing " << name() << "...");
42 auto previousDecisionsHandle = SG::makeHandle(decisionInput(), context);
43
44 if (not previousDecisionsHandle.isValid()) {
45 ATH_MSG_DEBUG("No implicit RH for previous decisions " << decisionInput().key() << ": is this expected?");
46 return StatusCode::SUCCESS;
47 }
48
49 if (previousDecisionsHandle->size() == 0) {
50 ATH_MSG_DEBUG("No previous decision, nothing to do.");
51 return StatusCode::SUCCESS;
52 }
53
54 const auto view = (previousDecisionsHandle->at(0))->objectLink<ViewContainer>(viewString());
55 ATH_CHECK(view.isValid());
56 auto zVertexHandle = ViewHelper::makeHandle(*view, m_zVertexCollKey, context);
57
59 auto decisions = outputHandle.ptr();
60
61 auto d = newDecisionIn(decisions, hypoAlgNodeName());
62 linkToPrevious(d, decisionInput().key(), 0);
63 d->setObjectLink(featureString(), ViewHelper::makeLink<xAOD::TrigCompositeContainer>(*view, zVertexHandle, 0));
64
66 TrigCompositeUtils::decisionIDs(previousDecisionsHandle->at(0), prev);
67
68 TrigZVertexHypoTool::ZVertexInfo info{ d, zVertexHandle.cptr(), std::move(prev) };
69
70 for (const auto& tool : m_hypoTools) {
71 ATH_CHECK(tool->decide(info));
72 }
73 ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
74 return StatusCode::SUCCESS;
75}
76
#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 std::string & viewString()
DataVector< SG::View > ViewContainer
View container for recording in StoreGate.
Definition View.h:290
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
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 execute(const EventContext &context) const override
virtual StatusCode finalize() override
TrigZVertexHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
virtual ~TrigZVertexHypoAlg() override
ToolHandleArray< TrigZVertexHypoTool > m_hypoTools
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_zVertexCollKey
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
const std::string & viewString()
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< T > makeLink(const SG::View *view, const SG::ReadHandle< T > &handle, size_t index)
Create EL to a collection in view.
Definition ViewHelper.h:309
auto makeHandle(const SG::View *view, const KEY &key, const EventContext &ctx)
Create a view handle from a handle key.
Definition ViewHelper.h:273