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

#include <P4ImplEEtaPhiM.h>

Inheritance diagram for P4ImplEEtaPhiM:
Collaboration diagram for P4ImplEEtaPhiM:

Public Types

typedef FourMomentumError< P4ImplEEtaPhiMErrorType
 

Public Member Functions

 P4ImplEEtaPhiM ()
 Default constructor: More...
 
 P4ImplEEtaPhiM (const P4ImplEEtaPhiM &rhs)
 Copy constructor. More...
 
P4ImplEEtaPhiMoperator= (const P4ImplEEtaPhiM &rhs)
 Assignment operator. More...
 
 P4ImplEEtaPhiM (const double e, const double eta, const double phi, const double m)
 constructor with all data members More...
 
 P4ImplEEtaPhiM (const CLHEP::HepLorentzVector &hlv)
 constructor from hlv to allow conversion from hlv More...
 
 P4ImplEEtaPhiM (const I4Momentum &theI4M)
 constructor from any I4Momentum reference More...
 
 P4ImplEEtaPhiM (const I4Momentum *const theI4M)
 constructor from any I4Momentum pointer More...
 
virtual ~P4ImplEEtaPhiM ()
 virtual destructor needed by pool More...
 
double m () const
 {@ a la I4Momentum -like interface More...
 
double eta () const
 
double phi () const
 
double e () const
 
virtual const I4MomentumErrorerrors () const
 
I4Momentum::Kind kind () const
 
void setE (const double theE)
 set energy 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 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...
 
void setErrors (const ErrorMatrixEEtaPhiM &err)
 set the errors More...
 
double px () const
 {@ a la I4Momentum -like interface More...
 
double py () const
 
double pz () const
 
double m2 () const
 
double rapidity () const
 
double p () const
 
double p2 () const
 
double et () const
 
double pt () const
 
double iPt () const
 
double sinPhi () const
 
double cosPhi () 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_e
 
double m_eta
 
double m_phi
 
double m_m
 
std::unique_ptr< ErrorTypem_error
 

Friends

class P4ImplEEtaPhiMCnv_p1
 

Detailed Description

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

Author
David Rousseau rouss.nosp@m.eau@.nosp@m.lal.i.nosp@m.n2p3.nosp@m..fr
Sebastien Binet binet.nosp@m.@cer.nosp@m.n.ch

Definition at line 39 of file P4ImplEEtaPhiM.h.

Member Typedef Documentation

◆ ErrorType

Definition at line 45 of file P4ImplEEtaPhiM.h.

Constructor & Destructor Documentation

◆ P4ImplEEtaPhiM() [1/6]

P4ImplEEtaPhiM::P4ImplEEtaPhiM ( )
inline

Default constructor:

Definition at line 132 of file P4ImplEEtaPhiM.h.

132  :
133  P4BaseEEtaPhiM( ),
134  m_e ( 0.*CLHEP::GeV ),
135  m_eta( 0. ),
136  m_phi( 0. ),
137  m_m ( 0.*CLHEP::GeV ),
138  m_error(nullptr)
139 {}

◆ P4ImplEEtaPhiM() [2/6]

P4ImplEEtaPhiM::P4ImplEEtaPhiM ( const P4ImplEEtaPhiM rhs)
inlineexplicit

Copy constructor.

Definition at line 141 of file P4ImplEEtaPhiM.h.

141  :
142  P4BaseEEtaPhiM( ),
143  m_e ( rhs.m_e ),
144  m_eta( rhs.m_eta ),
145  m_phi( rhs.m_phi ),
146  m_m ( rhs.m_m ),
147  m_error(nullptr)
148 {}

◆ P4ImplEEtaPhiM() [3/6]

P4ImplEEtaPhiM::P4ImplEEtaPhiM ( const double  e,
const double  eta,
const double  phi,
const double  m 
)
inline

constructor with all data members

Definition at line 150 of file P4ImplEEtaPhiM.h.

151  :
152  P4BaseEEtaPhiM( ),
153  m_e ( e ),
154  m_eta( eta ),
155  m_phi( phi ),
156  m_m ( m ),
157  m_error(nullptr)
158 {
159  // could enforce phi range convention there
160  // const double twopi =2.*M_PI;
161  // const double threepi=3.*M_PI;
162  // m_phi=std::fmod(phi+threepi,twopi)-M_PI;
163 }

◆ P4ImplEEtaPhiM() [4/6]

P4ImplEEtaPhiM::P4ImplEEtaPhiM ( const CLHEP::HepLorentzVector &  hlv)
inlineexplicit

constructor from hlv to allow conversion from hlv

Definition at line 165 of file P4ImplEEtaPhiM.h.

165  :
166  P4BaseEEtaPhiM( ),
167  m_e ( hlv.e() ),
168  m_eta( hlv.eta() ),
169  m_phi( hlv.phi() ),
170  m_m ( hlv.m() ),
171  m_error(nullptr)
172 {}

◆ P4ImplEEtaPhiM() [5/6]

P4ImplEEtaPhiM::P4ImplEEtaPhiM ( const I4Momentum theI4M)
inlineexplicit

constructor from any I4Momentum reference

Definition at line 174 of file P4ImplEEtaPhiM.h.

174  :
175  P4BaseEEtaPhiM( ),
176  m_e ( i4mom.e() ),
177  m_eta( i4mom.eta() ),
178  m_phi( i4mom.phi() ),
179  m_m ( i4mom.m() ),
180  m_error(nullptr)
181 {}

◆ P4ImplEEtaPhiM() [6/6]

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

constructor from any I4Momentum pointer

Definition at line 183 of file P4ImplEEtaPhiM.h.

183  :
184  P4BaseEEtaPhiM( ),
185  m_e ( i4Mom->e() ),
186  m_eta( i4Mom->eta() ),
187  m_phi( i4Mom->phi() ),
188  m_m ( i4Mom->m() ),
189  m_error(nullptr)
190 {}

◆ ~P4ImplEEtaPhiM()

P4ImplEEtaPhiM::~P4ImplEEtaPhiM ( )
inlinevirtual

virtual destructor needed by pool

Definition at line 192 of file P4ImplEEtaPhiM.h.

193 {
194 }

Member Function Documentation

◆ cosPhi()

double P4BaseEEtaPhiM::cosPhi ( ) const
inlineinherited

Definition at line 166 of file P4BaseEEtaPhiM.h.

167 {
168  return std::cos(this->phi());
169 }

◆ cosTh()

double P4BaseEEtaPhiM::cosTh ( ) const
inlineinherited

Definition at line 187 of file P4BaseEEtaPhiM.h.

188 {
189  return std::tanh(this->eta());
190 }

◆ cotTh()

double P4BaseEEtaPhiM::cotTh ( ) const
inlineinherited

Definition at line 204 of file P4BaseEEtaPhiM.h.

205 {
206  return std::sinh(this->eta());
207 }

◆ dump()

std::ostream & P4BaseEEtaPhiM::dump ( std::ostream &  out) const
inlineinherited

Print I4Momentum content.

Definition at line 231 of file P4BaseEEtaPhiM.h.

232 {
233  std::stringstream s;
234  s << "[e,eta,phi,m] ="
235  << std::right << std::scientific << std::setprecision(8)
236  << std::setw(16) << this->e()
237  << std::setw(16) << this->eta()
238  << std::setw(16) << this->phi()
239  << std::setw(16) << this->m();
240 
241  out << s.str();
242  return out;
243 
244 }

◆ e()

double P4ImplEEtaPhiM::e ( ) const
inlinevirtual

Implements P4BaseEEtaPhiM.

Definition at line 211 of file P4ImplEEtaPhiM.h.

212 {
213  return m_e;
214 }

◆ errors()

const I4MomentumError * P4ImplEEtaPhiM::errors ( ) const
inlinevirtual

Definition at line 216 of file P4ImplEEtaPhiM.h.

217 {
218  return m_error.get();
219 }

◆ et()

double P4BaseEEtaPhiM::et ( ) const
inlineinherited

Definition at line 144 of file P4BaseEEtaPhiM.h.

145 {
146  return this->e()*this->sinTh();
147 }

◆ eta()

double P4ImplEEtaPhiM::eta ( ) const
inlinevirtual

Implements P4BaseEEtaPhiM.

Definition at line 201 of file P4ImplEEtaPhiM.h.

202 {
203  return m_eta;
204 }

◆ hlv()

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

Definition at line 209 of file P4BaseEEtaPhiM.h.

210 {
211  //minimize the number of calculation and dereference
212  const double theE = this->e();
213  const double theCosTh = this->cosTh();
214 
215  // DR from Frank Paige
216  // negative energy point in opposite direction
217  // BUT Eta and Phi still the same
218  // double theP=theE;
219 
220  const double theP = this->p();
221 
222  const double theSinTh = std::sqrt(1.-theCosTh*theCosTh);
223  const double thePt = theP*theSinTh;
224  const double thePx = thePt*this->cosPhi();
225  const double thePy = thePt*this->sinPhi();
226  const double thePz = theP*theCosTh;
227 
228  return CLHEP::HepLorentzVector(thePx,thePy,thePz,theE);
229 }

◆ iPt()

double P4BaseEEtaPhiM::iPt ( ) const
inlineinherited

Definition at line 161 of file P4BaseEEtaPhiM.h.

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

◆ kind()

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

Definition at line 88 of file P4ImplEEtaPhiM.h.

88 { return I4Momentum::P4EETAPHIM; };

◆ m()

double P4ImplEEtaPhiM::m ( ) const
inlinevirtual

{@ a la I4Momentum -like interface

Implements P4BaseEEtaPhiM.

Definition at line 196 of file P4ImplEEtaPhiM.h.

197 {
198  return m_m;
199 }

◆ m2()

double P4BaseEEtaPhiM::m2 ( ) const
inlineinherited

Definition at line 105 of file P4BaseEEtaPhiM.h.

106 {
107  const double mass = this->m();
108  return mass*mass;
109 }

◆ operator=()

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

Assignment operator.

Definition at line 14 of file P4ImplEEtaPhiM.cxx.

15 {
16  if ( this != &rhs ) {
17  m_e = rhs.m_e;
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 P4BaseEEtaPhiM::p ( ) const
inlineinherited

Definition at line 111 of file P4BaseEEtaPhiM.h.

112 {
113  const double theM=this->m();
114  const double theE=this->e();
115  // if (theM==0.) return theE ;
116  // else return sqrt(theE*theE-theM*theM);
117  //DR from Frank Paige
118  // if negative energy point in the opposite direction
119  // BUT eta and phi still the same !!!
120  if (theM==0.) {
121  return theE;
122  } else {
123  double eSign = (theE >= 0.) ? +1. : -1.;
124  return eSign*std::sqrt(theE*theE-theM*theM);
125  }
126 
127 }

◆ p2()

double P4BaseEEtaPhiM::p2 ( ) const
inlineinherited

This p2() implementaion is derived from the (somewhat unusual) Frank Paige implementation used to calculate p() above. What we do is look at what would happen if we were to square the answer returned by Frank's algorithm:

(1) The "eSign" would square to +1 and disappear, (2) The sqrt would disappear leaving theE*theE-theM*theM (3) In the event that theM==0, this theE*theE would indeed still equal theE*theE-theM*theM, so we simply return this quantity.

Definition at line 129 of file P4BaseEEtaPhiM.h.

130 {
138  const double mass = this->m();
139  const double ene = this->e();
140 
141  return ene*ene - mass*mass;
142 }

◆ phi()

double P4ImplEEtaPhiM::phi ( ) const
inlinevirtual

Implements P4BaseEEtaPhiM.

Definition at line 206 of file P4ImplEEtaPhiM.h.

207 {
208  return m_phi;
209 }

◆ pt()

double P4BaseEEtaPhiM::pt ( ) const
inlineinherited

Definition at line 156 of file P4BaseEEtaPhiM.h.

157 {
158  return this->p()*this->sinTh();
159 }

◆ px()

double P4BaseEEtaPhiM::px ( ) const
inlineinherited

{@ a la I4Momentum -like interface

Definition at line 90 of file P4BaseEEtaPhiM.h.

91 {
92  return this->pt()*cos(this->phi());
93 }

◆ py()

double P4BaseEEtaPhiM::py ( ) const
inlineinherited

Definition at line 95 of file P4BaseEEtaPhiM.h.

96 {
97  return this->pt()*sin(this->phi());
98 }

◆ pz()

double P4BaseEEtaPhiM::pz ( ) const
inlineinherited

Definition at line 100 of file P4BaseEEtaPhiM.h.

101 {
102  return this->p()*this->cosTh();
103 }

◆ rapidity()

double P4BaseEEtaPhiM::rapidity ( ) const
inlineinherited

Definition at line 149 of file P4BaseEEtaPhiM.h.

150  {
151  const double theE=this->e();
152  const double thePz=this->pz();
153  return 0.5*std::log((theE+thePz)/(theE-thePz));
154  }

◆ set4Mom() [1/3]

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

set all 4-mom from CLHEP HepLorentzVector

Definition at line 254 of file P4ImplEEtaPhiM.h.

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

◆ set4Mom() [2/3]

void P4ImplEEtaPhiM::set4Mom ( const I4Momentum theI4Mom)
inline

set all 4-mom from another I4Momentum reference

Definition at line 241 of file P4ImplEEtaPhiM.h.

242 {
243  m_e = theI4Mom.e();
244  m_eta = theI4Mom.eta();
245  m_phi = theI4Mom.phi();
246  m_m = theI4Mom.m();
247 }

◆ set4Mom() [3/3]

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

set all 4-mom from another I4Momentum pointer

Definition at line 249 of file P4ImplEEtaPhiM.h.

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

◆ setE()

void P4ImplEEtaPhiM::setE ( const double  theE)
inline

set energy data member

Definition at line 221 of file P4ImplEEtaPhiM.h.

222 {
223  m_e = theE;
224 }

◆ setErrors()

void P4ImplEEtaPhiM::setErrors ( const ErrorMatrixEEtaPhiM err)
inline

set the errors

Definition at line 269 of file P4ImplEEtaPhiM.h.

270 {
271  // if (m_error != 0) delete m_error;
272  // if (err != 0) m_error = new FourMomentumError(*err);
273  // else m_error = 0;
274 
275  m_error = std::make_unique< ErrorType>(err, *this);
276 }

◆ setEta()

void P4ImplEEtaPhiM::setEta ( const double  theEta)
inline

set eta data member

Definition at line 226 of file P4ImplEEtaPhiM.h.

227 {
228  m_eta = theEta;
229 }

◆ setM()

void P4ImplEEtaPhiM::setM ( const double  theM)
inline

set mass data member

Definition at line 236 of file P4ImplEEtaPhiM.h.

237 {
238  m_m = theM;
239 }

◆ setPhi()

void P4ImplEEtaPhiM::setPhi ( const double  thePhi)
inline

set phi data member

Definition at line 231 of file P4ImplEEtaPhiM.h.

232 {
233  m_phi = thePhi;
234 }

◆ sinPhi()

double P4BaseEEtaPhiM::sinPhi ( ) const
inlineinherited

Definition at line 171 of file P4BaseEEtaPhiM.h.

172 {
173  return std::sin(this->phi());
174 }

◆ sinTh()

double P4BaseEEtaPhiM::sinTh ( ) const
inlineinherited

Definition at line 192 of file P4BaseEEtaPhiM.h.

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

◆ tanTh()

double P4BaseEEtaPhiM::tanTh ( ) const
inlineinherited

Definition at line 177 of file P4BaseEEtaPhiM.h.

178 {
179  double theEta=this->eta();
180  if ( std::abs(theEta)>710) {
181  theEta=theEta>0 ? 710 : -710;
182  return 1./std::sinh(theEta);
183  }
184  return 1./this->cotTh();
185 }

Friends And Related Function Documentation

◆ P4ImplEEtaPhiMCnv_p1

friend class P4ImplEEtaPhiMCnv_p1
friend

Definition at line 41 of file P4ImplEEtaPhiM.h.

Member Data Documentation

◆ m_e

double P4ImplEEtaPhiM::m_e
private

Definition at line 120 of file P4ImplEEtaPhiM.h.

◆ m_error

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

Definition at line 124 of file P4ImplEEtaPhiM.h.

◆ m_eta

double P4ImplEEtaPhiM::m_eta
private

Definition at line 121 of file P4ImplEEtaPhiM.h.

◆ m_m

double P4ImplEEtaPhiM::m_m
private

Definition at line 123 of file P4ImplEEtaPhiM.h.

◆ m_phi

double P4ImplEEtaPhiM::m_phi
private

Definition at line 122 of file P4ImplEEtaPhiM.h.


The documentation for this class was generated from the following files:
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
P4ImplEEtaPhiM::m_error
std::unique_ptr< ErrorType > m_error
Definition: P4ImplEEtaPhiM.h:124
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
P4BaseEEtaPhiM::cotTh
double cotTh() const
Definition: P4BaseEEtaPhiM.h:204
P4BaseEEtaPhiM::p
double p() const
Definition: P4BaseEEtaPhiM.h:111
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4BaseEEtaPhiM::sinTh
double sinTh() const
Definition: P4BaseEEtaPhiM.h:192
P4BaseEEtaPhiM::sinPhi
double sinPhi() const
Definition: P4BaseEEtaPhiM.h:171
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
P4BaseEEtaPhiM::m
virtual double m() const =0
P4ImplEEtaPhiM::eta
double eta() const
Definition: P4ImplEEtaPhiM.h:201
P4BaseEEtaPhiM::hlv
CLHEP::HepLorentzVector hlv() const
Definition: P4BaseEEtaPhiM.h:209
P4ImplEEtaPhiM::set4Mom
void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
Definition: P4ImplEEtaPhiM.h:241
P4BaseEEtaPhiM::cosPhi
double cosPhi() const
Definition: P4BaseEEtaPhiM.h:166
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
P4ImplEEtaPhiM::phi
double phi() const
Definition: P4ImplEEtaPhiM.h:206
I4Momentum::e
virtual double e() const =0
energy
P4ImplEEtaPhiM::m_e
double m_e
Definition: P4ImplEEtaPhiM.h:120
P4BaseEEtaPhiM::eta
virtual double eta() const =0
I4Momentum::eta
virtual double eta() const =0
pseudo rapidity
I4Momentum::phi
virtual double phi() const =0
phi in [-pi,pi[
P4BaseEEtaPhiM
Definition: P4BaseEEtaPhiM.h:33
P4ImplEEtaPhiM::m_eta
double m_eta
Definition: P4ImplEEtaPhiM.h:121
P4ImplEEtaPhiM::m
double m() const
{@ a la I4Momentum -like interface
Definition: P4ImplEEtaPhiM.h:196
P4ImplEEtaPhiM::m_phi
double m_phi
Definition: P4ImplEEtaPhiM.h:122
I4Momentum::m
virtual double m() const =0
mass
P4BaseEEtaPhiM::cosTh
double cosTh() const
Definition: P4BaseEEtaPhiM.h:187
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
P4BaseEEtaPhiM::e
virtual double e() const =0
P4BaseEEtaPhiM::pz
double pz() const
Definition: P4BaseEEtaPhiM.h:100
P4BaseEEtaPhiM::pt
double pt() const
Definition: P4BaseEEtaPhiM.h:156
P4BaseEEtaPhiM::phi
virtual double phi() const =0
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
P4ImplEEtaPhiM::m_m
double m_m
Definition: P4ImplEEtaPhiM.h:123
I4Momentum::P4EETAPHIM
@ P4EETAPHIM
Definition: I4Momentum.h:33
P4ImplEEtaPhiM::e
double e() const
Definition: P4ImplEEtaPhiM.h:211