TLorentzRotation.cxx

Go to the documentation of this file.
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00026 | xx&nbsp; xy&nbsp; xz&nbsp; xt |</TT>
00027 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00028 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00029 |</TT>
00030 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00031 | yx&nbsp; yy&nbsp; yz&nbsp; yt |</TT>
00032 <BR><TT>&nbsp;&nbsp; lambda = |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00033 |</TT>
00034 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00035 | zx&nbsp; zy&nbsp; zz&nbsp; zt |</TT>
00036 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00037 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00038 |</TT>
00039 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00040 | tx&nbsp; ty&nbsp; tz&nbsp; tt |</TT>
00041 <BR>&nbsp;
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>&nbsp; TLorentzRotation l;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // l is
00049 initialized as identity</TT>
00050 <BR><TT>&nbsp; TLorentzRotation m(l);&nbsp;&nbsp; // m = l</TT>
00051 <BR><TT>&nbsp; TRotation r;</TT>
00052 <BR><TT>&nbsp; TLorentzRotation lr(r);</TT>
00053 <BR><TT>&nbsp; TLorentzRotation lb1(bx,by,bz);</TT>
00054 <BR><TT>&nbsp; TVector3 b;</TT>
00055 <BR><TT>&nbsp; TLorentzRotation lb2(b);</TT>
00056 
00057 <P>The Matrix for a Lorentz boosts is:
00058 
00059 <P><TT>&nbsp;| 1+gamma'*bx*bx&nbsp; gamma'*bx*by&nbsp;&nbsp; gamma'*bx*bz&nbsp;
00060 gamma*bx |</TT>
00061 <BR><TT>&nbsp;|&nbsp; gamma'*by*bx&nbsp; 1+gamma'*by*by&nbsp; gamma'*by*bz&nbsp;
00062 gamma*by |</TT>
00063 <BR><TT>&nbsp;|&nbsp; gamma'*bz*bx&nbsp;&nbsp; gamma'*bz*by&nbsp; 1+gamma'*bz*bz
00064 gamma*bz |</TT>
00065 <BR><TT>&nbsp;|&nbsp;&nbsp;&nbsp; gamma*bx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00066 gamma*by&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gamma*bz&nbsp;&nbsp;&nbsp;&nbsp;
00067 gamma&nbsp;&nbsp; |</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>&nbsp; Double_t xx;</TT>
00078 <BR><TT>&nbsp; TLorentzRotation l;</TT>
00079 <BR><TT>&nbsp; xx = l.XX();&nbsp;&nbsp;&nbsp; // gets the xx component</TT>
00080 <BR><TT>&nbsp; xx = l(0,0);&nbsp;&nbsp;&nbsp; // gets the xx component</TT>
00081 
00082 <P><TT>&nbsp; if (l==m) {...}&nbsp; // test for equality</TT>
00083 <BR><TT>&nbsp; if (l !=m) {...} // test for inequality</TT>
00084 <BR><TT>&nbsp; if (l.IsIdentity()) {...} // test for identity</TT>
00085 <BR>&nbsp;
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>&nbsp; TLorentzRotation a,b,c;</TT>
00095 <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>
00096 <BR><TT>&nbsp; c = a.MatrixMultiplication(b);&nbsp; // a is unchanged</TT>
00097 <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>
00098 <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>
00099 <BR>&nbsp;
00100 <H5>
00101 Lorentz boosts</H5>
00102 <TT>&nbsp; Double_t bx, by, bz;</TT>
00103 <BR><TT>&nbsp; TVector3 v(bx,by,bz);</TT>
00104 <BR><TT>&nbsp; TLorentzRotation l;</TT>
00105 <BR><TT>&nbsp; l.Boost(v);</TT>
00106 <BR><TT>&nbsp; l.Boost(bx,by,bz);</TT>
00107 <BR>&nbsp;
00108 <H5>
00109 Rotations</H5>
00110 <TT>&nbsp; TVector3 axis;</TT>
00111 <BR><TT>&nbsp; l.RotateX(TMath::Pi());&nbsp;&nbsp; //&nbsp; rotation around
00112 x-axis</TT>
00113 <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>
00114 <H5>
00115 Inverse transformation</H5>
00116 The matrix for the inverse transformation of a TLorentzRotation is as follows:
00117 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00118 | xx&nbsp; yx&nbsp; zx -tx |</TT>
00119 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00120 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00121 |</TT>
00122 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00123 | xy&nbsp; yy&nbsp; zy -ty |</TT>
00124 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00125 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00126 |</TT>
00127 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00128 | xz&nbsp; yz&nbsp; zz -tz |</TT>
00129 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00130 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00131 |</TT>
00132 <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
00133 |-xt -yt -zt&nbsp; 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>&nbsp; l1 = l2.Inverse();&nbsp; // l1 is inverse of l2, l2 unchanged</TT>
00139 <BR><TT>&nbsp; l1 = l2.Invert();&nbsp;&nbsp; // invert l2, then&nbsp; 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>&nbsp; TLorentzVector v;</TT>
00148 <BR><TT>&nbsp; ...</TT>
00149 <BR><TT>&nbsp; v=l.VectorMultiplication(v);</TT>
00150 <BR><TT>&nbsp; v = l * v;</TT>
00151 
00152 <P><TT>&nbsp; v.Transform(l);</TT>
00153 <BR><TT>&nbsp; v *= l;&nbsp; // 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 }

Generated on Tue Jul 5 14:37:47 2011 for ROOT_528-00b_version by  doxygen 1.5.1