Logo ROOT  
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 
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
TLorentzRotation::MatrixMultiplication
TLorentzRotation MatrixMultiplication(const TLorentzRotation &) const
Definition: TLorentzRotation.cxx:221
m
auto * m
Definition: textangle.C:8
TLorentzRotation::ZZ
Double_t ZZ() const
Definition: TLorentzRotation.h:153
TVector3
TVector3 is a general three vector class, which can be used for the description of different vectors ...
Definition: TVector3.h:22
TLorentzRotation::TLorentzRotationRow::fRR
const TLorentzRotation * fRR
Definition: TLorentzRotation.h:30
TLorentzRotation::YX
Double_t YX() const
Definition: TLorentzRotation.h:147
TLorentzRotation::operator()
Double_t operator()(int, int) const
Definition: TLorentzRotation.cxx:177
TLorentzRotation::Transform
TLorentzRotation & Transform(const TLorentzRotation &)
Definition: TLorentzRotation.h:259
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TLorentzRotation::XX
Double_t XX() const
Definition: TLorentzRotation.h:143
TLorentzRotation::TZ
Double_t TZ() const
Definition: TLorentzRotation.h:157
TLorentzRotation::operator*
TLorentzVector operator*(const TLorentzVector &) const
Definition: TLorentzRotation.h:247
TLorentzRotation::TT
Double_t TT() const
Definition: TLorentzRotation.h:158
TLorentzRotation::operator*=
TLorentzRotation & operator*=(const TLorentzRotation &)
Definition: TLorentzRotation.h:255
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TLorentzRotation::fzt
Double_t fzt
Definition: TLorentzRotation.h:124
TLorentzRotation::Rotate
TLorentzRotation & Rotate(Double_t, const TVector3 &)
Definition: TLorentzRotation.h:298
TLorentzRotation::YT
Double_t YT() const
Definition: TLorentzRotation.h:150
TLorentzRotation::SetBoost
void SetBoost(Double_t, Double_t, Double_t)
Definition: TLorentzRotation.cxx:204
TLorentzRotation::fty
Double_t fty
Definition: TLorentzRotation.h:125
TLorentzRotation::TLorentzRotation
TLorentzRotation()
Definition: TLorentzRotation.cxx:136
TLorentzRotation::RotateX
TLorentzRotation & RotateX(Double_t)
Definition: TLorentzRotation.h:286
TLorentzRotation::Invert
TLorentzRotation & Invert()
Definition: TLorentzRotation.h:274
TLorentzRotation::operator==
Bool_t operator==(const TLorentzRotation &) const
Definition: TLorentzRotation.h:206
TLorentzRotation::fxz
Double_t fxz
Definition: TLorentzRotation.h:122
b
#define b(i)
Definition: RSha256.hxx:100
TLorentzRotation::XZ
Double_t XZ() const
Definition: TLorentzRotation.h:145
TLorentzRotation::Boost
TLorentzRotation & Boost(Double_t, Double_t, Double_t)
Definition: TLorentzRotation.h:278
TLorentzVector::Z
Double_t Z() const
Definition: TLorentzVector.h:273
TLorentzRotation::fyx
Double_t fyx
Definition: TLorentzRotation.h:123
TLorentzRotation::Inverse
TLorentzRotation Inverse() const
Definition: TLorentzRotation.h:267
bool
TLorentzRotation::fzx
Double_t fzx
Definition: TLorentzRotation.h:124
TLorentzRotation::fyz
Double_t fyz
Definition: TLorentzRotation.h:123
TLorentzRotation::fzz
Double_t fzz
Definition: TLorentzRotation.h:124
TLorentzRotation
The TLorentzRotation class describes Lorentz transformations including Lorentz boosts and rotations (...
Definition: TLorentzRotation.h:20
TLorentzRotation::TY
Double_t TY() const
Definition: TLorentzRotation.h:156
TLorentzRotation::XY
Double_t XY() const
Definition: TLorentzRotation.h:144
TLorentzVector::T
Double_t T() const
Definition: TLorentzVector.h:274
TLorentzVector::X
Double_t X() const
Definition: TLorentzVector.h:271
TLorentzRotation::fxx
Double_t fxx
Definition: TLorentzRotation.h:122
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TLorentzVector
Definition: TLorentzVector.h:32
TLorentzRotation::fxy
Double_t fxy
Definition: TLorentzRotation.h:122
TLorentzRotation::YZ
Double_t YZ() const
Definition: TLorentzRotation.h:149
TLorentzRotation::fxt
Double_t fxt
Definition: TLorentzRotation.h:122
TLorentzRotation::TLorentzRotationRow::TLorentzRotationRow
TLorentzRotationRow(const TLorentzRotation &, int)
Definition: TLorentzRotation.h:161
TLorentzRotation::ftz
Double_t ftz
Definition: TLorentzRotation.h:125
TLorentzRotation::VectorMultiplication
TLorentzVector VectorMultiplication(const TLorentzVector &) const
Definition: TLorentzRotation.h:240
TLorentzRotation::fyt
Double_t fyt
Definition: TLorentzRotation.h:123
TRotation
The TRotation class describes a rotation of objects of the TVector3 class.
Definition: TRotation.h:20
TLorentzRotation::RotateY
TLorentzRotation & RotateY(Double_t)
Definition: TLorentzRotation.h:290
TLorentzVector::Y
Double_t Y() const
Definition: TLorentzVector.h:272
TLorentzRotation::ftx
Double_t ftx
Definition: TLorentzRotation.h:125
TLorentzRotation::ZY
Double_t ZY() const
Definition: TLorentzRotation.h:152
TLorentzRotation::ZX
Double_t ZX() const
Definition: TLorentzRotation.h:151
TLorentzRotation::TX
Double_t TX() const
Definition: TLorentzRotation.h:155
TLorentzRotation::TLorentzRotationRow::operator[]
Double_t operator[](int) const
Definition: TLorentzRotation.h:163
Double_t
double Double_t
Definition: RtypesCore.h:59
TLorentzRotation::fzy
Double_t fzy
Definition: TLorentzRotation.h:124
TLorentzRotation::YY
Double_t YY() const
Definition: TLorentzRotation.h:148
TLorentzRotation::RotateZ
TLorentzRotation & RotateZ(Double_t)
Definition: TLorentzRotation.h:294
TLorentzRotation::IsIdentity
Bool_t IsIdentity() const
Definition: TLorentzRotation.h:231
TLorentzRotation::operator[]
TLorentzRotationRow operator[](int) const
Definition: TLorentzRotation.h:167
TLorentzRotation::operator!=
Bool_t operator!=(const TLorentzRotation &) const
Definition: TLorentzRotation.h:223
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TLorentzRotation::XT
Double_t XT() const
Definition: TLorentzRotation.h:146
TLorentzRotation::ftt
Double_t ftt
Definition: TLorentzRotation.h:125
TRotation.h
TLorentzRotation::operator=
TLorentzRotation & operator=(const TLorentzRotation &)
Definition: TLorentzRotation.h:171
TLorentzRotation::TLorentzRotationRow
Definition: TLorentzRotation.h:25
TLorentzRotation::fyy
Double_t fyy
Definition: TLorentzRotation.h:123
TLorentzVector.h
TLorentzRotation::ZT
Double_t ZT() const
Definition: TLorentzRotation.h:154
TLorentzRotation::TLorentzRotationRow::fII
int fII
Definition: TLorentzRotation.h:31