This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / PHOS / CLHEP / Vector / LorentzVector.icc
CommitLineData
fe4da5cc 1// -*- C++ -*-
2// $Id$
3// ---------------------------------------------------------------------------
4//
5// This file is a part of the CLHEP - a Class Library for High Energy Physics.
6//
7// This is the definitions of the inline member functions of the
8// HepLorentzVector class.
9//
10
11#ifdef HEP_DEBUG_INLINE
12#define inline
13#endif
14
15inline HepDouble HepLorentzVector::x() const { return pp.x(); }
16inline HepDouble HepLorentzVector::y() const { return pp.y(); }
17inline HepDouble HepLorentzVector::z() const { return pp.z(); }
18inline HepDouble HepLorentzVector::t() const { return ee; }
19
20inline HepLorentzVector::
21HepLorentzVector(HepDouble x, HepDouble y, HepDouble z, HepDouble t)
22 : pp(x, y, z), ee(t) {}
23
24inline HepLorentzVector::HepLorentzVector(const Hep3Vector & p, HepDouble e)
25 : pp(p), ee(e) {}
26
27inline HepLorentzVector::HepLorentzVector(const HepLorentzVector & p)
28 : pp(p.x(), p.y(), p.z()), ee(p.t()) {}
29
30inline HepLorentzVector::~HepLorentzVector() {}
31
32inline HepLorentzVector::operator Hep3Vector () const { return pp; }
33inline HepLorentzVector::operator Hep3Vector & () { return pp; }
34
35inline void HepLorentzVector::setX(HepDouble a) { pp.setX(a); }
36inline void HepLorentzVector::setY(HepDouble a) { pp.setY(a); }
37inline void HepLorentzVector::setZ(HepDouble a) { pp.setZ(a); }
38inline void HepLorentzVector::setT(HepDouble a) { ee = a;}
39
40inline HepDouble HepLorentzVector::px() const { return pp.x(); }
41inline HepDouble HepLorentzVector::py() const { return pp.y(); }
42inline HepDouble HepLorentzVector::pz() const { return pp.z(); }
43inline HepDouble HepLorentzVector::e() const { return ee; }
44
45inline void HepLorentzVector::setPx(HepDouble a) { pp.setX(a); }
46inline void HepLorentzVector::setPy(HepDouble a) { pp.setY(a); }
47inline void HepLorentzVector::setPz(HepDouble a) { pp.setZ(a); }
48inline void HepLorentzVector::setE(HepDouble a) { ee = a;}
49
50inline Hep3Vector HepLorentzVector::vect() const { return pp; }
51inline void HepLorentzVector::setVect(const Hep3Vector &p) { pp = p; }
52
53inline HepDouble HepLorentzVector::theta() const { return pp.theta(); }
54inline HepDouble HepLorentzVector::cosTheta() const { return pp.cosTheta(); }
55inline HepDouble HepLorentzVector::phi() const { return pp.phi(); }
56inline HepDouble HepLorentzVector::rho() const { return pp.mag(); }
57
58inline void HepLorentzVector::setTheta(HepDouble a) { pp.setTheta(a); }
59inline void HepLorentzVector::setPhi(HepDouble a) { pp.setPhi(a); }
60inline void HepLorentzVector::setRho(HepDouble a) { pp.setMag(a); }
61
62inline HepDouble HepLorentzVector::operator () (int i) const {
63 if (i==3) { return ee; } else { return pp(i); }
64}
65
66inline HepLorentzVector &
67HepLorentzVector::operator = (const HepLorentzVector & q) {
68 pp = q.vect();
69 ee = q.t();
70 return *this;
71}
72
73inline HepLorentzVector
74HepLorentzVector::operator + (const HepLorentzVector & q) const {
75 return HepLorentzVector(x()+q.x(), y()+q.y(), z()+q.z(), t()+q.t());
76}
77
78inline HepLorentzVector &
79HepLorentzVector::operator += (const HepLorentzVector & q) {
80 pp += q.vect();
81 ee += q.t();
82 return *this;
83}
84
85inline HepLorentzVector
86HepLorentzVector::operator - (const HepLorentzVector & q) const {
87 return HepLorentzVector(x()-q.x(), y()-q.y(), z()-q.z(), t()-q.t());
88}
89
90inline HepLorentzVector &
91HepLorentzVector::operator -= (const HepLorentzVector & q) {
92 pp -= q.vect();
93 ee -= q.t();
94 return *this;
95}
96
97inline HepLorentzVector HepLorentzVector::operator - () const {
98 return HepLorentzVector(-x(), -y(), -z(), -t());
99}
100
101inline HepBoolean
102HepLorentzVector::operator == (const HepLorentzVector & q) const {
103 return (vect()==q.vect() && t()==q.t());
104}
105
106inline HepBoolean
107HepLorentzVector::operator != (const HepLorentzVector & q) const {
108 return (vect()!=q.vect() || t()!=q.t());
109}
110
111inline HepDouble HepLorentzVector::perp2() const {
112 return pp.perp2();
113}
114
115inline HepDouble HepLorentzVector::perp() const {
116 return pp.perp();
117}
118
119inline HepDouble HepLorentzVector::perp2(const Hep3Vector &v) const {
120 return pp.perp2(v);
121}
122
123inline HepDouble HepLorentzVector::perp(const Hep3Vector &v) const {
124 return pp.perp(v);
125}
126
127inline HepDouble HepLorentzVector::angle(const Hep3Vector &v) const {
128 return pp.angle(v);
129}
130
131inline HepDouble HepLorentzVector::mag2() const {
132 return t()*t() - pp.mag2();
133}
134
135inline HepDouble HepLorentzVector::mag() const {
136 HepDouble mm = mag2();
137 return mm < 0.0 ? -sqrt(-mm) : sqrt(mm);
138}
139
140inline HepDouble HepLorentzVector::m2() const { return mag2(); }
141inline HepDouble HepLorentzVector::m() const { return mag(); }
142
143
144inline HepDouble HepLorentzVector::dot(const HepLorentzVector & q) const {
145 return t()*q.t() - z()*q.z() - y()*q.y() - x()*q.x();
146}
147
148inline HepDouble
149HepLorentzVector::operator * (const HepLorentzVector & q) const {
150 return dot(q);
151}
152
153inline HepDouble HepLorentzVector::plus() const {
154 return t() + z();
155}
156
157inline HepDouble HepLorentzVector::minus() const {
158 return t() - z();
159}
160
161inline Hep3Vector HepLorentzVector::boostVector() const {
162 return Hep3Vector(x()/t(), y()/t(), z()/t());
163}
164
165inline void HepLorentzVector::boost(const Hep3Vector & b){
166 boost(b.x(), b.y(), b.z());
167}
168
169inline void HepLorentzVector::rotateX(HepDouble a) { pp.rotateX(a); }
170inline void HepLorentzVector::rotateY(HepDouble a) { pp.rotateY(a); }
171inline void HepLorentzVector::rotateZ(HepDouble a) { pp.rotateZ(a); }
172inline void HepLorentzVector::rotateUz(Hep3Vector &v) { pp.rotateUz(v); }
173inline void HepLorentzVector::rotate(HepDouble a, const Hep3Vector &v) {
174 pp.rotate(a,v);
175}
176
177inline HepLorentzVector &
178HepLorentzVector::operator *= (const HepRotation & m) {
179 pp *= m;
180 return *this;
181}
182
183inline HepLorentzVector &
184HepLorentzVector::transform(const HepRotation & m) {
185 pp.transform(m);
186 return *this;
187}
188
189#ifdef HEP_DEBUG_INLINE
190#undef inline
191#endif