ATLAS Offline Software
InputMakerBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DECISIONHANDLING_INPUTMAKERBASE_H
6 #define DECISIONHANDLING_INPUTMAKERBASE_H 1
7 
11 
21 
22  public:
24  InputMakerBase( const std::string& name, ISvcLocator* pSvcLocator );
26  virtual ~InputMakerBase();
28  virtual StatusCode sysInitialize() override;
29 
30  protected:
35  struct MatchingCache {
36  void setMatchingHash(const TrigCompositeUtils::Decision* inputDecision, const uint64_t matchingHash);
37  void linkOutputToInput(const TrigCompositeUtils::Decision* outputDecision, const TrigCompositeUtils::Decision* inputDecision);
38  uint64_t getMatchingHash(const TrigCompositeUtils::Decision* outputDecision) const;
39  std::map<const TrigCompositeUtils::Decision*, const TrigCompositeUtils::Decision*> m_outputDecToInputDec;
40  std::map<const TrigCompositeUtils::Decision*, uint64_t> m_inputDecToMatchingHash;
41  };
42 
45 
48 
49  // name of link to the RoI
50  StringProperty m_roisLink {this, "RoIsLink", "initialRoI",
51  "Name of EL to RoI object linked to the decision, used in merging input Decision objects when mergeUsingFeature=False." };
52 
53  Gaudi::Property<bool> m_mergeUsingFeature {this, "mergeUsingFeature", false,
54  "True=the IParicle-derived feature from the previous step is used to determine identical inputs. False=the ROI located with the RoIsLink property is used to determine identical inputs" };
55 
56  Gaudi::Property<bool> m_isEmptyStep {this, "isEmptyStep", false,
57  "True if this InputMaker instance is being used in an empty step. Forgoes the requirement to link an ROI, and auto-configures the 'mergeUsingFeature' property at runtime." };
58 
59  // helper methods for derived classes to reduce boiler plate code //
61 
63  void debugPrintOut(const EventContext& context, SG::WriteHandle<TrigCompositeUtils::DecisionContainer>& outputHandle) const;
64 
66  StatusCode decisionInputToOutput(const EventContext& context, SG::WriteHandle<TrigCompositeUtils::DecisionContainer>& outputHandle) const;
67 
69  size_t matchDecision(const TrigCompositeUtils::DecisionContainer* outDecisions,
70  const TrigCompositeUtils::Decision* toMatch,
71  const std::string& linkNameToMatch,
72  MatchingCache& matchingCache) const;
73 
76  const TrigCompositeUtils::Decision* toMatch,
77  size_t& matchIndex,
78  bool& usedROIMatchingFlag,
79  MatchingCache& matchingCache) const;
80 
82  uint64_t getMatchingHashForDecision(const TrigCompositeUtils::Decision* toMatch, const std::string& linkNameToMatch) const;
83 
84  private:
85 
87  SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_inputs { this, "InputMakerInputDecisions", {}, "Input Decisions (implicit)" };
88 
90  SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_outputs { this, "InputMakerOutputDecisions", "", "Output Decisions" };
91 
92 };
93 
94 #endif // DECISIONHANDLING_INPUTMAKERBASE_H
InputMakerBase::getMatchingHashForDecision
uint64_t getMatchingHashForDecision(const TrigCompositeUtils::Decision *toMatch, const std::string &linkNameToMatch) const
Searches from toMatch to locate a single (type-less) Element Link with given edge name....
Definition: InputMakerBase.cxx:159
ReadHandleKeyArray.h
InputMakerBase::m_mergeUsingFeature
Gaudi::Property< bool > m_mergeUsingFeature
Definition: InputMakerBase.h:53
InputMakerBase::decisionInputToOutput
StatusCode decisionInputToOutput(const EventContext &context, SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle) const
does the standard handling of input decisions: read from handles with all the checks,...
Definition: InputMakerBase.cxx:43
TrigCompositeUtils.h
InputMakerBase::MatchingCache::m_inputDecToMatchingHash
std::map< const TrigCompositeUtils::Decision *, uint64_t > m_inputDecToMatchingHash
Definition: InputMakerBase.h:40
InputMakerBase
Input Makers are used at the start of a sequence: retrieve filtered collection via the input decision...
Definition: InputMakerBase.h:20
InputMakerBase::InputMakerBase
InputMakerBase(const std::string &name, ISvcLocator *pSvcLocator)
constructor, to be called by sub-class constructors
Definition: InputMakerBase.cxx:12
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
InputMakerBase::decisionInputs
const SG::ReadHandleKeyArray< TrigCompositeUtils::DecisionContainer > & decisionInputs() const
methods for derived classes to access handles of the base class input and output decisions; other rea...
Definition: InputMakerBase.cxx:17
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
InputMakerBase::MatchingCache::getMatchingHash
uint64_t getMatchingHash(const TrigCompositeUtils::Decision *outputDecision) const
Definition: InputMakerBase.cxx:237
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InputMakerBase::MatchingCache::linkOutputToInput
void linkOutputToInput(const TrigCompositeUtils::Decision *outputDecision, const TrigCompositeUtils::Decision *inputDecision)
Definition: InputMakerBase.cxx:232
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
InputMakerBase::m_outputs
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_outputs
output decisions
Definition: InputMakerBase.h:90
InputMakerBase::m_roisLink
StringProperty m_roisLink
Definition: InputMakerBase.h:50
AthReentrantAlgorithm.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
InputMakerBase::decisionOutputs
const SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > & decisionOutputs() const
methods for derived classes to access handles of the base class input and output decisions; other rea...
Definition: InputMakerBase.cxx:21
InputMakerBase::debugPrintOut
void debugPrintOut(const EventContext &context, SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle) const
provides debug printout of the output of the algorithm
Definition: InputMakerBase.cxx:200
InputMakerBase::matchDecision
size_t matchDecision(const TrigCompositeUtils::DecisionContainer *outDecisions, const TrigCompositeUtils::Decision *toMatch, const std::string &linkNameToMatch, MatchingCache &matchingCache) const
Checks for merge-able Decision objects coming from N upstream filters. Check based on most-recent ele...
Definition: InputMakerBase.cxx:140
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
InputMakerBase::m_isEmptyStep
Gaudi::Property< bool > m_isEmptyStep
Definition: InputMakerBase.h:56
InputMakerBase::sysInitialize
virtual StatusCode sysInitialize() override
initialise this base class and renounce input decision key handles
Definition: InputMakerBase.cxx:25
InputMakerBase::matchInCollection
bool matchInCollection(const TrigCompositeUtils::DecisionContainer *outDecisions, const TrigCompositeUtils::Decision *toMatch, size_t &matchIndex, bool &usedROIMatchingFlag, MatchingCache &matchingCache) const
Wrapper around matchDecision. Returns boolean if the match was successful.
Definition: InputMakerBase.cxx:117
InputMakerBase::MatchingCache::setMatchingHash
void setMatchingHash(const TrigCompositeUtils::Decision *inputDecision, const uint64_t matchingHash)
Definition: InputMakerBase.cxx:227
InputMakerBase::~InputMakerBase
virtual ~InputMakerBase()
destructor
Definition: InputMakerBase.cxx:15
InputMakerBase::m_inputs
SG::ReadHandleKeyArray< TrigCompositeUtils::DecisionContainer > m_inputs
input decisions array, will be implicit (renounced).
Definition: InputMakerBase.h:87
InputMakerBase::MatchingCache::m_outputDecToInputDec
std::map< const TrigCompositeUtils::Decision *, const TrigCompositeUtils::Decision * > m_outputDecToInputDec
Definition: InputMakerBase.h:39
InputMakerBase::MatchingCache
Used to cache each incoming Decision object's ElementLink which is being used to identify the Decisio...
Definition: InputMakerBase.h:35