ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
P4ImplPtEtaPhiM Class Reference

#include <P4ImplPtEtaPhiM.h>

Inheritance diagram for P4ImplPtEtaPhiM:
Collaboration diagram for P4ImplPtEtaPhiM:

Public Types

typedef FourMomentumError< P4ImplPtEtaPhiMErrorType
 

Public Member Functions

 P4ImplPtEtaPhiM ()
 Default constructor: More...
 
 P4ImplPtEtaPhiM (const P4ImplPtEtaPhiM &rhs)
 Copy constructor. More...
 
P4ImplPtEtaPhiMoperator= (const P4ImplPtEtaPhiM &rhs)
 Assignment operator. More...
 
 P4ImplPtEtaPhiM (const double pt, const double eta, const double phi, const double m)
 constructor with all data members More...
 
 P4ImplPtEtaPhiM (const CLHEP::HepLorentzVector &hlv)
 constructor from hlv to allow conversion from hlv More...
 
 P4ImplPtEtaPhiM (const I4Momentum &theI4M)
 constructor from any I4Momentum reference More...
 
 P4ImplPtEtaPhiM (const I4Momentum *const theI4M)
 constructor from any I4Momentum pointer More...
 
virtual ~P4ImplPtEtaPhiM ()
 virtual destructor needed by pool More...
 
