ATLAS Offline Software
Functions
AnalysisUtils::Match Namespace Reference

find the closest element in a collection to an INavigable4Momentum More...

Functions

template<class COLL >
bool R (const double eta, const double phi, COLL *coll, int &index, double &deltaR, const int pdg)
 find the closest element in R More...
 
template<class COLL >
bool R (const double eta, const double phi, const double e, COLL *coll, int &index, double &deltaR, const int pdg, double &deltaE)
 find the closest element in R - with a condition on E More...
 
template<class COLL >
bool R (const INavigable4Momentum *t, COLL *coll, int &index, double &deltaR, const int pdg)
 find the closest element in R More...
 
template<class COLL >
bool R (const INavigable4Momentum *t, COLL *coll, int &index, double &deltaR, const int pdg, double &deltaE)
 find the closest element in R - with a condition on E More...
 
template<class COLL >
bool R (const double eta, const double phi, COLL *coll, int &index, double &deltaR)
 find the closest element in R (not check PDG ID) More...
 
template<class COLL >
bool R (const double eta, const double phi, const double e, COLL *coll, int &index, double &deltaR, double &deltaE)
 find the closest element in R (not check PDG ID) - with a condition on E More...
 
template<class COLL >
bool R (const INavigable4Momentum *t, COLL *coll, int &index, double &deltaR)
 find the closest element in R (not check PDG ID) More...
 
template<class COLL >
bool R (const INavigable4Momentum *t, COLL *coll, int &index, double &deltaR, double &deltaE)
 find the closest element in R (not check PDG ID) - with a condition on E More...
 

Detailed Description

find the closest element in a collection to an INavigable4Momentum

Function Documentation

◆ R() [1/8]

template<class COLL >
bool AnalysisUtils::Match::R ( const double  eta,
const double  phi,
COLL *  coll,
int &  index,
double &  deltaR 
)
inline

find the closest element in R (not check PDG ID)

Returns
index of the element; -1 if not found

Definition at line 178 of file AnalysisMisc.h.

179  {
180  deltaR = 10000.; // big value
181  bool l_return = false;
182  int l_idx = 0;
183  typename COLL::const_iterator it = coll->begin();
184  typename COLL::const_iterator itE = coll->end();
185  for (; it != itE; ++it)
186  {
187  double rtu = Delta::R(*it,eta,phi);
188  if ( rtu < deltaR )
189  {
190  index = l_idx;
191  deltaR = rtu;
192  l_return = true;
193  }
194  ++l_idx;
195  }
196  return l_return;
197  }

◆ R() [2/8]

template<class COLL >
bool AnalysisUtils::Match::R ( const double  eta,
const double  phi,
COLL *  coll,
int &  index,
double &  deltaR,
const int  pdg 
)
inline

find the closest element in R

Parameters
index[out] index of the closest element
deltaR[out] \( \Delta{R} \)
Returns
true if found

Definition at line 93 of file AnalysisMisc.h.

94  {
95  deltaR = 10000.; // big value
96  bool l_return = false;
97  int l_idx = 0;
98  typename COLL::const_iterator it = coll->begin();
99  typename COLL::const_iterator itE = coll->end();
100  for (; it != itE; ++it)
101  {
102  if (((*it)->pdgId()==pdg) || pdg==0 )
103  {
104  double rtu = Delta::R(*it,eta,phi);
105  if ( rtu < deltaR )
106  {
107  index = l_idx;
108  deltaR = rtu;
109  l_return = true;
110  }
111  }
112  ++l_idx;
113  }
114  return l_return;
115  }

◆ R() [3/8]

template<class COLL >
bool AnalysisUtils::Match::R ( const double  eta,
const double  phi,
const double  e,
COLL *  coll,
int &  index,
double &  deltaR,
const int  pdg,
double &  deltaE 
)
inline

find the closest element in R - with a condition on E

Parameters
index[out] index of the closest element
deltaR[out] \( \Delta{R} \)
Returns
true if found

Definition at line 123 of file AnalysisMisc.h.

