ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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
 
template<class ClusterType >
double getDRCutSquared (ClusterType *theCluster) const
 

Private Member Functions

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

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. More...
 

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(); }

◆ ~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 64 of file PFMatcher.h.

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

◆ bestMatches()

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

Definition at line 86 of file PFMatcher.h.

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

◆ getDRCutSquared()

template<class ClusterType >
double PFMatch::TrackClusterMatcher::getDRCutSquared ( ClusterType *  theCluster) const

Definition at line 153 of file PFMatcher.h.

153  {
154 
155  double m_coneRSq = 1.64*1.64;
156  double coneRSq = m_coneRSq;
157  int ieta = -1;
158  double clusEta;
159 
160  clusEta = theCluster->eta();
161 
162  if (std::abs(clusEta)<0.6) ieta=0;
163  if (std::abs(clusEta)>=0.6 && std::abs(clusEta)<1.6) ieta = 1 + int((std::abs(clusEta) - 0.6)/0.2) ;
164  if (std::abs(clusEta)>=1.6 && std::abs(clusEta)<2.0) ieta = 6 ;
165  if (std::abs(clusEta)>=2.0 && std::abs(clusEta)<2.5) ieta = 7 ;
166  if (std::abs(clusEta)>=2.5) ieta = 8 ;
167 
168  double clusterEnergy = theCluster->e()/1000.0;
169 
170  double drcut = m_drcut_par[ieta][0]+m_drcut_par[ieta][1]*exp(m_drcut_par[ieta][2]*clusterEnergy);
171  coneRSq = drcut*drcut;
172 
173  if (coneRSq>m_coneRSq) coneRSq = m_coneRSq;
174  double conemin = m_drcut_par[ieta][0]+m_drcut_par[ieta][1]*exp(m_drcut_par[ieta][2]*10);
175 
176  if (coneRSq<conemin*conemin) coneRSq = conemin*conemin;
177  return coneRSq;
178 
179  }

◆ 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 }

◆ 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 }

Member Data Documentation

◆ m_distanceProvider

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

Definition at line 52 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 55 of file PFMatcher.h.

◆ m_matchCut

double PFMatch::TrackClusterMatcher::m_matchCut
private

Definition at line 53 of file PFMatcher.h.


The documentation for this class was generated from the following files:
PFMatch::MatchDistance
std::pair< ICluster *, double > MatchDistance
Definition: PFMatcher.h:24
get_generator_info.result
result
Definition: get_generator_info.py:21
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
PFMatch::TrackClusterMatcher::m_matchCut
double m_matchCut
Definition: PFMatcher.h:53
PFMatch::TrackClusterMatcher::m_distanceProvider
std::unique_ptr< IDistanceProvider > m_distanceProvider
Definition: PFMatcher.h:52
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
PFMatch::TrackClusterMatcher::getDRCutSquared
double getDRCutSquared(ClusterType *theCluster) const
Definition: PFMatcher.h:153
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
PFMatch::TrackClusterMatcher::setDRParameters
void setDRParameters()
This sets the parameters in the above array.
Definition: PFMatcher.cxx:21
PFMatch::TrackClusterMatcher::m_drcut_par
float m_drcut_par[9][3]
This stores the parameters to vary DR cut with Pt.
Definition: PFMatcher.h:55