ROOT   6.08/07 Reference Guide
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  \ingroup Physics
7 The TLorentzRotation class describes Lorentz transformations including
8 Lorentz boosts and rotations (see TRotation)
9
10 ~~~
11  | xx xy xz xt |
12  | |
13  | yx yy yz yt |
14  lambda = | |
15  | zx zy zz zt |
16  | |
17  | tx ty tz tt |
18 ~~~
19
20 ### Declaration
21 By default it is initialized to the identity matrix, but it may also be
22 intialized by an other TLorentzRotation,
23 by a pure TRotation or by a boost:
24
25  TLorentzRotation l; // l is
26 initialized as identity
27  TLorentzRotation m(l); // m = l
28  TRotation r;
29  TLorentzRotation lr(r);
30  TLorentzRotation lb1(bx,by,bz);
31  TVector3 b;
32  TLorentzRotation lb2(b);
33
34 The Matrix for a Lorentz boosts is:
35
36 ~~~
37  | 1+gamma'*bx*bx gamma'*bx*by gamma'*bx*bz gamma*bx |
38  | gamma'*by*bx 1+gamma'*by*by gamma'*by*bz gamma*by |
39  | gamma'*bz*bx gamma'*bz*by 1+gamma'*bz*bz gamma*bz |
40  | gamma*bx gamma*by gamma*bz gamma |
41 ~~~
42
43 with the boost vector b=(bx,by,bz) and gamma=1/Sqrt(1-beta*beta)
44 and gamma'=(gamma-1)/beta*beta.
46 Access to the matrix components is possible through the member functions
47 XX(), XY() .. TT(),
48 through the operator (int,int):
49
50 ~~~
51  Double_t xx;
52  TLorentzRotation l;
53  xx = l.XX(); // gets the xx component
54  xx = l(0,0); // gets the xx component
55
56  if (l==m) {...} // test for equality
57  if (l !=m) {...} // test for inequality
58  if (l.IsIdentity()) {...} // test for identity
59 ~~~
60
61 ### Transformations of a LorentzRotation
62
63 #### Compound transformations
64 There are four possibilities to find the product of two TLorentzRotation
65 transformations:
66
67 ~~~
68  TLorentzRotation a,b,c;
69  c = b*a;// product
70  c = a.MatrixMultiplication(b); // a is unchanged
71  a *= b;// Attention: a=a*b
72  c = a.Transform(b)// a=b*a then c=a
73 ~~~
74
75 #### Lorentz boosts
76
77 ~~~
78  Double_t bx, by, bz;
79  TVector3 v(bx,by,bz);
80  TLorentzRotation l;
81  l.Boost(v);
82  l.Boost(bx,by,bz);
83 ~~~
84
85 #### Rotations
86
87 ~~~
88  TVector3 axis;
89  l.RotateX(TMath::Pi()); // rotation around x-axis
90  l.Rotate(.5,axis);// rotation around specified vector
91 ~~~
92
93 #### Inverse transformation
94 The matrix for the inverse transformation of a TLorentzRotation is as follows:
95
96 ~~~
97  | xx yx zx -tx |
98  | |
99  | xy yy zy -ty |
100  | |
101  | xz yz zz -tz |
102  | |
103  |-xt -yt -zt tt |
104 ~~~
105
106 To return the inverse transformation keeping the current unchanged
107 use the member function Inverse().
108 Invert() inverts the current TLorentzRotation:
109
110 ~~~
111  l1 = l2.Inverse(); // l1 is inverse of l2, l2 unchanged
112  l1 = l2.Invert(); // invert l2, then l1=l2
113 ~~~
114
115 ### Transformation of a TLorentzVector
116 To apply TLorentzRotation to TLorentzVector you can use
117 either the VectorMultiplication() member function or the *
118 operator. You can also use the Transform() function and the *=
119 operator of the TLorentzVector class.:
120
121 ~~~
122  TLorentzVector v;
123  ...
124  v=l.VectorMultiplication(v);
125  v = l * v;
126
127  v.Transform(l);
128  v *= l; // Attention v = l*v
129 ~~~
130 */
131
132 #include "TError.h"
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  //derefencing 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 }
Double_t X() const
Definition: TVector3.h:224
The TLorentzRotation class describes Lorentz transformations including Lorentz boosts and rotations (...
TLorentzRotation MatrixMultiplication(const TLorentzRotation &) const
void SetBoost(Double_t, Double_t, Double_t)
Double_t Y() const
Definition: TVector3.h:225
TVector3 is a general three vector class, which can be used for the description of different vectors ...
Definition: TVector3.h:30
Double_t Z() const
Definition: TVector3.h:226
The TRotation class describes a rotation of objects of the TVector3 class.
Definition: TRotation.h:22
double gamma(double x)
TRandom2 r(17)
#define ClassImp(name)
Definition: Rtypes.h:279
double Double_t
Definition: RtypesCore.h:55
Mother of all ROOT objects.
Definition: TObject.h:37
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 operator()(int, int) const
Double_t Sqrt(Double_t x)
Definition: TMath.h:464
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:911