ATLAS Offline Software
TrigZVertexHypoAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TrigZVertexHypoAlg.h"
6 #include "AthViews/ViewHelper.h"
15 
16 TrigZVertexHypoAlg::TrigZVertexHypoAlg(const std::string& name, ISvcLocator* pSvcLocator) :
17  ::HypoBase(name, pSvcLocator)
18 {
19 }
20 
22 {
23 }
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 
38 StatusCode 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 
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(), 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 
grepfile.info
info
Definition: grepfile.py:38
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigCompositeContainer.h:21
TrigCompositeUtils.h
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
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TrigCompositeUtils::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:906
TrigZVertexHypoAlg.h
ViewHelper::makeHandle
SG::ReadHandle< T > makeHandle(const SG::View *view, const SG::ReadHandleKey< T > &rhKey, const EventContext &context)
navigate from the TrigComposite to nearest view and fetch object from it
Definition: ViewHelper.h:258
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce
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)
Definition: AthCommonDataStore.h:380
TrigZVertexHypoAlg::TrigZVertexHypoAlg
TrigZVertexHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigZVertexHypoAlg.cxx:16
HypoBase::decisionInput
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:16
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
ViewHelper.h
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
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
TrigZVertexHypoAlg::m_zVertexCollKey
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_zVertexCollKey
Definition: TrigZVertexHypoAlg.h:29
HypoBase::hypoBaseOutputProcessing
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:33
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigZVertexHypoAlg::m_hypoTools
ToolHandleArray< TrigZVertexHypoTool > m_hypoTools
Definition: TrigZVertexHypoAlg.h:28
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:81
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:886
TrigZVertexHypoTool::ZVertexInfo
Definition: TrigZVertexHypoTool.h:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
HypoBase
Hypothesis algorithms take the output of reco algorithms and the decision from the preceeding InputMa...
Definition: HypoBase.h:13
TrigZVertexHypoAlg::finalize
virtual StatusCode finalize() override
Definition: TrigZVertexHypoAlg.cxx:33
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
TrigZVertexHypoAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: TrigZVertexHypoAlg.cxx:38
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
TrigCompositeUtils::linkToPrevious
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
Definition: TrigCompositeUtilsRoot.cxx:139
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
TrigZVertexHypoAlg::~TrigZVertexHypoAlg
virtual ~TrigZVertexHypoAlg() override
Definition: TrigZVertexHypoAlg.cxx:21
TrigZVertexHypoAlg::initialize
virtual StatusCode initialize() override
Definition: TrigZVertexHypoAlg.cxx:25
TrigCompositeUtils::viewString
const std::string & viewString()
Definition: TrigCompositeUtilsRoot.cxx:882
drawFromPickle.view
view
Definition: drawFromPickle.py:294
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37