ATLAS Offline Software
Public Member Functions | List of all members
P4BasePtEtaPhiM Class Referenceabstract

#include <P4BasePtEtaPhiM.h>

Inheritance diagram for P4BasePtEtaPhiM:
Collaboration diagram for P4BasePtEtaPhiM:

Public Member Functions

virtual ~P4BasePtEtaPhiM ()
 virtual destructor needed for inheritance More...
 
double px () const
 {@ a la I4Momentum -like interface More...
 
double py () const
 
double pz () const
 
virtual double m () const =0
 
double m2 () const
 
double p () const
 
double p2 () const
 
virtual double eta () const =0
 
virtual double phi () const =0
 
double e () const
 
double et () const
 
virtual double pt () const =0
 
double iPt () const
 
double rapidity () const
 
double cosPhi () const
 
double sinPhi () const
 
double tanTh () const
 
double cosTh () const
 
double sinTh () const
 
double cotTh () const
 
CLHEP::HepLorentzVector hlv () const
 
std::ostream & dump (std::ostream &out) const
 Print I4Momentum content. More...
 

Detailed Description

P4BasePtEtaPhiM is a base class for classes with 4-momentum behavior, for which pt, eta, phi and M are natural parameters, which is typically the case for a ger object. Any class deriving from it should implement pt(), eta(), phi(), m().

Author
Olga Igonkina olya@.nosp@m.cern.nosp@m..ch

Definition at line 32 of file P4BasePtEtaPhiM.h.

Constructor & Destructor Documentation

◆ ~P4BasePtEtaPhiM()

P4BasePtEtaPhiM::~P4BasePtEtaPhiM ( )
inlinevirtual

virtual destructor needed for inheritance

Definition at line 92 of file P4BasePtEtaPhiM.h.

93 {}

Member Function Documentation

◆ cosPhi()

double P4BasePtEtaPhiM::cosPhi ( ) const
inline

Definition at line 172 of file P4BasePtEtaPhiM.h.

173 {
174  return std::cos(this->phi());
175 }

◆ cosTh()

double P4BasePtEtaPhiM::cosTh ( ) const
inline

Definition at line 184 of file P4BasePtEtaPhiM.h.

185 {
186  return std::tanh(this->eta());
187 }

◆ cotTh()

double P4BasePtEtaPhiM::cotTh ( ) const
inline

Definition at line 201 of file P4BasePtEtaPhiM.h.

202 {
203  return std::sinh(this->eta());
204 }

◆ dump()

std::ostream & P4BasePtEtaPhiM::dump ( std::ostream &  out) const
inline

Print I4Momentum content.

Definition at line 236 of file P4BasePtEtaPhiM.h.

237 {
238  std::stringstream s;
239  s << "[pt,eta,phi,m] ="
240  << std::right << std::scientific << std::setprecision(8)
241  << std::setw(16) << this->pt()
242  << std::setw(16) << this->eta()
243  << std::setw(16) << this->phi()
244  << std::setw(16) << this->m();
245 
246  out << s.str();
247  return out;
248 }

◆ e()

double P4BasePtEtaPhiM::e ( ) const
inline

Definition at line 141 of file P4BasePtEtaPhiM.h.

142 {
143  const double theMass = this->m();
144  const double thePt = this->pt();
145  const double thePz = this->pz();
146 
147  //DR from Frank Paige
148  // if negative pt point in the opposite direction
149  // BUT eta and phi still the same !!!
150 
151  const double eSign = (thePt >= 0.) ? +1. : -1.;
152  return eSign * std::sqrt( thePt*thePt + thePz*thePz + theMass*theMass);
153 }

◆ et()

double P4BasePtEtaPhiM::et ( ) const
inline

Definition at line 155 of file P4BasePtEtaPhiM.h.

156 {
157  return this->e()*this->sinTh();
158 }

◆ eta()

virtual double P4BasePtEtaPhiM::eta ( ) const
pure virtual

Implemented in P4ImplPtEtaPhiM.

◆ hlv()

CLHEP::HepLorentzVector P4BasePtEtaPhiM::hlv ( ) const
inline

Definition at line 217 of file P4BasePtEtaPhiM.h.

218 {
219  //minimize the number of calculation and dereference
220  const double theM = this->m();
221  // note that pt can have negative sign : then it points in opposite direction but eta and phi are still on the same side
222  const double thePt = this->pt();
223 
224 
225  const double thePx = thePt*this->cosPhi();
226  const double thePy = thePt*this->sinPhi();
227 
228  const double thePz = thePt*this->cotTh();
229 
230  const double theE=std::sqrt(thePt*thePt+thePz*thePz+theM*theM);
231 
232 
233  return CLHEP::HepLorentzVector( thePx, thePy, thePz, theE );
234 }

◆ iPt()

double P4BasePtEtaPhiM::iPt ( ) const
inline

Definition at line 160 of file P4BasePtEtaPhiM.h.

161 {
162  return 1./this->pt();
163 }

◆ m()

virtual double P4BasePtEtaPhiM::m ( ) const
pure virtual

Implemented in P4ImplPtEtaPhiM.

◆ m2()

double P4BasePtEtaPhiM::m2 ( ) const
inline

Definition at line 110 of file P4BasePtEtaPhiM.h.

111 {
112  const double mass = this->m();
113  return mass*mass;
114 }

◆ p()

double P4BasePtEtaPhiM::p ( ) const
inline

Definition at line 116 of file P4BasePtEtaPhiM.h.

117 {
118  const double thePt = this->pt();
119  const double thePz = this->pz();
120 
121  //DR from Frank Paige
122  // if negative pt point in the opposite direction
123  // BUT eta and phi still the same !!!
124 
125  const double eSign = (thePt >= 0.) ? +1. : -1.;
126  return eSign * std::sqrt( thePt*thePt + thePz*thePz );
127 }

◆ p2()

double P4BasePtEtaPhiM::p2 ( ) const
inline

Definition at line 129 of file P4BasePtEtaPhiM.h.

130 {
131  // This method has been implemented so as to give the same as would be
132  // obtained from pow((this->p()),2) with this->p() implemented according to
133  // Frank Paige's algorithm above.
134 
135  const double pt = this->pt();
136  const double pz = this->pz();
137 
138  return pt*pt + pz*pz;
139 }

◆ phi()

virtual double P4BasePtEtaPhiM::phi ( ) const
pure virtual

Implemented in P4ImplPtEtaPhiM.

◆ pt()

virtual double P4BasePtEtaPhiM::pt ( ) const
pure virtual

Implemented in P4ImplPtEtaPhiM.

◆ px()

double P4BasePtEtaPhiM::px ( ) const
inline

{@ a la I4Momentum -like interface

Definition at line 95 of file P4BasePtEtaPhiM.h.

96 {
97  return this->pt() * std::cos(this->phi());
98 }

◆ py()

double P4BasePtEtaPhiM::py ( ) const
inline

Definition at line 100 of file P4BasePtEtaPhiM.h.

101 {
102  return this->pt() * std::sin(this->phi());
103 }

◆ pz()

double P4BasePtEtaPhiM::pz ( ) const
inline

Definition at line 105 of file P4BasePtEtaPhiM.h.

106 {
107  return this->pt()/this->tanTh();
108 }

◆ rapidity()

double P4BasePtEtaPhiM::rapidity ( ) const
inline

Definition at line 165 of file P4BasePtEtaPhiM.h.

166  {
167  const double theE=this->e();
168  const double thePz=this->pz();
169  return 0.5*std::log((theE+thePz)/(theE-thePz));
170  }

◆ sinPhi()

double P4BasePtEtaPhiM::sinPhi ( ) const
inline

Definition at line 177 of file P4BasePtEtaPhiM.h.

178 {
179  return std::sin(this->phi());
180 }

◆ sinTh()

double P4BasePtEtaPhiM::sinTh ( ) const
inline

Definition at line 189 of file P4BasePtEtaPhiM.h.

190 {
191  // avoid numeric overflow if very large eta
192 
193  double aEta=std::abs(this->eta());
194  if ( aEta>710) {
195  aEta=710;
196  }
197 
198  return 1./std::cosh(aEta);
199 }

◆ tanTh()

double P4BasePtEtaPhiM::tanTh ( ) const
inline

Definition at line 206 of file P4BasePtEtaPhiM.h.

207 {
208  return 1./std::sinh(this->eta());
209 }

The documentation for this class was generated from the following file:
P4BasePtEtaPhiM::cotTh
double cotTh() const
Definition: P4BasePtEtaPhiM.h:201
P4BasePtEtaPhiM::m
virtual double m() const =0
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4BasePtEtaPhiM::e
double e() const
Definition: P4BasePtEtaPhiM.h:141
P4BasePtEtaPhiM::sinPhi
double sinPhi() const
Definition: P4BasePtEtaPhiM.h:177
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
dqt_zlumi_pandas.mass
mass
Definition: dqt_zlumi_pandas.py:170
P4BasePtEtaPhiM::tanTh
double tanTh() const
Definition: P4BasePtEtaPhiM.h:206
P4BasePtEtaPhiM::cosPhi
double cosPhi() const
Definition: P4BasePtEtaPhiM.h:172
P4BasePtEtaPhiM::phi
virtual double phi() const =0
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
P4BasePtEtaPhiM::pt
virtual double pt() const =0
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
P4BasePtEtaPhiM::sinTh
double sinTh() const
Definition: P4BasePtEtaPhiM.h:189
P4BasePtEtaPhiM::pz
double pz() const
Definition: P4BasePtEtaPhiM.h:105
P4BasePtEtaPhiM::eta
virtual double eta() const =0