}
}
///////////////////////////////////////////////////////////////////////////
-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()
}
}
///////////////////////////////////////////////////////////////////////////
-Ali3Vector Ali4Vector::Get3Vector()
+Ali3Vector Ali4Vector::Get3Vector() const
{
// Provide the 3-vector part
return fV;
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];
}
}
///////////////////////////////////////////////////////////////////////////
-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
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
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;
+}
+///////////////////////////////////////////////////////////////////////////