ATLAS Offline Software
TrigGenericHypoAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "TrigGenericHypoAlg.h"
7 
8 TrigGenericHypoAlg::TrigGenericHypoAlg(const std::string& name, ISvcLocator* pSvcLocator) :
9  ::HypoBase(name, pSvcLocator) {}
10 
12  ATH_CHECK( m_hypoTools.retrieve() );
13  ATH_CHECK(m_trigCompKey.initialize());
14  return StatusCode::SUCCESS;
15 }
16 
17 StatusCode TrigGenericHypoAlg::execute(const EventContext& context) const {
18 
19  // Retrieve previous decision
20  auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context );
21  ATH_CHECK( previousDecisionsHandle.isValid() );
22  ATH_MSG_DEBUG( "Running with "<< previousDecisionsHandle->size() <<" previous decisions");
23 
27 
28  std::vector<TrigGenericHypoTool::HypoToolInfo> hypoToolInput;
29  for (const TrigCompositeUtils::Decision* previousDecision: *previousDecisionsHandle) {
30  TrigCompositeUtils::DecisionIDContainer previousDecisionIDs;
31  TrigCompositeUtils::decisionIDs(previousDecision, previousDecisionIDs);
32 
34  if(trigComposite->size()==0) continue;
35  if(trigComposite->size() > 1){
36  ATH_MSG_ERROR("Expect at most 1 TrigComposite, but received: "<<trigComposite->size());//should have at most 1 trig composite
37  return StatusCode::FAILURE;
38  }
39  const xAOD::TrigComposite* tc = trigComposite->at(0);
41 
43  hypoToolInput.emplace_back(newd, tc, previousDecision );
44  newd -> setObjectLink( TrigCompositeUtils::featureString(), featureLink );
45  TrigCompositeUtils::linkToPrevious( newd, previousDecision, context );
46  }
47 
48  for ( auto & tool: m_hypoTools ) {
49  ATH_CHECK( tool->decide( hypoToolInput ) );
50  }
51 
52  ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
53  return StatusCode::SUCCESS;
54 }
TrigGenericHypoAlg.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
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TrigGenericHypoAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: TrigGenericHypoAlg.cxx:17
TrigCompositeUtils::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:904
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
TrigGenericHypoAlg::TrigGenericHypoAlg
TrigGenericHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigGenericHypoAlg.cxx:8
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
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
TrigCompositeUtils.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigGenericHypoAlg::m_trigCompKey
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_trigCompKey
Definition: TrigGenericHypoAlg.h:19
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
TrigCompositeUtils::decisionToElementLink
ElementLink< DecisionContainer > decisionToElementLink(const Decision *d, const EventContext &ctx)
Takes a raw pointer to a Decision and returns an ElementLink to the Decision.
Definition: TrigCompositeUtilsRoot.cxx:122
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:884
TrigGenericHypoAlg::initialize
virtual StatusCode initialize() override
Definition: TrigGenericHypoAlg.cxx:11
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
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
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
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
TrigGenericHypoAlg::m_hypoTools
ToolHandleArray< TrigGenericHypoTool > m_hypoTools
Definition: TrigGenericHypoAlg.h:18
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TrigRoiDescriptorCollection.h