ATLAS Offline Software
TrigStreamerHypoAlg.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 "TrigStreamerHypoAlg.h"
5 
6 #include "Gaudi/Property.h"
10 
11 using namespace TrigCompositeUtils;
12 
14  ISvcLocator* pSvcLocator ) :
15  ::HypoBase( name, pSvcLocator ) {}
16 
17 
19 
20  CHECK( m_hypoTools.retrieve() );
21  return StatusCode::SUCCESS;
22 }
23 
24 StatusCode TrigStreamerHypoAlg::execute( const EventContext& context ) const {
25 
26  ATH_MSG_DEBUG ( "Executing " << name() << "..." );
27  auto h_prevDecisions = SG::makeHandle( decisionInput(), context );
28  ATH_CHECK( h_prevDecisions.isValid() );
29  ATH_MSG_DEBUG( "Running with "<< h_prevDecisions->size() <<" previous decisions");
30 
31  // Make a new Decisions container which will contain the new Decision object created by this hypo.
33  DecisionContainer* newDecisions = outputHandle.ptr();
34 
35  // Struct to pass info on to the HypoTools
36  std::vector< ITrigStreamerHypoTool::HypoInfo > hypoInfo;
37 
38  for (const Decision* previousDecision : *h_prevDecisions ) {
39  // Create output Decision object, link it to prevDecision.
40  Decision* newDecision = newDecisionIn(newDecisions, previousDecision, hypoAlgNodeName(), context);
41 
42  // Obligatory link to feature. Re-using the initial ROI.
43  // If this happens to be a FullScan ROI, then the following ComboHypo will also pass this leg through without cuts
44  //LinkInfo<TrigRoiDescriptorCollection> featureLinkInfo = findLink<TrigRoiDescriptorCollection>(previousDecision, initialRoIString());
45  //newDecision->setObjectLink(featureString(), featureLinkInfo.link);
46  if (m_featureIsROI) {
47  // Obligatory link to feature. Re-using the initial ROI.
48  // If this happens to be a FullScan ROI, then the following ComboHypo will also pass this leg through without cuts
49  LinkInfo<TrigRoiDescriptorCollection> featureLinkInfo = findLink<TrigRoiDescriptorCollection>(previousDecision, initialRoIString());
50  newDecision->setObjectLink(featureString(), featureLinkInfo.link);
51  } else {
52  // Obligatory link to feature. Re-use previous Step's feature.
53  SG::sgkey_t key = 0;
54  uint32_t clid = 0;
56  const Decision* source = nullptr; // Unused
57  ATH_CHECK( typelessFindLink(previousDecision, featureString(), key, clid, index, source) );
58  newDecision->typelessSetObjectLink(featureString(), key, clid, index);
59  }
60 
61  hypoInfo.emplace_back(newDecision, previousDecision);
62  }
63 
64  for (const auto& tool: m_hypoTools) {
65  ATH_MSG_DEBUG( "About to decide for " << tool->name() );
66  ATH_CHECK(tool->decide(hypoInfo)); // The StreamerHypoTool only contains logical-flow checks
67  }
68 
69  // Common debug printing
70  ATH_CHECK(hypoBaseOutputProcessing(outputHandle));
71 
72  return StatusCode::SUCCESS;
73 }
TrigStreamerHypoAlg.h
TrigCompositeUtils::LinkInfo::link
ElementLink< T > link
Link to the feature.
Definition: LinkInfo.h:61
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigStreamerHypoAlg::initialize
virtual StatusCode initialize() override
Definition: TrigStreamerHypoAlg.cxx:18
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
index
Definition: index.py:1
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
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
TrigStreamerHypoAlg::m_featureIsROI
Gaudi::Property< bool > m_featureIsROI
Definition: TrigStreamerHypoAlg.h:31
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
xAOD::TrigComposite_v1::typelessSetObjectLink
void typelessSetObjectLink(const std::string &name, const sgkey_t key, const uint32_t clid, const index_type beginIndex, const index_type endIndex=0)
Add a link without type.
Definition: TrigComposite_v1.cxx:344
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
TrigCompositeUtils.h
xAOD::TrigComposite_v1::setObjectLink
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
TrigCompositeUtils::initialRoIString
const std::string & initialRoIString()
Definition: TrigCompositeUtilsRoot.cxx:868
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
TrigStreamerHypoAlg::m_hypoTools
ToolHandleArray< ITrigStreamerHypoTool > m_hypoTools
Definition: TrigStreamerHypoAlg.h:28
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
TrigStreamerHypoAlg::TrigStreamerHypoAlg
TrigStreamerHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigStreamerHypoAlg.cxx:13
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:884
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
xAOD::TrigComposite_v1::index_type
uint32_t index_type
Definition: TrigComposite_v1.h:56
TrigStreamerHypoAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: TrigStreamerHypoAlg.cxx:24
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
TrigCompositeUtils::LinkInfo
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition: LinkInfo.h:28
HLTIdentifier.h
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
copySelective.source
string source
Definition: copySelective.py:32
TrigRoiDescriptorCollection.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TrigCompositeUtils::typelessFindLink
bool typelessFindLink(const Decision *start, const std::string &linkName, sgkey_t &key, uint32_t &clid, Decision::index_type &index, const Decision *&source, const bool suppressMultipleLinksWarning)
Perform a recursive search for ElementLinks of any time and name 'linkName', starting from Decision o...
Definition: TrigCompositeUtilsRoot.cxx:723