//-------------------------------------------------------------------------
#include "AliKalmanTrack.h"
-#include "AliPDG.h"
-#include "TPDGCode.h"
-#include "TDatabasePDG.h"
-#include "AliRunLoader.h"
-#include "AliRun.h"
-#include "AliMagF.h"
+#include "AliLog.h"
ClassImp(AliKalmanTrack)
//_______________________________________________________________________
AliKalmanTrack::AliKalmanTrack():
fLab(-3141593),
+ fFakeRatio(0),
fChi2(0),
- fMass(0.13957),
+ fMass(AliPID::ParticleMass(AliPID::kPion)),
fN(0)
{
//
// Default constructor
//
if (fgConvConst==0) {
- Warning("AliKalmanTrack()", "The magnetic field has not been set!");
- SetConvConst();
+ AliFatal("The magnetic field has not been set!");
}
fStartTimeIntegral = kFALSE;
AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack &t):
TObject(t),
fLab(t.fLab),
+ fFakeRatio(t.fFakeRatio),
fChi2(t.fChi2),
fMass(t.fMass),
fN(t.fN)
// Copy constructor
//
if (fgConvConst==0) {
- Warning("AliKalmanTrack(const AliKalmanTrack&)",
- "The magnetic field has not been set!");
- SetConvConst();
+ AliFatal("The magnetic field has not been set!");
}
fStartTimeIntegral = t.fStartTimeIntegral;
fIntegratedTime[i] = t.fIntegratedTime[i];
}
-
-//_______________________________________________________________________
-void AliKalmanTrack::SetConvConst()
-{
- // Sets the conversion constants for the magnetic field
- // (Momentum in GeV/c -> curvature in mm)
- ::Info("SetConvConst()", "tryinig to get the magnetic field from the AliRun object...");
- AliRunLoader* loader = AliRunLoader::GetRunLoader();
- if (!loader) ::Fatal("SetConvConst()", "No run loader found");
- if (!loader->GetAliRun()) loader->LoadgAlice();
- AliRun* alirun = loader->GetAliRun();
- if (!alirun) ::Fatal("SetConvConst()", "No AliRun object found");
-
- Double_t field = alirun->Field()->SolenoidField();
- SetConvConst(1000/0.299792458/field);
- ::Info("SetConvConst()", "Magnetic field set to %f kGauss\n", field);
-}
-
-//_______________________________________________________________________
-Double_t AliKalmanTrack::GetX() const
-{
- // Returns the X coordinate of the current track position
- Warning("GetX()","Method must be overloaded !\n");
- return 0.;
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::GetdEdx() const
-{
- // Returns the dE/dx of the track
- Warning("GetdEdx()","Method must be overloaded !\n");
- return 0.;
-}
-
-//_______________________________________________________________________
-Double_t AliKalmanTrack::GetY() const
-{
- // Returns the Y coordinate of the current track position
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return par[0];
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::GetZ() const
-{
- // Returns the Z coordinate of the current track position
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return par[1];
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::GetSnp() const
-{
- // Returns the Sin(phi), where phi is the angle between the transverse
- // momentum (in xOy plane) and the X axis
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return par[2];
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::GetTgl() const
-{
- // Returns the Tan(lambda), where lambda is the dip angle (between
- // the bending plane (xOy) and the momentum of the track
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return par[3];
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::Get1Pt() const
-{
- // Returns 1/pT
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return par[4];
-}
-
-//_______________________________________________________________________
-Double_t AliKalmanTrack::Phi() const
-{
-// return global phi of track
-
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- if (par[2] > 1.) par[2] = 1.;
- if (par[2] < -1.) par[2] = -1.;
- Double_t phi = TMath::ASin(par[2]) + GetAlpha();
- while (phi < 0) phi += TMath::TwoPi();
- while (phi > TMath::TwoPi()) phi -= TMath::TwoPi();
- return phi;
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::SigmaPhi() const
-{
-// return error of global phi of track
-
- Double_t par[5];
- Double_t cov[15];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- GetExternalCovariance(cov);
- return TMath::Sqrt(TMath::Abs(cov[5] / (1. - par[2]*par[2])));
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::Theta() const
-{
-// return global theta of track
-
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return TMath::Pi()/2. - TMath::ATan(par[3]);
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::SigmaTheta() const
-{
-// return error of global theta of track
-
- Double_t par[5];
- Double_t cov[15];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- GetExternalCovariance(cov);
- return TMath::Sqrt(TMath::Abs(cov[5])) / (1. + par[3]*par[3]);
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::Eta() const
-{
-// return global eta of track
-
- return -TMath::Log(TMath::Tan(Theta()/2.));
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::Px() const
-{
-// return x component of track momentum
-
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- Double_t phi = TMath::ASin(par[2]) + GetAlpha();
- return TMath::Cos(phi) / TMath::Abs(par[4]);
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::Py() const
-{
-// return y component of track momentum
-
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- Double_t phi = TMath::ASin(par[2]) + GetAlpha();
- return TMath::Sin(phi) / TMath::Abs(par[4]);
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::Pz() const
-{
-// return z component of track momentum
-
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return par[3] / TMath::Abs(par[4]);
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::Pt() const
-{
-// return transverse component of track momentum
-
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return 1. / TMath::Abs(par[4]);
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::SigmaPt() const
-{
-// return error of transverse component of track momentum
-
- Double_t par[5];
- Double_t cov[15];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- GetExternalCovariance(cov);
- return TMath::Sqrt(cov[14]) / TMath::Abs(par[4]);
-}
-//_______________________________________________________________________
-Double_t AliKalmanTrack::P() const
-{
-// return total track momentum
-
- Double_t par[5];
- Double_t localX = GetX();
- GetExternalParameters(localX, par);
- return 1. / TMath::Abs(par[4] * TMath::Cos(TMath::ATan(par[3])));
-}
//_______________________________________________________________________
void AliKalmanTrack::StartTimeIntegral()
{
//
//if (fStartTimeIntegral)
- // Warning("StartTimeIntegral", "Reseting Recorded Time.");
+ // AliWarning("Reseting Recorded Time.");
fStartTimeIntegral = kTRUE;
- for(Int_t i=0; i<fgkTypes; i++) fIntegratedTime[i] = 0;
+ for(Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i] = 0;
fIntegratedLength = 0;
}
//_______________________________________________________________________
fIntegratedLength += length;
- static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
- TDatabasePDG *db = TDatabasePDG::Instance();
-
Double_t xr, param[5];
Double_t pt, tgl;
if (length > 100) return;
- for (Int_t i=0; i<fgkTypes; i++) {
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) {
- Double_t mass = db->GetParticle(pdgCode[i])->Mass();
+ Double_t mass = AliPID::ParticleMass(i);
Double_t correction = TMath::Sqrt( pt*pt * (1 + tgl*tgl) + mass * mass ) / p;
Double_t time = length * correction / kcc;
- //cout << mass << "\t" << pt << "\t" << p << "\t"
- // << correction << endl;
-
fIntegratedTime[i] += time;
}
}
if (!fStartTimeIntegral) {
- Warning("GetIntegratedTime","Time integration not started");
+ AliWarning("Time integration not started");
return 0.;
}
- static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
+ for (Int_t i=0; i<AliPID::kSPECIES; i++)
+ if (AliPID::ParticleCode(i) == TMath::Abs(pdg)) return fIntegratedTime[i];
- for (Int_t i=0; i<fgkTypes; i++)
- if (pdgCode[i] == TMath::Abs(pdg)) return fIntegratedTime[i];
-
- Warning(":GetIntegratedTime","Particle type [%d] not found", pdg);
+ AliWarning(Form("Particle type [%d] not found", pdg));
return 0;
}
void AliKalmanTrack::GetIntegratedTimes(Double_t *times) const {
- for (Int_t i=0; i<fgkTypes; i++) times[i]=fIntegratedTime[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fIntegratedTime[i];
}
void AliKalmanTrack::SetIntegratedTimes(const Double_t *times) {
- for (Int_t i=0; i<fgkTypes; i++) fIntegratedTime[i]=times[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i]=times[i];
}
//_______________________________________________________________________
// Prints time for all hypothesis
//
- static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
-
- for (Int_t i=0; i<fgkTypes; i++)
- printf("%d: %.2f ", pdgCode[i], fIntegratedTime[i]);
+ for (Int_t i=0; i<AliPID::kSPECIES; i++)
+ printf("%d: %.2f ", AliPID::ParticleCode(i), fIntegratedTime[i]);
printf("\n");
}
if (TMath::Abs(dt1)/(TMath::Abs(t1)+1.e-3) < 1.e-4)
if (TMath::Abs(dt2)/(TMath::Abs(t2)+1.e-3) < 1.e-4) {
if ((gt1*gt1+gt2*gt2) > 1.e-4/dy2/dy2)
- Warning("GetDCA"," stopped at not a stationary point !\n");
+ AliWarning(" stopped at not a stationary point !");
Double_t lmb=h11+h22; lmb=lmb-TMath::Sqrt(lmb*lmb-4*det);
if (lmb < 0.)
- Warning("GetDCA"," stopped at not a minimum !\n");
+ AliWarning(" stopped at not a minimum !");
break;
}
if (dd<dm) break;
dt1*=0.5; dt2*=0.5;
if (div>512) {
- Warning("GetDCA"," overshoot !\n"); break;
+ AliWarning(" overshoot !"); break;
}
}
dm=dd;
}
- if (max<=0) Warning("GetDCA"," too many iterations !\n");
+ if (max<=0) AliWarning(" too many iterations !");
Double_t cs=TMath::Cos(GetAlpha());
Double_t sn=TMath::Sin(GetAlpha());
Double_t dca=GetDCA(p,xthis,xp);
if (!PropagateTo(xthis,d,x0)) {
- //Warning("PropagateToDCA"," propagation failed !\n");
+ //AliWarning(" propagation failed !");
return 1e+33;
}
if (!p->PropagateTo(xp,d,x0)) {
- //Warning("PropagateToDCA"," propagation failed !\n";
+ //AliWarning(" propagation failed !";
return 1e+33;
}