125  {
126  deltaR = 1.0e+20; // big value
127  deltaE = 1.0e+20;
128  bool l_return = false;
129  int l_idx = 0;
130  typename COLL::const_iterator it = coll->begin();
131  typename COLL::const_iterator itE = coll->end();
132  for (; it != itE; ++it)
133  {
134  if (((*it)->pdgId()==pdg) || pdg==0 )
135  {
136  double rtu = Delta::R(*it,eta,phi);
137  double dE = fabs( e-(*it)->e() );
138  if ( rtu < deltaR && dE < deltaE)
139  {
140  index = l_idx;
141  deltaR = rtu;
142  deltaE = dE;
143  l_return = true;
144  }
145  }
146  ++l_idx;
147  }
148  return l_return;
149  }

◆ R() [4/8]

template<class COLL >
bool AnalysisUtils::Match::R ( const double  eta,
const double  phi,
const double  e,
COLL *  coll,
int &  index,
double &  deltaR,
double &  deltaE 
)
inline

find the closest element in R (not check PDG ID) - with a condition on E

Returns
index of the element; -1 if not found

Definition at line 203 of file AnalysisMisc.h.

205  {
206  deltaR = 1.0e+20; // big value
207  deltaE = 1.0e+20;
208  bool l_return = false;
209  int l_idx = 0;
210  typename COLL::const_iterator it = coll->begin();
211  typename COLL::const_iterator itE = coll->end();
212  for (; it != itE; ++it)
213  {
214  double rtu = Delta::R(*it,eta,phi);
215  double dE = fabs( e-(*it)->e() );
216  if ( rtu < deltaR && dE < deltaE)
217  {
218  index = l_idx;
219  deltaR = rtu;
220  deltaE = dE;
221  l_return = true;
222  }
223  ++l_idx;
224  }
225  return l_return;
226  }

◆ R() [5/8]

template<class COLL >
bool AnalysisUtils::Match::R ( const INavigable4Momentum t,
COLL *  coll,
int &  index,
double &  deltaR 
)
inline

find the closest element in R (not check PDG ID)

Returns
index of the element; -1 if not found

Definition at line 232 of file AnalysisMisc.h.

233  {
234  return R (t->eta(), t->phi(), coll, index, deltaR);
235  }

◆ R() [6/8]

template<class COLL >
bool AnalysisUtils::Match::R ( const INavigable4Momentum t,
COLL *  coll,
int &  index,
double &  deltaR,
const int  pdg 
)
inline

find the closest element in R

Parameters
index[out] index of the closest element
deltaR[out] \( \Delta{R} \)
Returns
true if found

Definition at line 157 of file AnalysisMisc.h.

158  {
159  return R (t->eta(), t->phi(), coll, index, deltaR, pdg);
160  }

◆ R() [7/8]

template<class COLL >
bool AnalysisUtils::Match::R ( const INavigable4Momentum t,
COLL *  coll,
int &  index,
double &  deltaR,
const int  pdg,
double &  deltaE 
)
inline

find the closest element in R - with a condition on E

Parameters
index[out] index of the closest element
deltaR[out] \( \Delta{R} \)
Returns
true if found

Definition at line 168 of file AnalysisMisc.h.

170  {
171  return R (t->eta(), t->phi(), t->e(), coll, index, deltaR, pdg, deltaE);
172  }

◆ R() [8/8]

template<class COLL >
bool AnalysisUtils::Match::R ( const INavigable4Momentum t,
COLL *  coll,
int &  index,
double &  deltaR,
double &  deltaE 
)
inline

find the closest element in R (not check PDG ID) - with a condition on E

Returns
index of the element; -1 if not found

Definition at line 241 of file AnalysisMisc.h.

242  {
243  return R (t->eta(), t->phi(), t->e(), coll, index, deltaR, deltaE);
244  }
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
AnalysisUtils::Match::R
bool R(const INavigable4Momentum *t, COLL *coll, int &index, double &deltaR, double &deltaE)
find the closest element in R (not check PDG ID) - with a condition on E
Definition: AnalysisMisc.h:241
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
index
Definition: index.py:1
skel.it
it
Definition: skel.GENtoEVGEN.py:396
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TruthTest.itE
itE
Definition: TruthTest.py:25
AnalysisUtils::Sort::e
void e(COLL *coll)
sort by e
Definition: AnalysisMisc.h:325
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36