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 AthAlgTool,
39  virtual public IAugmentationTool
40  {
41  public:
43  using particleVec_t = std::vector<const xAOD::IParticle *>;
46  const std::string &type,
47  const std::string &name,
48  const IInterface *pSvcLocator);
49 
51  virtual StatusCode initialize() override;
52 
54  virtual StatusCode addBranches() const override;
55 
56  private:
57  // Properties
59  mutable std::vector<std::string> m_chainNames ATLAS_THREAD_SAFE;
60  // This being mutable isn't exactly the greatest thing but we can't check
61  // whether the chains actually exist before the first event. A better
62  // solution would be to filter the chains by what is available in the
63  // input file but I don't know if that's possible.
64  // It is thread-safe because the mutable operation is done as part of a
65  // static const initialization on the first call of addBranches().
66 
68  ToolHandle<Trig::IIParticleRetrievalTool> m_trigParticleTool{"Trig::IParticleRetrievalTool/OnlineParticleTool"};
69 
71  std::map<xAOD::Type::ObjectType, SG::ReadHandleKey<xAOD::IParticleContainer>> m_offlineInputs;
72 
75 
77  bool m_rerun;
78 
80  std::string m_outputPrefix;
81 
85 
89 
91  ToolHandle<Trig::TrigDecisionTool> m_tdt{"Trig::TrigDecisionTool/TrigDecisionTool"};
92 
94  ToolHandle<Trig::IMatchScoringTool> m_scoreTool{
95  this, "ScoringTool", "Trig::DRScoringTool", "The pair scoring tool"};
96 
97  // Internal functions
106  xAOD::TrigCompositeContainer *&container,
107  const std::string &chain) const;
108 
116  const xAOD::IParticle *part,
117  std::map<xAOD::Type::ObjectType, particleVec_t> &offlineParticles,
118  std::map<const xAOD::IParticle *, particleVec_t> &cache) const;
119 
123  bool matchParticles(
124  const xAOD::IParticle *lhs,
125  const xAOD::IParticle *rhs) const;
126  }; //> end class TriggerMatchingTool
127 } // namespace DerivationFramework
128 
129 #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:74
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:282
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:80
DerivationFramework::TriggerMatchingTool::ATLAS_THREAD_SAFE
std::vector< std::string > m_chainNames ATLAS_THREAD_SAFE
The list of chain names to match.
Definition: TriggerMatchingTool.h:59
IAugmentationTool.h
DerivationFramework::TriggerMatchingTool::m_scoreTool
ToolHandle< Trig::IMatchScoringTool > m_scoreTool
The pair scoring tool.
Definition: TriggerMatchingTool.h:94
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:40
DerivationFramework::IAugmentationTool
Definition: IAugmentationTool.h:24
DerivationFramework::TriggerMatchingTool::m_checkEmptyChainGroups
bool m_checkEmptyChainGroups
If set, discard any triggers with empty chain groups (break the job otherwise).
Definition: TriggerMatchingTool.h:84
DerivationFramework::TriggerMatchingTool::addBranches
virtual StatusCode addBranches() const override
Calculate the matchings.
Definition: TriggerMatchingTool.cxx:97
IMatchScoringTool.h
DerivationFramework::TriggerMatchingTool::m_trigParticleTool
ToolHandle< Trig::IIParticleRetrievalTool > m_trigParticleTool
The tool to retrieve the online candidates.
Definition: TriggerMatchingTool.h:68
DerivationFramework::TriggerMatchingTool::particleVec_t
std::vector< const xAOD::IParticle * > particleVec_t
Helper typedefs.
Definition: TriggerMatchingTool.h:43
DerivationFramework::TriggerMatchingTool::m_rerun
bool m_rerun
Whether to match in rerun mode or not.
Definition: TriggerMatchingTool.h:77
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:91
IIParticleRetrievalTool.h
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
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:244
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:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DerivationFramework::TriggerMatchingTool::m_inputDependentConfig
bool m_inputDependentConfig
If using an input-file-dependent config then we warn when triggers are removed.
Definition: TriggerMatchingTool.h:88
DerivationFramework::TriggerMatchingTool
Tool to perform trigger matching in the derivation framework.
Definition: TriggerMatchingTool.h:40
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DerivationFramework::TriggerMatchingTool::initialize
virtual StatusCode initialize() override
Initialize the tool.
Definition: TriggerMatchingTool.cxx:80
AthAlgTool
Definition: AthAlgTool.h:26
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:227