double m () const
 {@ a la I4Momentum -like interface More...
 
double eta () const
 
double phi () const
 
double pt () const
 
virtual const I4MomentumErrorerrors () const
 
I4Momentum::Kind kind () const
 
void setPt (const double thePt)
 set pt data member More...
 
void setEta (const double theEta)
 set eta data member More...
 
void setPhi (const double thePhi)
 set phi data member More...
 
void setM (const double theM)
 set mass data member More...
 
void setErrors (const ErrorMatrixPtEtaPhiM &err)
 set the errors More...
 
void set4Mom (const I4Momentum &theI4Mom)
 set all 4-mom from another I4Momentum reference
More...
 
void set4Mom (const I4Momentum *const theI4Mom)
 set all 4-mom from another I4Momentum pointer
More...
 
void set4Mom (const CLHEP::HepLorentzVector &theHlv)
 set all 4-mom from CLHEP HepLorentzVector
More...
 
double px () const
 {@ a la I4Momentum -like interface More...
 
double py () const
 
double pz () const
 
double m2 () const
 
double p () const
 
double p2 () const
 
double e () const
 
double et () const
 
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...
 

Private Attributes

double m_pt
 
double m_eta
 
double m_phi
 
double m_m
 
std::unique_ptr< ErrorTypem_error
 

Friends

class P4ImplPtEtaPhiMCnv_p1
 

Detailed Description

P4ImplPtEtaPhiM 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 40 of file P4ImplPtEtaPhiM.h.

Member Typedef Documentation

◆ ErrorType

Definition at line 46 of file P4ImplPtEtaPhiM.h.

Constructor & Destructor Documentation

◆ P4ImplPtEtaPhiM() [1/6]

P4ImplPtEtaPhiM::P4ImplPtEtaPhiM ( )
inline

Default constructor:

Definition at line 134 of file P4ImplPtEtaPhiM.h.

134  :
135  P4BasePtEtaPhiM( ),
136  m_pt ( 0.*CLHEP::GeV ),
137  m_eta( 0. ),
138  m_phi( 0. ),
139  m_m ( 0.*CLHEP::GeV ),
140  m_error(nullptr)
141 {}

◆ P4ImplPtEtaPhiM() [2/6]

P4ImplPtEtaPhiM::P4ImplPtEtaPhiM ( const P4ImplPtEtaPhiM rhs)
inlineexplicit

Copy constructor.

Definition at line 143 of file P4ImplPtEtaPhiM.h.

143  :
144  P4BasePtEtaPhiM( ),
145  m_pt ( rhs.m_pt ),
146  m_eta( rhs.m_eta ),
147  m_phi( rhs.m_phi ),
148  m_m ( rhs.m_m ),
149  m_error(nullptr)
150 {}

◆ P4ImplPtEtaPhiM() [3/6]

P4ImplPtEtaPhiM::P4ImplPtEtaPhiM ( const double  pt,
const double  eta,
const double  phi,
const double  m 
)
inline

constructor with all data members

Definition at line 152 of file P4ImplPtEtaPhiM.h.

153  :
154  P4BasePtEtaPhiM( ),
155  m_pt ( pt ),
156  m_eta( eta ),
157  m_phi( phi ),
158  m_m ( m ),
159  m_error(nullptr)
160 {}

◆ P4ImplPtEtaPhiM() [4/6]

P4ImplPtEtaPhiM::P4ImplPtEtaPhiM ( const CLHEP::HepLorentzVector &  hlv)
inline

constructor from hlv to allow conversion from hlv

Definition at line 162 of file P4ImplPtEtaPhiM.h.

162  :
163  P4BasePtEtaPhiM( ),
164  m_pt ( hlv.perp() ),
165  m_eta( hlv.eta() ),
166  m_phi( hlv.phi() ),
167  m_m ( hlv.m() ),
168  m_error(nullptr)
169 {}

◆ P4ImplPtEtaPhiM() [5/6]

P4ImplPtEtaPhiM::P4ImplPtEtaPhiM ( const I4Momentum theI4M)
inlineexplicit

constructor from any I4Momentum reference

Definition at line 171 of file P4ImplPtEtaPhiM.h.

171  :
172  P4BasePtEtaPhiM( ),
173  m_pt ( i4mom.pt() ),
174  m_eta( i4mom.eta() ),
175  m_phi( i4mom.phi() ),
176  m_m ( i4mom.m() ),
177  m_error(nullptr)
178 {}

◆ P4ImplPtEtaPhiM() [6/6]

P4ImplPtEtaPhiM::P4ImplPtEtaPhiM ( const I4Momentum *const  theI4M)
inlineexplicit

constructor from any I4Momentum pointer

Definition at line 180 of file P4ImplPtEtaPhiM.h.

180  :
181  P4BasePtEtaPhiM( ),
182  m_pt ( i4Mom->pt() ),
183  m_eta( i4Mom->eta() ),
184  m_phi( i4Mom->phi() ),
185  m_m ( i4Mom->m() ),
186  m_error(nullptr)
187 {}

◆ ~P4ImplPtEtaPhiM()

P4ImplPtEtaPhiM::~P4ImplPtEtaPhiM ( )
inlinevirtual

virtual destructor needed by pool

Definition at line 189 of file P4ImplPtEtaPhiM.h.

190 {}

Member Function Documentation

◆ cosPhi()

double P4BasePtEtaPhiM::cosPhi ( ) const
inlineinherited

Definition at line 172 of file P4BasePtEtaPhiM.h.

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

◆ cosTh()

double P4BasePtEtaPhiM::cosTh ( ) const
inlineinherited

Definition at line 184 of file P4BasePtEtaPhiM.h.

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

◆ cotTh()

double P4BasePtEtaPhiM::cotTh ( ) const
inlineinherited

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
inlineinherited

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
inlineinherited

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 }

◆ errors()

const I4MomentumError * P4ImplPtEtaPhiM::errors ( ) const
inlinevirtual

Definition at line 212 of file P4ImplPtEtaPhiM.h.

213 {
214  // check if the pointer is empty before dereferencing
215  return m_error.get();
216 }

◆ et()

double P4BasePtEtaPhiM::et ( ) const
inlineinherited

Definition at line 155 of file P4BasePtEtaPhiM.h.

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

◆ eta()

double P4ImplPtEtaPhiM::eta ( ) const
inlinevirtual

Implements P4BasePtEtaPhiM.

Definition at line 197 of file P4ImplPtEtaPhiM.h.

198 {
199  return m_eta;
200 }

◆ hlv()

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

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
inlineinherited

Definition at line 160 of file P4BasePtEtaPhiM.h.

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

◆ kind()

I4Momentum::Kind P4ImplPtEtaPhiM::kind ( ) const
inline

Definition at line 89 of file P4ImplPtEtaPhiM.h.

89 { return I4Momentum::P4PTETAPHIM; }

◆ m()

double P4ImplPtEtaPhiM::m ( ) const
inlinevirtual

{@ a la I4Momentum -like interface

Implements P4BasePtEtaPhiM.

Definition at line 192 of file P4ImplPtEtaPhiM.h.

193 {
194  return m_m;
195 }

◆ m2()

double P4BasePtEtaPhiM::m2 ( ) const
inlineinherited

Definition at line 110 of file P4BasePtEtaPhiM.h.

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

◆ operator=()

P4ImplPtEtaPhiM & P4ImplPtEtaPhiM::operator= ( const P4ImplPtEtaPhiM rhs)

Assignment operator.

Definition at line 14 of file P4ImplPtEtaPhiM.cxx.

15 {
16  if ( this != &rhs ) {
17  m_pt = rhs.m_pt;
18  m_eta = rhs.m_eta;
19  m_phi = rhs.m_phi;
20  m_m = rhs.m_m;
21  }
22  return *this;
23 }

◆ p()

double P4BasePtEtaPhiM::p ( ) const
inlineinherited

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
inlineinherited

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()

double P4ImplPtEtaPhiM::phi ( ) const
inlinevirtual

Implements P4BasePtEtaPhiM.

Definition at line 202 of file P4ImplPtEtaPhiM.h.

203 {
204  return m_phi;
205 }

◆ pt()

double P4ImplPtEtaPhiM::pt ( ) const
inlinevirtual

Implements P4BasePtEtaPhiM.

Definition at line 207 of file P4ImplPtEtaPhiM.h.

208 {
209  return m_pt;
210 }

◆ px()

double P4BasePtEtaPhiM::px ( ) const
inlineinherited

{@ 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
inlineinherited

Definition at line 100 of file P4BasePtEtaPhiM.h.

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

◆ pz()

double P4BasePtEtaPhiM::pz ( ) const
inlineinherited

Definition at line 105 of file P4BasePtEtaPhiM.h.

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

◆ rapidity()

double P4BasePtEtaPhiM::rapidity ( ) const
inlineinherited

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  }

◆ set4Mom() [1/3]

void P4ImplPtEtaPhiM::set4Mom ( const CLHEP::HepLorentzVector &  theHlv)
inline

set all 4-mom from CLHEP HepLorentzVector

Definition at line 253 of file P4ImplPtEtaPhiM.h.

254 {
255  m_pt = hlv.perp();
256  m_eta = hlv.eta();
257  //FIXME protect against negative energy
258  //assert(m_e >= 0,"P4ImplPtEtaPhiM::set4Mom cannot have negative energy");
259  //assert(m_e >= 0);
260  // FIXME of the FIXME in fact it is not necessary to prtoect against negative energy
261  // and besides Seal assert does not work
262  // ASSERT( m_e >= 0 );
263  m_phi = hlv.phi();
264  m_m = hlv.m();
265 }

◆ set4Mom() [2/3]

void P4ImplPtEtaPhiM::set4Mom ( const I4Momentum theI4Mom)
inline

set all 4-mom from another I4Momentum reference

Definition at line 240 of file P4ImplPtEtaPhiM.h.

241 {
242  m_pt = i4mom.pt();
243  m_eta = i4mom.eta();
244  m_phi = i4mom.phi();
245  m_m = i4mom.m();
246 }

◆ set4Mom() [3/3]

void P4ImplPtEtaPhiM::set4Mom ( const I4Momentum *const  theI4Mom)
inline

set all 4-mom from another I4Momentum pointer

Definition at line 248 of file P4ImplPtEtaPhiM.h.

249 {
250  this->set4Mom(*theI4Mom);
251 }

◆ setErrors()

void P4ImplPtEtaPhiM::setErrors ( const ErrorMatrixPtEtaPhiM err)
inline

set the errors

Definition at line 267 of file P4ImplPtEtaPhiM.h.

268 {
269  m_error = std::make_unique< ErrorType>(err, *this);
270 }

◆ setEta()

void P4ImplPtEtaPhiM::setEta ( const double  theEta)
inline

set eta data member

Definition at line 225 of file P4ImplPtEtaPhiM.h.

226 {
227  m_eta = theEta;
228 }

◆ setM()

void P4ImplPtEtaPhiM::setM ( const double  theM)
inline

set mass data member

Definition at line 235 of file P4ImplPtEtaPhiM.h.

236 {
237  m_m = theM;
238 }

◆ setPhi()

void P4ImplPtEtaPhiM::setPhi ( const double  thePhi)
inline

set phi data member

Definition at line 230 of file P4ImplPtEtaPhiM.h.

231 {
232  m_phi = thePhi;
233 }

◆ setPt()

void P4ImplPtEtaPhiM::setPt ( const double  thePt)
inline

set pt data member

Definition at line 220 of file P4ImplPtEtaPhiM.h.

221 {
222  m_pt = thePt;
223 }

◆ sinPhi()

double P4BasePtEtaPhiM::sinPhi ( ) const
inlineinherited

Definition at line 177 of file P4BasePtEtaPhiM.h.

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

◆ sinTh()

double P4BasePtEtaPhiM::sinTh ( ) const
inlineinherited

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
inlineinherited

Definition at line 206 of file P4BasePtEtaPhiM.h.

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

Friends And Related Function Documentation

◆ P4ImplPtEtaPhiMCnv_p1

friend class P4ImplPtEtaPhiMCnv_p1
friend

Definition at line 42 of file P4ImplPtEtaPhiM.h.

Member Data Documentation

◆ m_error

std::unique_ptr< ErrorType> P4ImplPtEtaPhiM::m_error
private

Definition at line 126 of file P4ImplPtEtaPhiM.h.

◆ m_eta

double P4ImplPtEtaPhiM::m_eta
private

Definition at line 123 of file P4ImplPtEtaPhiM.h.

◆ m_m

double P4ImplPtEtaPhiM::m_m
private

Definition at line 125 of file P4ImplPtEtaPhiM.h.

◆ m_phi

double P4ImplPtEtaPhiM::m_phi
private

Definition at line 124 of file P4ImplPtEtaPhiM.h.

◆ m_pt

double P4ImplPtEtaPhiM::m_pt
private

Definition at line 122 of file P4ImplPtEtaPhiM.h.


The documentation for this class was generated from the following files:
P4BasePtEtaPhiM::cotTh
double cotTh() const
Definition: P4BasePtEtaPhiM.h:201
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
P4BasePtEtaPhiM::m
virtual double m() const =0
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
P4ImplPtEtaPhiM::eta
double eta() const
Definition: P4ImplPtEtaPhiM.h:197
P4ImplPtEtaPhiM::pt
double pt() const
Definition: P4ImplPtEtaPhiM.h:207
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
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
P4BasePtEtaPhiM::hlv
CLHEP::HepLorentzVector hlv() const
Definition: P4BasePtEtaPhiM.h:217
P4ImplPtEtaPhiM::m_error
std::unique_ptr< ErrorType > m_error
Definition: P4ImplPtEtaPhiM.h:126
P4BasePtEtaPhiM::tanTh
double tanTh() const
Definition: P4BasePtEtaPhiM.h:206
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
P4ImplPtEtaPhiM::m_pt
double m_pt
Definition: P4ImplPtEtaPhiM.h:122
I4Momentum::P4PTETAPHIM
@ P4PTETAPHIM
Definition: I4Momentum.h:33
P4BasePtEtaPhiM::cosPhi
double cosPhi() const
Definition: P4BasePtEtaPhiM.h:172
P4BasePtEtaPhiM::phi
virtual double phi() const =0
P4ImplPtEtaPhiM::m_phi
double m_phi
Definition: P4ImplPtEtaPhiM.h:124
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
P4ImplPtEtaPhiM::m_m
double m_m
Definition: P4ImplPtEtaPhiM.h:125
P4BasePtEtaPhiM::pt
virtual double pt() const =0
P4ImplPtEtaPhiM::m
double m() const
{@ a la I4Momentum -like interface
Definition: P4ImplPtEtaPhiM.h:192
P4ImplPtEtaPhiM::phi
double phi() const
Definition: P4ImplPtEtaPhiM.h:202
P4ImplPtEtaPhiM::m_eta
double m_eta
Definition: P4ImplPtEtaPhiM.h:123
P4BasePtEtaPhiM
Definition: P4BasePtEtaPhiM.h:33
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
P4BasePtEtaPhiM::sinTh
double sinTh() const
Definition: P4BasePtEtaPhiM.h:189
P4ImplPtEtaPhiM::set4Mom
void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
Definition: P4ImplPtEtaPhiM.h:240
P4BasePtEtaPhiM::pz
double pz() const
Definition: P4BasePtEtaPhiM.h:105
P4BasePtEtaPhiM::eta
virtual double eta() const =0