ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TLorentzRotation.cxx
Go to the documentation of this file.
1 // @(#)root/physics:$Id$
2 // Author: Peter Malzacher 19/06/99
3 
4 //______________________________________________________________________________
5 //*-*-*-*-*-*-*-*-*-*-*-*The Physics Vector package *-*-*-*-*-*-*-*-*-*-*-*
6 //*-* ========================== *
7 //*-* The Physics Vector package consists of five classes: *
8 //*-* - TVector2 *
9 //*-* - TVector3 *
10 //*-* - TRotation *
11 //*-* - TLorentzVector *
12 //*-* - TLorentzRotation *
13 //*-* It is a combination of CLHEPs Vector package written by *
14 //*-* Leif Lonnblad, Andreas Nilsson and Evgueni Tcherniaev *
15 //*-* and a ROOT package written by Pasha Murat. *
16 //*-* for CLHEP see: http://wwwinfo.cern.ch/asd/lhc++/clhep/ *
17 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
18 //BEGIN_HTML <!--
19 /* -->
20 <H2>
21 TLorentzRotation</H2>
22 The TLorentzRotation class describes Lorentz transformations including
23 Lorentz boosts and rotations (see TRotation)
24 
25 <P><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
26 | xx&nbsp; xy&nbsp; xz&nbsp; xt |</TT>
27 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
28 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
29 |</TT>
30 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
31 | yx&nbsp; yy&nbsp; yz&nbsp; yt |</TT>
32 <BR><TT>&nbsp;&nbsp; lambda = |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
33 |</TT>
34 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
35 | zx&nbsp; zy&nbsp; zz&nbsp; zt |</TT>
36 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
37 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
38 |</TT>
39 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
40 | tx&nbsp; ty&nbsp; tz&nbsp; tt |</TT>
41 <BR>&nbsp;
42 <H3>
43 Declaration</H3>
44 By default it is initialized to the identity matrix, but it may also be
45 intialized by an other <TT>TLorentzRotation</TT>,
46 <BR>by a pure TRotation or by a boost:
47 
48 <P><TT>&nbsp; TLorentzRotation l;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // l is
49 initialized as identity</TT>
50 <BR><TT>&nbsp; TLorentzRotation m(l);&nbsp;&nbsp; // m = l</TT>
51 <BR><TT>&nbsp; TRotation r;</TT>
52 <BR><TT>&nbsp; TLorentzRotation lr(r);</TT>
53 <BR><TT>&nbsp; TLorentzRotation lb1(bx,by,bz);</TT>
54 <BR><TT>&nbsp; TVector3 b;</TT>
55 <BR><TT>&nbsp; TLorentzRotation lb2(b);</TT>
56 
57 <P>The Matrix for a Lorentz boosts is:
58 
59 <P><TT>&nbsp;| 1+gamma'*bx*bx&nbsp; gamma'*bx*by&nbsp;&nbsp; gamma'*bx*bz&nbsp;
60 gamma*bx |</TT>
61 <BR><TT>&nbsp;|&nbsp; gamma'*by*bx&nbsp; 1+gamma'*by*by&nbsp; gamma'*by*bz&nbsp;
62 gamma*by |</TT>
63 <BR><TT>&nbsp;|&nbsp; gamma'*bz*bx&nbsp;&nbsp; gamma'*bz*by&nbsp; 1+gamma'*bz*bz
64 gamma*bz |</TT>
65 <BR><TT>&nbsp;|&nbsp;&nbsp;&nbsp; gamma*bx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
66 gamma*by&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gamma*bz&nbsp;&nbsp;&nbsp;&nbsp;
67 gamma&nbsp;&nbsp; |</TT>
68 
69 <P>with the boost vector <TT><B>b</B>=(bx,by,bz) </TT>and<TT> gamma=1/Sqrt(1-beta*beta)
70 </TT>and<TT> gamma'=(gamma-1)/beta*beta.</TT>
71 <H3>
72 Access to the matrix components/Comparisons</H3>
73 Access to the matrix components is possible through the member functions
74 XX(), XY() .. TT(),
75 <BR>through the operator (int,int):
76 
77 <P><TT>&nbsp; Double_t xx;</TT>
78 <BR><TT>&nbsp; TLorentzRotation l;</TT>
79 <BR><TT>&nbsp; xx = l.XX();&nbsp;&nbsp;&nbsp; // gets the xx component</TT>
80 <BR><TT>&nbsp; xx = l(0,0);&nbsp;&nbsp;&nbsp; // gets the xx component</TT>
81 
82 <P><TT>&nbsp; if (l==m) {...}&nbsp; // test for equality</TT>
83 <BR><TT>&nbsp; if (l !=m) {...} // test for inequality</TT>
84 <BR><TT>&nbsp; if (l.IsIdentity()) {...} // test for identity</TT>
85 <BR>&nbsp;
86 <H3>
87 Transformations of a LorentzRotation</H3>
88 
89 <H5>
90 Compound transformations</H5>
91 There are four possibilities to find the product of two <TT>TLorentzRotation</TT>
92 transformations:
93 
94 <P><TT>&nbsp; TLorentzRotation a,b,c;</TT>
95 <BR><TT>&nbsp; c = b*a;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// product</TT>
96 <BR><TT>&nbsp; c = a.MatrixMultiplication(b);&nbsp; // a is unchanged</TT>
97 <BR><TT>&nbsp; a *= b;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Attention: a=a*b</TT>
98 <BR><TT>&nbsp; c = a.Transform(b)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// a=b*a then c=a</TT>
99 <BR>&nbsp;
100 <H5>
101 Lorentz boosts</H5>
102 <TT>&nbsp; Double_t bx, by, bz;</TT>
103 <BR><TT>&nbsp; TVector3 v(bx,by,bz);</TT>
104 <BR><TT>&nbsp; TLorentzRotation l;</TT>
105 <BR><TT>&nbsp; l.Boost(v);</TT>
106 <BR><TT>&nbsp; l.Boost(bx,by,bz);</TT>
107 <BR>&nbsp;
108 <H5>
109 Rotations</H5>
110 <TT>&nbsp; TVector3 axis;</TT>
111 <BR><TT>&nbsp; l.RotateX(TMath::Pi());&nbsp;&nbsp; //&nbsp; rotation around
112 x-axis</TT>
113 <BR><TT>&nbsp; l.Rotate(.5,axis);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp; rotation around specified vector</TT>
114 <H5>
115 Inverse transformation</H5>
116 The matrix for the inverse transformation of a TLorentzRotation is as follows:
117 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
118 | xx&nbsp; yx&nbsp; zx -tx |</TT>
119 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
120 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
121 |</TT>
122 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
123 | xy&nbsp; yy&nbsp; zy -ty |</TT>
124 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
125 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
126 |</TT>
127 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
128 | xz&nbsp; yz&nbsp; zz -tz |</TT>
129 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
130 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
131 |</TT>
132 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
133 |-xt -yt -zt&nbsp; tt |</TT>
134 <BR>To return the inverse transformation keeping the current unchanged
135 use the memberfunction <TT>Inverse()</TT>.
136 <BR><TT>Invert()</TT> inverts the current <TT>TLorentzRotation</TT>:
137 
138 <P><TT>&nbsp; l1 = l2.Inverse();&nbsp; // l1 is inverse of l2, l2 unchanged</TT>
139 <BR><TT>&nbsp; l1 = l2.Invert();&nbsp;&nbsp; // invert l2, then&nbsp; l1=l2</TT>
140 <H3>
141 Transformation of a TLorentzVector</H3>
142 To apply <TT>TLorentzRotation</TT> to <TT>TLorentzVector</TT> you can use
143 either the <TT>VectorMultiplication()</TT> member function or the <TT>*</TT>
144 operator. You can also use the <TT>Transform()</TT> function and the <TT>*=</TT>
145 operator of the <TT>TLorentzVector</TT> class.:
146 
147 <P><TT>&nbsp; TLorentzVector v;</TT>
148 <BR><TT>&nbsp; ...</TT>
149 <BR><TT>&nbsp; v=l.VectorMultiplication(v);</TT>
150 <BR><TT>&nbsp; v = l * v;</TT>
151 
152 <P><TT>&nbsp; v.Transform(l);</TT>
153 <BR><TT>&nbsp; v *= l;&nbsp; // Attention v = l*v</TT>
154 <!--*/
155 // -->END_HTML
156 //
157 
158 #include "TError.h"
159 #include "TLorentzRotation.h"
160 
162 
164  : fxx(1.0), fxy(0.0), fxz(0.0), fxt(0.0),
165  fyx(0.0), fyy(1.0), fyz(0.0), fyt(0.0),
166  fzx(0.0), fzy(0.0), fzz(1.0), fzt(0.0),
167  ftx(0.0), fty(0.0), ftz(0.0), ftt(1.0) {}
168 
170  : fxx(r.XX()), fxy(r.XY()), fxz(r.XZ()), fxt(0.0),
171  fyx(r.YX()), fyy(r.YY()), fyz(r.YZ()), fyt(0.0),
172  fzx(r.ZX()), fzy(r.ZY()), fzz(r.ZZ()), fzt(0.0),
173  ftx(0.0), fty(0.0), ftz(0.0), ftt(1.0) {}
174 
176  fxx(r.fxx), fxy(r.fxy), fxz(r.fxz), fxt(r.fxt),
177  fyx(r.fyx), fyy(r.fyy), fyz(r.fyz), fyt(r.fyt),
178  fzx(r.fzx), fzy(r.fzy), fzz(r.fzz), fzt(r.fzt),
179  ftx(r.ftx), fty(r.fty), ftz(r.ftz), ftt(r.ftt) {}
180 
182  Double_t rxx, Double_t rxy, Double_t rxz, Double_t rxt,
183  Double_t ryx, Double_t ryy, Double_t ryz, Double_t ryt,
184  Double_t rzx, Double_t rzy, Double_t rzz, Double_t rzt,
185  Double_t rtx, Double_t rty, Double_t rtz, Double_t rtt)
186  : fxx(rxx), fxy(rxy), fxz(rxz), fxt(rxt),
187  fyx(ryx), fyy(ryy), fyz(ryz), fyt(ryt),
188  fzx(rzx), fzy(rzy), fzz(rzz), fzt(rzt),
189  ftx(rtx), fty(rty), ftz(rtz), ftt(rtt) {}
190 
192  Double_t by,
193  Double_t bz)
194 {
195  //constructor
196  SetBoost(bx, by, bz);
197 }
198 
200  //copy constructor
201  SetBoost(p.X(), p.Y(), p.Z());
202 }
203 
205  //derefencing operator
206  if (i == 0) {
207  if (j == 0) { return fxx; }
208  if (j == 1) { return fxy; }
209  if (j == 2) { return fxz; }
210  if (j == 3) { return fxt; }
211  } else if (i == 1) {
212  if (j == 0) { return fyx; }
213  if (j == 1) { return fyy; }
214  if (j == 2) { return fyz; }
215  if (j == 3) { return fyt; }
216  } else if (i == 2) {
217  if (j == 0) { return fzx; }
218  if (j == 1) { return fzy; }
219  if (j == 2) { return fzz; }
220  if (j == 3) { return fzt; }
221  } else if (i == 3) {
222  if (j == 0) { return ftx; }
223  if (j == 1) { return fty; }
224  if (j == 2) { return ftz; }
225  if (j == 3) { return ftt; }
226  }
227  Warning("operator()(i,j)","subscripting: bad indeces(%d,%d)",i,j);
228  return 0.0;
229 }
230 
232  //boost this Lorentz vector
233  Double_t bp2 = bx*bx + by*by + bz*bz;
234  Double_t gamma = 1.0 / TMath::Sqrt(1.0 - bp2);
235  Double_t bgamma = gamma * gamma / (1.0 + gamma);
236  fxx = 1.0 + bgamma * bx * bx;
237  fyy = 1.0 + bgamma * by * by;
238  fzz = 1.0 + bgamma * bz * bz;
239  fxy = fyx = bgamma * bx * by;
240  fxz = fzx = bgamma * bx * bz;
241  fyz = fzy = bgamma * by * bz;
242  fxt = ftx = gamma * bx;
243  fyt = fty = gamma * by;
244  fzt = ftz = gamma * bz;
245  ftt = gamma;
246 }
247 
249  //multiply this vector by a matrix
250  return TLorentzRotation(
251  fxx*b.fxx + fxy*b.fyx + fxz*b.fzx + fxt*b.ftx,
252  fxx*b.fxy + fxy*b.fyy + fxz*b.fzy + fxt*b.fty,
253  fxx*b.fxz + fxy*b.fyz + fxz*b.fzz + fxt*b.ftz,
254  fxx*b.fxt + fxy*b.fyt + fxz*b.fzt + fxt*b.ftt,
255  fyx*b.fxx + fyy*b.fyx + fyz*b.fzx + fyt*b.ftx,
256  fyx*b.fxy + fyy*b.fyy + fyz*b.fzy + fyt*b.fty,
257  fyx*b.fxz + fyy*b.fyz + fyz*b.fzz + fyt*b.ftz,
258  fyx*b.fxt + fyy*b.fyt + fyz*b.fzt + fyt*b.ftt,
259  fzx*b.fxx + fzy*b.fyx + fzz*b.fzx + fzt*b.ftx,
260  fzx*b.fxy + fzy*b.fyy + fzz*b.fzy + fzt*b.fty,
261  fzx*b.fxz + fzy*b.fyz + fzz*b.fzz + fzt*b.ftz,
262  fzx*b.fxt + fzy*b.fyt + fzz*b.fzt + fzt*b.ftt,
263  ftx*b.fxx + fty*b.fyx + ftz*b.fzx + ftt*b.ftx,
264  ftx*b.fxy + fty*b.fyy + ftz*b.fzy + ftt*b.fty,
265  ftx*b.fxz + fty*b.fyz + ftz*b.fzz + ftt*b.ftz,
266  ftx*b.fxt + fty*b.fyt + ftz*b.fzt + ftt*b.ftt);
267 }
Double_t Z() const
Definition: TVector3.h:222
void SetBoost(Double_t, Double_t, Double_t)
TLorentzRotation MatrixMultiplication(const TLorentzRotation &) const
double gamma(double x)
ROOT::R::TRInterface & r
Definition: Object.C:4
Double_t X() const
Definition: TVector3.h:220
double Double_t
Definition: RtypesCore.h:55
Mother of all ROOT objects.
Definition: TObject.h:58
Double_t Y() const
Definition: TVector3.h:221
Double_t Sqrt(Double_t x)
Definition: TMath.h:464
ClassImp(TLorentzRotation) TLorentzRotation
Double_t operator()(int, int) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904