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

#include <P4ImplIPtCotThPhiM.h>

Inheritance diagram for P4ImplIPtCotThPhiM:
Collaboration diagram for P4ImplIPtCotThPhiM:

Public Types

typedef FourMomentumError< P4ImplIPtCotThPhiMErrorType
 

Public Member Functions

 P4ImplIPtCotThPhiM ()
 Default constructor: More...
 
 P4ImplIPtCotThPhiM (const P4ImplIPtCotThPhiM &rhs)
 Copy constructor. More...
 
P4ImplIPtCotThPhiMoperator= (const P4ImplIPtCotThPhiM &rhs)
 Assignment operator. More...
 
 P4ImplIPtCotThPhiM (const double iPt, const double cotTh, const double phi, const double m)
 constructor with all data members More...
 
 P4ImplIPtCotThPhiM (const CLHEP::HepLorentzVector &hlv)
 constructor from hlv to allow conversion from hlv More...
 
 P4ImplIPtCotThPhiM (const I4Momentum &theI4M)
 constructor from any I4Momentum reference More...
 
 P4ImplIPtCotThPhiM (const I4Momentum *const theI4M)
 constructor from any I4Momentum pointer More...
 
virtual ~P4ImplIPtCotThPhiM ()
 virtual destructor needed by Pool More...
 
