2// ---------------------------------------------------------------------------
4// This file is a part of the CLHEP - a Class Library for High Energy Physics.
6// This is the definitions of the inline member functions of the
7// HepLorentzRotation class
12// ---------- Constructors and Assignment:
14inline HepLorentzRotation::HepLorentzRotation() :
15 mxx(1.0), mxy(0.0), mxz(0.0), mxt(0.0),
16 myx(0.0), myy(1.0), myz(0.0), myt(0.0),
17 mzx(0.0), mzy(0.0), mzz(1.0), mzt(0.0),
18 mtx(0.0), mty(0.0), mtz(0.0), mtt(1.0) {}
20inline HepLorentzRotation::HepLorentzRotation(const HepLorentzRotation & r) :
21 mxx(r.mxx), mxy(r.mxy), mxz(r.mxz), mxt(r.mxt),
22 myx(r.myx), myy(r.myy), myz(r.myz), myt(r.myt),
23 mzx(r.mzx), mzy(r.mzy), mzz(r.mzz), mzt(r.mzt),
24 mtx(r.mtx), mty(r.mty), mtz(r.mtz), mtt(r.mtt) {}
26inline HepLorentzRotation::HepLorentzRotation(const HepRotation & r) {
29inline HepLorentzRotation::HepLorentzRotation(const HepRotationX & r) {
32inline HepLorentzRotation::HepLorentzRotation(const HepRotationY & r) {
35inline HepLorentzRotation::HepLorentzRotation(const HepRotationZ & r) {
39inline HepLorentzRotation::HepLorentzRotation(const HepBoost & b) {
42inline HepLorentzRotation::HepLorentzRotation(const HepBoostX & b) {
45inline HepLorentzRotation::HepLorentzRotation(const HepBoostY & b) {
48inline HepLorentzRotation::HepLorentzRotation(const HepBoostZ & b) {
52inline HepLorentzRotation &
53HepLorentzRotation::operator = (const HepLorentzRotation & r) {
54 mxx = r.mxx; mxy = r.mxy; mxz = r.mxz; mxt = r.mxt;
55 myx = r.myx; myy = r.myy; myz = r.myz; myt = r.myt;
56 mzx = r.mzx; mzy = r.mzy; mzz = r.mzz; mzt = r.mzt;
57 mtx = r.mtx; mty = r.mty; mtz = r.mtz; mtt = r.mtt;
61inline HepLorentzRotation &
62HepLorentzRotation::operator = (const HepRotation & m1) {
63 return set (m1.rep4x4());
66inline HepLorentzRotation &
67HepLorentzRotation::operator = (const HepBoost & m1) {
68 return set (m1.rep4x4());
71HepLorentzRotation & HepLorentzRotation::set (const Hep3Vector & p) {
72 return set (p.x(), p.y(), p.z());
75inline HepLorentzRotation & HepLorentzRotation::set (const HepRotation & r) {
76 return set (r.rep4x4());
78inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationX & r) {
79 return set (r.rep4x4());
81inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationY & r) {
82 return set (r.rep4x4());
84inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationZ & r) {
85 return set (r.rep4x4());
88inline HepLorentzRotation & HepLorentzRotation::set (const HepBoost & bboost) {
89 return set (bboost.rep4x4());
91inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostX & bboost) {
92 return set (bboost.rep4x4());
94inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostY & bboost) {
95 return set (bboost.rep4x4());
97inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostZ & bboost) {
98 return set (bboost.rep4x4());
101inline HepLorentzRotation::HepLorentzRotation(double bx,
108inline HepLorentzRotation::HepLorentzRotation(const Hep3Vector & p)
110 set(p.x(), p.y(), p.z());
113inline HepLorentzRotation::HepLorentzRotation(
114 const HepBoost & B, const HepRotation & R)
119inline HepLorentzRotation::HepLorentzRotation(
120 const HepRotation & R, const HepBoost & B)
125inline HepLorentzRotation & HepLorentzRotation::set( const HepRep4x4 & rep ) {
126 mxx=rep.xx_; mxy=rep.xy_; mxz=rep.xz_; mxt=rep.xt_;
127 myx=rep.yx_; myy=rep.yy_; myz=rep.yz_; myt=rep.yt_;
128 mzx=rep.zx_; mzy=rep.zy_; mzz=rep.zz_; mzt=rep.zt_;
129 mtx=rep.tx_; mty=rep.ty_; mtz=rep.tz_; mtt=rep.tt_;
133inline HepLorentzRotation ::HepLorentzRotation ( const HepRep4x4 & rep ) :
134 mxx(rep.xx_), mxy(rep.xy_), mxz(rep.xz_), mxt(rep.xt_),
135 myx(rep.yx_), myy(rep.yy_), myz(rep.yz_), myt(rep.yt_),
136 mzx(rep.zx_), mzy(rep.zy_), mzz(rep.zz_), mzt(rep.zt_),
137 mtx(rep.tx_), mty(rep.ty_), mtz(rep.tz_), mtt(rep.tt_) {}
139// - Protected methods
141inline HepLorentzRotation::HepLorentzRotation(
142 double rxx, double rxy, double rxz, double rxt,
143 double ryx, double ryy, double ryz, double ryt,
144 double rzx, double rzy, double rzz, double rzt,
145 double rtx, double rty, double rtz, double rtt) :
146 mxx(rxx), mxy(rxy), mxz(rxz), mxt(rxt),
147 myx(ryx), myy(ryy), myz(ryz), myt(ryt),
148 mzx(rzx), mzy(rzy), mzz(rzz), mzt(rzt),
149 mtx(rtx), mty(rty), mtz(rtz), mtt(rtt) {}
151inline void HepLorentzRotation::setBoost
152 (double bx, double by, double bz) {
156// ---------- Accessors:
158inline double HepLorentzRotation::xx() const { return mxx; }
159inline double HepLorentzRotation::xy() const { return mxy; }
160inline double HepLorentzRotation::xz() const { return mxz; }
161inline double HepLorentzRotation::xt() const { return mxt; }
162inline double HepLorentzRotation::yx() const { return myx; }
163inline double HepLorentzRotation::yy() const { return myy; }
164inline double HepLorentzRotation::yz() const { return myz; }
165inline double HepLorentzRotation::yt() const { return myt; }
166inline double HepLorentzRotation::zx() const { return mzx; }
167inline double HepLorentzRotation::zy() const { return mzy; }
168inline double HepLorentzRotation::zz() const { return mzz; }
169inline double HepLorentzRotation::zt() const { return mzt; }
170inline double HepLorentzRotation::tx() const { return mtx; }
171inline double HepLorentzRotation::ty() const { return mty; }
172inline double HepLorentzRotation::tz() const { return mtz; }
173inline double HepLorentzRotation::tt() const { return mtt; }
175inline HepLorentzVector HepLorentzRotation::col1() const {
176 return HepLorentzVector ( mxx, myx, mzx, mtx );
178inline HepLorentzVector HepLorentzRotation::col2() const {
179 return HepLorentzVector ( mxy, myy, mzy, mty );
181inline HepLorentzVector HepLorentzRotation::col3() const {
182 return HepLorentzVector ( mxz, myz, mzz, mtz );
184inline HepLorentzVector HepLorentzRotation::col4() const {
185 return HepLorentzVector ( mxt, myt, mzt, mtt );
188inline HepLorentzVector HepLorentzRotation::row1() const {
189 return HepLorentzVector ( mxx, mxy, mxz, mxt );
191inline HepLorentzVector HepLorentzRotation::row2() const {
192 return HepLorentzVector ( myx, myy, myz, myt );
194inline HepLorentzVector HepLorentzRotation::row3() const {
195 return HepLorentzVector ( mzx, mzy, mzz, mzt );
197inline HepLorentzVector HepLorentzRotation::row4() const {
198 return HepLorentzVector ( mtx, mty, mtz, mtt );
201inline HepRep4x4 HepLorentzRotation::rep4x4() const {
202 return HepRep4x4( mxx, mxy, mxz, mxt,
205 mtx, mty, mtz, mtt );
209// ------------ Subscripting:
211inline HepLorentzRotation::HepLorentzRotation_row::HepLorentzRotation_row
212(const HepLorentzRotation & r, int i) : rr(r), ii(i) {}
215HepLorentzRotation::HepLorentzRotation_row::operator [] (int jj) const {
219inline const HepLorentzRotation::HepLorentzRotation_row
220HepLorentzRotation::operator [] (int i) const {
221 return HepLorentzRotation_row(*this, i);
224// ---------- Comparisons:
227HepLorentzRotation::operator == (const HepLorentzRotation & r) const {
228 return (mxx == r.xx() && mxy == r.xy() && mxz == r.xz() && mxt == r.xt() &&
229 myx == r.yx() && myy == r.yy() && myz == r.yz() && myt == r.yt() &&
230 mzx == r.zx() && mzy == r.zy() && mzz == r.zz() && mzt == r.zt() &&
231 mtx == r.tx() && mty == r.ty() && mtz == r.tz() && mtt == r.tt());
235HepLorentzRotation::operator != (const HepLorentzRotation & r) const {
236 return ! operator==(r);
240HepLorentzRotation::operator < ( const HepLorentzRotation & r ) const
241 { return compare(r)< 0; }
243HepLorentzRotation::operator <= ( const HepLorentzRotation & r ) const
244 { return compare(r)<=0; }
247HepLorentzRotation::operator >= ( const HepLorentzRotation & r ) const
248 { return compare(r)>=0; }
250HepLorentzRotation::operator > ( const HepLorentzRotation & r ) const
251 { return compare(r)> 0; }
253inline bool HepLorentzRotation::isIdentity() const {
254 return (mxx == 1.0 && mxy == 0.0 && mxz == 0.0 && mxt == 0.0 &&
255 myx == 0.0 && myy == 1.0 && myz == 0.0 && myt == 0.0 &&
256 mzx == 0.0 && mzy == 0.0 && mzz == 1.0 && mzt == 0.0 &&
257 mtx == 0.0 && mty == 0.0 && mtz == 0.0 && mtt == 1.0);
260// ---------- Properties:
262// ---------- Application:
264inline HepLorentzVector
265HepLorentzRotation::vectorMultiplication(const HepLorentzVector & p) const {
270 return HepLorentzVector(mxx*x + mxy*y + mxz*z + mxt*t,
271 myx*x + myy*y + myz*z + myt*t,
272 mzx*x + mzy*y + mzz*z + mzt*t,
273 mtx*x + mty*y + mtz*z + mtt*t);
276inline HepLorentzVector
277HepLorentzRotation::operator() (const HepLorentzVector & w) const {
278 return vectorMultiplication(w);
281inline HepLorentzVector
282HepLorentzRotation::operator * (const HepLorentzVector & p) const {
283 return vectorMultiplication(p);
286// ---------- Operations in the group of 4-Rotations
288inline HepLorentzRotation
289HepLorentzRotation::operator * (const HepBoost & b) const {
290 return matrixMultiplication(b.rep4x4());
292inline HepLorentzRotation
293HepLorentzRotation::operator * (const HepRotation & r) const {
294 return matrixMultiplication(r.rep4x4());
296inline HepLorentzRotation
297HepLorentzRotation::operator * (const HepLorentzRotation & lt) const {
298 return matrixMultiplication(lt.rep4x4());
301inline HepLorentzRotation &
302HepLorentzRotation::operator *= (const HepBoost & b) {
303 return *this = matrixMultiplication(b.rep4x4());
305inline HepLorentzRotation &
306HepLorentzRotation::operator *= (const HepRotation & r) {
307 return *this = matrixMultiplication(r.rep4x4());
309inline HepLorentzRotation &
310HepLorentzRotation::operator *= (const HepLorentzRotation & lt) {
311 return *this = matrixMultiplication(lt.rep4x4());
314inline HepLorentzRotation &
315HepLorentzRotation::transform (const HepBoost & b) {
316 return *this = HepLorentzRotation(b).matrixMultiplication(rep4x4());
318inline HepLorentzRotation &
319HepLorentzRotation::transform (const HepRotation & r) {
320 return *this = HepLorentzRotation(r).matrixMultiplication(rep4x4());
322inline HepLorentzRotation &
323HepLorentzRotation::transform (const HepLorentzRotation & lt) {
324 return *this = lt.matrixMultiplication(rep4x4());
327inline HepLorentzRotation &
328HepLorentzRotation::rotate(double angle, const Hep3Vector & axis) {
329 return transform(HepRotation().rotate(angle, axis));
332inline HepLorentzRotation &
333HepLorentzRotation::rotate(double angle, const Hep3Vector * axis) {
334 return transform(HepRotation().rotate(angle, axis));
337inline HepLorentzRotation &
338HepLorentzRotation::boost(double bx, double by, double bz) {
339 return transform(HepLorentzRotation(bx, by, bz));
342inline HepLorentzRotation &
343HepLorentzRotation::boost(const Hep3Vector & b) {
344 return transform(HepLorentzRotation(b));
347inline HepLorentzRotation HepLorentzRotation::inverse() const {
348 return HepLorentzRotation( mxx, myx, mzx, -mtx,
351 -mxt, -myt, -mzt, mtt );
354inline HepLorentzRotation & HepLorentzRotation::invert() {
355 return *this = inverse();
358inline HepLorentzRotation inverseOf ( const HepLorentzRotation & lt ) {
359 return HepLorentzRotation(
361 lt.mxx, lt.myx, lt.mzx, -lt.mtx,
362 lt.mxy, lt.myy, lt.mzy, -lt.mty,
363 lt.mxz, lt.myz, lt.mzz, -lt.mtz,
364 -lt.mxt, -lt.myt, -lt.mzt, lt.mtt ) );
367inline double HepLorentzRotation::getTolerance() {
368 return Hep4RotationInterface::tolerance;
370inline double HepLorentzRotation::setTolerance(double tol) {
371 return Hep4RotationInterface::setTolerance(tol);