]>
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 | //------------------------------------------------------------------------- | |
6c94f330 | 23 | #include <TGeoManager.h> |
39d4ae58 | 24 | |
87594435 | 25 | #include "AliKalmanTrack.h" |
87594435 | 26 | |
27 | ClassImp(AliKalmanTrack) | |
28 | ||
e2afb3b6 | 29 | //_______________________________________________________________________ |
6c94f330 | 30 | AliKalmanTrack::AliKalmanTrack():AliExternalTrackParam(), |
e2afb3b6 | 31 | fLab(-3141593), |
68b8060b | 32 | fFakeRatio(0), |
e2afb3b6 | 33 | fChi2(0), |
304864ab | 34 | fMass(AliPID::ParticleMass(AliPID::kPion)), |
90e48c0c | 35 | fN(0), |
36 | fStartTimeIntegral(kFALSE), | |
37 | fIntegratedLength(0) | |
e2afb3b6 | 38 | { |
116cbefd | 39 | // |
40 | // Default constructor | |
41 | // | |
c84a5e9e | 42 | |
7d0f8548 | 43 | for(Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i] = 0; |
e2afb3b6 | 44 | } |
45 | ||
46 | //_______________________________________________________________________ | |
47 | AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack &t): | |
6c94f330 | 48 | AliExternalTrackParam(t), |
e2afb3b6 | 49 | fLab(t.fLab), |
babd135a | 50 | fFakeRatio(t.fFakeRatio), |
e2afb3b6 | 51 | fChi2(t.fChi2), |
52 | fMass(t.fMass), | |
90e48c0c | 53 | fN(t.fN), |
54 | fStartTimeIntegral(t.fStartTimeIntegral), | |
55 | fIntegratedLength(t.fIntegratedLength) | |
e2afb3b6 | 56 | { |
116cbefd | 57 | // |
58 | // Copy constructor | |
59 | // | |
74f9526e | 60 | |
c84a5e9e | 61 | for (Int_t i=0; i<AliPID::kSPECIES; i++) |
62 | fIntegratedTime[i] = t.fIntegratedTime[i]; | |
74f9526e | 63 | } |
c5507f6d | 64 | |
74f9526e | 65 | //_______________________________________________________________________ |
66 | void AliKalmanTrack::StartTimeIntegral() | |
67 | { | |
49a7a79a | 68 | // Sylwester Radomski, GSI |
69 | // S.Radomski@gsi.de | |
74f9526e | 70 | // |
71 | // Start time integration | |
72 | // To be called at Vertex by ITS tracker | |
73 | // | |
74 | ||
75 | //if (fStartTimeIntegral) | |
f37d970d | 76 | // AliWarning("Reseting Recorded Time."); |
74f9526e | 77 | |
78 | fStartTimeIntegral = kTRUE; | |
304864ab | 79 | for(Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i] = 0; |
74f9526e | 80 | fIntegratedLength = 0; |
81 | } | |
7d0f8548 | 82 | |
74f9526e | 83 | //_______________________________________________________________________ |
84 | void AliKalmanTrack:: AddTimeStep(Double_t length) | |
85 | { | |
86 | // | |
87 | // Add step to integrated time | |
88 | // this method should be called by a sublasses at the end | |
89 | // of the PropagateTo function or by a tracker | |
90 | // each time step is made. | |
91 | // | |
92 | // If integration not started function does nothing | |
93 | // | |
94 | // Formula | |
95 | // dt = dl * sqrt(p^2 + m^2) / p | |
96 | // p = pT * (1 + tg^2 (lambda) ) | |
97 | // | |
98 | // pt = 1/external parameter [4] | |
99 | // tg lambda = external parameter [3] | |
100 | // | |
101 | // | |
102 | // Sylwester Radomski, GSI | |
103 | // S.Radomski@gsi.de | |
104 | // | |
105 | ||
5d8718b8 | 106 | static const Double_t kcc = 2.99792458e-2; |
74f9526e | 107 | |
108 | if (!fStartTimeIntegral) return; | |
109 | ||
110 | fIntegratedLength += length; | |
111 | ||
74f9526e | 112 | Double_t xr, param[5]; |
113 | Double_t pt, tgl; | |
114 | ||
115 | GetExternalParameters(xr, param); | |
116 | pt = 1/param[4] ; | |
117 | tgl = param[3]; | |
118 | ||
119 | Double_t p = TMath::Abs(pt * TMath::Sqrt(1+tgl*tgl)); | |
120 | ||
121 | if (length > 100) return; | |
122 | ||
304864ab | 123 | for (Int_t i=0; i<AliPID::kSPECIES; i++) { |
74f9526e | 124 | |
304864ab | 125 | Double_t mass = AliPID::ParticleMass(i); |
74f9526e | 126 | Double_t correction = TMath::Sqrt( pt*pt * (1 + tgl*tgl) + mass * mass ) / p; |
5d8718b8 | 127 | Double_t time = length * correction / kcc; |
74f9526e | 128 | |
74f9526e | 129 | fIntegratedTime[i] += time; |
130 | } | |
e2afb3b6 | 131 | } |
132 | ||
74f9526e | 133 | //_______________________________________________________________________ |
74f9526e | 134 | Double_t AliKalmanTrack::GetIntegratedTime(Int_t pdg) const |
135 | { | |
49a7a79a | 136 | // Sylwester Radomski, GSI |
137 | // S.Radomski@gsi.de | |
74f9526e | 138 | // |
139 | // Return integrated time hypothesis for a given particle | |
140 | // type assumption. | |
141 | // | |
142 | // Input parameter: | |
143 | // pdg - Pdg code of a particle type | |
144 | // | |
145 | ||
146 | ||
147 | if (!fStartTimeIntegral) { | |
f37d970d | 148 | AliWarning("Time integration not started"); |
74f9526e | 149 | return 0.; |
150 | } | |
151 | ||
304864ab | 152 | for (Int_t i=0; i<AliPID::kSPECIES; i++) |
153 | if (AliPID::ParticleCode(i) == TMath::Abs(pdg)) return fIntegratedTime[i]; | |
74f9526e | 154 | |
f37d970d | 155 | AliWarning(Form("Particle type [%d] not found", pdg)); |
74f9526e | 156 | return 0; |
157 | } | |
ae982df3 | 158 | |
159 | void AliKalmanTrack::GetIntegratedTimes(Double_t *times) const { | |
304864ab | 160 | for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fIntegratedTime[i]; |
ae982df3 | 161 | } |
162 | ||
163 | void AliKalmanTrack::SetIntegratedTimes(const Double_t *times) { | |
304864ab | 164 | for (Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i]=times[i]; |
ae982df3 | 165 | } |
166 | ||
41a3fbd5 | 167 | |
4557b520 | 168 | Double_t AliKalmanTrack::MeanMaterialBudget(Double_t *start, Double_t *end, Double_t *mparam) |
169 | { | |
6c94f330 | 170 | // |
4557b520 | 171 | // calculate mean material budget and material properties beween point start and end |
172 | // mparam - returns parameters used for dEdx and multiple scatering | |
173 | // | |
6c94f330 | 174 | // mparam[0] - density mean |
4557b520 | 175 | // mparam[1] - rad length |
176 | // mparam[2] - A mean | |
177 | // mparam[3] - Z mean | |
178 | // mparam[4] - length | |
179 | // mparam[5] - Z/A mean | |
180 | // mparam[6] - number of boundary crosses | |
181 | // | |
6c94f330 | 182 | mparam[0]=0; mparam[1]=1; mparam[2] =0; mparam[3] =0, mparam[4]=0, mparam[5]=0; mparam[6]=0; |
4557b520 | 183 | // |
184 | Double_t bparam[6], lparam[6]; // bparam - total param - lparam - local parameters | |
6c94f330 | 185 | for (Int_t i=0;i<6;i++) bparam[i]=0; // |
4557b520 | 186 | |
187 | if (!gGeoManager) { | |
188 | printf("ERROR: no TGeo\n"); | |
189 | return 0.; | |
190 | } | |
191 | // | |
192 | Double_t length; | |
193 | Double_t dir[3]; | |
194 | length = TMath::Sqrt((end[0]-start[0])*(end[0]-start[0])+ | |
6c94f330 | 195 | (end[1]-start[1])*(end[1]-start[1])+ |
196 | (end[2]-start[2])*(end[2]-start[2])); | |
4557b520 | 197 | mparam[4]=length; |
198 | if (length<TGeoShape::Tolerance()) return 0.0; | |
199 | Double_t invlen = 1./length; | |
200 | dir[0] = (end[0]-start[0])*invlen; | |
201 | dir[1] = (end[1]-start[1])*invlen; | |
202 | dir[2] = (end[2]-start[2])*invlen; | |
203 | // Initialize start point and direction | |
204 | TGeoNode *currentnode = 0; | |
205 | TGeoNode *startnode = gGeoManager->InitTrack(start, dir); | |
206 | // printf("%s length=%f\n",gGeoManager->GetPath(),length); | |
207 | if (!startnode) { | |
208 | printf("ERROR: start point out of geometry\n"); | |
209 | return 0.0; | |
210 | } | |
211 | TGeoMaterial *material = startnode->GetVolume()->GetMedium()->GetMaterial(); | |
212 | lparam[0] = material->GetDensity(); | |
213 | lparam[1] = material->GetRadLen(); | |
214 | lparam[2] = material->GetA(); | |
215 | lparam[3] = material->GetZ(); | |
6c94f330 | 216 | lparam[4] = length; |
4557b520 | 217 | lparam[5] = lparam[3]/lparam[2]; |
218 | if (material->IsMixture()) { | |
219 | lparam[1]*=lparam[0]; // different normalization in the modeler for mixture | |
220 | TGeoMixture * mixture = (TGeoMixture*)material; | |
221 | lparam[5] =0; | |
222 | Double_t sum =0; | |
223 | for (Int_t iel=0;iel<mixture->GetNelements();iel++){ | |
224 | sum += mixture->GetWmixt()[iel]; | |
225 | lparam[5]+= mixture->GetZmixt()[iel]*mixture->GetWmixt()[iel]/mixture->GetAmixt()[iel]; | |
226 | } | |
227 | lparam[5]/=sum; | |
228 | } | |
229 | gGeoManager->FindNextBoundary(length); | |
230 | Double_t snext = gGeoManager->GetStep(); | |
231 | Double_t step = 0.0; | |
232 | // If no boundary within proposed length, return current density | |
233 | if (snext>=length) { | |
6c94f330 | 234 | for (Int_t ip=0;ip<5;ip++) mparam[ip] = lparam[ip]; |
4557b520 | 235 | return lparam[0]; |
236 | } | |
237 | // Try to cross the boundary and see what is next | |
238 | while (length>TGeoShape::Tolerance()) { | |
239 | mparam[6]+=1.; | |
240 | currentnode = gGeoManager->Step(); | |
241 | step += snext+1.E-6; | |
242 | bparam[1] += snext*lparam[1]; | |
243 | bparam[2] += snext*lparam[2]; | |
244 | bparam[3] += snext*lparam[3]; | |
6c94f330 | 245 | bparam[5] += snext*lparam[5]; |
4557b520 | 246 | bparam[0] += snext*lparam[0]; |
247 | ||
248 | if (snext>=length) break; | |
58d96064 | 249 | if (!currentnode) break; |
4557b520 | 250 | // printf("%s snext=%f density=%f bparam[0]=%f\n", gGeoManager->GetPath(),snext,density,bparam[0]); |
251 | if (!gGeoManager->IsEntering()) { | |
252 | gGeoManager->SetStep(1.E-3); | |
253 | currentnode = gGeoManager->Step(); | |
254 | if (!gGeoManager->IsEntering() || !currentnode) { | |
6c94f330 | 255 | // printf("ERROR: cannot cross boundary\n"); |
256 | mparam[0] = bparam[0]/step; | |
257 | mparam[1] = bparam[1]/step; | |
258 | mparam[2] = bparam[2]/step; | |
259 | mparam[3] = bparam[3]/step; | |
260 | mparam[5] = bparam[5]/step; | |
261 | mparam[4] = step; | |
262 | mparam[0] = 0.; // if crash of navigation take mean density 0 | |
263 | mparam[1] = 1000000; // and infinite rad length | |
4557b520 | 264 | return bparam[0]/step; |
265 | } | |
266 | step += 1.E-3; | |
267 | snext += 1.E-3; | |
268 | bparam[0] += lparam[0]*1.E-3; | |
269 | bparam[1] += lparam[1]*1.E-3; | |
270 | bparam[2] += lparam[2]*1.E-3; | |
271 | bparam[3] += lparam[3]*1.E-3; | |
272 | bparam[5] += lparam[5]*1.E-3; | |
273 | } | |
274 | length -= snext; | |
275 | material = currentnode->GetVolume()->GetMedium()->GetMaterial(); | |
276 | lparam[0] = material->GetDensity(); | |
277 | lparam[1] = material->GetRadLen(); | |
278 | lparam[2] = material->GetA(); | |
279 | lparam[3] = material->GetZ(); | |
280 | lparam[5] = lparam[3]/lparam[2]; | |
281 | if (material->IsMixture()) { | |
282 | lparam[1]*=lparam[0]; | |
283 | TGeoMixture * mixture = (TGeoMixture*)material; | |
6c94f330 | 284 | lparam[5]=0; |
4557b520 | 285 | Double_t sum =0; |
286 | for (Int_t iel=0;iel<mixture->GetNelements();iel++){ | |
6c94f330 | 287 | sum+= mixture->GetWmixt()[iel]; |
288 | lparam[5]+= mixture->GetZmixt()[iel]*mixture->GetWmixt()[iel]/mixture->GetAmixt()[iel]; | |
4557b520 | 289 | } |
290 | lparam[5]/=sum; | |
291 | } | |
292 | gGeoManager->FindNextBoundary(length); | |
293 | snext = gGeoManager->GetStep(); | |
6c94f330 | 294 | } |
4557b520 | 295 | mparam[0] = bparam[0]/step; |
296 | mparam[1] = bparam[1]/step; | |
297 | mparam[2] = bparam[2]/step; | |
6c94f330 | 298 | mparam[3] = bparam[3]/step; |
299 | mparam[5] = bparam[5]/step; | |
300 | return bparam[0]/step; | |
7d0f8548 | 301 | |
7d0f8548 | 302 | } |
303 |