00001 // @(#)root/physics:$Id: TLorentzRotation.cxx 22448 2008-03-05 07:48:37Z moneta $ 00002 // Author: Peter Malzacher 19/06/99 00003 00004 //______________________________________________________________________________ 00005 //*-*-*-*-*-*-*-*-*-*-*-*The Physics Vector package *-*-*-*-*-*-*-*-*-*-*-* 00006 //*-* ========================== * 00007 //*-* The Physics Vector package consists of five classes: * 00008 //*-* - TVector2 * 00009 //*-* - TVector3 * 00010 //*-* - TRotation * 00011 //*-* - TLorentzVector * 00012 //*-* - TLorentzRotation * 00013 //*-* It is a combination of CLHEPs Vector package written by * 00014 //*-* Leif Lonnblad, Andreas Nilsson and Evgueni Tcherniaev * 00015 //*-* and a ROOT package written by Pasha Murat. * 00016 //*-* for CLHEP see: http://wwwinfo.cern.ch/asd/lhc++/clhep/ * 00017 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 00018 //BEGIN_HTML <!-- 00019 /* --> 00020 <H2> 00021 TLorentzRotation</H2> 00022 The TLorentzRotation class describes Lorentz transformations including 00023 Lorentz boosts and rotations (see TRotation) 00024 00025 <P><TT> 00026 | xx xy xz xt |</TT> 00027 <BR><TT> 00028 | 00029 |</TT> 00030 <BR><TT> 00031 | yx yy yz yt |</TT> 00032 <BR><TT> lambda = | 00033 |</TT> 00034 <BR><TT> 00035 | zx zy zz zt |</TT> 00036 <BR><TT> 00037 | 00038 |</TT> 00039 <BR><TT> 00040 | tx ty tz tt |</TT> 00041 <BR> 00042 <H3> 00043 Declaration</H3> 00044 By default it is initialized to the identity matrix, but it may also be 00045 intialized by an other <TT>TLorentzRotation</TT>, 00046 <BR>by a pure TRotation or by a boost: 00047 00048 <P><TT> TLorentzRotation l; // l is 00049 initialized as identity</TT> 00050 <BR><TT> TLorentzRotation m(l); // m = l</TT> 00051 <BR><TT> TRotation r;</TT> 00052 <BR><TT> TLorentzRotation lr(r);</TT> 00053 <BR><TT> TLorentzRotation lb1(bx,by,bz);</TT> 00054 <BR><TT> TVector3 b;</TT> 00055 <BR><TT> TLorentzRotation lb2(b);</TT> 00056 00057 <P>The Matrix for a Lorentz boosts is: 00058 00059 <P><TT> | 1+gamma'*bx*bx gamma'*bx*by gamma'*bx*bz 00060 gamma*bx |</TT> 00061 <BR><TT> | gamma'*by*bx 1+gamma'*by*by gamma'*by*bz 00062 gamma*by |</TT> 00063 <BR><TT> | gamma'*bz*bx gamma'*bz*by 1+gamma'*bz*bz 00064 gamma*bz |</TT> 00065 <BR><TT> | gamma*bx 00066 gamma*by gamma*bz 00067 gamma |</TT> 00068 00069 <P>with the boost vector <TT><B>b</B>=(bx,by,bz) </TT>and<TT> gamma=1/Sqrt(1-beta*beta) 00070 </TT>and<TT> gamma'=(gamma-1)/beta*beta.</TT> 00071 <H3> 00072 Access to the matrix components/Comparisons</H3> 00073 Access to the matrix components is possible through the member functions 00074 XX(), XY() .. TT(), 00075 <BR>through the operator (int,int): 00076 00077 <P><TT> Double_t xx;</TT> 00078 <BR><TT> TLorentzRotation l;</TT> 00079 <BR><TT> xx = l.XX(); // gets the xx component</TT> 00080 <BR><TT> xx = l(0,0); // gets the xx component</TT> 00081 00082 <P><TT> if (l==m) {...} // test for equality</TT> 00083 <BR><TT> if (l !=m) {...} // test for inequality</TT> 00084 <BR><TT> if (l.IsIdentity()) {...} // test for identity</TT> 00085 <BR> 00086 <H3> 00087 Transformations of a LorentzRotation</H3> 00088 00089 <H5> 00090 Compound transformations</H5> 00091 There are four possibilities to find the product of two <TT>TLorentzRotation</TT> 00092 transformations: 00093 00094 <P><TT> TLorentzRotation a,b,c;</TT> 00095 <BR><TT> c = b*a; // product</TT> 00096 <BR><TT> c = a.MatrixMultiplication(b); // a is unchanged</TT> 00097 <BR><TT> a *= b; // Attention: a=a*b</TT> 00098 <BR><TT> c = a.Transform(b) // a=b*a then c=a</TT> 00099 <BR> 00100 <H5> 00101 Lorentz boosts</H5> 00102 <TT> Double_t bx, by, bz;</TT> 00103 <BR><TT> TVector3 v(bx,by,bz);</TT> 00104 <BR><TT> TLorentzRotation l;</TT> 00105 <BR><TT> l.Boost(v);</TT> 00106 <BR><TT> l.Boost(bx,by,bz);</TT> 00107 <BR> 00108 <H5> 00109 Rotations</H5> 00110 <TT> TVector3 axis;</TT> 00111 <BR><TT> l.RotateX(TMath::Pi()); // rotation around 00112 x-axis</TT> 00113 <BR><TT> l.Rotate(.5,axis); // rotation around specified vector</TT> 00114 <H5> 00115 Inverse transformation</H5> 00116 The matrix for the inverse transformation of a TLorentzRotation is as follows: 00117 <BR><TT> 00118 | xx yx zx -tx |</TT> 00119 <BR><TT> 00120 | 00121 |</TT> 00122 <BR><TT> 00123 | xy yy zy -ty |</TT> 00124 <BR><TT> 00125 | 00126 |</TT> 00127 <BR><TT> 00128 | xz yz zz -tz |</TT> 00129 <BR><TT> 00130 | 00131 |</TT> 00132 <BR><TT> 00133 |-xt -yt -zt tt |</TT> 00134 <BR>To return the inverse transformation keeping the current unchanged 00135 use the memberfunction <TT>Inverse()</TT>. 00136 <BR><TT>Invert()</TT> inverts the current <TT>TLorentzRotation</TT>: 00137 00138 <P><TT> l1 = l2.Inverse(); // l1 is inverse of l2, l2 unchanged</TT> 00139 <BR><TT> l1 = l2.Invert(); // invert l2, then l1=l2</TT> 00140 <H3> 00141 Transformation of a TLorentzVector</H3> 00142 To apply <TT>TLorentzRotation</TT> to <TT>TLorentzVector</TT> you can use 00143 either the <TT>VectorMultiplication()</TT> member function or the <TT>*</TT> 00144 operator. You can also use the <TT>Transform()</TT> function and the <TT>*=</TT> 00145 operator of the <TT>TLorentzVector</TT> class.: 00146 00147 <P><TT> TLorentzVector v;</TT> 00148 <BR><TT> ...</TT> 00149 <BR><TT> v=l.VectorMultiplication(v);</TT> 00150 <BR><TT> v = l * v;</TT> 00151 00152 <P><TT> v.Transform(l);</TT> 00153 <BR><TT> v *= l; // Attention v = l*v</TT> 00154 <!--*/ 00155 // -->END_HTML 00156 // 00157 00158 #include "TError.h" 00159 #include "TLorentzRotation.h" 00160 00161 ClassImp(TLorentzRotation) 00162 00163 TLorentzRotation::TLorentzRotation() 00164 : fxx(1.0), fxy(0.0), fxz(0.0), fxt(0.0), 00165 fyx(0.0), fyy(1.0), fyz(0.0), fyt(0.0), 00166 fzx(0.0), fzy(0.0), fzz(1.0), fzt(0.0), 00167 ftx(0.0), fty(0.0), ftz(0.0), ftt(1.0) {} 00168 00169 TLorentzRotation::TLorentzRotation(const TRotation & r) 00170 : fxx(r.XX()), fxy(r.XY()), fxz(r.XZ()), fxt(0.0), 00171 fyx(r.YX()), fyy(r.YY()), fyz(r.YZ()), fyt(0.0), 00172 fzx(r.ZX()), fzy(r.ZY()), fzz(r.ZZ()), fzt(0.0), 00173 ftx(0.0), fty(0.0), ftz(0.0), ftt(1.0) {} 00174 00175 TLorentzRotation::TLorentzRotation(const TLorentzRotation & r) : TObject(r), 00176 fxx(r.fxx), fxy(r.fxy), fxz(r.fxz), fxt(r.fxt), 00177 fyx(r.fyx), fyy(r.fyy), fyz(r.fyz), fyt(r.fyt), 00178 fzx(r.fzx), fzy(r.fzy), fzz(r.fzz), fzt(r.fzt), 00179 ftx(r.ftx), fty(r.fty), ftz(r.ftz), ftt(r.ftt) {} 00180 00181 TLorentzRotation::TLorentzRotation( 00182 Double_t rxx, Double_t rxy, Double_t rxz, Double_t rxt, 00183 Double_t ryx, Double_t ryy, Double_t ryz, Double_t ryt, 00184 Double_t rzx, Double_t rzy, Double_t rzz, Double_t rzt, 00185 Double_t rtx, Double_t rty, Double_t rtz, Double_t rtt) 00186 : fxx(rxx), fxy(rxy), fxz(rxz), fxt(rxt), 00187 fyx(ryx), fyy(ryy), fyz(ryz), fyt(ryt), 00188 fzx(rzx), fzy(rzy), fzz(rzz), fzt(rzt), 00189 ftx(rtx), fty(rty), ftz(rtz), ftt(rtt) {} 00190 00191 TLorentzRotation::TLorentzRotation(Double_t bx, 00192 Double_t by, 00193 Double_t bz) 00194 { 00195 //constructor 00196 SetBoost(bx, by, bz); 00197 } 00198 00199 TLorentzRotation::TLorentzRotation(const TVector3 & p) { 00200 //copy constructor 00201 SetBoost(p.X(), p.Y(), p.Z()); 00202 } 00203 00204 Double_t TLorentzRotation::operator () (int i, int j) const { 00205 //derefencing operator 00206 if (i == 0) { 00207 if (j == 0) { return fxx; } 00208 if (j == 1) { return fxy; } 00209 if (j == 2) { return fxz; } 00210 if (j == 3) { return fxt; } 00211 } else if (i == 1) { 00212 if (j == 0) { return fyx; } 00213 if (j == 1) { return fyy; } 00214 if (j == 2) { return fyz; } 00215 if (j == 3) { return fyt; } 00216 } else if (i == 2) { 00217 if (j == 0) { return fzx; } 00218 if (j == 1) { return fzy; } 00219 if (j == 2) { return fzz; } 00220 if (j == 3) { return fzt; } 00221 } else if (i == 3) { 00222 if (j == 0) { return ftx; } 00223 if (j == 1) { return fty; } 00224 if (j == 2) { return ftz; } 00225 if (j == 3) { return ftt; } 00226 } 00227 Warning("operator()(i,j)","subscripting: bad indeces(%d,%d)",i,j); 00228 return 0.0; 00229 } 00230 00231 void TLorentzRotation::SetBoost(Double_t bx, Double_t by, Double_t bz) { 00232 //boost this Lorentz vector 00233 Double_t bp2 = bx*bx + by*by + bz*bz; 00234 Double_t gamma = 1.0 / TMath::Sqrt(1.0 - bp2); 00235 Double_t bgamma = gamma * gamma / (1.0 + gamma); 00236 fxx = 1.0 + bgamma * bx * bx; 00237 fyy = 1.0 + bgamma * by * by; 00238 fzz = 1.0 + bgamma * bz * bz; 00239 fxy = fyx = bgamma * bx * by; 00240 fxz = fzx = bgamma * bx * bz; 00241 fyz = fzy = bgamma * by * bz; 00242 fxt = ftx = gamma * bx; 00243 fyt = fty = gamma * by; 00244 fzt = ftz = gamma * bz; 00245 ftt = gamma; 00246 } 00247 00248 TLorentzRotation TLorentzRotation::MatrixMultiplication(const TLorentzRotation & b) const { 00249 //multiply this vector by a matrix 00250 return TLorentzRotation( 00251 fxx*b.fxx + fxy*b.fyx + fxz*b.fzx + fxt*b.ftx, 00252 fxx*b.fxy + fxy*b.fyy + fxz*b.fzy + fxt*b.fty, 00253 fxx*b.fxz + fxy*b.fyz + fxz*b.fzz + fxt*b.ftz, 00254 fxx*b.fxt + fxy*b.fyt + fxz*b.fzt + fxt*b.ftt, 00255 fyx*b.fxx + fyy*b.fyx + fyz*b.fzx + fyt*b.ftx, 00256 fyx*b.fxy + fyy*b.fyy + fyz*b.fzy + fyt*b.fty, 00257 fyx*b.fxz + fyy*b.fyz + fyz*b.fzz + fyt*b.ftz, 00258 fyx*b.fxt + fyy*b.fyt + fyz*b.fzt + fyt*b.ftt, 00259 fzx*b.fxx + fzy*b.fyx + fzz*b.fzx + fzt*b.ftx, 00260 fzx*b.fxy + fzy*b.fyy + fzz*b.fzy + fzt*b.fty, 00261 fzx*b.fxz + fzy*b.fyz + fzz*b.fzz + fzt*b.ftz, 00262 fzx*b.fxt + fzy*b.fyt + fzz*b.fzt + fzt*b.ftt, 00263 ftx*b.fxx + fty*b.fyx + ftz*b.fzx + ftt*b.ftx, 00264 ftx*b.fxy + fty*b.fyy + ftz*b.fzy + ftt*b.fty, 00265 ftx*b.fxz + fty*b.fyz + ftz*b.fzz + ftt*b.ftz, 00266 ftx*b.fxt + fty*b.fyt + ftz*b.fzt + ftt*b.ftt); 00267 }