]>
Commit | Line | Data |
---|---|---|
87594435 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
acd84897 | 16 | /* $Id$ */ |
fb17acd4 | 17 | |
87594435 | 18 | //------------------------------------------------------------------------- |
19 | // Implementation of the AliKalmanTrack class | |
066782e8 | 20 | // that is the base for AliTPCtrack, AliITStrackV2 and AliTRDtrack |
87594435 | 21 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch |
22 | //------------------------------------------------------------------------- | |
23 | ||
24 | #include "AliKalmanTrack.h" | |
74f9526e | 25 | #include "AliPDG.h" |
26 | #include "TPDGCode.h" | |
27 | #include "TDatabasePDG.h" | |
87594435 | 28 | |
29 | ClassImp(AliKalmanTrack) | |
30 | ||
116cbefd | 31 | Double_t AliKalmanTrack::fgConvConst; |
9b280d80 | 32 | |
e2afb3b6 | 33 | //_______________________________________________________________________ |
34 | AliKalmanTrack::AliKalmanTrack(): | |
35 | fLab(-3141593), | |
36 | fChi2(0), | |
37 | fMass(0.13957), | |
38 | fN(0) | |
39 | { | |
116cbefd | 40 | // |
41 | // Default constructor | |
42 | // | |
43 | if (fgConvConst==0) | |
e2afb3b6 | 44 | Fatal("AliKalmanTrack()","The magnetic field has not been set !\n"); |
74f9526e | 45 | |
46 | fStartTimeIntegral = kFALSE; | |
47 | fIntegratedLength = 0; | |
48 | for(Int_t i=0; i<5; i++) fIntegratedTime[i] = 0; | |
e2afb3b6 | 49 | } |
50 | ||
51 | //_______________________________________________________________________ | |
52 | AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack &t): | |
53 | TObject(t), | |
54 | fLab(t.fLab), | |
55 | fChi2(t.fChi2), | |
56 | fMass(t.fMass), | |
57 | fN(t.fN) | |
58 | { | |
116cbefd | 59 | // |
60 | // Copy constructor | |
61 | // | |
62 | if (fgConvConst==0) | |
e2afb3b6 | 63 | Fatal("AliKalmanTrack(const AliKalmanTrack&)", |
64 | "The magnetic field has not been set !\n"); | |
74f9526e | 65 | |
66 | fStartTimeIntegral = t.fStartTimeIntegral; | |
67 | fIntegratedLength = t.fIntegratedLength; | |
68 | ||
69 | for (Int_t i=0; i<5; i++) | |
70 | fIntegratedTime[i] = t.fIntegratedTime[i]; | |
71 | } | |
72 | //_______________________________________________________________________ | |
73 | void AliKalmanTrack::StartTimeIntegral() | |
74 | { | |
75 | // | |
76 | // Start time integration | |
77 | // To be called at Vertex by ITS tracker | |
78 | // | |
79 | ||
80 | //if (fStartTimeIntegral) | |
81 | // Warning("StartTimeIntegral", "Reseting Recorded Time."); | |
82 | ||
83 | fStartTimeIntegral = kTRUE; | |
5d8718b8 | 84 | for(Int_t i=0; i<fgkTypes; i++) fIntegratedTime[i] = 0; |
74f9526e | 85 | fIntegratedLength = 0; |
86 | } | |
87 | //_______________________________________________________________________ | |
88 | void AliKalmanTrack:: AddTimeStep(Double_t length) | |
89 | { | |
90 | // | |
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. | |
95 | // | |
96 | // If integration not started function does nothing | |
97 | // | |
98 | // Formula | |
99 | // dt = dl * sqrt(p^2 + m^2) / p | |
100 | // p = pT * (1 + tg^2 (lambda) ) | |
101 | // | |
102 | // pt = 1/external parameter [4] | |
103 | // tg lambda = external parameter [3] | |
104 | // | |
105 | // | |
106 | // Sylwester Radomski, GSI | |
107 | // S.Radomski@gsi.de | |
108 | // | |
109 | ||
5d8718b8 | 110 | static const Double_t kcc = 2.99792458e-2; |
74f9526e | 111 | |
112 | if (!fStartTimeIntegral) return; | |
113 | ||
114 | fIntegratedLength += length; | |
115 | ||
5d8718b8 | 116 | static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; |
74f9526e | 117 | TDatabasePDG *db = TDatabasePDG::Instance(); |
118 | ||
119 | Double_t xr, param[5]; | |
120 | Double_t pt, tgl; | |
121 | ||
122 | GetExternalParameters(xr, param); | |
123 | pt = 1/param[4] ; | |
124 | tgl = param[3]; | |
125 | ||
126 | Double_t p = TMath::Abs(pt * TMath::Sqrt(1+tgl*tgl)); | |
127 | ||
128 | if (length > 100) return; | |
129 | ||
5d8718b8 | 130 | for (Int_t i=0; i<fgkTypes; i++) { |
74f9526e | 131 | |
132 | Double_t mass = db->GetParticle(pdgCode[i])->Mass(); | |
133 | Double_t correction = TMath::Sqrt( pt*pt * (1 + tgl*tgl) + mass * mass ) / p; | |
5d8718b8 | 134 | Double_t time = length * correction / kcc; |
74f9526e | 135 | |
136 | //cout << mass << "\t" << pt << "\t" << p << "\t" | |
137 | // << correction << endl; | |
138 | ||
139 | fIntegratedTime[i] += time; | |
140 | } | |
e2afb3b6 | 141 | } |
142 | ||
74f9526e | 143 | //_______________________________________________________________________ |
144 | ||
145 | Double_t AliKalmanTrack::GetIntegratedTime(Int_t pdg) const | |
146 | { | |
147 | // | |
148 | // Return integrated time hypothesis for a given particle | |
149 | // type assumption. | |
150 | // | |
151 | // Input parameter: | |
152 | // pdg - Pdg code of a particle type | |
153 | // | |
154 | ||
155 | ||
156 | if (!fStartTimeIntegral) { | |
157 | Warning("GetIntegratedTime","Time integration not started"); | |
158 | return 0.; | |
159 | } | |
160 | ||
5d8718b8 | 161 | static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; |
74f9526e | 162 | |
5d8718b8 | 163 | for (Int_t i=0; i<fgkTypes; i++) |
74f9526e | 164 | if (pdgCode[i] == TMath::Abs(pdg)) return fIntegratedTime[i]; |
165 | ||
166 | Warning(":GetIntegratedTime","Particle type [%d] not found", pdg); | |
167 | return 0; | |
168 | } | |
169 | //_______________________________________________________________________ | |
170 | ||
171 | void AliKalmanTrack::PrintTime() const | |
172 | { | |
173 | // For testing | |
174 | // Prints time for all hypothesis | |
175 | // | |
176 | ||
5d8718b8 | 177 | static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; |
74f9526e | 178 | |
5d8718b8 | 179 | for (Int_t i=0; i<fgkTypes; i++) |
74f9526e | 180 | printf("%d: %.2f ", pdgCode[i], fIntegratedTime[i]); |
181 | printf("\n"); | |
182 | } | |
183 | ||
184 | //_______________________________________________________________________ | |
185 |