Logo ROOT   6.12/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.
45 ### Access to the matrix components/Comparisons
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 "TLorentzRotation.h"
133 
135 
137  : fxx(1.0), fxy(0.0), fxz(0.0), fxt(0.0),
138  fyx(0.0), fyy(1.0), fyz(0.0), fyt(0.0),
139  fzx(0.0), fzy(0.0), fzz(1.0), fzt(0.0),
140  ftx(0.0), fty(0.0), ftz(0.0), ftt(1.0) {}
141 
143  : fxx(r.XX()), fxy(r.XY()), fxz(r.XZ()), fxt(0.0),
144  fyx(r.YX()), fyy(r.YY()), fyz(r.YZ()), fyt(0.0),
145  fzx(r.ZX()), fzy(r.ZY()), fzz(r.ZZ()), fzt(0.0),
146  ftx(0.0), fty(0.0), ftz(0.0), ftt(1.0) {}
147 
149  fxx(r.fxx), fxy(r.fxy), fxz(r.fxz), fxt(r.fxt),
150  fyx(r.fyx), fyy(r.fyy), fyz(r.fyz), fyt(r.fyt),
151  fzx(r.fzx), fzy(r.fzy), fzz(r.fzz), fzt(r.fzt),
152  ftx(r.ftx), fty(r.fty), ftz(r.ftz), ftt(r.ftt) {}
153 
155  Double_t rxx, Double_t rxy, Double_t rxz, Double_t rxt,
156  Double_t ryx, Double_t ryy, Double_t ryz, Double_t ryt,
157  Double_t rzx, Double_t rzy, Double_t rzz, Double_t rzt,
158  Double_t rtx, Double_t rty, Double_t rtz, Double_t rtt)
159  : fxx(rxx), fxy(rxy), fxz(rxz), fxt(rxt),
160  fyx(ryx), fyy(ryy), fyz(ryz), fyt(ryt),
161  fzx(rzx), fzy(rzy), fzz(rzz), fzt(rzt),
162  ftx(rtx), fty(rty), ftz(rtz), ftt(rtt) {}
163 
165  Double_t by,
166  Double_t bz)
167 {
168  //constructor
169  SetBoost(bx, by, bz);
170 }
171 
173  //copy constructor
174  SetBoost(p.X(), p.Y(), p.Z());
175 }
176 
178  //derefencing operator
179  if (i == 0) {
180  if (j == 0) { return fxx; }
181  if (j == 1) { return fxy; }
182  if (j == 2) { return fxz; }
183  if (j == 3) { return fxt; }
184  } else if (i == 1) {
185  if (j == 0) { return fyx; }
186  if (j == 1) { return fyy; }
187  if (j == 2) { return fyz; }
188  if (j == 3) { return fyt; }
189  } else if (i == 2) {
190  if (j == 0) { return fzx; }
191  if (j == 1) { return fzy; }
192  if (j == 2) { return fzz; }
193  if (j == 3) { return fzt; }
194  } else if (i == 3) {
195  if (j == 0) { return ftx; }
196  if (j == 1) { return fty; }
197  if (j == 2) { return ftz; }
198  if (j == 3) { return ftt; }
199  }
200  Warning("operator()(i,j)","subscripting: bad indices(%d,%d)",i,j);
201  return 0.0;
202 }
203 
205  //boost this Lorentz vector
206  Double_t bp2 = bx*bx + by*by + bz*bz;
207  Double_t gamma = 1.0 / TMath::Sqrt(1.0 - bp2);
208  Double_t bgamma = gamma * gamma / (1.0 + gamma);
209  fxx = 1.0 + bgamma * bx * bx;
210  fyy = 1.0 + bgamma * by * by;
211  fzz = 1.0 + bgamma * bz * bz;
212  fxy = fyx = bgamma * bx * by;
213  fxz = fzx = bgamma * bx * bz;
214  fyz = fzy = bgamma * by * bz;
215  fxt = ftx = gamma * bx;
216  fyt = fty = gamma * by;
217  fzt = ftz = gamma * bz;
218  ftt = gamma;
219 }
220 
222  //multiply this vector by a matrix
223  return TLorentzRotation(
224  fxx*b.fxx + fxy*b.fyx + fxz*b.fzx + fxt*b.ftx,
225  fxx*b.fxy + fxy*b.fyy + fxz*b.fzy + fxt*b.fty,
226  fxx*b.fxz + fxy*b.fyz + fxz*b.fzz + fxt*b.ftz,
227  fxx*b.fxt + fxy*b.fyt + fxz*b.fzt + fxt*b.ftt,
228  fyx*b.fxx + fyy*b.fyx + fyz*b.fzx + fyt*b.ftx,
229  fyx*b.fxy + fyy*b.fyy + fyz*b.fzy + fyt*b.fty,
230  fyx*b.fxz + fyy*b.fyz + fyz*b.fzz + fyt*b.ftz,
231  fyx*b.fxt + fyy*b.fyt + fyz*b.fzt + fyt*b.ftt,
232  fzx*b.fxx + fzy*b.fyx + fzz*b.fzx + fzt*b.ftx,
233  fzx*b.fxy + fzy*b.fyy + fzz*b.fzy + fzt*b.fty,
234  fzx*b.fxz + fzy*b.fyz + fzz*b.fzz + fzt*b.ftz,
235  fzx*b.fxt + fzy*b.fyt + fzz*b.fzt + fzt*b.ftt,
236  ftx*b.fxx + fty*b.fyx + ftz*b.fzx + ftt*b.ftx,
237  ftx*b.fxy + fty*b.fyy + ftz*b.fzy + ftt*b.fty,
238  ftx*b.fxz + fty*b.fyz + ftz*b.fzz + ftt*b.ftz,
239  ftx*b.fxt + fty*b.fyt + ftz*b.fzt + ftt*b.ftt);
240 }
Double_t X() const
Definition: TVector3.h:216
The TLorentzRotation class describes Lorentz transformations including Lorentz boosts and rotations (...
Double_t ZZ() const
TLorentzRotation MatrixMultiplication(const TLorentzRotation &) const
void SetBoost(Double_t, Double_t, Double_t)
Double_t Y() const
Definition: TVector3.h:217
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
Double_t Z() const
Definition: TVector3.h:218
The TRotation class describes a rotation of objects of the TVector3 class.
Definition: TRotation.h:20
double gamma(double x)
ROOT::R::TRInterface & r
Definition: Object.C:4
Double_t XY() const
Double_t ZX() const
#define ClassImp(name)
Definition: Rtypes.h:359
double Double_t
Definition: RtypesCore.h:55
Double_t ZY() const
Mother of all ROOT objects.
Definition: TObject.h:37
Double_t YY() const
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 YX() const
Double_t Sqrt(Double_t x)
Definition: TMath.h:590
Double_t XX() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866