ATLAS Offline Software
TriggerMatchingTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DERIVATIONFRAMEWORKTRIGGER_TRIGGERMATCHINGTOOL_H
6 #define DERIVATIONFRAMEWORKTRIGGER_TRIGGERMATCHINGTOOL_H
7 
11 #include "GaudiKernel/ToolHandle.h"
15 #include "xAODBase/IParticle.h"
19 #include <vector>
20 
21 namespace DerivationFramework
22 {
38  class TriggerMatchingTool final : public extends<AthAlgTool, IAugmentationTool>
39  {
40  public:
42  using particleVec_t = std::vector<const xAOD::IParticle *>;
45  const std::string &type,
46  const std::string &name,
47  const IInterface *pSvcLocator);
48 
50  virtual StatusCode initialize() override;
51 
53  virtual StatusCode addBranches() const override;
54 
55  private:
56  // Properties
58  mutable std::vector<std::string> m_chainNames ATLAS_THREAD_SAFE;
59  // This being mutable isn't exactly the greatest thing but we can't check
60  // whether the chains actually exist before the first event. A better
61  // solution would be to filter the chains by what is available in the
62  // input file but I don't know if that's possible.
63  // It is thread-safe because the mutable operation is done as part of a
64  // static const initialization on the first call of addBranches().
65 
67  ToolHandle<Trig::IIParticleRetrievalTool> m_trigParticleTool{"Trig::IParticleRetrievalTool/OnlineParticleTool"};
68 
70  std::map<xAOD::Type::ObjectType, SG::ReadHandleKey<xAOD::IParticleContainer>> m_offlineInputs;
71 
74 
76  bool m_rerun;
77 
79  std::string m_outputPrefix;
80 
84 
88 
90  ToolHandle<Trig::TrigDecisionTool> m_tdt{"Trig::TrigDecisionTool/TrigDecisionTool"};
91 
93  ToolHandle<Trig::IMatchScoringTool> m_scoreTool{
94  this, "ScoringTool", "Trig::DRScoringTool", "The pair scoring tool"};
95 
96  // Internal functions
105  xAOD::TrigCompositeContainer *&container,
106  const std::string &chain) const;
107 
115  const xAOD::IParticle *part,
116  std::map<xAOD::Type::ObjectType, particleVec_t> &offlineParticles,
117  std::map<const xAOD::IParticle *, particleVec_t> &cache) const;
118 
122  bool matchParticles(
123  const xAOD::IParticle *lhs,
124  const xAOD::IParticle *rhs) const;
125  }; //> end class TriggerMatchingTool
126 } // namespace DerivationFramework
127 
128 #endif //> ! DERIVATIONFRAMEWORKTRIGGER_TRIGGERMATCHINGTOOL_H
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
DerivationFramework::TriggerMatchingTool::m_drThreshold
float m_drThreshold
The DR threshold to use.
Definition: TriggerMatchingTool.h:73
DerivationFramework::TriggerMatchingTool::matchParticles
bool matchParticles(const xAOD::IParticle *lhs, const xAOD::IParticle *rhs) const
Check if the dR between two particles is below threshold.
Definition: TriggerMatchingTool.cxx:297
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
IParticle.h
DerivationFramework::TriggerMatchingTool::m_outputPrefix
std::string m_outputPrefix
The prefix to place at the beginning of the output containers.
Definition: TriggerMatchingTool.h:79
DerivationFramework::TriggerMatchingTool::ATLAS_THREAD_SAFE
std::vector< std::string > m_chainNames ATLAS_THREAD_SAFE
The list of chain names to match.
Definition: TriggerMatchingTool.h:58
IAugmentationTool.h
DerivationFramework::TriggerMatchingTool::m_scoreTool
ToolHandle< Trig::IMatchScoringTool > m_scoreTool
The pair scoring tool.
Definition: TriggerMatchingTool.h:93
TrigDecisionTool.h
DerivationFramework::TriggerMatchingTool::TriggerMatchingTool
TriggerMatchingTool(const std::string &type, const std::string &name, const IInterface *pSvcLocator)
Constructor.
Definition: TriggerMatchingTool.cxx:42
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
DerivationFramework::TriggerMatchingTool::m_checkEmptyChainGroups
bool m_checkEmptyChainGroups
If set, discard any triggers with empty chain groups (break the job otherwise).
Definition: TriggerMatchingTool.h:83
DerivationFramework::TriggerMatchingTool::addBranches
virtual StatusCode addBranches() const override
Calculate the matchings.
Definition: TriggerMatchingTool.cxx:96
IMatchScoringTool.h
DerivationFramework::TriggerMatchingTool::m_trigParticleTool
ToolHandle< Trig::IIParticleRetrievalTool > m_trigParticleTool
The tool to retrieve the online candidates.
Definition: TriggerMatchingTool.h:67
DerivationFramework::TriggerMatchingTool::particleVec_t
std::vector< const xAOD::IParticle * > particleVec_t
Helper typedefs.
Definition: TriggerMatchingTool.h:42
DerivationFramework::TriggerMatchingTool::m_rerun
bool m_rerun
Whether to match in rerun mode or not.
Definition: TriggerMatchingTool.h:76
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IParticleContainer.h
AthAlgTool.h
DerivationFramework::TriggerMatchingTool::m_tdt
ToolHandle< Trig::TrigDecisionTool > m_tdt
The trig decision tool.
Definition: TriggerMatchingTool.h:90
IIParticleRetrievalTool.h
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
columnar::final
CM final
Definition: ColumnAccessor.h:106
TrigCompositeContainer.h
DerivationFramework::TriggerMatchingTool::getCandidateMatchesFor
const particleVec_t & getCandidateMatchesFor(const xAOD::IParticle *part, std::map< xAOD::Type::ObjectType, particleVec_t > &offlineParticles, std::map< const xAOD::IParticle *, particleVec_t > &cache) const
Get all offline particles that could match a given online one.
Definition: TriggerMatchingTool.cxx:259
DerivationFramework::TriggerMatchingTool::m_offlineInputs
std::map< xAOD::Type::ObjectType, SG::ReadHandleKey< xAOD::IParticleContainer > > m_offlineInputs
The input containers to use. These are keyed by xAOD object type.
Definition: TriggerMatchingTool.h:70
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DerivationFramework::TriggerMatchingTool::m_inputDependentConfig
bool m_inputDependentConfig
If using an input-file-dependent config then we warn when triggers are removed.
Definition: TriggerMatchingTool.h:87
DerivationFramework::TriggerMatchingTool
Tool to perform trigger matching in the derivation framework.
Definition: TriggerMatchingTool.h:39
DerivationFramework::TriggerMatchingTool::initialize
virtual StatusCode initialize() override
Initialize the tool.
Definition: TriggerMatchingTool.cxx:79
checker_macros.h
Define macros for attributes used to control the static checker.
DerivationFramework::TriggerMatchingTool::createOutputContainer
StatusCode createOutputContainer(xAOD::TrigCompositeContainer *&container, const std::string &chain) const
Create an output container for the named chain.
Definition: TriggerMatchingTool.cxx:242