ATLAS Offline Software
StableMatchingBase.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_STABLEMATCHINGBASE_H
6 #define INDETTRACKPERFMON_STABLEMATCHINGBASE_H
7 
15 #include "AsgTools/AsgTool.h"
17 
19 #include "ITrackMatchingTool.h"
21 #include "TrackMatchingLookup.h"
22 
23 #include <vector>
24 #include <algorithm>
25 
26 namespace IDTPM {
27 
31  template< typename T, typename R=T >
33  public:
34 
36  StableMatchingBase( const std::string& name ) :
37  asg::AsgTool( name ) { };
38 
40  virtual StatusCode matchVectors(const std::vector< const T* >& vTest,
41  const std::vector< const R* >& vRef,
42  ITrackMatchingLookup& matches ) const;
43 
44  // Override this in derived classes
45  virtual float distance(const T& t, const R& r) const = 0;
46 
47  protected:
48 
49  // Helper methods (implemented in StableMatchingBase.icc)
50  void buildDistanceMatrix(const std::vector<const T*>& vTest,
51  const std::vector<const R*>& vRef,
52  std::vector<std::vector<float>>& dist) const;
53 
54  void buildPreferenceLists(const std::vector<std::vector<float>>& dist,
55  std::vector<std::vector<int>>& testPrefs,
56  std::vector<std::vector<int>>& refRankings) const;
57 
58  void galeShapley(const std::vector<std::vector<int>>& testPrefs,
59  const std::vector<std::vector<int>>& refRankings,
60  const std::vector<std::vector<float>>& dist,
61  std::vector<int>& testMatch,
62  std::vector<int>& refMatch) const;
63  };
64 
65 } // namespace IDTPM
66 
67 #include "StableMatchingBase.icc"
68 #endif // > !INDETTRACKPERFMON_STABLEMATCHINGBASE_H
beamspotman.r
def r
Definition: beamspotman.py:672
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
asg
Definition: DataHandleTestTool.h:28
IDTPM::StableMatchingBase::distance
virtual float distance(const T &t, const R &r) const =0
TrackAnalysisCollections.h
Class to hold for each event collections needed in the TrkAnalsis.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
IDTPM::StableMatchingBase::StableMatchingBase
StableMatchingBase(const std::string &name)
Constructor.
Definition: StableMatchingBase.h:36
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition: AsgTool.cxx:58
TrackMatchingLookup.h
Look-up table (templated) class to store (internally to IDTPM) all the matches between test and refer...
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IDTPM::StableMatchingBase::buildPreferenceLists
void buildPreferenceLists(const std::vector< std::vector< float >> &dist, std::vector< std::vector< int >> &testPrefs, std::vector< std::vector< int >> &refRankings) const
IDTPM::StableMatchingBase::galeShapley
void galeShapley(const std::vector< std::vector< int >> &testPrefs, const std::vector< std::vector< int >> &refRankings, const std::vector< std::vector< float >> &dist, std::vector< int > &testMatch, std::vector< int > &refMatch) const
ITrackMatchingTool.h
StableMatchingBase.icc
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
IDTPM::StableMatchingBase::matchVectors
virtual StatusCode matchVectors(const std::vector< const T * > &vTest, const std::vector< const R * > &vRef, ITrackMatchingLookup &matches) const
matchVectors
IDTPM::StableMatchingBase::buildDistanceMatrix
void buildDistanceMatrix(const std::vector< const T * > &vTest, const std::vector< const R * > &vRef, std::vector< std::vector< float >> &dist) const
IDTPM::ITrackMatchingLookup
Definition: ITrackMatchingLookup.h:30
IDTPM
Athena include(s).
Definition: IPlotsDefinitionSvc.h:25
AsgTool.h
IDTPM::StableMatchingBase
Definition: StableMatchingBase.h:32