source: trunk/CLHEP/Vector/BoostY.icc@ 22

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

first commit

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