]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliKalmanTrack.cxx
Fix for raw tag file creation.
[u/mrichter/AliRoot.git] / STEER / AliKalmanTrack.cxx
index 5b1a85f0a2a776354e75ccfd9d5164c957d921fe..92df4af77cfd24124241509e795ccc97cfd820f3 100644 (file)
 //   that is the base for AliTPCtrack, AliITStrackV2 and AliTRDtrack
 //        Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
 //-------------------------------------------------------------------------
+#include <TGeoManager.h>
 
 #include "AliKalmanTrack.h"
-#include "AliPDG.h"
-#include "TPDGCode.h"
-#include "TDatabasePDG.h"
 
 ClassImp(AliKalmanTrack)
 
-Double_t AliKalmanTrack::fgConvConst;
-
 //_______________________________________________________________________
-AliKalmanTrack::AliKalmanTrack():
-  fLab(-3141593),
+  AliKalmanTrack::AliKalmanTrack():AliExternalTrackParam(),
+  fFakeRatio(0),
   fChi2(0),
-  fMass(0.13957),
-  fN(0)
+  fMass(AliPID::ParticleMass(AliPID::kPion)),
+  fLab(-3141593),
+  fN(0),
+  fStartTimeIntegral(kFALSE),
+  fIntegratedLength(0)
 {
   //
   // Default constructor
   //
-    if (fgConvConst==0) 
-      Fatal("AliKalmanTrack()","The magnetic field has not been set !\n"); 
-    
-    fStartTimeIntegral = kFALSE;
-    fIntegratedLength = 0;
-    for(Int_t i=0; i<5; i++) fIntegratedTime[i] = 0;
+
+  for(Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i] = 0;
 }
 
-//_______________________________________________________________________
 AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack &t):
-  TObject(t),
-  fLab(t.fLab),
+  AliExternalTrackParam(t),
+  fFakeRatio(t.fFakeRatio),
   fChi2(t.fChi2),
   fMass(t.fMass),
-  fN(t.fN)
+  fLab(t.fLab),
+  fN(t.fN),
+  fStartTimeIntegral(t.fStartTimeIntegral),
+  fIntegratedLength(t.fIntegratedLength)
 {
   //
   // Copy constructor
   //
-  if (fgConvConst==0) 
-    Fatal("AliKalmanTrack(const AliKalmanTrack&)",
-          "The magnetic field has not been set !\n"); 
-
-  fStartTimeIntegral = t.fStartTimeIntegral;
-  fIntegratedLength = t.fIntegratedLength;
   
-  for (Int_t i=0; i<5; i++) 
-    fIntegratedTime[i] = t.fIntegratedTime[i];
+  for (Int_t i=0; i<AliPID::kSPECIES; i++)
+      fIntegratedTime[i] = t.fIntegratedTime[i];
+}
+
+AliKalmanTrack& AliKalmanTrack::operator=(const AliKalmanTrack&o){
+  if(this!=&o){
+    AliExternalTrackParam::operator=(o);
+    fLab = o.fLab;
+    fFakeRatio = o.fFakeRatio;
+    fChi2 = o.fChi2;
+    fMass = o.fMass;
+    fN = o.fN;
+    fStartTimeIntegral = o.fStartTimeIntegral;
+    for(Int_t i = 0;i<AliPID::kSPECIES;++i)fIntegratedTime[i] = o.fIntegratedTime[i];
+    fIntegratedLength = o.fIntegratedLength;
+  }
+  return *this;
 }
+
 //_______________________________________________________________________
 void AliKalmanTrack::StartTimeIntegral() 
 {
+  // Sylwester Radomski, GSI
+  // S.Radomski@gsi.de
   //
   // Start time integration
   // To be called at Vertex by ITS tracker
   //
   
   //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;
 }
+
 //_______________________________________________________________________
 void AliKalmanTrack:: AddTimeStep(Double_t length) 
 {
@@ -113,9 +123,6 @@ void AliKalmanTrack:: AddTimeStep(Double_t length)
   
   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;
   
@@ -127,23 +134,21 @@ void AliKalmanTrack:: AddTimeStep(Double_t length)
 
   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;
   }
 }
 
 //_______________________________________________________________________
-
 Double_t AliKalmanTrack::GetIntegratedTime(Int_t pdg) const 
 {
+  // Sylwester Radomski, GSI
+  // S.Radomski@gsi.de
   //
   // Return integrated time hypothesis for a given particle
   // type assumption.
@@ -154,32 +159,22 @@ Double_t AliKalmanTrack::GetIntegratedTime(Int_t pdg) const
 
 
   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<fgkTypes; i++)
-    if (pdgCode[i] == TMath::Abs(pdg)) return fIntegratedTime[i];
+  for (Int_t i=0; i<AliPID::kSPECIES; i++)
+    if (AliPID::ParticleCode(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::PrintTime() const
-{
-  // For testing
-  // 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]);
-  printf("\n");  
+void AliKalmanTrack::GetIntegratedTimes(Double_t *times) const {
+  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<AliPID::kSPECIES; i++) fIntegratedTime[i]=times[i];
+}