![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
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"
32 #ifndef XAOD_STANDALONE
43 double dphi = fabs(phi1-phi2);
52 double phi2 = (v_phi>
M_PI) ? v_phi-2*
M_PI : v_phi;
53 double dphi = fabs(phi1-phi2);
55 double deta = p1->
eta() - v_eta;
56 return sqrt(dphi*dphi+deta*deta);
62 return R (p1, p2->
eta(), p2->
phi());
73 return (p1->
hlv()+p2->
hlv()).m();
78 return (p1->
hlv()+p2->
hlv()+
p3->hlv()+p4->
hlv()).m();
94 inline bool R (
const double eta,
const double phi, COLL *coll,
int &
index,
double &
deltaR,
const int pdg)
97 bool l_return =
false;
99 typename COLL::const_iterator
it = coll->begin();
100 typename COLL::const_iterator
itE = coll->end();
103 if (((*it)->pdgId()==pdg) || pdg==0 )
119 double &
deltaR,
const int pdg,
const bool genOnly=
true)
122 bool l_return =
false;
132 if (((*it)->pdgId()==pdg) || pdg==0 )
155 template <
class COLL>
156 inline bool R (
const double eta,
const double phi,
const double e, COLL *coll,
157 int &
index,
double &
deltaR,
const int pdg,
double &deltaE)
161 bool l_return =
false;
163 typename COLL::const_iterator
it = coll->begin();
164 typename COLL::const_iterator
itE = coll->end();
167 if (((*it)->pdgId()==pdg) || pdg==0 )
170 double dE = fabs(
e-(*it)->e() );
171 if ( rtu <
deltaR && dE < deltaE)
185 int &
index,
double &
deltaR,
const int pdg,
double &deltaE,
const bool genOnly=
true)
189 bool l_return =
false;
199 if (((*it)->pdgId()==pdg) || pdg==0 )
202 double dE = fabs(
e-(*it)->e() );
203 if ( rtu <
deltaR && dE < deltaE)
224 template <
class COLL>
231 const int pdg,
const bool genOnly=
true)
241 template <
class COLL>
243 const int pdg,
double &deltaE)
245 return R (
t->eta(),
t->phi(),
t->e(), coll,
index,
deltaR, pdg, deltaE);
249 double &
deltaR,
const int pdg,
double &deltaE,
const bool genOnly=
true)
251 return R (
t->eta(),
t->phi(),
t->e(), coll,
index,
deltaR, pdg, deltaE, genOnly);
257 template <
class COLL>
261 bool l_return =
false;
263 typename COLL::const_iterator
it = coll->begin();
264 typename COLL::const_iterator
itE = coll->end();
280 int &
index,
double &
deltaR,
const bool genOnly=
true)
283 bool l_return =
false;
311 template <
class COLL>
312 inline bool R (
const double eta,
const double phi,
const double e, COLL *coll,
int &
index,
313 double &
deltaR,
double &deltaE)
317 bool l_return =
false;
319 typename COLL::const_iterator
it = coll->begin();
320 typename COLL::const_iterator
itE = coll->end();
324 double dE = fabs(
e-(*it)->e() );
325 if ( rtu <
deltaR && dE < deltaE)
338 double &
deltaR,
double &deltaE,
const bool genOnly=
true)
342 bool l_return =
false;
353 double dE = fabs(
e-(*it)->e() );
354 if ( rtu <
deltaR && dE < deltaE)
372 template <
class COLL>
379 const bool genOnly=
true)
387 template <
class COLL>
394 double &
deltaR,
double &deltaE,
const bool genOnly=
true)
396 return R (
t->eta(),
t->phi(),
t->e(), coll,
index,
deltaR, deltaE, genOnly);
420 template <
class T>
inline bool compE (T
a, T
b)
440 template <
class COLL,
class COMP>
442 { std::sort (coll.begin(), coll.end(),
comp); }
448 template <
class COLL,
class COMP>
453 template <
class COLL,
class COMP>
468 template <
class COLL>
inline void pT (COLL *coll)
478 template <
class COLL>
inline void e (COLL *coll)
488 template <
class COLL>
inline void eta (COLL *coll)
498 template <
class COLL>
inline void phi (COLL *coll)
505 #ifndef XAOD_STANDALONE
518 template <
class COLL>
inline void charge (COLL *coll,
519 std::vector<typename COLL::value_type> &
pos,
520 std::vector<typename COLL::value_type> &neg)
526 typename COLL::const_iterator
it = coll->begin();
527 typename COLL::const_iterator
itE = coll->end();
530 if ((*it)->pdgId() > 0)
532 else if ((*it)->pdgId() < 0)
Const iterator class for DataVector/DataList.
void charge(COLL *coll, std::vector< typename COLL::value_type > &pos, std::vector< typename COLL::value_type > &neg)
classify by charge
Scalar phi() const
phi method
Scalar eta() const
pseudorapidity method
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.
Amg::Vector3D p3(const xAOD::TruthVertex *p)
double two(const INavigable4Momentum *p1, const INavigable4Momentum *p2)
void eta(COLL *coll)
sort by eta
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
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
virtual double eta() const =0
pseudo rapidity
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
virtual double phi() const =0
phi in [-pi,pi[
double four(const INavigable4Momentum *p1, const INavigable4Momentum *p2, const INavigable4Momentum *p3, const INavigable4Momentum *p4)
void phi(COLL *coll)
sort by phi
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
An STL vector of pointers that by default owns its pointed-to elements.
void dosort(COLL &coll, COMP comp)
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.