]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/Ali4Vector.cxx
change class name: AliMUONEventReconstructor -> AliMUONTrackReconstructor
[u/mrichter/AliRoot.git] / RALICE / Ali4Vector.cxx
index 1ea598c8b7a58397736940fc0e9d7903e7ae516a..0253a4d2bba94b98353a01ca7b9247dcaa3e4e70 100644 (file)
@@ -297,7 +297,7 @@ Double_t Ali4Vector::GetScalar()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-Double_t Ali4Vector::GetResultError()
+Double_t Ali4Vector::GetResultError() const
 {
 // Provide the error on the result of an operation yielding a scalar
 // E.g. GetScalar(), GetInvariant() or Dot()
@@ -439,7 +439,7 @@ Double_t Ali4Vector::GetInvariant()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-Ali3Vector Ali4Vector::Get3Vector()
+Ali3Vector Ali4Vector::Get3Vector() const
 {
 // Provide the 3-vector part
  return fV;
@@ -482,7 +482,11 @@ void Ali4Vector::GetErrors(Double_t* e,TString f)
  Double_t a[3];
  fV.GetErrors(a,f);
 
+ // Dummy invokation of GetScalar to obtain automatic proper error determination 
+ e[0]=GetScalar();
+
  e[0]=GetResultError();
+
  for (Int_t i=0; i<3; i++)
  {
   e[i+1]=a[i];
@@ -738,13 +742,13 @@ Ali4Vector& Ali4Vector::operator/=(Double_t s)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-Int_t Ali4Vector::GetScalarFlag()
+Int_t Ali4Vector::GetScalarFlag() const
 {
 // Provide the value of the fScalar flag (for internal use only).
  return fScalar;
 }
 ///////////////////////////////////////////////////////////////////////////
-Ali3Vector Ali4Vector::GetVecTrans()
+Ali3Vector Ali4Vector::GetVecTrans() const
 {
 // Provide the transverse vector part w.r.t. z-axis.
 // Error propagation is performed automatically
@@ -752,7 +756,7 @@ Ali3Vector Ali4Vector::GetVecTrans()
  return fV.GetVecTrans();
 }
 ///////////////////////////////////////////////////////////////////////////
-Ali3Vector Ali4Vector::GetVecLong()
+Ali3Vector Ali4Vector::GetVecLong() const
 {
 // Provide the longitudinal vector part w.r.t. z-axis.
 // Error propagation is performed automatically
@@ -816,3 +820,50 @@ Double_t Ali4Vector::GetPseudoRapidity()
  return eta;
 }
 ///////////////////////////////////////////////////////////////////////////
+Ali3Vector Ali4Vector::GetBetaVector() const
+{
+// Provide the beta 3-vector corresponding to this 4-vector.
+ Ali3Vector beta;
+ if (fabs(fV0)>0.) beta=fV/fV0;
+ if (fabs(fDv0)>0.)
+ {
+  Double_t vecv[3],errv[3],errb[3];
+  Double_t sqerr=0;
+  fV.GetVector(vecv,"car");
+  fV.GetErrors(errv,"car");
+  for (Int_t i=0; i<3; i++)
+  {
+   sqerr=pow((errv[i]/fV0),2)+pow((vecv[i]*fDv0/(fV0*fV0)),2);
+   errb[i]=sqrt(sqerr);
+  }
+  beta.SetErrors(errb,"car");
+ }
+ return beta;
+}
+///////////////////////////////////////////////////////////////////////////
+Double_t Ali4Vector::GetBeta()
+{
+// Provide the beta value (i.e. v/c) corresponding to this 4-vector.
+ Ali3Vector beta=GetBetaVector();
+ Double_t val=beta.GetNorm();
+ fDresult=beta.GetResultError();
+ return val;
+}
+///////////////////////////////////////////////////////////////////////////
+Double_t Ali4Vector::GetGamma()
+{
+// Provide the Lorentz gamma factor corresponding to this 4-vector.
+// In case the gamma factor is infinite a value of -1 is returned.
+ Double_t gamma=-1;
+ fDresult=0;
+ Double_t inv=sqrt(fabs(fV2));
+ if (inv>0.)
+ {
+  Double_t dinv=fDv2/(2.*inv);
+  gamma=fV0/inv;
+  Double_t sqerr=pow((fDv0/inv),2)+pow((fV0*dinv/fV2),2);
+  fDresult=sqrt(sqerr);
+ }
+ return gamma;
+}
+///////////////////////////////////////////////////////////////////////////