ROOT  6.06/09
Reference Guide
TLorentzRotation.h
Go to the documentation of this file.
1 // @(#)root/physics:$Id$
2 // Author: Peter Malzacher 19/06/99
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TLorentzRotation
13 #define ROOT_TLorentzRotation
14 
15 
16 #ifndef ROOT_TRotation
17 #include "TRotation.h"
18 #endif
19 #ifndef ROOT_TLorentzVector
20 #include "TLorentzVector.h"
21 #endif
22 
23 
24 class TLorentzRotation : public TObject {
25 
26 
27 public:
28 
30 public:
31  inline TLorentzRotationRow(const TLorentzRotation &, int);
32  inline Double_t operator [] (int) const;
33 private:
35  int fII;
36 };
37  // Helper class for implemention of C-style subscripting r[i][j]
38 
40  // Default constructor. Gives a unit matrix.
41 
42  TLorentzRotation(const TRotation &);
43  // Constructor for 3d rotations.
44 
46  // Copy constructor.
47 
49  TLorentzRotation(const TVector3 &);
50  // Constructors giving a Lorenz-boost.
51 
52  inline Double_t XX() const;
53  inline Double_t XY() const;
54  inline Double_t XZ() const;
55  inline Double_t XT() const;
56  inline Double_t YX() const;
57  inline Double_t YY() const;
58  inline Double_t YZ() const;
59  inline Double_t YT() const;
60  inline Double_t ZX() const;
61  inline Double_t ZY() const;
62  inline Double_t ZZ() const;
63  inline Double_t ZT() const;
64  inline Double_t TX() const;
65  inline Double_t TY() const;
66  inline Double_t TZ() const;
67  inline Double_t TT() const;
68  // Elements of the matrix.
69 
70  inline TLorentzRotationRow operator [] (int) const;
71  // Returns object of the helper class for C-style subscripting r[i][j]
72 
73 
74  Double_t operator () (int, int) const;
75  // Fortran-style subscriptimg: returns (i,j) element of the matrix.
76 
77 
79  inline TLorentzRotation & operator = (const TRotation &);
80  // Assignment.
81 
82  inline Bool_t operator == (const TLorentzRotation &) const;
83  inline Bool_t operator != (const TLorentzRotation &) const;
84  // Comparisons.
85 
86  inline Bool_t IsIdentity() const;
87  // Returns true if the Identity matrix.
88 
90  inline TLorentzVector operator * (const TLorentzVector &) const;
91  // Multiplication with a Lorentz vector.
92 
94  inline TLorentzRotation operator * (const TLorentzRotation &) const;
97  inline TLorentzRotation & Transform(const TRotation &);
98  // Matrix multiplication.
99  // Note: a *= b; <=> a = a * b; while a.Transform(b); <=> a = b * a;
100 
101  inline TLorentzRotation Inverse() const;
102  // Return the inverse.
103 
104  inline TLorentzRotation & Invert();
105  // Inverts the LorentzRotation matrix.
106 
108  inline TLorentzRotation & Boost(const TVector3 &);
109  // Lorenz boost.
110 
112  // Rotation around x-axis.
113 
115  // Rotation around y-axis.
116 
118  // Rotation around z-axis.
119 
120  inline TLorentzRotation & Rotate(Double_t, const TVector3 &);
121  inline TLorentzRotation & Rotate(Double_t, const TVector3 *);
122  // Rotation around specified vector.
123 
124 protected:
125 
127  fyx, fyy, fyz, fyt,
128  fzx, fzy, fzz, fzt,
129  ftx, fty, ftz, ftt;
130  // The matrix elements.
131 
133  // Set elements according to a boost vector.
134 
139  // Protected constructor.
140 
141  ClassDef(TLorentzRotation,1) // Lorentz transformations including boosts and rotations
142 
143 };
144 
145 
146 
147 inline Double_t TLorentzRotation::XX() const { return fxx; }
148 inline Double_t TLorentzRotation::XY() const { return fxy; }
149 inline Double_t TLorentzRotation::XZ() const { return fxz; }
150 inline Double_t TLorentzRotation::XT() const { return fxt; }
151 inline Double_t TLorentzRotation::YX() const { return fyx; }
152 inline Double_t TLorentzRotation::YY() const { return fyy; }
153 inline Double_t TLorentzRotation::YZ() const { return fyz; }
154 inline Double_t TLorentzRotation::YT() const { return fyt; }
155 inline Double_t TLorentzRotation::ZX() const { return fzx; }
156 inline Double_t TLorentzRotation::ZY() const { return fzy; }
157 inline Double_t TLorentzRotation::ZZ() const { return fzz; }
158 inline Double_t TLorentzRotation::ZT() const { return fzt; }
159 inline Double_t TLorentzRotation::TX() const { return ftx; }
160 inline Double_t TLorentzRotation::TY() const { return fty; }
161 inline Double_t TLorentzRotation::TZ() const { return ftz; }
162 inline Double_t TLorentzRotation::TT() const { return ftt; }
163 
165 (const TLorentzRotation & r, int i) : fRR(&r), fII(i) {}
166 
168  return fRR->operator()(fII,jj);
169 }
170 
172  return TLorentzRotationRow(*this, i);
173 }
174 
176  fxx = r.fxx; fxy = r.fxy; fxz = r.fxz; fxt = r.fxt;
177  fyx = r.fyx; fyy = r.fyy; fyz = r.fyz; fyt = r.fyt;
178  fzx = r.fzx; fzy = r.fzy; fzz = r.fzz; fzt = r.fzt;
179  ftx = r.ftx; fty = r.fty; ftz = r.ftz; ftt = r.ftt;
180  return *this;
181 }
182 
183 //inline TLorentzRotation &
184 //TLorentzRotation::operator = (const TRotation & r) {
185 // mxx = r.xx(); mxy = r.xy(); mxz = r.xz(); mxt = 0.0;
186 // myx = r.yx(); myy = r.yy(); myz = r.yz(); myt = 0.0;
187 // mzx = r.zx(); mzy = r.zy(); mzz = r.zz(); mzt = 0.0;
188 // mtx = 0.0; mty = 0.0; mtz = 0.0; mtt = 1.0;
189 // return *this;
190 //}
191 
193  fxx = r.XX(); fxy = r.XY(); fxz = r.XZ(); fxt = 0.0;
194  fyx = r.YX(); fyy = r.YY(); fyz = r.YZ(); fyt = 0.0;
195  fzx = r.ZX(); fzy = r.ZY(); fzz = r.ZZ(); fzt = 0.0;
196  ftx = 0.0; fty = 0.0; ftz = 0.0; ftt = 1.0;
197  return *this;
198 }
199 
200 
201 //inline Bool_t
202 //TLorentzRotation::operator == (const TLorentzRotation & r) const {
203 // return (mxx == r.xx() && mxy == r.xy() && mxz == r.xz() && mxt == r.xt() &&
204 // myx == r.yx() && myy == r.yy() && myz == r.yz() && myt == r.yt() &&
205 // mzx == r.zx() && mzy == r.zy() && mzz == r.zz() && mzt == r.zt() &&
206 // mtx == r.tx() && mty == r.ty() && mtz == r.tz() && mtt == r.tt())
207 // ? kTRUE : kFALSE;
208 //}
209 
211  return (fxx == r.fxx && fxy == r.fxy && fxz == r.fxz && fxt == r.fxt &&
212  fyx == r.fyx && fyy == r.fyy && fyz == r.fyz && fyt == r.fyt &&
213  fzx == r.fzx && fzy == r.fzy && fzz == r.fzz && fzt == r.fzt &&
214  ftx == r.ftx && fty == r.fty && ftz == r.ftz && ftt == r.ftt)
215  ? kTRUE : kFALSE;
216 }
217 
218 //inline Bool_t
219 //TLorentzRotation::operator != (const TLorentzRotation & r) const {
220 // return (mxx != r.xx() || mxy != r.xy() || mxz != r.xz() || mxt != r.xt() ||
221 // myx != r.yx() || myy != r.yy() || myz != r.yz() || myt != r.yt() ||
222 // mzx != r.zx() || mzy != r.zy() || mzz != r.zz() || mzt != r.zt() ||
223 // mtx != r.tx() || mty != r.ty() || mtz != r.tz() || mtt != r.tt())
224 // ? kTRUE : kFALSE;
225 //}
226 
228  return (fxx != r.fxx || fxy != r.fxy || fxz != r.fxz || fxt != r.fxt ||
229  fyx != r.fyx || fyy != r.fyy || fyz != r.fyz || fyt != r.fyt ||
230  fzx != r.fzx || fzy != r.fzy || fzz != r.fzz || fzt != r.fzt ||
231  ftx != r.ftx || fty != r.fty || ftz != r.ftz || ftt != r.ftt)
232  ? kTRUE : kFALSE;
233 }
234 
236  return (fxx == 1.0 && fxy == 0.0 && fxz == 0.0 && fxt == 0.0 &&
237  fyx == 0.0 && fyy == 1.0 && fyz == 0.0 && fyt == 0.0 &&
238  fzx == 0.0 && fzy == 0.0 && fzz == 1.0 && fzt == 0.0 &&
239  ftx == 0.0 && fty == 0.0 && ftz == 0.0 && ftt == 1.0)
240  ? kTRUE : kFALSE;
241 }
242 
243 
245  return TLorentzVector(fxx*p.X()+fxy*p.Y()+fxz*p.Z()+fxt*p.T(),
246  fyx*p.X()+fyy*p.Y()+fyz*p.Z()+fyt*p.T(),
247  fzx*p.X()+fzy*p.Y()+fzz*p.Z()+fzt*p.T(),
248  ftx*p.X()+fty*p.Y()+ftz*p.Z()+ftt*p.T());
249 }
250 
252  return VectorMultiplication(p);
253 }
254 
256  return MatrixMultiplication(m);
257 }
258 
260  return *this = MatrixMultiplication(m);
261 }
262 
264  return *this = m.MatrixMultiplication(*this);
265 }
266 
268  return Transform(TLorentzRotation(m));
269 }
270 
272  return TLorentzRotation( fxx, fyx, fzx, -ftx,
273  fxy, fyy, fzy, -fty,
274  fxz, fyz, fzz, -ftz,
275  -fxt, -fyt, -fzt, ftt);
276 }
277 
279  return *this = Inverse();
280 }
281 
283  return Transform(TLorentzRotation(bx, by, bz));
284 }
285 
287  return Transform(TLorentzRotation(b));
288 }
289 
291  return Transform(TRotation().RotateX(angle));
292 }
293 
295  return Transform(TRotation().RotateY(angle));
296 }
297 
299  return Transform(TRotation().RotateZ(angle));
300 }
301 
303  return Transform(TRotation().Rotate(angle, axis));
304 }
305 
307  return Transform(TRotation().Rotate(angle, axis));
308 }
309 
310 #endif
TLorentzRotation & operator=(const TLorentzRotation &)
Double_t YZ() const
TLorentzRotation & Rotate(Double_t, const TVector3 &)
Double_t TX() const
Double_t XZ() const
Double_t YX() const
Definition: TRotation.h:195
Double_t Z() const
Double_t YZ() const
Definition: TRotation.h:197
Double_t YX() const
Double_t XY() const
TLorentzRotation & Boost(Double_t, Double_t, Double_t)
Double_t TY() const
Double_t ZY() const
void SetBoost(Double_t, Double_t, Double_t)
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Double_t ZT() const
Double_t Y() const
TLorentzRotation MatrixMultiplication(const TLorentzRotation &) const
Double_t X() const
TLorentzRotation & operator*=(const TLorentzRotation &)
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t ZX() const
Definition: TRotation.h:198
Double_t XX() const
TLorentzRotation & Invert()
TLorentzRotation Inverse() const
TLorentzVector VectorMultiplication(const TLorentzVector &) const
Double_t TZ() const
Double_t XZ() const
Definition: TRotation.h:194
TLorentzRotation & RotateX(Double_t)
Double_t ZX() const
TLorentzRotation & RotateY(Double_t)
Double_t TT() const
Double_t YY() const
Definition: TRotation.h:196
Double_t ZZ() const
Double_t YY() const
TMarker * m
Definition: textangle.C:8
Double_t ZY() const
Definition: TRotation.h:199
Double_t XY() const
Definition: TRotation.h:193
TLorentzRotationRow(const TLorentzRotation &, int)
Bool_t operator==(const TLorentzRotation &) const
TLorentzVector operator*(const TLorentzVector &) const
double Double_t
Definition: RtypesCore.h:55
Mother of all ROOT objects.
Definition: TObject.h:58
Bool_t IsIdentity() const
TLorentzRotationRow operator[](int) const
TLorentzRotation & RotateZ(Double_t)
Double_t ZZ() const
Definition: TRotation.h:200
Double_t XT() const
TLorentzRotation & Transform(const TLorentzRotation &)
const Bool_t kTRUE
Definition: Rtypes.h:91
Bool_t operator!=(const TLorentzRotation &) const
Double_t T() const
Double_t operator()(int, int) const
Double_t YT() const
Double_t XX() const
Definition: TRotation.h:192