ATLAS Offline Software
DeltaRMatchingTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef INDETTRACKPERFMON_DELTARMATCHINGTOOL_H
6 #define INDETTRACKPERFMON_DELTARMATCHINGTOOL_H
7 
16 #include "AsgTools/AsgTool.h"
18 
20 #include "ITrackMatchingTool.h"
21 
22 
23 namespace IDTPM {
24 
28  template< typename T, typename R=T >
30  public asg::AsgTool {
31 
32  public:
33 
35  DeltaRMatchingToolBase( const std::string& name ) :
36  asg::AsgTool( name ) { };
37 
39  virtual StatusCode initialize() override
40  {
41  ATH_MSG_DEBUG( "Initializing " << name() );
43 
44  if( m_dRmax<0 and m_pTResMax<0 ) {
45  ATH_MSG_ERROR( "No DeltaRMax or pTresMax criteria requested" );
46  return StatusCode::FAILURE;
47  }
48 
49  return StatusCode::SUCCESS;
50  }
51 
54  const std::vector< const T* >& vTest,
55  const std::vector< const R* >& vRef,
56  ITrackMatchingLookup& matches ) const;
57 
59  const R* getMatchedRef(
60  const T& t, const std::vector< const R* >& vRef, float& dist ) const;
61 
62  protected:
63 
64  FloatProperty m_dRmax { this, "dRmax", 0.05, "Maximum DeltaR cone size for DeltaR-matching (disabled if <0)" };
65  FloatProperty m_pTResMax { this, "pTResMax", -9.9, "Maximum relative pT distance allowed for matching (disabled if <0)" };
66 
67  }; // class DeltaRMatchingToolBase
68 
69 
74  public DeltaRMatchingToolBase< xAOD::TrackParticle >,
75  public virtual ITrackMatchingTool {
76 
77  public:
78 
80 
82  DeltaRMatchingTool_trk( const std::string& name ) :
84 
86  virtual StatusCode match(
87  TrackAnalysisCollections& trkAnaColls,
88  const std::string& chainRoIName,
89  const std::string& roiStr ) const override;
90 
93  virtual StatusCode match(
94  const std::vector< const xAOD::TrackParticle* >& vTest,
95  const std::vector< const xAOD::TrackParticle* >& vRef,
96  ITrackMatchingLookup& matches ) const override
97  {
98  ATH_MSG_DEBUG( "Doing Track->Track DeltaR matching" );
99  ATH_CHECK( matchVectors( vTest, vRef, matches ) );
100  return StatusCode::SUCCESS;
101  }
102 
104  virtual StatusCode match(
105  const std::vector< const xAOD::TrackParticle* >&,
106  const std::vector< const xAOD::TruthParticle* >&,
107  ITrackMatchingLookup& ) const override
108  {
109  ATH_MSG_WARNING( "Track->Truth matching disabled" );
110  return StatusCode::SUCCESS;
111  }
112 
114  virtual StatusCode match(
115  const std::vector< const xAOD::TruthParticle* >&,
116  const std::vector< const xAOD::TrackParticle* >&,
117  ITrackMatchingLookup& ) const override
118  {
119  ATH_MSG_WARNING( "Truth->Track matching disabled" );
120  return StatusCode::SUCCESS;
121  }
122 
123  }; // class DeltaRMatchingTool_trk
124 
125 
130  public DeltaRMatchingToolBase< xAOD::TrackParticle, xAOD::TruthParticle >,
131  public virtual ITrackMatchingTool {
132 
133  public:
134 
136 
138  DeltaRMatchingTool_trkTruth( const std::string& name ) :
140 
142  virtual StatusCode match(
143  TrackAnalysisCollections& trkAnaColls,
144  const std::string& chainRoIName,
145  const std::string& roiStr ) const override;
146 
149  virtual StatusCode match(
150  const std::vector< const xAOD::TrackParticle* >&,
151  const std::vector< const xAOD::TrackParticle* >&,
152  ITrackMatchingLookup& ) const override
153  {
154  ATH_MSG_WARNING( "Track->Track matching disabled" );
155  return StatusCode::SUCCESS;
156  }
157 
159  virtual StatusCode match(
160  const std::vector< const xAOD::TrackParticle* >& vTest,
161  const std::vector< const xAOD::TruthParticle* >& vRef,
162  ITrackMatchingLookup& matches ) const override
163  {
164  ATH_MSG_DEBUG( "Doing Track->Truth DeltaR matching" );
165  ATH_CHECK( matchVectors( vTest, vRef, matches ) );
166  return StatusCode::SUCCESS;
167  }
168 
170  virtual StatusCode match(
171  const std::vector< const xAOD::TruthParticle* >&,
172  const std::vector< const xAOD::TrackParticle* >&,
173  ITrackMatchingLookup& ) const override
174  {
175  ATH_MSG_WARNING( "Truth->Track matching disabled" );
176  return StatusCode::SUCCESS;
177  }
178 
179  }; // class DeltaRMatchingTool_trkTruth
180 
181 
186  public DeltaRMatchingToolBase< xAOD::TruthParticle, xAOD::TrackParticle >,
187  public virtual ITrackMatchingTool {
188 
189  public:
190 
192 
194  DeltaRMatchingTool_truthTrk( const std::string& name ) :
196 
198  virtual StatusCode match(
199  TrackAnalysisCollections& trkAnaColls,
200  const std::string& chainRoIName,
201  const std::string& roiStr ) const override;
202 
205  virtual StatusCode match(
206  const std::vector< const xAOD::TrackParticle* >&,
207  const std::vector< const xAOD::TrackParticle* >&,
208  ITrackMatchingLookup& ) const override
209  {
210  ATH_MSG_WARNING( "Track->Track matching disabled" );
211  return StatusCode::SUCCESS;
212  }
213 
215  virtual StatusCode match(
216  const std::vector< const xAOD::TrackParticle* >&,
217  const std::vector< const xAOD::TruthParticle* >&,
218  ITrackMatchingLookup& ) const override
219  {
220  ATH_MSG_WARNING( "Track->Truth matching disabled" );
221  return StatusCode::SUCCESS;
222  }
223 
225  virtual StatusCode match(
226  const std::vector< const xAOD::TruthParticle* >& vTest,
227  const std::vector< const xAOD::TrackParticle* >& vRef,
228  ITrackMatchingLookup& matches ) const override
229  {
230  ATH_MSG_DEBUG( "Doing Truth->Track DeltaR matching" );
231  ATH_CHECK( matchVectors( vTest, vRef, matches ) );
232  return StatusCode::SUCCESS;
233  }
234 
235  }; // class DeltaRMatchingTool_truthTrk
236 
237 } // namespace IDTPM
238 
239 #include "DeltaRMatchingTool.icc"
240 
241 #endif // > !INDETTRACKPERFMON_DELTARMATCHINGTOOL_H
IDTPM::DeltaRMatchingTool_trk::match
virtual StatusCode match(const std::vector< const xAOD::TrackParticle * > &, const std::vector< const xAOD::TruthParticle * > &, ITrackMatchingLookup &) const override
track -> truth matching (disabled)
Definition: DeltaRMatchingTool.h:104
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
IDTPM::TrackAnalysisCollections
Definition: TrackAnalysisCollections.h:46
IDTPM::DeltaRMatchingToolBase::m_pTResMax
FloatProperty m_pTResMax
Definition: DeltaRMatchingTool.h:65
IDTPM::ITrackMatchingTool
Definition: InnerDetector/InDetValidation/InDetTrackPerfMon/src/ITrackMatchingTool.h:32
IDTPM::DeltaRMatchingTool_trkTruth::ASG_TOOL_CLASS
ASG_TOOL_CLASS(DeltaRMatchingTool_trkTruth, ITrackMatchingTool)
IDTPM::DeltaRMatchingToolBase::getMatchedRef
const R * getMatchedRef(const T &t, const std::vector< const R * > &vRef, float &dist) const
Get the reference track matched to the given test.
asg
Definition: DataHandleTestTool.h:28
TruthParticle
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h:58
IDTPM::DeltaRMatchingTool_trk
Definition: DeltaRMatchingTool.h:75
IDTPM::DeltaRMatchingTool_truthTrk::match
virtual StatusCode match(const std::vector< const xAOD::TrackParticle * > &, const std::vector< const xAOD::TrackParticle * > &, ITrackMatchingLookup &) const override
Specific matching methods, via test/reference vectors track -> track matching (disabled)
Definition: DeltaRMatchingTool.h:205
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
IDTPM::DeltaRMatchingTool_truthTrk::match
virtual StatusCode match(const std::vector< const xAOD::TruthParticle * > &vTest, const std::vector< const xAOD::TrackParticle * > &vRef, ITrackMatchingLookup &matches) const override
truth -> track matching
Definition: DeltaRMatchingTool.h:225
IDTPM::DeltaRMatchingTool_trk::ASG_TOOL_CLASS
ASG_TOOL_CLASS(DeltaRMatchingTool_trk, ITrackMatchingTool)
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
IDTPM::DeltaRMatchingTool_trk::DeltaRMatchingTool_trk
DeltaRMatchingTool_trk(const std::string &name)
Constructor.
Definition: DeltaRMatchingTool.h:82
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition: AsgTool.cxx:58
IDTPM::DeltaRMatchingTool_truthTrk::ASG_TOOL_CLASS
ASG_TOOL_CLASS(DeltaRMatchingTool_truthTrk, ITrackMatchingTool)
IDTPM::DeltaRMatchingTool_trk::match
virtual StatusCode match(const std::vector< const xAOD::TruthParticle * > &, const std::vector< const xAOD::TrackParticle * > &, ITrackMatchingLookup &) const override
truth -> track matching (disabled)
Definition: DeltaRMatchingTool.h:114
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
IDTPM::DeltaRMatchingTool_truthTrk::match
virtual StatusCode match(TrackAnalysisCollections &trkAnaColls, const std::string &chainRoIName, const std::string &roiStr) const override
General matching method, via TrackAnalysisCollections.
Definition: DeltaRMatchingTool.cxx:82
IDTPM::DeltaRMatchingTool_truthTrk
Definition: DeltaRMatchingTool.h:187
IDTPM::DeltaRMatchingToolBase::m_dRmax
FloatProperty m_dRmax
Definition: DeltaRMatchingTool.h:64
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
IDTPM::DeltaRMatchingTool_truthTrk::match
virtual StatusCode match(const std::vector< const xAOD::TrackParticle * > &, const std::vector< const xAOD::TruthParticle * > &, ITrackMatchingLookup &) const override
track -> truth matching (disabled)
Definition: DeltaRMatchingTool.h:215
IDTPM::DeltaRMatchingToolBase::matchVectors
StatusCode matchVectors(const std::vector< const T * > &vTest, const std::vector< const R * > &vRef, ITrackMatchingLookup &matches) const
matchVectors
IDTPM::DeltaRMatchingTool_trk::match
virtual StatusCode match(TrackAnalysisCollections &trkAnaColls, const std::string &chainRoIName, const std::string &roiStr) const override
General matching method, via TrackAnalysisCollections.
Definition: DeltaRMatchingTool.cxx:20
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ITrackMatchingTool.h
IDTPM::DeltaRMatchingTool_trk::match
virtual StatusCode match(const std::vector< const xAOD::TrackParticle * > &vTest, const std::vector< const xAOD::TrackParticle * > &vRef, ITrackMatchingLookup &matches) const override
Specific matching methods, via test/reference vectors track -> track matching.
Definition: DeltaRMatchingTool.h:93
IDTPM::DeltaRMatchingTool_trkTruth::match
virtual StatusCode match(const std::vector< const xAOD::TrackParticle * > &, const std::vector< const xAOD::TrackParticle * > &, ITrackMatchingLookup &) const override
Specific matching methods, via test/reference vectors track -> track matching (disabled)
Definition: DeltaRMatchingTool.h:149
IDTPM::DeltaRMatchingToolBase::DeltaRMatchingToolBase
DeltaRMatchingToolBase(const std::string &name)
Constructor.
Definition: DeltaRMatchingTool.h:35
IDTPM::DeltaRMatchingToolBase
Definition: DeltaRMatchingTool.h:30
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
IDTPM::DeltaRMatchingTool_truthTrk::DeltaRMatchingTool_truthTrk
DeltaRMatchingTool_truthTrk(const std::string &name)
Constructor.
Definition: DeltaRMatchingTool.h:194
IDTPM::DeltaRMatchingToolBase::initialize
virtual StatusCode initialize() override
Initialize.
Definition: DeltaRMatchingTool.h:39
IDTPM::DeltaRMatchingTool_trkTruth::match
virtual StatusCode match(TrackAnalysisCollections &trkAnaColls, const std::string &chainRoIName, const std::string &roiStr) const override
General matching method, via TrackAnalysisCollections.
Definition: DeltaRMatchingTool.cxx:51
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IDTPM::DeltaRMatchingTool_trkTruth
Definition: DeltaRMatchingTool.h:131
IDTPM::ITrackMatchingLookup
Definition: ITrackMatchingLookup.h:30
IDTPM::DeltaRMatchingTool_trkTruth::DeltaRMatchingTool_trkTruth
DeltaRMatchingTool_trkTruth(const std::string &name)
Constructor.
Definition: DeltaRMatchingTool.h:138
IDTPM::DeltaRMatchingTool_trkTruth::match
virtual StatusCode match(const std::vector< const xAOD::TruthParticle * > &, const std::vector< const xAOD::TrackParticle * > &, ITrackMatchingLookup &) const override
truth -> track matching (disabled)
Definition: DeltaRMatchingTool.h:170
IDTPM
Athena include(s).
Definition: IPlotsDefinitionSvc.h:25
AsgTool.h
IDTPM::DeltaRMatchingTool_trkTruth::match
virtual StatusCode match(const std::vector< const xAOD::TrackParticle * > &vTest, const std::vector< const xAOD::TruthParticle * > &vRef, ITrackMatchingLookup &matches) const override
track -> truth matching
Definition: DeltaRMatchingTool.h:159
asg::AsgTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: AsgTool.h:133
DeltaRMatchingTool.icc