ATLAS Offline Software
Functions
xAOD::P4Helpers Namespace Reference

Functions

double deltaRapidity (const xAOD::IParticle &p1, const xAOD::IParticle &p2)
 Computes efficiently \( \Delta{y} \). More...
 
double deltaRapidity (const xAOD::IParticle *const p1, const xAOD::IParticle *const p2)
 Computes efficiently \( \Delta{y} \), pointer args. More...
 
double deltaEta (const xAOD::IParticle &p1, const xAOD::IParticle &p2)
 Computes efficiently \( \Delta{\eta} \). More...
 
double deltaEta (const xAOD::IParticle *const p1, const xAOD::IParticle *const p2)
 Computes efficiently \( \Delta{\eta} \), pointer args. More...
 
double deltaPhi (double phiA, double phiB)
 delta Phi in range [-pi,pi[ More...
 
double deltaPhi (const xAOD::IParticle &p4, const double phi)
 delta Phi in range [-pi,pi[ from one xAOD::IParticle reference More...
 
double deltaPhi (const xAOD::IParticle &pA, const xAOD::IParticle &pB)
 delta Phi in range [-pi,pi[ from two xAOD::IParticle references More...
 
double deltaPhi (const xAOD::IParticle *const pA, const xAOD::IParticle *const pB)
 delta Phi in range [-pi,pi[ from two xAOD::IParticle pointers More...
 
double deltaPhi (const xAOD::IParticle &pA, const xAOD::MissingET &met)
 delta Phi in range [-pi,pi[ from an xAOD::IParticle references and an xAOD::MissingEt reference More...
 
double deltaPhi (const xAOD::IParticle *const pA, const xAOD::MissingET *const met)
 delta Phi in range [-pi,pi[ from an xAOD::IParticle pointers and an xAOD::MissingEt poiter More...
 
double deltaR2 (double rapidity1, double phi1, double rapidity2, double phi2)
 \( \Delta{R}^2 \) from bare rapidity,phi More...
 
double deltaR2 (const xAOD::IParticle &p4, double rapidity, double phi, bool useRapidity=true)
 \( \Delta{R}^2 \) from 1 xAOD::IParticle More...
 
double deltaR2 (const xAOD::IParticle &pA, const xAOD::IParticle &pB, bool useRapidity=true)
 delta R^2 from two xAOD::IParticle reference More...
 
double deltaR2 (const xAOD::IParticle *const pA, const xAOD::IParticle *const pB, bool useRapidity=true)
 delta R^2 from two xAOD::IParticle pointers More...
 
double deltaR (double rapidity1, double phi1, double rapidity2, double phi2)
 \( \Delta{R} \) from bare bare rapidity,phi More...
 
double deltaR (const xAOD::IParticle &p4, double rapidity, double phi, bool useRapidity=true)
 \( \Delta{R} \) from 1 xAOD::IParticle More...
 
double deltaR (const xAOD::IParticle &pA, const xAOD::IParticle &pB, bool useRapidity=true)
 delta R from two xAOD::IParticle reference More...
 
double deltaR (const xAOD::IParticle *const pA, const xAOD::IParticle *const pB, bool useRapidity=true)
 delta R from two xAOD::IParticle pointers More...
 
bool isInDeltaR (const xAOD::IParticle &p1, const xAOD::IParticle &p2, double dR, bool useRapidity=true)
 Check if 2 xAOD::IParticle are in a \( \Delta{R} \) cone. More...
 
double deltaAbsP (const xAOD::IParticle &pA, const xAOD::IParticle &pB)
 Get the delta-| \( \vec{p} \)| between two particles. More...
 
double deltaAbsP (const xAOD::IParticle *const pA, const xAOD::IParticle *const pB)
 Get the delta-| \( \vec{p} \)| between two particles using pointers. More...
 

Function Documentation

◆ deltaAbsP() [1/2]

double xAOD::P4Helpers::deltaAbsP ( const xAOD::IParticle pA,
const xAOD::IParticle pB 
)
inline

Get the delta-| \( \vec{p} \)| between two particles.

Definition at line 199 of file xAODP4Helpers.h.

200  {
201  const double absPA = std::abs( pA.p4().P() );
202  const double absPB = std::abs( pB.p4().P() );
203  return absPA - absPB;
204  }

◆ deltaAbsP() [2/2]

double xAOD::P4Helpers::deltaAbsP ( const xAOD::IParticle *const  pA,
const xAOD::IParticle *const  pB 
)
inline

Get the delta-| \( \vec{p} \)| between two particles using pointers.

Definition at line 208 of file xAODP4Helpers.h.

209  { return xAOD::P4Helpers::deltaAbsP( *pA, *pB ); }

◆ deltaEta() [1/2]

double xAOD::P4Helpers::deltaEta ( const xAOD::IParticle p1,
const xAOD::IParticle p2 
)
inline

Computes efficiently \( \Delta{\eta} \).

Definition at line 54 of file xAODP4Helpers.h.

55  {
56  return p1.eta() - p2.eta();
57  }

◆ deltaEta() [2/2]

double xAOD::P4Helpers::deltaEta ( const xAOD::IParticle *const  p1,
const xAOD::IParticle *const  p2 
)
inline

Computes efficiently \( \Delta{\eta} \), pointer args.

Definition at line 61 of file xAODP4Helpers.h.

62  {
63  return xAOD::P4Helpers::deltaEta(*p1, *p2);
64  }

◆ deltaPhi() [1/6]

double xAOD::P4Helpers::deltaPhi ( const xAOD::IParticle p4,
const double  phi 
)
inline

delta Phi in range [-pi,pi[ from one xAOD::IParticle reference

Definition at line 76 of file xAODP4Helpers.h.

77  {
78  return xAOD::P4Helpers::deltaPhi( p4.phi(), phi );
79  }

◆ deltaPhi() [2/6]

double xAOD::P4Helpers::deltaPhi ( const xAOD::IParticle pA,
const xAOD::IParticle pB 
)
inline

delta Phi in range [-pi,pi[ from two xAOD::IParticle references

Definition at line 83 of file xAODP4Helpers.h.

84  {
85  return xAOD::P4Helpers::deltaPhi( pA.phi(), pB.phi() );
86  }

◆ deltaPhi() [3/6]

double xAOD::P4Helpers::deltaPhi ( const xAOD::IParticle pA,
const xAOD::MissingET met 
)
inline

delta Phi in range [-pi,pi[ from an xAOD::IParticle references and an xAOD::MissingEt reference

Definition at line 97 of file xAODP4Helpers.h.

98  {
99  return xAOD::P4Helpers::deltaPhi( pA.phi(), met.phi() );
100  }

◆ deltaPhi() [4/6]

double xAOD::P4Helpers::deltaPhi ( const xAOD::IParticle *const  pA,
const xAOD::IParticle *const  pB 
)
inline

delta Phi in range [-pi,pi[ from two xAOD::IParticle pointers

Definition at line 90 of file xAODP4Helpers.h.

91  { return xAOD::P4Helpers::deltaPhi( pA->phi(), pB->phi() ); }

◆ deltaPhi() [5/6]

double xAOD::P4Helpers::deltaPhi ( const xAOD::IParticle *const  pA,
const xAOD::MissingET *const  met 
)
inline

delta Phi in range [-pi,pi[ from an xAOD::IParticle pointers and an xAOD::MissingEt poiter

Definition at line 104 of file xAODP4Helpers.h.

105  { return xAOD::P4Helpers::deltaPhi( pA->phi(), met->phi() ); }

◆ deltaPhi() [6/6]

double xAOD::P4Helpers::deltaPhi ( double  phiA,
double  phiB 
)
inline

delta Phi in range [-pi,pi[

Definition at line 69 of file xAODP4Helpers.h.

70  {
71  return -remainder( -phiA + phiB, 2*M_PI );
72  }

◆ deltaR() [1/4]

double xAOD::P4Helpers::deltaR ( const xAOD::IParticle p4,
double  rapidity,
double  phi,
bool  useRapidity = true 
)
inline

\( \Delta{R} \) from 1 xAOD::IParticle

Definition at line 155 of file xAODP4Helpers.h.

156  { return std::sqrt( xAOD::P4Helpers::deltaR2( p4, rapidity, phi, useRapidity ) ); }

◆ deltaR() [2/4]

double xAOD::P4Helpers::deltaR ( const xAOD::IParticle pA,
const xAOD::IParticle pB,
bool  useRapidity = true 
)
inline

delta R from two xAOD::IParticle reference

Definition at line 160 of file xAODP4Helpers.h.

161  { return std::sqrt( xAOD::P4Helpers::deltaR2( pA, pB, useRapidity ) ); }

◆ deltaR() [3/4]

double xAOD::P4Helpers::deltaR ( const xAOD::IParticle *const  pA,
const xAOD::IParticle *const  pB,
bool  useRapidity = true 
)
inline

delta R from two xAOD::IParticle pointers

Definition at line 165 of file xAODP4Helpers.h.

166  { return std::sqrt( xAOD::P4Helpers::deltaR2( *pA, *pB, useRapidity ) ); }

◆ deltaR() [4/4]

double xAOD::P4Helpers::deltaR ( double  rapidity1,
double  phi1,
double  rapidity2,
double  phi2 
)
inline

\( \Delta{R} \) from bare bare rapidity,phi

Definition at line 150 of file xAODP4Helpers.h.

151  { return std::sqrt( xAOD::P4Helpers::deltaR2( rapidity1, phi1, rapidity2, phi2 ) ); }

◆ deltaR2() [1/4]

double xAOD::P4Helpers::deltaR2 ( const xAOD::IParticle p4,
double  rapidity,
double  phi,
bool  useRapidity = true 
)
inline

\( \Delta{R}^2 \) from 1 xAOD::IParticle

Definition at line 120 of file xAODP4Helpers.h.

121  {
122  if (useRapidity) {
123  return xAOD::P4Helpers::deltaR2(p4.rapidity(),p4.phi(),rapidity,phi);
124  }
125  else {
126  return xAOD::P4Helpers::deltaR2(p4.eta(),p4.phi(),rapidity,phi);
127  }
128  }

◆ deltaR2() [2/4]

double xAOD::P4Helpers::deltaR2 ( const xAOD::IParticle pA,
const xAOD::IParticle pB,
bool  useRapidity = true 
)
inline

delta R^2 from two xAOD::IParticle reference

Definition at line 132 of file xAODP4Helpers.h.

133  {
134  if (useRapidity) {
135  return xAOD::P4Helpers::deltaR2(pA.rapidity(),pA.phi(),pB.rapidity(),pB.phi());
136  }
137  else {
138  return xAOD::P4Helpers::deltaR2(pA.eta(),pA.phi(),pB.eta(),pB.phi());
139  }
140  }

◆ deltaR2() [3/4]

double xAOD::P4Helpers::deltaR2 ( const xAOD::IParticle *const  pA,
const xAOD::IParticle *const  pB,
bool  useRapidity = true 
)
inline

delta R^2 from two xAOD::IParticle pointers

Definition at line 144 of file xAODP4Helpers.h.

145  { return xAOD::P4Helpers::deltaR2( *pA, *pB, useRapidity ); }

◆ deltaR2() [4/4]

double xAOD::P4Helpers::deltaR2 ( double  rapidity1,
double  phi1,
double  rapidity2,
double  phi2 
)
inline

\( \Delta{R}^2 \) from bare rapidity,phi

Definition at line 111 of file xAODP4Helpers.h.

112  {
113  const double dPhi = xAOD::P4Helpers::deltaPhi( phi1, phi2 );
114  const double dRapidity = rapidity1-rapidity2;
115  return dRapidity*dRapidity + dPhi*dPhi;
116  }

◆ deltaRapidity() [1/2]

double xAOD::P4Helpers::deltaRapidity ( const xAOD::IParticle p1,
const xAOD::IParticle p2 
)
inline

Computes efficiently \( \Delta{y} \).

Definition at line 39 of file xAODP4Helpers.h.

40  {
41  return p1.rapidity() - p2.rapidity();
42  }

◆ deltaRapidity() [2/2]

double xAOD::P4Helpers::deltaRapidity ( const xAOD::IParticle *const  p1,
const xAOD::IParticle *const  p2 
)
inline

Computes efficiently \( \Delta{y} \), pointer args.

Definition at line 46 of file xAODP4Helpers.h.

47  {
49  }

◆ isInDeltaR()

bool xAOD::P4Helpers::isInDeltaR ( const xAOD::IParticle p1,
const xAOD::IParticle p2,
double  dR,
bool  useRapidity = true 
)
inline

Check if 2 xAOD::IParticle are in a \( \Delta{R} \) cone.

Parameters
dR[in] \( \Delta{R} \)
Returns
true if they are

Definition at line 174 of file xAODP4Helpers.h.

176  {
177  const double dPhi = std::abs( xAOD::P4Helpers::deltaPhi(p1,p2) ); // in [-pi,pi)
178  if ( CxxUtils::fpcompare::greater(dPhi,dR) ) return false; // <==
179  if (useRapidity) {
180  const double dRapidity = std::abs( xAOD::P4Helpers::deltaRapidity(p1,p2) );
181  if ( CxxUtils::fpcompare::greater(dRapidity,dR) ) return false; // <==
182  const double deltaR2 = dRapidity*dRapidity + dPhi*dPhi;
183  if ( CxxUtils::fpcompare::greater(deltaR2,dR*dR) ) return false; // <==
184  return true;
185  }
186  else {
187  const double dEta = std::abs( xAOD::P4Helpers::deltaEta(p1,p2) );
188  if ( CxxUtils::fpcompare::greater(dEta,dR) ) return false; // <==
189  const double deltaR2 = dEta*dEta + dPhi*dPhi;
190  if ( CxxUtils::fpcompare::greater(deltaR2,dR*dR) ) return false; // <==
191  return true;
192  }
193  }
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
xAOD::P4Helpers::deltaAbsP
double deltaAbsP(const xAOD::IParticle &pA, const xAOD::IParticle &pB)
Get the delta-| | between two particles.
Definition: xAODP4Helpers.h:199
xAOD::IParticle::rapidity
virtual double rapidity() const =0
The true rapidity (y) of the particle.
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: xAODP4Helpers.h:69
xAOD::P4Helpers::deltaR2
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Definition: xAODP4Helpers.h:111
xAOD::P4Helpers::deltaR2
double deltaR2(const xAOD::IParticle *const pA, const xAOD::IParticle *const pB, bool useRapidity=true)
delta R^2 from two xAOD::IParticle pointers
Definition: xAODP4Helpers.h:144
CxxUtils::fpcompare::greater
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:140
xAOD::P4Helpers::deltaRapidity
double deltaRapidity(const xAOD::IParticle &p1, const xAOD::IParticle &p2)
Computes efficiently .
Definition: xAODP4Helpers.h:39
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
met
Definition: IMETSignificance.h:24
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:538
remainder
std::vector< std::string > remainder(const std::vector< std::string > &v1, const std::vector< std::string > &v2)
list of entries in a vector that are not in another
Definition: compareFlatTrees.cxx:44
xAOD::IParticle::p4
virtual FourMom_t p4() const =0
The full 4-momentum of the particle.
xAOD::IParticle::eta
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
xAOD::P4Helpers::deltaEta
double deltaEta(const xAOD::IParticle &p1, const xAOD::IParticle &p2)
Computes efficiently .
Definition: xAODP4Helpers.h:54
xAOD::IParticle::phi
virtual double phi() const =0
The azimuthal angle ( ) of the particle.
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:527