|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef ANALYSISUTILS_ANALYSISMISC_H
6 #define ANALYSISUTILS_ANALYSISMISC_H
21 #include <type_traits>
24 #ifndef XAOD_STANDALONE
25 #include "CLHEP/Vector/LorentzVector.h"
31 #ifndef XAOD_STANDALONE
42 double dphi = fabs(phi1-phi2);
51 double phi2 = (v_phi>
M_PI) ? v_phi-2*
M_PI : v_phi;
52 double dphi = fabs(phi1-phi2);
54 double deta =
p1->eta() - v_eta;
55 return sqrt(dphi*dphi+deta*deta);
61 return R (
p1,
p2->eta(),
p2->phi());
72 return (
p1->hlv()+
p2->hlv()).m();
77 return (
p1->hlv()+
p2->hlv()+
p3->hlv()+p4->
hlv()).m();
93 inline bool R (
const double eta,
const double phi, COLL *coll,
int &
index,
double &
deltaR,
const int pdg)
96 bool l_return =
false;
98 typename COLL::const_iterator
it = coll->begin();
99 typename COLL::const_iterator
itE = coll->end();
102 if (((*it)->pdgId()==pdg) || pdg==0 )
122 template <
class COLL>
123 inline bool R (
const double eta,
const double phi,
const double e, COLL *coll,
124 int &
index,
double &
deltaR,
const int pdg,
double &deltaE)
128 bool l_return =
false;
130 typename COLL::const_iterator
it = coll->begin();
131 typename COLL::const_iterator
itE = coll->end();
134 if (((*it)->pdgId()==pdg) || pdg==0 )
137 double dE = fabs(
e-(*it)->e() );
138 if ( rtu <
deltaR && dE < deltaE)
156 template <
class COLL>
167 template <
class COLL>
169 const int pdg,
double &deltaE)
171 return R (
t->eta(),
t->phi(),
t->e(), coll,
index,
deltaR, pdg, deltaE);
177 template <
class COLL>
178 inline bool R (
const double eta,
const double phi, COLL *coll,
int &
index,
double &
deltaR)
181 bool l_return =
false;
183 typename COLL::const_iterator
it = coll->begin();
184 typename COLL::const_iterator
itE = coll->end();
202 template <
class COLL>
203 inline bool R (
const double eta,
const double phi,
const double e, COLL *coll,
int &
index,
204 double &
deltaR,
double &deltaE)
208 bool l_return =
false;
210 typename COLL::const_iterator
it = coll->begin();
211 typename COLL::const_iterator
itE = coll->end();
215 double dE = fabs(
e-(*it)->e() );
216 if ( rtu <
deltaR && dE < deltaE)
231 template <
class COLL>
240 template <
class COLL>
267 template <
class T>
inline bool compE (T
a, T
b)
287 template <
class COLL,
class COMP>
289 { std::sort (coll.begin(), coll.end(),
comp); }
295 template <
class COLL,
class COMP>
300 template <
class COLL,
class COMP>
315 template <
class COLL>
inline void pT (COLL *coll)
325 template <
class COLL>
inline void e (COLL *coll)
335 template <
class COLL>
inline void eta (COLL *coll)
345 template <
class COLL>
inline void phi (COLL *coll)
352 #ifndef XAOD_STANDALONE
365 template <
class COLL>
inline void charge (COLL *coll,
366 std::vector<typename COLL::value_type> &
pos,
367 std::vector<typename COLL::value_type> &neg)
373 typename COLL::const_iterator
it = coll->begin();
374 typename COLL::const_iterator
itE = coll->end();
377 if ((*it)->pdgId() > 0)
379 else if ((*it)->pdgId() < 0)
void charge(COLL *coll, std::vector< typename COLL::value_type > &pos, std::vector< typename COLL::value_type > &neg)
classify by charge
static void dosort(COLL &coll, COMP comp)
double phi(const INavigable4Momentum *p1, const INavigable4Momentum *p2)
utility class to select combination of elements in a collection
static void dosort(COLL &coll, COMP comp)
virtual CLHEP::HepLorentzVector hlv() const =0
CLHEP HepLorentzVector.
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
double two(const INavigable4Momentum *p1, const INavigable4Momentum *p2)
void eta(COLL *coll)
sort by eta
Sort
Define the simple modifier setups here – those defined in JetRec.
void e(COLL *coll)
sort by e
bool R(const double eta, const double phi, COLL *coll, int &index, double &deltaR, const int pdg)
find the closest element in R
Workaround x86 precision issues for FP inequality comparisons.
void pT(COLL *coll)
sort by pT
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
double four(const INavigable4Momentum *p1, const INavigable4Momentum *p2, const INavigable4Momentum *p3, const INavigable4Momentum *p4)
void phi(COLL *coll)
sort by phi
An STL vector of pointers that by default owns its pointed-to elements.
void dosort(COLL &coll, COMP comp)