ATLAS Offline Software
Loading...
Searching...
No Matches
PFMatch::TrackClusterMatcher Class Reference

Checks if a cluster should be matched to a track or not, and has methods to return list of best matches. More...

#include <PFMatcher.h>

Collaboration diagram for PFMatch::TrackClusterMatcher:

Public Member Functions

 TrackClusterMatcher (std::unique_ptr< IDistanceProvider > distanceProvider, double matchCut)
virtual ~TrackClusterMatcher ()
MatchDistance match (ITrack *track, ICluster *cluster) const
template<class ClusterType>
MatchDistance bestMatchDRparametrized (ITrack *track, const std::vector< ClusterType * > &clusters) const
template<class ClusterType>
std::vector< MatchDistancebestMatches (ITrack *track, std::vector< ClusterType * > &clusters, int nMatches, double energyThreshold) const

Private Member Functions

void setDRParameters ()
 This sets the parameters in the above array.

Private Attributes

std::unique_ptr< IDistanceProviderm_distanceProvider
double m_matchCut
float m_drcut_par [9][3]
 This stores the parameters to vary DR cut with Pt.

Detailed Description

Checks if a cluster should be matched to a track or not, and has methods to return list of best matches.

Definition at line 29 of file PFMatcher.h.

Constructor & Destructor Documentation

◆ TrackClusterMatcher()

PFMatch::TrackClusterMatcher::TrackClusterMatcher ( std::unique_ptr< IDistanceProvider > distanceProvider,
double matchCut )
inline

Definition at line 31 of file PFMatcher.h.

31 :
32 m_distanceProvider(std::move(distanceProvider)), m_matchCut(matchCut) { setDRParameters(); }
void setDRParameters()
This sets the parameters in the above array.
Definition PFMatcher.cxx:21
std::unique_ptr< IDistanceProvider > m_distanceProvider
Definition PFMatcher.h:49

◆ ~TrackClusterMatcher()

virtual PFMatch::TrackClusterMatcher::~TrackClusterMatcher ( )
inlinevirtual

Definition at line 34 of file PFMatcher.h.

34{};

Member Function Documentation

◆ bestMatchDRparametrized()

template<class ClusterType>
MatchDistance PFMatch::TrackClusterMatcher::bestMatchDRparametrized ( ITrack * track,
const std::vector< ClusterType * > & clusters ) const

Definition at line 61 of file PFMatcher.h.

61 {
62 ClusterType* bestCluster = nullptr;
63 double bestDistance(m_matchCut);
64 unsigned int nClusters(clusters.size());
65 for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster){
66
67 ClusterType* thisCluster = clusters[iCluster];
68 double thisDistance(m_distanceProvider->distanceBetween(track, clusters[iCluster]));
69 double mybestdistance = getDRCutSquared(thisCluster);
70
71 if (thisDistance < mybestdistance){
72 if (thisDistance < bestDistance) {
73 bestDistance = thisDistance;
74 bestCluster = thisCluster;
75 }
76 }
77 }
78
79 return MatchDistance(bestCluster, bestDistance);
80 }
std::pair< ICluster *, double > MatchDistance
Definition PFMatcher.h:24

◆ bestMatches()

template<class ClusterType>
std::vector< MatchDistance > PFMatch::TrackClusterMatcher::bestMatches ( ITrack * track,
std::vector< ClusterType * > & clusters,
int nMatches,
double energyThreshold ) const

Definition at line 83 of file PFMatcher.h.

83 {
84
85 std::vector<MatchDistance> result;
86 unsigned const nClusters(clusters.size());
87
88 if (nMatches == -1) {
89 for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) {
90 ClusterType* thisCluster = clusters[iCluster];
91 double thisDistance(m_distanceProvider->distanceBetween(track, thisCluster));
92 if (thisDistance < m_matchCut) {
93 result.push_back(MatchDistance(thisCluster, thisDistance));
94 }
95 }
96 }
97
98 else{
99 int nLoops = nMatches;
100 std::vector<unsigned int> masked;
101 std::vector<int> maskedType;
102 for (int imatch = 0; imatch < nLoops; ++imatch) {
103 ClusterType* bestCluster = nullptr;
104 double bestDistance(m_matchCut);
105 int iMasked = -1;
106 for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) {
107 /* Do not consider matched ones. */
108 if (masked.size() != 0 && find(masked.begin(), masked.end(), iCluster) != masked.end()) {
109 continue;
110 }
111
112 ClusterType* thisCluster = clusters[iCluster];
113
114 /* Require that first matched cluster energy is above energyThreshold (10% of track energy). */
115 if(imatch == 0 && thisCluster->e() <= energyThreshold) {
116 continue;
117 }
118
119 /* Do not consider the same type (ECAL, HCAL or FCAL) ones. */
120 /* First we check if another ECAL, HCAL or FCAL cluster is found */
121 if ((maskedType.size() != 0 && find(maskedType.begin(), maskedType.end(),
122 thisCluster->getEfRecCluster()->getClusterType()) != maskedType.end())
123 || (thisCluster->getEfRecCluster()->getClusterType() == 4)) { /* then also veto if it is type 4, which means "unknown" type */
124 continue;
125 }
126
127 double thisDistance(m_distanceProvider->distanceBetween(track, thisCluster));
128
129 if (thisDistance < bestDistance) {
130 iMasked = iCluster;
131 bestDistance = thisDistance;
132 bestCluster = thisCluster;
133 }
134 }
135 if (iMasked == -1 || nullptr == bestCluster) break;
136
137 masked.push_back(iMasked);
138 maskedType.push_back(bestCluster->getEfRecCluster()->getClusterType());
139
140 result.push_back(MatchDistance(bestCluster, bestDistance));
141 }
142 assert(maskedType.size() == masked.size());
143 }
144
145 return result;
146
147 }
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138

◆ match()

MatchDistance PFMatch::TrackClusterMatcher::match ( ITrack * track,
ICluster * cluster ) const

Definition at line 17 of file PFMatcher.cxx.

17 {
18 double distance = m_distanceProvider->distanceBetween(track, cluster);
19 return MatchDistance(cluster, distance);
20}
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space

◆ setDRParameters()

void PFMatch::TrackClusterMatcher::setDRParameters ( )
private

This sets the parameters in the above array.

Definition at line 21 of file PFMatcher.cxx.

21 {
22 std::string theFileName = PathResolver::find_file ("rmsvsdr.dat", "DATAPATH");
23 std::ifstream DRPARAM(theFileName.c_str());
24 for (int i=0;i<8;i++) DRPARAM>>m_drcut_par[i][0]>>m_drcut_par[i][1]>>m_drcut_par[i][2];
25
26}
float m_drcut_par[9][3]
This stores the parameters to vary DR cut with Pt.
Definition PFMatcher.h:52
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)

Member Data Documentation

◆ m_distanceProvider

std::unique_ptr<IDistanceProvider> PFMatch::TrackClusterMatcher::m_distanceProvider
private

Definition at line 49 of file PFMatcher.h.

◆ m_drcut_par

float PFMatch::TrackClusterMatcher::m_drcut_par[9][3]
private

This stores the parameters to vary DR cut with Pt.

Definition at line 52 of file PFMatcher.h.

◆ m_matchCut

double PFMatch::TrackClusterMatcher::m_matchCut
private

Definition at line 50 of file PFMatcher.h.


The documentation for this class was generated from the following files: