Logo ROOT   6.12/07
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 #include "TRotation.h"
17 #include "TLorentzVector.h"
18 
19 
20 class TLorentzRotation : public TObject {
21 
22 
23 public:
24 
26 public:
27  inline TLorentzRotationRow(const TLorentzRotation &, int);
28  inline Double_t operator [] (int) const;
29 private:
31  int fII;
32 };
33  // Helper class for implemention of C-style subscripting r[i][j]
34 
36  // Default constructor. Gives a unit matrix.
37 
38  TLorentzRotation(const TRotation &);
39  // Constructor for 3d rotations.
40 
42  // Copy constructor.
43 
45  TLorentzRotation(const TVector3 &);
46  // Constructors giving a Lorenz-boost.
47 
48  inline Double_t XX() const;
49  inline Double_t XY() const;
50  inline Double_t XZ() const;
51  inline Double_t XT() const;
52  inline Double_t YX() const;
53  inline Double_t YY() const;
54  inline Double_t YZ() const;
55  inline Double_t YT() const;
56  inline Double_t ZX() const;
57  inline Double_t ZY() const;
58  inline Double_t ZZ() const;
59  inline Double_t ZT() const;
60  inline Double_t TX() const;
61  inline Double_t TY() const;
62  inline Double_t TZ() const;
63  inline Double_t TT() const;
64  // Elements of the matrix.
65 
66  inline TLorentzRotationRow operator [] (int) const;
67  // Returns object of the helper class for C-style subscripting r[i][j]
68 
69 
70  Double_t operator () (int, int) const;
71  // Fortran-style subscriptimg: returns (i,j) element of the matrix.
72 
73 
75  inline TLorentzRotation & operator = (const TRotation &);
76  // Assignment.
77 
78  inline Bool_t operator == (const TLorentzRotation &) const;
79  inline Bool_t operator != (const TLorentzRotation &) const;
80  // Comparisons.
81 
82  inline Bool_t IsIdentity() const;
83  // Returns true if the Identity matrix.
84 
86  inline TLorentzVector operator * (const TLorentzVector &) const;
87  // Multiplication with a Lorentz vector.
88 
90  inline TLorentzRotation operator * (const TLorentzRotation &) const;
93  inline TLorentzRotation & Transform(const TRotation &);
94  // Matrix multiplication.
95  // Note: a *= b; <=> a = a * b; while a.Transform(b); <=> a = b * a;
96 
97  inline TLorentzRotation Inverse() const;
98  // Return the inverse.
99 
100  inline TLorentzRotation & Invert();
101  // Inverts the LorentzRotation matrix.
102 
104  inline TLorentzRotation & Boost(const TVector3 &);
105  // Lorenz boost.
106 
108  // Rotation around x-axis.
109 
111  // Rotation around y-axis.
112 
114  // Rotation around z-axis.
115 
116  inline TLorentzRotation & Rotate(Double_t, const TVector3 &);
117  inline TLorentzRotation & Rotate(Double_t, const TVector3 *);
118  // Rotation around specified vector.
119 
120 protected:
121 
123  fyx, fyy, fyz, fyt,
124  fzx, fzy, fzz, fzt,
125  ftx, fty, ftz, ftt;
126  // The matrix elements.
127 
129  // Set elements according to a boost vector.
130 
135  // Protected constructor.
136 
137  ClassDef(TLorentzRotation,1) // Lorentz transformations including boosts and rotations
138 
139 };
140 
141 
142 
143 inline Double_t TLorentzRotation::XX() const { return fxx; }
144 inline Double_t TLorentzRotation::XY() const { return fxy; }
145 inline Double_t TLorentzRotation::XZ() const { return fxz; }
146 inline Double_t TLorentzRotation::XT() const { return fxt; }
147 inline Double_t TLorentzRotation::YX() const { return fyx; }
148 inline Double_t TLorentzRotation::YY() const { return fyy; }
149 inline Double_t TLorentzRotation::YZ() const { return fyz; }
150 inline Double_t TLorentzRotation::YT() const { return fyt; }
151 inline Double_t TLorentzRotation::ZX() const { return fzx; }
152 inline Double_t TLorentzRotation::ZY() const { return fzy; }
153 inline Double_t TLorentzRotation::ZZ() const { return fzz; }
154 inline Double_t TLorentzRotation::ZT() const { return fzt; }
155 inline Double_t TLorentzRotation::TX() const { return ftx; }
156 inline Double_t TLorentzRotation::TY() const { return fty; }
157 inline Double_t TLorentzRotation::TZ() const { return ftz; }
158 inline Double_t TLorentzRotation::TT() const { return ftt; }
159 
161 (const TLorentzRotation & r, int i) : fRR(&r), fII(i) {}
162 
164  return fRR->operator()(fII,jj);
165 }
166 
168  return TLorentzRotationRow(*this, i);
169 }
170 
172  fxx = r.fxx; fxy = r.fxy; fxz = r.fxz; fxt = r.fxt;
173  fyx = r.fyx; fyy = r.fyy; fyz = r.fyz; fyt = r.fyt;
174  fzx = r.fzx; fzy = r.fzy; fzz = r.fzz; fzt = r.fzt;
175  ftx = r.ftx; fty = r.fty; ftz = r.ftz; ftt = r.ftt;
176  return *this;
177 }
178 
179 //inline TLorentzRotation &
180 //TLorentzRotation::operator = (const TRotation & r) {
181 // mxx = r.xx(); mxy = r.xy(); mxz = r.xz(); mxt = 0.0;
182 // myx = r.yx(); myy = r.yy(); myz = r.yz(); myt = 0.0;
183 // mzx = r.zx(); mzy = r.zy(); mzz = r.zz(); mzt = 0.0;
184 // mtx = 0.0; mty = 0.0; mtz = 0.0; mtt = 1.0;
185 // return *this;
186 //}
187 
189  fxx = r.XX(); fxy = r.XY(); fxz = r.XZ(); fxt = 0.0;
190  fyx = r.YX(); fyy = r.YY(); fyz = r.YZ(); fyt = 0.0;
191  fzx = r.ZX(); fzy = r.ZY(); fzz = r.ZZ(); fzt = 0.0;
192  ftx = 0.0; fty = 0.0; ftz = 0.0; ftt = 1.0;
193  return *this;
194 }
195 
196 
197 //inline Bool_t
198 //TLorentzRotation::operator == (const TLorentzRotation & r) const {
199 // return (mxx == r.xx() && mxy == r.xy() && mxz == r.xz() && mxt == r.xt() &&
200 // myx == r.yx() && myy == r.yy() && myz == r.yz() && myt == r.yt() &&
201 // mzx == r.zx() && mzy == r.zy() && mzz == r.zz() && mzt == r.zt() &&
202 // mtx == r.tx() && mty == r.ty() && mtz == r.tz() && mtt == r.tt())
203 // ? kTRUE : kFALSE;
204 //}
205 
207  return (fxx == r.fxx && fxy == r.fxy && fxz == r.fxz && fxt == r.fxt &&
208  fyx == r.fyx && fyy == r.fyy && fyz == r.fyz && fyt == r.fyt &&
209  fzx == r.fzx && fzy == r.fzy && fzz == r.fzz && fzt == r.fzt &&
210  ftx == r.ftx && fty == r.fty && ftz == r.ftz && ftt == r.ftt)
211  ? kTRUE : kFALSE;
212 }
213 
214 //inline Bool_t
215 //TLorentzRotation::operator != (const TLorentzRotation & r) const {
216 // return (mxx != r.xx() || mxy != r.xy() || mxz != r.xz() || mxt != r.xt() ||
217 // myx != r.yx() || myy != r.yy() || myz != r.yz() || myt != r.yt() ||
218 // mzx != r.zx() || mzy != r.zy() || mzz != r.zz() || mzt != r.zt() ||
219 // mtx != r.tx() || mty != r.ty() || mtz != r.tz() || mtt != r.tt())
220 // ? kTRUE : kFALSE;
221 //}
222 
224  return (fxx != r.fxx || fxy != r.fxy || fxz != r.fxz || fxt != r.fxt ||
225  fyx != r.fyx || fyy != r.fyy || fyz != r.fyz || fyt != r.fyt ||
226  fzx != r.fzx || fzy != r.fzy || fzz != r.fzz || fzt != r.fzt ||
227  ftx != r.ftx || fty != r.fty || ftz != r.ftz || ftt != r.ftt)
228  ? kTRUE : kFALSE;
229 }
230 
232  return (fxx == 1.0 && fxy == 0.0 && fxz == 0.0 && fxt == 0.0 &&
233  fyx == 0.0 && fyy == 1.0 && fyz == 0.0 && fyt == 0.0 &&
234  fzx == 0.0 && fzy == 0.0 && fzz == 1.0 && fzt == 0.0 &&
235  ftx == 0.0 && fty == 0.0 && ftz == 0.0 && ftt == 1.0)
236  ? kTRUE : kFALSE;
237 }
238 
239 
241  return TLorentzVector(fxx*p.X()+fxy*p.Y()+fxz*p.Z()+fxt*p.T(),
242  fyx*p.X()+fyy*p.Y()+fyz*p.Z()+fyt*p.T(),
243  fzx*p.X()+fzy*p.Y()+fzz*p.Z()+fzt*p.T(),
244  ftx*p.X()+fty*p.Y()+ftz*p.Z()+ftt*p.T());
245 }
246 
248  return VectorMultiplication(p);
249 }
250 
252  return MatrixMultiplication(m);
253 }
254 
256  return *this = MatrixMultiplication(m);
257 }
258 
260  return *this = m.MatrixMultiplication(*this);
261 }
262 
264  return Transform(TLorentzRotation(m));
265 }
266 
268  return TLorentzRotation( fxx, fyx, fzx, -ftx,
269  fxy, fyy, fzy, -fty,
270  fxz, fyz, fzz, -ftz,
271  -fxt, -fyt, -fzt, ftt);
272 }
273 
275  return *this = Inverse();
276 }
277 
279  return Transform(TLorentzRotation(bx, by, bz));
280 }
281 
283  return Transform(TLorentzRotation(b));
284 }
285 
287  return Transform(TRotation().RotateX(angle));
288 }
289 
291  return Transform(TRotation().RotateY(angle));
292 }
293 
295  return Transform(TRotation().RotateZ(angle));
296 }
297 
299  return Transform(TRotation().Rotate(angle, axis));
300 }
301 
303  return Transform(TRotation().Rotate(angle, axis));
304 }
305 
306 #endif
The TLorentzRotation class describes Lorentz transformations including Lorentz boosts and rotations (...
TLorentzRotation & operator=(const TLorentzRotation &)
TLorentzRotation & Rotate(Double_t, const TVector3 &)
Double_t TZ() const
Double_t Z() const
TLorentzVector operator*(const TLorentzVector &) const
Double_t TT() const
auto * m
Definition: textangle.C:8
Double_t ZZ() const
Double_t ZY() const
Definition: TRotation.h:197
Double_t XZ() const
Definition: TRotation.h:192
Double_t YT() const
TLorentzRotation & Boost(Double_t, Double_t, Double_t)
TLorentzRotation MatrixMultiplication(const TLorentzRotation &) const
TLorentzRotation Inverse() const
void SetBoost(Double_t, Double_t, Double_t)
bool Bool_t
Definition: RtypesCore.h:59
Bool_t operator==(const TLorentzRotation &) const
Double_t YX() const
Definition: TRotation.h:193
TLorentzRotation & operator*=(const TLorentzRotation &)
#define ClassDef(name, id)
Definition: Rtypes.h:320
Double_t YZ() const
Definition: TRotation.h:195
Double_t TY() const
TLorentzRotation & Invert()
Double_t XZ() const
Double_t YZ() const
TVector3 is a general three vector class, which can be used for the description of different vectors ...
Definition: TVector3.h:22
TLorentzRotation & RotateX(Double_t)
TLorentzRotation & RotateY(Double_t)
The TRotation class describes a rotation of objects of the TVector3 class.
Definition: TRotation.h:20
Double_t YY() const
Definition: TRotation.h:194
ROOT::R::TRInterface & r
Definition: Object.C:4
TLorentzVector is a general four-vector class, which can be used either for the description of positi...
Double_t XY() const
TLorentzRotationRow operator[](int) const
Double_t ZX() const
Double_t ZX() const
Definition: TRotation.h:196
Double_t XY() const
Definition: TRotation.h:191
Double_t XT() const
const Bool_t kFALSE
Definition: RtypesCore.h:88
TLorentzRotationRow(const TLorentzRotation &, int)
double Double_t
Definition: RtypesCore.h:55
Double_t Y() const
Double_t ZT() const
Double_t ZY() const
Double_t T() const
Double_t TX() const
Mother of all ROOT objects.
Definition: TObject.h:37
TLorentzVector VectorMultiplication(const TLorentzVector &) const
Double_t YY() const
TLorentzRotation & RotateZ(Double_t)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Double_t ZZ() const
Definition: TRotation.h:198
Double_t XX() const
Definition: TRotation.h:190
Double_t X() const
Double_t operator()(int, int) const
Double_t YX() const
TLorentzRotation & Transform(const TLorentzRotation &)
Double_t XX() const
Bool_t IsIdentity() const
const Bool_t kTRUE
Definition: RtypesCore.h:87
Bool_t operator!=(const TLorentzRotation &) const