ROOT   Reference Guide
Searching...
No Matches
TLorentzRotation.cxx
Go to the documentation of this file.
1// @(#)root/physics:$Id$
2// Author: Peter Malzacher 19/06/99
3
4
5/** \class TLorentzRotation
6 \legacy{TLorentzRotation, Consider using instead ROOT::Math::LorentzRotation.}
7 \ingroup Physics
8The TLorentzRotation class describes Lorentz transformations including
9Lorentz boosts and rotations (see TRotation)
10
11~~~
12 | xx xy xz xt |
13 | |
14 | yx yy yz yt |
15 lambda = | |
16 | zx zy zz zt |
17 | |
18 | tx ty tz tt |
19~~~
20
21### Declaration
22By default it is initialized to the identity matrix, but it may also be
23initialized by an other TLorentzRotation,
24by a pure TRotation or by a boost:
25
26 TLorentzRotation l; // l is
27initialized as identity
28 TLorentzRotation m(l); // m = l
29 TRotation r;
30 TLorentzRotation lr(r);
31 TLorentzRotation lb1(bx,by,bz);
32 TVector3 b;
33 TLorentzRotation lb2(b);
34
35The Matrix for a Lorentz boosts is:
36
37~~~
38 | 1+gamma'*bx*bx gamma'*bx*by gamma'*bx*bz gamma*bx |
39 | gamma'*by*bx 1+gamma'*by*by gamma'*by*bz gamma*by |
40 | gamma'*bz*bx gamma'*bz*by 1+gamma'*bz*bz gamma*bz |
41 | gamma*bx gamma*by gamma*bz gamma |
42~~~
43
44with the boost vector b=(bx,by,bz) and gamma=1/Sqrt(1-beta*beta)
45and gamma'=(gamma-1)/beta*beta.
48XX(), XY() .. TT(),
49through the operator (int,int):
50
51~~~
52 Double_t xx;
53 TLorentzRotation l;
54 xx = l.XX(); // gets the xx component
55 xx = l(0,0); // gets the xx component
56
57 if (l==m) {...} // test for equality
58 if (l !=m) {...} // test for inequality
59 if (l.IsIdentity()) {...} // test for identity
60~~~
61
62### Transformations of a LorentzRotation
63
64#### Compound transformations
65There are four possibilities to find the product of two TLorentzRotation
66transformations:
67
68~~~
69 TLorentzRotation a,b,c;
70 c = b*a;// product
71 c = a.MatrixMultiplication(b); // a is unchanged
72 a *= b;// Attention: a=a*b
73 c = a.Transform(b)// a=b*a then c=a
74~~~
75
76#### Lorentz boosts
77
78~~~
79 Double_t bx, by, bz;
80 TVector3 v(bx,by,bz);
81 TLorentzRotation l;
82 l.Boost(v);
83 l.Boost(bx,by,bz);
84~~~
85
86#### Rotations
87
88~~~
89 TVector3 axis;
90 l.RotateX(TMath::Pi()); // rotation around x-axis
91 l.Rotate(.5,axis);// rotation around specified vector
92~~~
93
94#### Inverse transformation
95The matrix for the inverse transformation of a TLorentzRotation is as follows:
96
97~~~
98 | xx yx zx -tx |
99 | |
100 | xy yy zy -ty |
101 | |
102 | xz yz zz -tz |
103 | |
104 |-xt -yt -zt tt |
105~~~
106
107To return the inverse transformation keeping the current unchanged
108use the member function Inverse().
109Invert() inverts the current TLorentzRotation:
110
111~~~
112 l1 = l2.Inverse(); // l1 is inverse of l2, l2 unchanged
113 l1 = l2.Invert(); // invert l2, then l1=l2
114~~~
115
116### Transformation of a TLorentzVector
117To apply TLorentzRotation to TLorentzVector you can use
118either the VectorMultiplication() member function or the *
119operator. You can also use the Transform() function and the *=
120operator of the TLorentzVector class.:
121
122~~~
123 TLorentzVector v;
124 ...
125 v=l.VectorMultiplication(v);
126 v = l * v;
127
128 v.Transform(l);
129 v *= l; // Attention v = l*v
130~~~
131*/
132
133#include "TLorentzRotation.h"
134
136
138 : fxx(1.0), fxy(0.0), fxz(0.0), fxt(0.0),
139 fyx(0.0), fyy(1.0), fyz(0.0), fyt(0.0),
140 fzx(0.0), fzy(0.0), fzz(1.0), fzt(0.0),
141 ftx(0.0), fty(0.0), ftz(0.0), ftt(1.0) {}
142
144 : fxx(r.XX()), fxy(r.XY()), fxz(r.XZ()), fxt(0.0),
145 fyx(r.YX()), fyy(r.YY()), fyz(r.YZ()), fyt(0.0),
146 fzx(r.ZX()), fzy(r.ZY()), fzz(r.ZZ()), fzt(0.0),
147 ftx(0.0), fty(0.0), ftz(0.0), ftt(1.0) {}
148
150 fxx(r.fxx), fxy(r.fxy), fxz(r.fxz), fxt(r.fxt),
151 fyx(r.fyx), fyy(r.fyy), fyz(r.fyz), fyt(r.fyt),
152 fzx(r.fzx), fzy(r.fzy), fzz(r.fzz), fzt(r.fzt),
153 ftx(r.ftx), fty(r.fty), ftz(r.ftz), ftt(r.ftt) {}
154
156 Double_t rxx, Double_t rxy, Double_t rxz, Double_t rxt,
157 Double_t ryx, Double_t ryy, Double_t ryz, Double_t ryt,
158 Double_t rzx, Double_t rzy, Double_t rzz, Double_t rzt,
159 Double_t rtx, Double_t rty, Double_t rtz, Double_t rtt)
160 : fxx(rxx), fxy(rxy), fxz(rxz), fxt(rxt),
161 fyx(ryx), fyy(ryy), fyz(ryz), fyt(ryt),
162 fzx(rzx), fzy(rzy), fzz(rzz), fzt(rzt),
163 ftx(rtx), fty(rty), ftz(rtz), ftt(rtt) {}
164
166 Double_t by,
167 Double_t bz)
168{
169 //constructor
170 SetBoost(bx, by, bz);
171}
172
174 //copy constructor
175 SetBoost(p.X(), p.Y(), p.Z());
176}
177
179 //dereferencing operator
180 if (i == 0) {
181 if (j == 0) { return fxx; }
182 if (j == 1) { return fxy; }
183 if (j == 2) { return fxz; }
184 if (j == 3) { return fxt; }
185 } else if (i == 1) {
186 if (j == 0) { return fyx; }
187 if (j == 1) { return fyy; }
188 if (j == 2) { return fyz; }
189 if (j == 3) { return fyt; }
190 } else if (i == 2) {
191 if (j == 0) { return fzx; }
192 if (j == 1) { return fzy; }
193 if (j == 2) { return fzz; }
194 if (j == 3) { return fzt; }
195 } else if (i == 3) {
196 if (j == 0) { return ftx; }
197 if (j == 1) { return fty; }
198 if (j == 2) { return ftz; }
199 if (j == 3) { return ftt; }
200 }
202 return 0.0;
203}
204
206 //boost this Lorentz vector
207 Double_t bp2 = bx*bx + by*by + bz*bz;
208 Double_t gamma = 1.0 / TMath::Sqrt(1.0 - bp2);
209 Double_t bgamma = gamma * gamma / (1.0 + gamma);
210 fxx = 1.0 + bgamma * bx * bx;
211 fyy = 1.0 + bgamma * by * by;
212 fzz = 1.0 + bgamma * bz * bz;
213 fxy = fyx = bgamma * bx * by;
214 fxz = fzx = bgamma * bx * bz;
215 fyz = fzy = bgamma * by * bz;
216 fxt = ftx = gamma * bx;
217 fyt = fty = gamma * by;
218 fzt = ftz = gamma * bz;
219 ftt = gamma;
220}
221
223 //multiply this vector by a matrix
224 return TLorentzRotation(
225 fxx*b.fxx + fxy*b.fyx + fxz*b.fzx + fxt*b.ftx,
226 fxx*b.fxy + fxy*b.fyy + fxz*b.fzy + fxt*b.fty,
227 fxx*b.fxz + fxy*b.fyz + fxz*b.fzz + fxt*b.ftz,
228 fxx*b.fxt + fxy*b.fyt + fxz*b.fzt + fxt*b.ftt,
229 fyx*b.fxx + fyy*b.fyx + fyz*b.fzx + fyt*b.ftx,
230 fyx*b.fxy + fyy*b.fyy + fyz*b.fzy + fyt*b.fty,
231 fyx*b.fxz + fyy*b.fyz + fyz*b.fzz + fyt*b.ftz,
232 fyx*b.fxt + fyy*b.fyt + fyz*b.fzt + fyt*b.ftt,
233 fzx*b.fxx + fzy*b.fyx + fzz*b.fzx + fzt*b.ftx,
234 fzx*b.fxy + fzy*b.fyy + fzz*b.fzy + fzt*b.fty,
235 fzx*b.fxz + fzy*b.fyz + fzz*b.fzz + fzt*b.ftz,
236 fzx*b.fxt + fzy*b.fyt + fzz*b.fzt + fzt*b.ftt,
237 ftx*b.fxx + fty*b.fyx + ftz*b.fzx + ftt*b.ftx,
238 ftx*b.fxy + fty*b.fyy + ftz*b.fzy + ftt*b.fty,
239 ftx*b.fxz + fty*b.fyz + ftz*b.fzz + ftt*b.ftz,
240 ftx*b.fxt + fty*b.fyt + ftz*b.fzt + ftt*b.ftt);
241}
#define b(i)
Definition RSha256.hxx:100
#define ClassImp(name)
Definition Rtypes.h:377
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
<div class="legacybox"><h2>Legacy Code</h2> TLorentzRotation is a legacy interface: there will be no ...
TLorentzRotation MatrixMultiplication(const TLorentzRotation &) const
Double_t operator()(int, int) const
void SetBoost(Double_t, Double_t, Double_t)
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:973
<div class="legacybox"><h2>Legacy Code</h2> TRotation is a legacy interface: there will be no bug fix...
Definition TRotation.h:20
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:662