1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // Implementation of the AliKalmanTrack class
20 // that is the base for AliTPCtrack, AliITStrackV2 and AliTRDtrack
21 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
22 //-------------------------------------------------------------------------
24 #include "AliKalmanTrack.h"
27 #include "TDatabasePDG.h"
29 ClassImp(AliKalmanTrack)
31 Double_t AliKalmanTrack::fgConvConst;
33 //_______________________________________________________________________
34 AliKalmanTrack::AliKalmanTrack():
41 // Default constructor
44 Fatal("AliKalmanTrack()","The magnetic field has not been set !\n");
46 fStartTimeIntegral = kFALSE;
47 fIntegratedLength = 0;
48 for(Int_t i=0; i<5; i++) fIntegratedTime[i] = 0;
51 //_______________________________________________________________________
52 AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack &t):
63 Fatal("AliKalmanTrack(const AliKalmanTrack&)",
64 "The magnetic field has not been set !\n");
66 fStartTimeIntegral = t.fStartTimeIntegral;
67 fIntegratedLength = t.fIntegratedLength;
69 for (Int_t i=0; i<5; i++)
70 fIntegratedTime[i] = t.fIntegratedTime[i];
72 //_______________________________________________________________________
73 void AliKalmanTrack::StartTimeIntegral()
76 // Start time integration
77 // To be called at Vertex by ITS tracker
80 //if (fStartTimeIntegral)
81 // Warning("StartTimeIntegral", "Reseting Recorded Time.");
83 fStartTimeIntegral = kTRUE;
84 for(Int_t i=0; i<fTypes; i++) fIntegratedTime[i] = 0;
85 fIntegratedLength = 0;
87 //_______________________________________________________________________
88 void AliKalmanTrack:: AddTimeStep(Double_t length)
91 // Add step to integrated time
92 // this method should be called by a sublasses at the end
93 // of the PropagateTo function or by a tracker
94 // each time step is made.
96 // If integration not started function does nothing
99 // dt = dl * sqrt(p^2 + m^2) / p
100 // p = pT * (1 + tg^2 (lambda) )
102 // pt = 1/external parameter [4]
103 // tg lambda = external parameter [3]
106 // Sylwester Radomski, GSI
110 static const Double_t cc = 2.99792458e-2;
112 if (!fStartTimeIntegral) return;
114 fIntegratedLength += length;
116 static Int_t pdgCode[fTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
117 TDatabasePDG *db = TDatabasePDG::Instance();
119 Double_t xr, param[5];
122 GetExternalParameters(xr, param);
126 Double_t p = TMath::Abs(pt * TMath::Sqrt(1+tgl*tgl));
128 if (length > 100) return;
130 for (Int_t i=0; i<fTypes; i++) {
132 Double_t mass = db->GetParticle(pdgCode[i])->Mass();
133 Double_t correction = TMath::Sqrt( pt*pt * (1 + tgl*tgl) + mass * mass ) / p;
134 Double_t time = length * correction / cc;
136 //cout << mass << "\t" << pt << "\t" << p << "\t"
137 // << correction << endl;
139 fIntegratedTime[i] += time;
143 //_______________________________________________________________________
145 Double_t AliKalmanTrack::GetIntegratedTime(Int_t pdg) const
148 // Return integrated time hypothesis for a given particle
152 // pdg - Pdg code of a particle type
156 if (!fStartTimeIntegral) {
157 Warning("GetIntegratedTime","Time integration not started");
161 static Int_t pdgCode[fTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
163 for (Int_t i=0; i<fTypes; i++)
164 if (pdgCode[i] == TMath::Abs(pdg)) return fIntegratedTime[i];
166 Warning(":GetIntegratedTime","Particle type [%d] not found", pdg);
169 //_______________________________________________________________________
171 void AliKalmanTrack::PrintTime() const
174 // Prints time for all hypothesis
177 static Int_t pdgCode[fTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
179 for (Int_t i=0; i<fTypes; i++)
180 printf("%d: %.2f ", pdgCode[i], fIntegratedTime[i]);
184 //_______________________________________________________________________