ATLAS Offline Software
Loading...
Searching...
No Matches
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
21namespace 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 EventContext& ctx) 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
104 StatusCode createOutputContainer(
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
Property holding a SG store/key/clid from which a ReadHandle is made.
Define macros for attributes used to control the static checker.
bool m_checkEmptyChainGroups
If set, discard any triggers with empty chain groups (break the job otherwise).
std::map< xAOD::Type::ObjectType, SG::ReadHandleKey< xAOD::IParticleContainer > > m_offlineInputs
The input containers to use. These are keyed by xAOD object type.
std::vector< std::string > m_chainNames ATLAS_THREAD_SAFE
The list of chain names to match.
virtual StatusCode addBranches(const EventContext &ctx) const override
Calculate the matchings.
bool matchParticles(const xAOD::IParticle *lhs, const xAOD::IParticle *rhs) const
Check if the dR between two particles is below threshold.
virtual StatusCode initialize() override
Initialize the tool.
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.
std::vector< const xAOD::IParticle * > particleVec_t
Helper typedefs.
std::string m_outputPrefix
The prefix to place at the beginning of the output containers.
ToolHandle< Trig::TrigDecisionTool > m_tdt
The trig decision tool.
StatusCode createOutputContainer(xAOD::TrigCompositeContainer *&container, const std::string &chain) const
Create an output container for the named chain.
bool m_rerun
Whether to match in rerun mode or not.
ToolHandle< Trig::IIParticleRetrievalTool > m_trigParticleTool
The tool to retrieve the online candidates.
TriggerMatchingTool(const std::string &type, const std::string &name, const IInterface *pSvcLocator)
Constructor.
bool m_inputDependentConfig
If using an input-file-dependent config then we warn when triggers are removed.
float m_drThreshold
The DR threshold to use.
ToolHandle< Trig::IMatchScoringTool > m_scoreTool
The pair scoring tool.
Class providing the definition of the 4-vector interface.
THE reconstruction tool.
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.