source: trunk/CLHEP/Vector/BoostZ.icc@ 20

Last change on this file since 20 was 4, checked in by Pavel Demin, 16 years ago

first commit

File size: 5.4 KB
Line 
1// -*- C++ -*-
2// ---------------------------------------------------------------------------
3//
4// This file is a part of the CLHEP - a Class Library for High Energy Physics.
5//
6// This is the definitions of the inline member functions of the
7// HepBoostZ class
8//
9
10#include <cmath>
11
12namespace CLHEP {
13
14// ---------- Constructors and Assignment:
15
16inline HepBoostZ::HepBoostZ() : beta_(0.0), gamma_(1.0) {}
17
18inline HepBoostZ::HepBoostZ(const HepBoostZ & b) :
19 beta_ (b.beta_),
20 gamma_(b.gamma_) {}
21
22inline HepBoostZ & HepBoostZ::operator = (const HepBoostZ & b) {
23 beta_ = b.beta_;
24 gamma_ = b.gamma_;
25 return *this;
26}
27
28inline HepBoostZ::HepBoostZ(double beta) { set(beta); }
29
30// - Protected method:
31inline HepBoostZ::HepBoostZ( double beta, double gamma ) :
32 beta_(beta), gamma_(gamma) {}
33
34// ---------- Accessors:
35
36inline double HepBoostZ::beta() const {
37 return beta_;
38}
39
40inline double HepBoostZ::gamma() const {
41 return gamma_;
42}
43
44inline Hep3Vector HepBoostZ::boostVector() const {
45 return Hep3Vector( 0, 0, beta_ );
46}
47
48inline Hep3Vector HepBoostZ::getDirection() const {
49 return Hep3Vector( 0.0, 0.0, 1.0 );
50}
51
52inline double HepBoostZ::xx() const { return 1.0;}
53inline double HepBoostZ::xy() const { return 0.0;}
54inline double HepBoostZ::xz() const { return 0.0;}
55inline double HepBoostZ::xt() const { return 0.0;}
56inline double HepBoostZ::yx() const { return 0.0;}
57inline double HepBoostZ::yy() const { return 1.0;}
58inline double HepBoostZ::yz() const { return 0.0;}
59inline double HepBoostZ::yt() const { return 0.0;}
60inline double HepBoostZ::zx() const { return 0.0;}
61inline double HepBoostZ::zy() const { return 0.0;}
62inline double HepBoostZ::zz() const { return gamma();}
63inline double HepBoostZ::zt() const { return beta()*gamma();}
64inline double HepBoostZ::tx() const { return 0.0;}
65inline double HepBoostZ::ty() const { return 0.0;}
66inline double HepBoostZ::tz() const { return beta()*gamma();}
67inline double HepBoostZ::tt() const { return gamma();}
68
69inline HepLorentzVector HepBoostZ::col1() const {
70 return HepLorentzVector ( 1, 0, 0, 0 );
71}
72inline HepLorentzVector HepBoostZ::col2() const {
73 return HepLorentzVector ( 0, 1, 0, 0 );
74}
75inline HepLorentzVector HepBoostZ::col3() const {
76 return HepLorentzVector ( 0, 0, gamma(), beta()*gamma() );
77}
78inline HepLorentzVector HepBoostZ::col4() const {
79 return HepLorentzVector ( 0, 0, beta()*gamma(), gamma() );
80}
81
82inline HepLorentzVector HepBoostZ::row1() const {
83 return HepLorentzVector ( col1() );
84}
85inline HepLorentzVector HepBoostZ::row2() const {
86 return HepLorentzVector ( col2() );
87}
88inline HepLorentzVector HepBoostZ::row3() const {
89 return HepLorentzVector ( col3() );
90}
91inline HepLorentzVector HepBoostZ::row4() const {
92 return HepLorentzVector ( col4() );
93}
94
95// ---------- Comparisons:
96
97inline int HepBoostZ::compare( const HepBoostZ & b ) const {
98 if (beta() < b.beta()) {
99 return -1;
100 } else if (beta() > b.beta()) {
101 return 1;
102 } else {
103 return 0;
104 }
105}
106
107inline bool HepBoostZ::operator == ( const HepBoostZ & b ) const {
108 return beta_ == b.beta_;
109}
110inline bool HepBoostZ::operator != ( const HepBoostZ & b ) const {
111 return beta_ != b.beta_;
112}
113inline bool HepBoostZ::operator <= ( const HepBoostZ & b ) const {
114 return beta_ <= b.beta_;
115}
116inline bool HepBoostZ::operator >= ( const HepBoostZ & b ) const {
117 return beta_ >= b.beta_;
118}
119inline bool HepBoostZ::operator < ( const HepBoostZ & b ) const {
120 return beta_ < b.beta_;
121}
122inline bool HepBoostZ::operator > ( const HepBoostZ & b ) const {
123 return beta_ > b.beta_;
124}
125
126inline bool HepBoostZ::isIdentity() const {
127 return ( beta() == 0 );
128}
129
130inline double HepBoostZ::distance2( const HepBoostZ & b ) const {
131 double d = beta()*gamma() - b.beta()*b.gamma();
132 return d*d;
133}
134
135inline double HepBoostZ::howNear(const HepBoostZ & b) const {
136 return std::sqrt(distance2(b)); }
137inline double HepBoostZ::howNear(const HepBoost & b) const {
138 return std::sqrt(distance2(b)); }
139inline double HepBoostZ::howNear(const HepRotation & r) const {
140 return std::sqrt(distance2(r)); }
141inline double HepBoostZ::howNear(const HepLorentzRotation & lt) const {
142 return std::sqrt(distance2(lt)); }
143
144inline bool HepBoostZ::isNear(const HepBoostZ & b,
145 double epsilon) const {
146 return (distance2(b) <= epsilon*epsilon);
147}
148inline bool HepBoostZ::isNear(const HepBoost & b,
149 double epsilon) const {
150 return (distance2(b) <= epsilon*epsilon);
151}
152
153// ---------- Properties:
154
155double HepBoostZ::norm2() const {
156 register double bg = beta_*gamma_;
157 return bg*bg;
158}
159
160// ---------- Application:
161
162inline HepLorentzVector
163HepBoostZ::operator * (const HepLorentzVector & p) const {
164 double bg = beta_*gamma_;
165 return HepLorentzVector( p.x(),
166 p.y(),
167 gamma_*p.z() + bg*p.t(),
168 gamma_*p.t() + bg*p.z());
169}
170
171HepLorentzVector HepBoostZ::operator() (const HepLorentzVector & w) const {
172 return operator*(w);
173}
174
175// ---------- Operations in the group of 4-Rotations
176
177inline HepBoostZ HepBoostZ::inverse() const {
178 return HepBoostZ( -beta(), gamma() );
179}
180
181inline HepBoostZ & HepBoostZ::invert() {
182 beta_ = -beta_;
183 return *this;
184}
185
186inline HepBoostZ inverseOf ( const HepBoostZ & b ) {
187 return HepBoostZ( -b.beta(), b.gamma());
188}
189
190// ---------- Tolerance:
191
192inline double HepBoostZ::getTolerance() {
193 return Hep4RotationInterface::tolerance;
194}
195inline double HepBoostZ::setTolerance(double tol) {
196 return Hep4RotationInterface::setTolerance(tol);
197}
198
199} // namespace CLHEP
Note: See TracBrowser for help on using the repository browser.