ATLAS Offline Software
P4IPtCotThPhiMBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <cmath>
7 #include <iomanip>
8 
10 {}
11 
12 double P4IPtCotThPhiMBase::pt() const
13  {
14  return 1./this->iPt();
15  }
16 
17 
18 double P4IPtCotThPhiMBase::p() const
19 {
20  const double theCotTh=this->cotTh();
21  return std::sqrt(1+theCotTh*theCotTh)/this->iPt() ;
22 }
23 
24 double P4IPtCotThPhiMBase::p2() const
25 {
26  const double theCotTh=this->cotTh();
27  const double theI_Pt=this->iPt();
28  return (1+theCotTh*theCotTh)/(theI_Pt*theI_Pt) ;
29 }
30 
31 double P4IPtCotThPhiMBase::m2() const {
32  const double theM = this->m();
33  return theM*theM;
34 }
35 
37 {
38  return 1./this->cotTh() ;
39 }
40 
42 {
43  const double theCotTh=this->cotTh();
44  return 1./std::sqrt(1+theCotTh*theCotTh) ;
45 }
46 
48 {
49  const double theCotTh=this->cotTh();
50  const double theCotTh2=theCotTh*theCotTh;
51  const double theCosTh=std::sqrt(theCotTh2/(1.+theCotTh2));
52  if (theCotTh>=0) {
53  return theCosTh;
54  }
55  else{
56  return -theCosTh;
57  }
58 }
59 
60 
61 double P4IPtCotThPhiMBase::e() const
62 {
63  const double theM=this->m();
64  const double theP=this->p();
65  if (theM==0.) return theP ;
66  else return std::sqrt(theP*theP+theM*theM);
67 }
68 
69 double P4IPtCotThPhiMBase::et() const
70 {
71  const double theCotTh=this->cotTh();
72  return this->e()/std::sqrt(1+theCotTh*theCotTh);
73 }
74 
75 
76 double P4IPtCotThPhiMBase::eta() const
77 {
78  const double theCotTh=this->cotTh();
79  const double aux=std::sqrt(1+theCotTh*theCotTh);
80  return -0.5*log((aux-theCotTh)/(aux+theCotTh));
81  }
82 
83 
85  {
86  const double theE=this->e();
87  const double thePz=this->pz();
88  return 0.5*std::log((theE+thePz)/(theE-thePz));
89  }
90 
91  double P4IPtCotThPhiMBase::px() const
92  { return this->cosPhi()/this->iPt();
93  }
94 
95  double P4IPtCotThPhiMBase::py() const
96  { return this->sinPhi()/this->iPt();
97  }
98 
99  double P4IPtCotThPhiMBase::pz() const
100  { return this->cotTh()/this->iPt();
101  }
102 
104 {
105  return std::cos(this->phi());
106 }
107 
109 {
110  return std::sin(this->phi());
111 }
112 
113  CLHEP::HepLorentzVector P4IPtCotThPhiMBase::hlv() const
114 {
115  //minimize the number of calculation and dereference
116  const double thePt=this->pt();
117  const double theM=this->m();
118  const double thePx=thePt*this->cosPhi();
119  const double thePy=thePt*this->sinPhi();
120  const double thePz=thePt*this->cotTh();
121  const double theE=std::sqrt(thePt*thePt+thePz*thePz+theM*theM);
122 
123  return CLHEP::HepLorentzVector(thePx,thePy,thePz,theE);
124 }
125 
126 std::ostream& P4IPtCotThPhiMBase::dump( std::ostream& out ) const
127 {
128 
129  std::stringstream outx;
130  outx << "[ipt,cotTh,phi,m] ="
131  << std::right << std::scientific << std::setprecision(8)
132  << std::setw(16) << this->iPt()
133  << std::setw(16) << this->cotTh()
134  << std::setw(16) << this->phi()
135  << std::setw(16) << this->m();
136 
137  out<<outx.str();
138 
139  return out;
140 }
141 
143 {
144  return 0;
145 }
146 
147 
149 {
150  std::cout << "FATAL ERROR dummy P4IPtCotThPhiMBase::set4Mom called " << std::endl ;
151  std::abort();
152 }
153 
155 {
156  std::cout << "FATAL ERROR dummy P4IPtCotThPhiMBase::set4Mom called " << std::endl ;
157  std::abort();
158 
159 }
160 
161 void P4IPtCotThPhiMBase::set4Mom(const CLHEP::HepLorentzVector & )
162 {
163  std::cout << "FATAL ERROR dummy P4IPtCotThPhiMBase::set4Mom called " << std::endl ;
164  std::abort();
165 }
P4IPtCotThPhiMBase::sinPhi
virtual double sinPhi() const
sinus phi
Definition: P4IPtCotThPhiMBase.cxx:108
I4Momentum
Definition: I4Momentum.h:31
P4IPtCotThPhiMBase::pz
virtual double pz() const
z component of momentum
Definition: P4IPtCotThPhiMBase.cxx:99
P4IPtCotThPhiMBase::px
virtual double px() const
x component of momentum
Definition: P4IPtCotThPhiMBase.cxx:91
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4IPtCotThPhiMBase::rapidity
virtual double rapidity() const
rapidity
Definition: P4IPtCotThPhiMBase.cxx:84
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
I4Momentum::cotTh
virtual double cotTh() const =0
cottan theta
P4IPtCotThPhiMBase::hlv
virtual CLHEP::HepLorentzVector hlv() const
CLHEP HepLorentzVector.
Definition: P4IPtCotThPhiMBase.cxx:113
P4IPtCotThPhiMBase::p
virtual double p() const
momentum magnitude
Definition: P4IPtCotThPhiMBase.cxx:18
P4IPtCotThPhiMBase::m2
virtual double m2() const
mass squared
Definition: P4IPtCotThPhiMBase.cxx:31
P4IPtCotThPhiMBase::~P4IPtCotThPhiMBase
virtual ~P4IPtCotThPhiMBase()
virtual destructor needed by Pool
Definition: P4IPtCotThPhiMBase.cxx:9
P4IPtCotThPhiMBase::e
virtual double e() const
energy
Definition: P4IPtCotThPhiMBase.cxx:61
P4IPtCotThPhiMBase::eta
virtual double eta() const
pseudo rapidity
Definition: P4IPtCotThPhiMBase.cxx:76
I4MomentumError
Definition: I4MomentumError.h:28
I4Momentum::phi
virtual double phi() const =0
phi in [-pi,pi[
P4IPtCotThPhiMBase::dump
virtual std::ostream & dump(std::ostream &out) const
Print I4Momentum content.
Definition: P4IPtCotThPhiMBase.cxx:126
P4IPtCotThPhiMBase::p2
virtual double p2() const
square of momentum magnitude
Definition: P4IPtCotThPhiMBase.cxx:24
P4IPtCotThPhiMBase.h
P4IPtCotThPhiMBase::set4Mom
virtual void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference DUMMY IMPLEMENTATION
Definition: P4IPtCotThPhiMBase.cxx:148
P4IPtCotThPhiMBase::cosPhi
virtual double cosPhi() const
cosinus phi
Definition: P4IPtCotThPhiMBase.cxx:103
I4Momentum::m
virtual double m() const =0
mass
P4IPtCotThPhiMBase::errors
virtual const I4MomentumError * errors() const
Access to errors, if available; returns 0 if no errors.
Definition: P4IPtCotThPhiMBase.cxx:142
P4IPtCotThPhiMBase::py
virtual double py() const
y component of momentum
Definition: P4IPtCotThPhiMBase.cxx:95
P4IPtCotThPhiMBase::cosTh
virtual double cosTh() const
cosinus theta
Definition: P4IPtCotThPhiMBase.cxx:47
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
P4IPtCotThPhiMBase::et
virtual double et() const
transverse energy defined to be e*sin(theta)
Definition: P4IPtCotThPhiMBase.cxx:69
I4Momentum::iPt
virtual double iPt() const =0
inverse of transverse momentum
P4IPtCotThPhiMBase::pt
virtual double pt() const
transverse momentum
Definition: P4IPtCotThPhiMBase.cxx:12
P4IPtCotThPhiMBase::sinTh
virtual double sinTh() const
sinus theta
Definition: P4IPtCotThPhiMBase.cxx:41
P4IPtCotThPhiMBase::tanTh
virtual double tanTh() const
tan theta
Definition: P4IPtCotThPhiMBase.cxx:36