double m () const
 {@ a la I4Momentum -like interface More...
 
double phi () const
 
double iPt () const
 
double cotTh () const
 
virtual const I4MomentumErrorerrors () const
 
I4Momentum::Kind kind () const
 
virtual void setIPt (const double theIPt)
 set inverse pT data member
More...
 
virtual void setCotTh (const double theCotTh)
 set cot(theta) data member
More...
 
virtual void setPhi (const double thePhi)
 set phi data member
More...
 
virtual void setM (const double theM)
 set m data member
More...
 
void setErrors (const ErrorMatrixPtCotThPhiM &err)
 set the errors More...
 
virtual void set4Mom (const I4Momentum &theI4Mom)
 set all 4-mom from another I4Momentum reference
More...
 
virtual void set4Mom (const I4Momentum *const theI4Mom)
 set all 4-mom from another I4Momentum pointer
More...
 
virtual 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 eta () const
 
double e () const
 
double et () const
 
double pt () const
 
double rapidity () const
 
double cosPhi () const
 
double sinPhi () const
 
double tanTh () const
 
double cosTh () const
 
double sinTh () const
 
CLHEP::HepLorentzVector hlv () const
 
std::ostream & dump (std::ostream &out) const
 Print I4Momentum content. More...
 

Private Attributes

double m_iPt
 inverse P_T More...
 
double m_cotTh
 cot(theta) More...
 
double m_phi
 Phi. More...
 
double m_m
 mass More...
 
std::unique_ptr< ErrorTypem_error
 error matrix pointer More...
 

Friends

class P4ImplIPtCotThPhiMCnv_p1
 

Detailed Description

P4ImplIPtCotThPhiM is a base class for classes with 4-momentum behavior, for which 1/Pt, cottan(tehta), phi and M are natural parameters, which is typically the case of some (not all!) tracking classes. Any class deriving from it should implement iPt(), cotTh(), 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 40 of file P4ImplIPtCotThPhiM.h.

Member Typedef Documentation

◆ ErrorType

Definition at line 45 of file P4ImplIPtCotThPhiM.h.

Constructor & Destructor Documentation

◆ P4ImplIPtCotThPhiM() [1/6]

P4ImplIPtCotThPhiM::P4ImplIPtCotThPhiM ( )
inline

Default constructor:

Definition at line 144 of file P4ImplIPtCotThPhiM.h.

144  :
146  m_iPt ( 0./CLHEP::GeV ),
147  m_cotTh ( 0. ),
148  m_phi ( 0. ),
149  m_m ( 0.*CLHEP::GeV ),
150  m_error(nullptr)
151 {}

◆ P4ImplIPtCotThPhiM() [2/6]

P4ImplIPtCotThPhiM::P4ImplIPtCotThPhiM ( const P4ImplIPtCotThPhiM rhs)
inlineexplicit

Copy constructor.

Definition at line 153 of file P4ImplIPtCotThPhiM.h.

153  :
155  m_iPt ( rhs.m_iPt ),
156  m_cotTh ( rhs.m_cotTh ),
157  m_phi ( rhs.m_phi ),
158  m_m ( rhs.m_m ),
159  m_error(nullptr)
160 {}

◆ P4ImplIPtCotThPhiM() [3/6]

P4ImplIPtCotThPhiM::P4ImplIPtCotThPhiM ( const double  iPt,
const double  cotTh,
const double  phi,
const double  m 
)
inline

constructor with all data members

Definition at line 162 of file P4ImplIPtCotThPhiM.h.

165  :
167  m_iPt ( std::fabs(iPt) ), //inverse Pt is unsigned. std::fabs for safety
168  m_cotTh( cotTh ),
169  m_phi ( phi ),
170  m_m ( m ),
171  m_error(nullptr)
172 {
173  // could enforce phi range convention there
174  // const double twopi =2.*M_PI;
175  // const double threepi=3.*M_PI;
176  // m_phi=fmod(phi+threepi,twopi)-M_PI;
177 }

◆ P4ImplIPtCotThPhiM() [4/6]

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

constructor from hlv to allow conversion from hlv

Definition at line 179 of file P4ImplIPtCotThPhiM.h.

179  :
181  m_iPt ( 1./hlv.perp() ),
182  m_cotTh ( hlv.pz() / hlv.perp() ),
183  m_phi ( hlv.phi() ),
184  m_m ( hlv.m() ),
185  m_error(nullptr)
186 {}

◆ P4ImplIPtCotThPhiM() [5/6]

P4ImplIPtCotThPhiM::P4ImplIPtCotThPhiM ( const I4Momentum theI4M)
inlineexplicit

constructor from any I4Momentum reference

Definition at line 188 of file P4ImplIPtCotThPhiM.h.

188  :
190  m_iPt ( p4.iPt() ),
191  m_cotTh( p4.cotTh() ),
192  m_phi ( p4.phi() ),
193  m_m ( p4.m() ),
194  m_error(nullptr)
195 {}

◆ P4ImplIPtCotThPhiM() [6/6]

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

constructor from any I4Momentum pointer

Definition at line 197 of file P4ImplIPtCotThPhiM.h.

197  :
199  m_iPt ( p4->iPt() ),
200  m_cotTh( p4->cotTh() ),
201  m_phi ( p4->phi() ),
202  m_m ( p4->m() ),
203  m_error(nullptr)
204 {}

◆ ~P4ImplIPtCotThPhiM()

P4ImplIPtCotThPhiM::~P4ImplIPtCotThPhiM ( )
inlinevirtual

virtual destructor needed by Pool

Definition at line 206 of file P4ImplIPtCotThPhiM.h.

207 {}

Member Function Documentation

◆ cosPhi()

double P4BaseIPtCotThPhiM::cosPhi ( ) const
inlineinherited

Definition at line 212 of file P4BaseIPtCotThPhiM.h.

213 {
214  return std::cos(this->phi());
215 }

◆ cosTh()

double P4BaseIPtCotThPhiM::cosTh ( ) const
inlineinherited

Definition at line 190 of file P4BaseIPtCotThPhiM.h.

191 {
192  const double theCotTh = this->cotTh();
193  const double theCotTh2 = theCotTh*theCotTh;
194  const double theCosTh = std::sqrt(theCotTh2/(1.+theCotTh2));
195  if ( theCotTh >= 0. ) {
196  return theCosTh;
197  } else{
198  return -theCosTh;
199  }
200 }

◆ cotTh()

double P4ImplIPtCotThPhiM::cotTh ( ) const
inlinevirtual

Implements P4BaseIPtCotThPhiM.

Definition at line 224 of file P4ImplIPtCotThPhiM.h.

225 {
226  return m_cotTh;
227 }

◆ dump()

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

Print I4Momentum content.

Definition at line 243 of file P4BaseIPtCotThPhiM.h.

244 {
245  std::stringstream s;
246  s << "[ipt,cotTh,phi,m] ="
247  << std::right << std::scientific << std::setprecision(8)
248  << std::setw(16) << this->iPt()
249  << std::setw(16) << this->cotTh()
250  << std::setw(16) << this->phi()
251  << std::setw(16) << this->m();
252 
253  out << s.str();
254 
255  return out;
256 }

◆ e()

double P4BaseIPtCotThPhiM::e ( ) const
inlineinherited

Definition at line 154 of file P4BaseIPtCotThPhiM.h.

155 {
156  const double theM = this->m();
157  const double theP = this->p();
158  if ( theM == 0. ) {
159  return theP;
160  } else {
161  return std::sqrt( theP*theP + theM*theM );
162  }
163 }

◆ errors()

const I4MomentumError * P4ImplIPtCotThPhiM::errors ( ) const
inlinevirtual

Definition at line 229 of file P4ImplIPtCotThPhiM.h.

230 {
231  return m_error.get();
232 }

◆ et()

double P4BaseIPtCotThPhiM::et ( ) const
inlineinherited

Definition at line 167 of file P4BaseIPtCotThPhiM.h.

168 {
169  const double theE = this->e();
170  const double theCotTh = this->cotTh();
171  return theE / std::sqrt( 1 + theCotTh*theCotTh );
172 }

◆ eta()

double P4BaseIPtCotThPhiM::eta ( ) const
inlineinherited

Definition at line 135 of file P4BaseIPtCotThPhiM.h.

136 {
137  const double theCotTh = this->cotTh();
138  const double aux = std::sqrt(1+theCotTh*theCotTh);
139  return -0.5 * std::log( (aux-theCotTh) / (aux+theCotTh) );
140 }

◆ hlv()

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

Definition at line 226 of file P4BaseIPtCotThPhiM.h.

227 {
228  //minimize the number of calculation and dereference
229  const double thePt = this->pt();
230  const double theM = this->m();
231  const double thePx = thePt*this->cosPhi();
232  const double thePy = thePt*this->sinPhi();
233  const double thePz = thePt * this->cotTh();
234  const double theE = std::sqrt( thePt * thePt
235  + thePz * thePz
236  + theM * theM );
237 
238  return CLHEP::HepLorentzVector( thePx, thePy, thePz, theE );
239 }

◆ iPt()

double P4ImplIPtCotThPhiM::iPt ( ) const
inlinevirtual

Implements P4BaseIPtCotThPhiM.

Definition at line 219 of file P4ImplIPtCotThPhiM.h.

220 {
221  return m_iPt;
222 }

◆ kind()

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

Definition at line 89 of file P4ImplIPtCotThPhiM.h.

89 { return I4Momentum::P4IPTCOTTHPHIM; };

◆ m()

double P4ImplIPtCotThPhiM::m ( ) const
inlinevirtual

{@ a la I4Momentum -like interface

Implements P4BaseIPtCotThPhiM.

Definition at line 209 of file P4ImplIPtCotThPhiM.h.

210 {
211  return m_m;
212 }

◆ m2()

double P4BaseIPtCotThPhiM::m2 ( ) const
inlineinherited

Definition at line 110 of file P4BaseIPtCotThPhiM.h.

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

◆ operator=()

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

Assignment operator.

Definition at line 15 of file P4ImplIPtCotThPhiM.cxx.

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

◆ p()

double P4BaseIPtCotThPhiM::p ( ) const
inlineinherited

Definition at line 118 of file P4BaseIPtCotThPhiM.h.

119 {
120  const double theCotTh = this->cotTh();
121  return std::sqrt( 1 + theCotTh*theCotTh ) / this->iPt() ;
122 }

◆ p2()

double P4BaseIPtCotThPhiM::p2 ( ) const
inlineinherited

Definition at line 126 of file P4BaseIPtCotThPhiM.h.

127 {
128  const double cotTh = this->cotTh();
129  const double iPt = this->iPt();
130  return ( 1 + cotTh*cotTh ) / (iPt*iPt) ;
131 }

◆ phi()

double P4ImplIPtCotThPhiM::phi ( ) const
inlinevirtual

Implements P4BaseIPtCotThPhiM.

Definition at line 214 of file P4ImplIPtCotThPhiM.h.

215 {
216  return m_phi;
217 }

◆ pt()

double P4BaseIPtCotThPhiM::pt ( ) const
inlineinherited

Definition at line 176 of file P4BaseIPtCotThPhiM.h.

177 {
178  return 1./this->iPt();
179 }

◆ px()

double P4BaseIPtCotThPhiM::px ( ) const
inlineinherited

{@ a la I4Momentum -like interface

Definition at line 89 of file P4BaseIPtCotThPhiM.h.

90 {
91  return std::cos(this->phi())/this->iPt();
92 }

◆ py()

double P4BaseIPtCotThPhiM::py ( ) const
inlineinherited

Definition at line 96 of file P4BaseIPtCotThPhiM.h.

97 {
98  return std::sin(this->phi())/this->iPt();
99 }

◆ pz()

double P4BaseIPtCotThPhiM::pz ( ) const
inlineinherited

Definition at line 103 of file P4BaseIPtCotThPhiM.h.

104 {
105  return this->cotTh()/this->iPt();
106 }

◆ rapidity()

double P4BaseIPtCotThPhiM::rapidity ( ) const
inlineinherited

Definition at line 144 of file P4BaseIPtCotThPhiM.h.

145 {
146  const double theE=this->e();
147  const double thePz=this->pz();
148  return 0.5*std::log((theE+thePz)/(theE-thePz));
149 }

◆ set4Mom() [1/3]

void P4ImplIPtCotThPhiM::set4Mom ( const CLHEP::HepLorentzVector &  theHlv)
inlinevirtual

set all 4-mom from CLHEP HepLorentzVector

Reimplemented in P4Impl< P4ImplIPtCotThPhiM >.

Definition at line 269 of file P4ImplIPtCotThPhiM.h.

270 {
271  m_iPt = 1./hlv.perp();
272  m_cotTh = hlv.pz()*m_iPt;
273  m_phi = hlv.phi();
274  m_m = hlv.m();
275 }

◆ set4Mom() [2/3]

void P4ImplIPtCotThPhiM::set4Mom ( const I4Momentum theI4Mom)
inlinevirtual

set all 4-mom from another I4Momentum reference

Reimplemented in P4Impl< P4ImplIPtCotThPhiM >.

Definition at line 256 of file P4ImplIPtCotThPhiM.h.

257 {
258  m_iPt = theI4Mom.iPt();
259  m_cotTh = theI4Mom.cotTh();
260  m_phi = theI4Mom.phi();
261  m_m = theI4Mom.m();
262 }

◆ set4Mom() [3/3]

void P4ImplIPtCotThPhiM::set4Mom ( const I4Momentum *const  theI4Mom)
inlinevirtual

set all 4-mom from another I4Momentum pointer

Reimplemented in P4Impl< P4ImplIPtCotThPhiM >.

Definition at line 264 of file P4ImplIPtCotThPhiM.h.

265 {
266  this->set4Mom(*theI4Mom);
267 }

◆ setCotTh()

void P4ImplIPtCotThPhiM::setCotTh ( const double  theCotTh)
inlinevirtual

set cot(theta) data member

Definition at line 241 of file P4ImplIPtCotThPhiM.h.

242 {
243  m_cotTh = theCotTh;
244 }

◆ setErrors()

void P4ImplIPtCotThPhiM::setErrors ( const ErrorMatrixPtCotThPhiM err)
inline

set the errors

Definition at line 277 of file P4ImplIPtCotThPhiM.h.

278 {
279  m_error = std::make_unique< ErrorType>(err, *this);
280 }

◆ setIPt()

void P4ImplIPtCotThPhiM::setIPt ( const double  theIPt)
inlinevirtual

set inverse pT data member

Definition at line 236 of file P4ImplIPtCotThPhiM.h.

237 {
238  m_iPt = theIPt;
239 }

◆ setM()

void P4ImplIPtCotThPhiM::setM ( const double  theM)
inlinevirtual

set m data member

Definition at line 251 of file P4ImplIPtCotThPhiM.h.

252 {
253  m_m=theM;
254 }

◆ setPhi()

void P4ImplIPtCotThPhiM::setPhi ( const double  thePhi)
inlinevirtual

set phi data member

Definition at line 246 of file P4ImplIPtCotThPhiM.h.

247 {
248  m_phi = thePhi;
249 }

◆ sinPhi()

double P4BaseIPtCotThPhiM::sinPhi ( ) const
inlineinherited

Definition at line 219 of file P4BaseIPtCotThPhiM.h.

220 {
221  return std::sin(this->phi());
222 }

◆ sinTh()

double P4BaseIPtCotThPhiM::sinTh ( ) const
inlineinherited

Definition at line 204 of file P4BaseIPtCotThPhiM.h.

205 {
206  const double theCotTh = this->cotTh();
207  return 1. / std::sqrt( 1 + theCotTh*theCotTh );
208 }

◆ tanTh()

double P4BaseIPtCotThPhiM::tanTh ( ) const
inlineinherited

Definition at line 183 of file P4BaseIPtCotThPhiM.h.

184 {
185  return 1./this->cotTh() ;
186 }

Friends And Related Function Documentation

◆ P4ImplIPtCotThPhiMCnv_p1

friend class P4ImplIPtCotThPhiMCnv_p1
friend

Definition at line 42 of file P4ImplIPtCotThPhiM.h.

Member Data Documentation

◆ m_cotTh

double P4ImplIPtCotThPhiM::m_cotTh
private

cot(theta)

Definition at line 128 of file P4ImplIPtCotThPhiM.h.

◆ m_error

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

error matrix pointer

Definition at line 140 of file P4ImplIPtCotThPhiM.h.

◆ m_iPt

double P4ImplIPtCotThPhiM::m_iPt
private

inverse P_T

Definition at line 124 of file P4ImplIPtCotThPhiM.h.

◆ m_m

double P4ImplIPtCotThPhiM::m_m
private

mass

Definition at line 136 of file P4ImplIPtCotThPhiM.h.

◆ m_phi

double P4ImplIPtCotThPhiM::m_phi
private

Phi.

Definition at line 132 of file P4ImplIPtCotThPhiM.h.


The documentation for this class was generated from the following files:
P4ImplIPtCotThPhiM::m_error
std::unique_ptr< ErrorType > m_error
error matrix pointer
Definition: P4ImplIPtCotThPhiM.h:140
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
P4ImplIPtCotThPhiM::m_phi
double m_phi
Phi.
Definition: P4ImplIPtCotThPhiM.h:132
P4BaseIPtCotThPhiM::pz
double pz() const
Definition: P4BaseIPtCotThPhiM.h:103
P4BaseIPtCotThPhiM::cotTh
virtual double cotTh() const =0
P4BaseIPtCotThPhiM
Definition: P4BaseIPtCotThPhiM.h:33
P4BaseIPtCotThPhiM::pt
double pt() const
Definition: P4BaseIPtCotThPhiM.h:176
I4Momentum::P4IPTCOTTHPHIM
@ P4IPTCOTTHPHIM
Definition: I4Momentum.h:33
P4ImplIPtCotThPhiM::m_m
double m_m
mass
Definition: P4ImplIPtCotThPhiM.h:136
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4ImplIPtCotThPhiM::phi
double phi() const
Definition: P4ImplIPtCotThPhiM.h:214
P4ImplIPtCotThPhiM::set4Mom
virtual void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
Definition: P4ImplIPtCotThPhiM.h:256
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
P4BaseIPtCotThPhiM::hlv
CLHEP::HepLorentzVector hlv() const
Definition: P4BaseIPtCotThPhiM.h:226
dqt_zlumi_pandas.mass
mass
Definition: dqt_zlumi_pandas.py:170
P4BaseIPtCotThPhiM::iPt
virtual double iPt() const =0
P4ImplIPtCotThPhiM::cotTh
double cotTh() const
Definition: P4ImplIPtCotThPhiM.h:224
P4BaseIPtCotThPhiM::p
double p() const
Definition: P4BaseIPtCotThPhiM.h:118
I4Momentum::cotTh
virtual double cotTh() const =0
cottan theta
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
I4Momentum::phi
virtual double phi() const =0
phi in [-pi,pi[
P4BaseIPtCotThPhiM::m
virtual double m() const =0
P4ImplIPtCotThPhiM::m
double m() const
{@ a la I4Momentum -like interface
Definition: P4ImplIPtCotThPhiM.h:209
I4Momentum::m
virtual double m() const =0
mass
P4BaseIPtCotThPhiM::cosPhi
double cosPhi() const
Definition: P4BaseIPtCotThPhiM.h:212
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
P4ImplIPtCotThPhiM::m_cotTh
double m_cotTh
cot(theta)
Definition: P4ImplIPtCotThPhiM.h:128
P4BaseIPtCotThPhiM::phi
virtual double phi() const =0
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
P4ImplIPtCotThPhiM::m_iPt
double m_iPt
inverse P_T
Definition: P4ImplIPtCotThPhiM.h:124
I4Momentum::iPt
virtual double iPt() const =0
inverse of transverse momentum
P4BaseIPtCotThPhiM::sinPhi
double sinPhi() const
Definition: P4BaseIPtCotThPhiM.h:219
P4ImplIPtCotThPhiM::iPt
double iPt() const
Definition: P4ImplIPtCotThPhiM.h:219
P4BaseIPtCotThPhiM::e
double e() const
Definition: P4BaseIPtCotThPhiM.h:154