]>
Commit | Line | Data |
---|---|---|
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 | ||
16 | //------------------------------------------------------------------------- | |
17 | // Implementation of the ITS tracker class | |
18 | // It reads AliITSRecPoint clusters and creates AliITStrackV2 tracks | |
19 | // and fills with them the ESD | |
20 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch | |
21 | // dEdx analysis by: Boris Batyunya, JINR, Boris.Batiounia@cern.ch | |
22 | //------------------------------------------------------------------------- | |
23 | ||
24 | #include <new> | |
25 | ||
26 | #include <TError.h> | |
27 | #include <TFile.h> | |
28 | #include <TTree.h> | |
29 | #include <TRandom.h> | |
30 | #include <TGeoMatrix.h> | |
31 | ||
32 | #include "AliITSgeomTGeo.h" | |
33 | #include "AliAlignObj.h" | |
34 | #include "AliITSRecPoint.h" | |
35 | #include "AliESDEvent.h" | |
36 | #include "AliITSRecPoint.h" | |
37 | #include "AliITSReconstructor.h" | |
38 | #include "AliITStrackerV2.h" | |
39 | ||
40 | ClassImp(AliITStrackerV2) | |
41 | ||
42 | AliITStrackerV2::AliITSlayer AliITStrackerV2::fgLayers[kMaxLayer]; //ITS layers | |
43 | ||
44 | AliITStrackerV2::AliITStrackerV2(): | |
45 | AliTracker(), | |
46 | fI(kMaxLayer), | |
47 | fBestTrack(), | |
48 | fTrackToFollow(), | |
49 | fPass(0), | |
50 | fLastLayerToTrackTo(kLastLayerToTrackTo) | |
51 | { | |
52 | //-------------------------------------------------------------------- | |
53 | //This is the AliITStrackerV2 default constructor | |
54 | //-------------------------------------------------------------------- | |
55 | ||
56 | for (Int_t i=1; i<kMaxLayer+1; i++) new(fgLayers+i-1) AliITSlayer(); | |
57 | ||
58 | fConstraint[0]=1; fConstraint[1]=0; | |
59 | ||
60 | Double_t xyz[]={AliITSReconstructor::GetRecoParam()->GetXVdef(), | |
61 | AliITSReconstructor::GetRecoParam()->GetYVdef(), | |
62 | AliITSReconstructor::GetRecoParam()->GetZVdef()}; | |
63 | Double_t ers[]={AliITSReconstructor::GetRecoParam()->GetSigmaXVdef(), | |
64 | AliITSReconstructor::GetRecoParam()->GetSigmaYVdef(), | |
65 | AliITSReconstructor::GetRecoParam()->GetSigmaZVdef()}; | |
66 | SetVertex(xyz,ers); | |
67 | ||
68 | for (Int_t i=0; i<kMaxLayer; i++) fLayersNotToSkip[i]=kLayersNotToSkip[i]; | |
69 | ||
70 | } | |
71 | ||
72 | AliITStrackerV2::AliITStrackerV2(const AliITStrackerV2 &t): | |
73 | AliTracker(t), | |
74 | fI(t.fI), | |
75 | fBestTrack(t.fBestTrack), | |
76 | fTrackToFollow(t.fTrackToFollow), | |
77 | fPass(t.fPass), | |
78 | fLastLayerToTrackTo(t.fLastLayerToTrackTo) | |
79 | { | |
80 | //-------------------------------------------------------------------- | |
81 | //This is the AliITStrackerV2 copy constructor | |
82 | //-------------------------------------------------------------------- | |
83 | ||
84 | //for (Int_t i=1; i<kMaxLayer+1; i++) new(fgLayers+i-1) AliITSlayer(); | |
85 | ||
86 | fConstraint[0]=t.fConstraint[0]; fConstraint[1]=t.fConstraint[1]; | |
87 | ||
88 | Double_t xyz[]={AliITSReconstructor::GetRecoParam()->GetXVdef(), | |
89 | AliITSReconstructor::GetRecoParam()->GetYVdef(), | |
90 | AliITSReconstructor::GetRecoParam()->GetZVdef()}; | |
91 | Double_t ers[]={AliITSReconstructor::GetRecoParam()->GetSigmaXVdef(), | |
92 | AliITSReconstructor::GetRecoParam()->GetSigmaYVdef(), | |
93 | AliITSReconstructor::GetRecoParam()->GetSigmaZVdef()}; | |
94 | xyz[0]=t.GetX(); xyz[1]=t.GetY(); xyz[2]=t.GetZ(); | |
95 | ers[0]=t.GetSigmaX(); ers[1]=t.GetSigmaY(); ers[2]=t.GetSigmaZ(); | |
96 | SetVertex(xyz,ers); | |
97 | ||
98 | for (Int_t i=0; i<kMaxLayer; i++) fLayersNotToSkip[i]=t.fLayersNotToSkip[i]; | |
99 | ||
100 | } | |
101 | ||
102 | AliITStrackerV2::AliITStrackerV2(const Char_t *geom) : | |
103 | AliTracker(), | |
104 | fI(kMaxLayer), | |
105 | fBestTrack(), | |
106 | fTrackToFollow(), | |
107 | fPass(0), | |
108 | fLastLayerToTrackTo(kLastLayerToTrackTo) | |
109 | { | |
110 | //-------------------------------------------------------------------- | |
111 | //This is the AliITStrackerV2 constructor | |
112 | //-------------------------------------------------------------------- | |
113 | if (geom) { | |
114 | AliWarning("\"geom\" is actually a dummy argument !"); | |
115 | } | |
116 | ||
117 | for (Int_t i=1; i<kMaxLayer+1; i++) { | |
118 | Int_t nlad=AliITSgeomTGeo::GetNLadders(i); | |
119 | Int_t ndet=AliITSgeomTGeo::GetNDetectors(i); | |
120 | ||
121 | Double_t xyz[3], &x=xyz[0], &y=xyz[1], &z=xyz[2]; | |
122 | AliITSgeomTGeo::GetOrigTranslation(i,1,1,xyz); | |
123 | Double_t poff=TMath::ATan2(y,x); | |
124 | Double_t zoff=z; | |
125 | Double_t r=TMath::Sqrt(x*x + y*y); | |
126 | ||
127 | AliITSgeomTGeo::GetOrigTranslation(i,1,2,xyz); | |
128 | r += TMath::Sqrt(x*x + y*y); | |
129 | AliITSgeomTGeo::GetOrigTranslation(i,2,1,xyz); | |
130 | r += TMath::Sqrt(x*x + y*y); | |
131 | AliITSgeomTGeo::GetOrigTranslation(i,2,2,xyz); | |
132 | r += TMath::Sqrt(x*x + y*y); | |
133 | r*=0.25; | |
134 | ||
135 | new (fgLayers+i-1) AliITSlayer(r,poff,zoff,nlad,ndet); | |
136 | ||
137 | for (Int_t j=1; j<nlad+1; j++) { | |
138 | for (Int_t k=1; k<ndet+1; k++) { //Fill this layer with detectors | |
139 | TGeoHMatrix m; AliITSgeomTGeo::GetOrigMatrix(i,j,k,m); | |
140 | const TGeoHMatrix *tm=AliITSgeomTGeo::GetTracking2LocalMatrix(i,j,k); | |
141 | m.Multiply(tm); | |
142 | Double_t txyz[3]={0.}, xyz[3]={0.}; | |
143 | m.LocalToMaster(txyz,xyz); | |
144 | Double_t r=TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]); | |
145 | Double_t phi=TMath::ATan2(xyz[1],xyz[0]); | |
146 | ||
147 | if (phi<0) phi+=TMath::TwoPi(); | |
148 | else if (phi>=TMath::TwoPi()) phi-=TMath::TwoPi(); | |
149 | ||
150 | AliITSdetector &det=fgLayers[i-1].GetDetector((j-1)*ndet + k-1); | |
151 | new(&det) AliITSdetector(r,phi); | |
152 | } | |
153 | } | |
154 | ||
155 | } | |
156 | ||
157 | fConstraint[0]=1; fConstraint[1]=0; | |
158 | ||
159 | Double_t xyz[]={AliITSReconstructor::GetRecoParam()->GetXVdef(), | |
160 | AliITSReconstructor::GetRecoParam()->GetYVdef(), | |
161 | AliITSReconstructor::GetRecoParam()->GetZVdef()}; | |
162 | Double_t ers[]={AliITSReconstructor::GetRecoParam()->GetSigmaXVdef(), | |
163 | AliITSReconstructor::GetRecoParam()->GetSigmaYVdef(), | |
164 | AliITSReconstructor::GetRecoParam()->GetSigmaZVdef()}; | |
165 | SetVertex(xyz,ers); | |
166 | ||
167 | for (Int_t i=0; i<kMaxLayer; i++) fLayersNotToSkip[i]=kLayersNotToSkip[i]; | |
168 | ||
169 | } | |
170 | ||
171 | void AliITStrackerV2::SetLayersNotToSkip(Int_t *l) { | |
172 | //-------------------------------------------------------------------- | |
173 | //This function set masks of the layers which must be not skipped | |
174 | //-------------------------------------------------------------------- | |
175 | for (Int_t i=0; i<kMaxLayer; i++) fLayersNotToSkip[i]=l[i]; | |
176 | } | |
177 | ||
178 | Int_t AliITStrackerV2::LoadClusters(TTree *cTree) { | |
179 | //-------------------------------------------------------------------- | |
180 | //This function loads ITS clusters | |
181 | //-------------------------------------------------------------------- | |
182 | TBranch *branch=cTree->GetBranch("ITSRecPoints"); | |
183 | if (!branch) { | |
184 | Error("LoadClusters"," can't get the branch !\n"); | |
185 | return 1; | |
186 | } | |
187 | ||
188 | TClonesArray dummy("AliITSRecPoint",10000), *clusters=&dummy; | |
189 | branch->SetAddress(&clusters); | |
190 | ||
191 | Int_t j=0; | |
192 | for (Int_t i=0; i<kMaxLayer; i++) { | |
193 | Int_t ndet=fgLayers[i].GetNdetectors(); | |
194 | Int_t jmax = j + fgLayers[i].GetNladders()*ndet; | |
195 | ||
196 | Double_t r=fgLayers[i].GetR(); | |
197 | Double_t circ=TMath::TwoPi()*r; | |
198 | ||
199 | for (; j<jmax; j++) { | |
200 | if (!cTree->GetEvent(j)) continue; | |
201 | Int_t ncl=clusters->GetEntriesFast(); | |
202 | ||
203 | while (ncl--) { | |
204 | AliITSRecPoint *c=(AliITSRecPoint*)clusters->UncheckedAt(ncl); | |
205 | ||
206 | if (!c->Misalign()) AliWarning("Can't misalign this cluster !"); | |
207 | ||
208 | Int_t idx=c->GetDetectorIndex(); | |
209 | AliITSdetector &det=fgLayers[i].GetDetector(idx); | |
210 | ||
211 | Double_t y=r*det.GetPhi()+c->GetY(); | |
212 | if (y>circ) y-=circ; else if (y<0) y+=circ; | |
213 | c->SetPhiR(y); | |
214 | ||
215 | fgLayers[i].InsertCluster(new AliITSRecPoint(*c)); | |
216 | } | |
217 | clusters->Delete(); | |
218 | } | |
219 | fgLayers[i].ResetRoad(); //road defined by the cluster density | |
220 | } | |
221 | ||
222 | return 0; | |
223 | } | |
224 | ||
225 | void AliITStrackerV2::UnloadClusters() { | |
226 | //-------------------------------------------------------------------- | |
227 | //This function unloads ITS clusters | |
228 | //-------------------------------------------------------------------- | |
229 | for (Int_t i=0; i<kMaxLayer; i++) fgLayers[i].ResetClusters(); | |
230 | } | |
231 | ||
232 | static Int_t CorrectForDeadZoneMaterial(AliITStrackV2 *t) { | |
233 | //-------------------------------------------------------------------- | |
234 | // Correction for the material between the TPC and the ITS | |
235 | // (should it belong to the TPC code ?) | |
236 | //-------------------------------------------------------------------- | |
237 | Double_t riw=80., diw=0.0053, x0iw=30; // TPC inner wall ? | |
238 | Double_t rcd=61., dcd=0.0053, x0cd=30; // TPC "central drum" ? | |
239 | Double_t yr=12.8, dr=0.03; // rods ? | |
240 | Double_t zm=0.2, dm=0.40; // membrane | |
241 | //Double_t rr=52., dr=0.19, x0r=24., yyr=7.77; //rails | |
242 | Double_t rs=50., ds=0.001; // something belonging to the ITS (screen ?) | |
243 | ||
244 | if (t->GetX() > riw) { | |
245 | if (!t->PropagateTo(riw,diw,x0iw)) return 1; | |
246 | if (TMath::Abs(t->GetY())>yr) t->CorrectForMaterial(dr); | |
247 | if (TMath::Abs(t->GetZ())<zm) t->CorrectForMaterial(dm); | |
248 | if (!t->PropagateTo(rcd,dcd,x0cd)) return 1; | |
249 | //Double_t x,y,z; t->GetGlobalXYZat(rr,x,y,z); | |
250 | //if (TMath::Abs(y)<yyr) t->PropagateTo(rr,dr,x0r); | |
251 | if (!t->PropagateTo(rs,ds)) return 1; | |
252 | } else if (t->GetX() < rs) { | |
253 | if (!t->PropagateTo(rs,-ds)) return 1; | |
254 | //Double_t x,y,z; t->GetGlobalXYZat(rr,x,y,z); | |
255 | //if (TMath::Abs(y)<yyr) t->PropagateTo(rr,-dr,x0r); | |
256 | if (!t->PropagateTo(rcd,-dcd,x0cd)) return 1; | |
257 | if (!t->PropagateTo(riw+0.001,-diw,x0iw)) return 1; | |
258 | } else { | |
259 | ::Error("CorrectForDeadZoneMaterial","track is already in the dead zone !"); | |
260 | return 1; | |
261 | } | |
262 | ||
263 | return 0; | |
264 | } | |
265 | ||
266 | Int_t AliITStrackerV2::Clusters2Tracks(AliESDEvent *event) { | |
267 | //-------------------------------------------------------------------- | |
268 | // This functions reconstructs ITS tracks | |
269 | // The clusters must be already loaded ! | |
270 | //-------------------------------------------------------------------- | |
271 | TObjArray itsTracks(15000); | |
272 | ||
273 | {/* Read ESD tracks */ | |
274 | Int_t nentr=event->GetNumberOfTracks(); | |
275 | Info("Clusters2Tracks", "Number of ESD tracks: %d\n", nentr); | |
276 | while (nentr--) { | |
277 | AliESDtrack *esd=event->GetTrack(nentr); | |
278 | ||
279 | if ((esd->GetStatus()&AliESDtrack::kTPCin)==0) continue; | |
280 | if (esd->GetStatus()&AliESDtrack::kTPCout) continue; | |
281 | if (esd->GetStatus()&AliESDtrack::kITSin) continue; | |
282 | ||
283 | AliITStrackV2 *t=0; | |
284 | try { | |
285 | t=new AliITStrackV2(*esd); | |
286 | } catch (const Char_t *msg) { | |
287 | Warning("Clusters2Tracks",msg); | |
288 | delete t; | |
289 | continue; | |
290 | } | |
291 | if (TMath::Abs(t->GetD(GetX(),GetY()))>4) { | |
292 | delete t; | |
293 | continue; | |
294 | } | |
295 | ||
296 | if (CorrectForDeadZoneMaterial(t)!=0) { | |
297 | Warning("Clusters2Tracks", | |
298 | "failed to correct for the material in the dead zone !\n"); | |
299 | delete t; | |
300 | continue; | |
301 | } | |
302 | itsTracks.AddLast(t); | |
303 | } | |
304 | } /* End Read ESD tracks */ | |
305 | ||
306 | itsTracks.Sort(); | |
307 | Int_t nentr=itsTracks.GetEntriesFast(); | |
308 | ||
309 | Int_t ntrk=0; | |
310 | for (fPass=0; fPass<2; fPass++) { | |
311 | Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue; | |
312 | for (Int_t i=0; i<nentr; i++) { | |
313 | AliITStrackV2 *t=(AliITStrackV2*)itsTracks.UncheckedAt(i); | |
314 | if (t==0) continue; //this track has been already tracked | |
315 | Int_t tpcLabel=t->GetLabel(); //save the TPC track label | |
316 | ||
317 | ResetTrackToFollow(*t); | |
318 | ResetBestTrack(); | |
319 | ||
320 | for (FollowProlongation(); fI<kMaxLayer; fI++) { | |
321 | while (TakeNextProlongation()) FollowProlongation(); | |
322 | } | |
323 | ||
324 | if (fBestTrack.GetNumberOfClusters() == 0) continue; | |
325 | ||
326 | if (fConstraint[fPass]) { | |
327 | ResetTrackToFollow(*t); | |
328 | if (!RefitAt(3.7, &fTrackToFollow, &fBestTrack)) continue; | |
329 | ResetBestTrack(); | |
330 | } | |
331 | ||
332 | fBestTrack.SetLabel(tpcLabel); | |
333 | fBestTrack.CookdEdx(); | |
334 | CookLabel(&fBestTrack,0.); //For comparison only | |
335 | fBestTrack.UpdateESDtrack(AliESDtrack::kITSin); | |
336 | UseClusters(&fBestTrack); | |
337 | delete itsTracks.RemoveAt(i); | |
338 | ntrk++; | |
339 | } | |
340 | } | |
341 | ||
342 | itsTracks.Delete(); | |
343 | ||
344 | Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk); | |
345 | ||
346 | return 0; | |
347 | } | |
348 | ||
349 | Int_t AliITStrackerV2::PropagateBack(AliESDEvent *event) { | |
350 | //-------------------------------------------------------------------- | |
351 | // This functions propagates reconstructed ITS tracks back | |
352 | // The clusters must be loaded ! | |
353 | //-------------------------------------------------------------------- | |
354 | Int_t nentr=event->GetNumberOfTracks(); | |
355 | Info("PropagateBack", "Number of ESD tracks: %d\n", nentr); | |
356 | ||
357 | Int_t ntrk=0; | |
358 | for (Int_t i=0; i<nentr; i++) { | |
359 | AliESDtrack *esd=event->GetTrack(i); | |
360 | ||
361 | if ((esd->GetStatus()&AliESDtrack::kITSin)==0) continue; | |
362 | if (esd->GetStatus()&AliESDtrack::kITSout) continue; | |
363 | ||
364 | AliITStrackV2 *t=0; | |
365 | try { | |
366 | t=new AliITStrackV2(*esd); | |
367 | } catch (const Char_t *msg) { | |
368 | Warning("PropagateBack",msg); | |
369 | delete t; | |
370 | continue; | |
371 | } | |
372 | ||
373 | ResetTrackToFollow(*t); | |
374 | ||
375 | // propagete to vertex [SR, GSI 17.02.2003] | |
376 | // Start Time measurement [SR, GSI 17.02.2003], corrected by I.Belikov | |
377 | if (fTrackToFollow.PropagateTo(3.,0.0028,65.19)) { | |
378 | if (fTrackToFollow.PropagateToVertex(event->GetVertex())) { | |
379 | fTrackToFollow.StartTimeIntegral(); | |
380 | } | |
381 | fTrackToFollow.PropagateTo(3.,-0.0028,65.19); | |
382 | } | |
383 | ||
384 | fTrackToFollow.ResetCovariance(10.); fTrackToFollow.ResetClusters(); | |
385 | if (RefitAt(49.,&fTrackToFollow,t)) { | |
386 | if (CorrectForDeadZoneMaterial(&fTrackToFollow)!=0) { | |
387 | Warning("PropagateBack", | |
388 | "failed to correct for the material in the dead zone !\n"); | |
389 | delete t; | |
390 | continue; | |
391 | } | |
392 | fTrackToFollow.SetLabel(t->GetLabel()); | |
393 | //fTrackToFollow.CookdEdx(); | |
394 | CookLabel(&fTrackToFollow,0.); //For comparison only | |
395 | fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSout); | |
396 | UseClusters(&fTrackToFollow); | |
397 | ntrk++; | |
398 | } | |
399 | delete t; | |
400 | } | |
401 | ||
402 | Info("PropagateBack","Number of back propagated ITS tracks: %d\n",ntrk); | |
403 | ||
404 | return 0; | |
405 | } | |
406 | ||
407 | Int_t AliITStrackerV2::RefitInward(AliESDEvent *event) { | |
408 | //-------------------------------------------------------------------- | |
409 | // This functions refits ITS tracks using the | |
410 | // "inward propagated" TPC tracks | |
411 | // The clusters must be loaded ! | |
412 | //-------------------------------------------------------------------- | |
413 | Int_t nentr=event->GetNumberOfTracks(); | |
414 | Info("RefitInward", "Number of ESD tracks: %d\n", nentr); | |
415 | ||
416 | Int_t ntrk=0; | |
417 | for (Int_t i=0; i<nentr; i++) { | |
418 | AliESDtrack *esd=event->GetTrack(i); | |
419 | ||
420 | if ((esd->GetStatus()&AliESDtrack::kITSout) == 0) continue; | |
421 | if (esd->GetStatus()&AliESDtrack::kITSrefit) continue; | |
422 | if (esd->GetStatus()&AliESDtrack::kTPCout) | |
423 | if ((esd->GetStatus()&AliESDtrack::kTPCrefit)==0) continue; | |
424 | ||
425 | AliITStrackV2 *t=0; | |
426 | try { | |
427 | t=new AliITStrackV2(*esd); | |
428 | } catch (const Char_t *msg) { | |
429 | Warning("RefitInward",msg); | |
430 | delete t; | |
431 | continue; | |
432 | } | |
433 | ||
434 | if (CorrectForDeadZoneMaterial(t)!=0) { | |
435 | Warning("RefitInward", | |
436 | "failed to correct for the material in the dead zone !\n"); | |
437 | delete t; | |
438 | continue; | |
439 | } | |
440 | ||
441 | ResetTrackToFollow(*t); | |
442 | fTrackToFollow.ResetClusters(); | |
443 | ||
444 | //Refitting... | |
445 | if (RefitAt(3.7, &fTrackToFollow, t, kTRUE)) { | |
446 | fTrackToFollow.SetLabel(t->GetLabel()); | |
447 | fTrackToFollow.CookdEdx(); | |
448 | CookLabel(&fTrackToFollow,0.); //For comparison only | |
449 | ||
450 | if (fTrackToFollow.PropagateTo(3.,0.0028,65.19)) {//The beam pipe | |
451 | AliESDtrack *esdTrack =fTrackToFollow.GetESDtrack(); | |
452 | esdTrack->UpdateTrackParams(&fTrackToFollow,AliESDtrack::kITSrefit); | |
453 | Float_t r[3]={0.,0.,0.}; | |
454 | Double_t maxD=3.; | |
455 | esdTrack->RelateToVertex(event->GetVertex(),GetBz(r),maxD); | |
456 | ntrk++; | |
457 | } | |
458 | } | |
459 | delete t; | |
460 | } | |
461 | ||
462 | Info("RefitInward","Number of refitted tracks: %d\n",ntrk); | |
463 | ||
464 | return 0; | |
465 | } | |
466 | ||
467 | AliCluster *AliITStrackerV2::GetCluster(Int_t index) const { | |
468 | //-------------------------------------------------------------------- | |
469 | // Return pointer to a given cluster | |
470 | //-------------------------------------------------------------------- | |
471 | Int_t l=(index & 0xf0000000) >> 28; | |
472 | Int_t c=(index & 0x0fffffff) >> 00; | |
473 | return fgLayers[l].GetCluster(c); | |
474 | } | |
475 | ||
476 | ||
477 | void AliITStrackerV2::FollowProlongation() { | |
478 | //-------------------------------------------------------------------- | |
479 | //This function finds a track prolongation | |
480 | //-------------------------------------------------------------------- | |
481 | while (fI>fLastLayerToTrackTo) { | |
482 | Int_t i=fI-1; | |
483 | ||
484 | AliITSlayer &layer=fgLayers[i]; | |
485 | AliITStrackV2 &track=fTracks[i]; | |
486 | ||
487 | Double_t r=layer.GetR(); | |
488 | ||
489 | if (i==3 || i==1) { | |
490 | Double_t rs=0.5*(fgLayers[i+1].GetR() + r); | |
491 | Double_t d=0.0034, x0=38.6; | |
492 | if (i==1) {rs=9.; d=0.0097; x0=42;} | |
493 | if (!fTrackToFollow.PropagateTo(rs,d,x0)) { | |
494 | //Warning("FollowProlongation","propagation failed !\n"); | |
495 | return; | |
496 | } | |
497 | } | |
498 | ||
499 | //find intersection | |
500 | Double_t phi,z; | |
501 | if (!fTrackToFollow.GetPhiZat(r,phi,z)) { | |
502 | //Warning("FollowProlongation","failed to estimate track !\n"); | |
503 | return; | |
504 | } | |
505 | ||
506 | Int_t idet=layer.FindDetectorIndex(phi,z); | |
507 | if (idet<0) { | |
508 | //Warning("FollowProlongation","failed to find a detector !\n"); | |
509 | return; | |
510 | } | |
511 | ||
512 | //propagate to the intersection | |
513 | const AliITSdetector &det=layer.GetDetector(idet); | |
514 | phi=det.GetPhi(); | |
515 | if (!fTrackToFollow.Propagate(phi,det.GetR())) { | |
516 | //Warning("FollowProlongation","propagation failed !\n"); | |
517 | return; | |
518 | } | |
519 | fTrackToFollow.SetDetectorIndex(idet); | |
520 | ||
521 | //Select possible prolongations and store the current track estimation | |
522 | track.~AliITStrackV2(); new(&track) AliITStrackV2(fTrackToFollow); | |
523 | Double_t dz=7*TMath::Sqrt(track.GetSigmaZ2() + AliITSReconstructor::GetRecoParam()->GetSigmaZ2(i)); | |
524 | Double_t dy=7*TMath::Sqrt(track.GetSigmaY2() + AliITSReconstructor::GetRecoParam()->GetSigmaY2(i)); | |
525 | Double_t road=layer.GetRoad(); | |
526 | if (dz*dy>road*road) { | |
527 | Double_t dd=TMath::Sqrt(dz*dy), scz=dz/dd, scy=dy/dd; | |
528 | dz=road*scz; dy=road*scy; | |
529 | } | |
530 | ||
531 | //Double_t dz=4*TMath::Sqrt(track.GetSigmaZ2() + AliITSReconstructor::GetRecoParam()->GetSigmaZ2(i)); | |
532 | if (dz < 0.5*TMath::Abs(track.GetTgl())) dz=0.5*TMath::Abs(track.GetTgl()); | |
533 | if (dz > AliITSReconstructor::GetRecoParam()->GetMaxRoad()) { | |
534 | //Warning("FollowProlongation","too broad road in Z !\n"); | |
535 | return; | |
536 | } | |
537 | ||
538 | if (TMath::Abs(fTrackToFollow.GetZ()-GetZ()) > r+dz) return; | |
539 | ||
540 | //Double_t dy=4*TMath::Sqrt(track.GetSigmaY2() + AliITSReconstructor::GetRecoParam()->GetSigmaY2(i)); | |
541 | if (dy < 0.5*TMath::Abs(track.GetSnp())) dy=0.5*TMath::Abs(track.GetSnp()); | |
542 | if (dy > AliITSReconstructor::GetRecoParam()->GetMaxRoad()) { | |
543 | //Warning("FollowProlongation","too broad road in Y !\n"); | |
544 | return; | |
545 | } | |
546 | ||
547 | fI--; | |
548 | ||
549 | Double_t zmin=track.GetZ() - dz; | |
550 | Double_t zmax=track.GetZ() + dz; | |
551 | Double_t ymin=track.GetY() + r*phi - dy; | |
552 | Double_t ymax=track.GetY() + r*phi + dy; | |
553 | if (layer.SelectClusters(zmin,zmax,ymin,ymax)==0) | |
554 | if (fLayersNotToSkip[fI]) return; | |
555 | ||
556 | if (!TakeNextProlongation()) | |
557 | if (fLayersNotToSkip[fI]) return; | |
558 | ||
559 | } | |
560 | ||
561 | //deal with the best track | |
562 | Int_t ncl=fTrackToFollow.GetNumberOfClusters(); | |
563 | Int_t nclb=fBestTrack.GetNumberOfClusters(); | |
564 | if (ncl) | |
565 | if (ncl >= nclb) { | |
566 | Double_t chi2=fTrackToFollow.GetChi2(); | |
567 | if (chi2/ncl < AliITSReconstructor::GetRecoParam()->GetChi2PerCluster()) { | |
568 | if (ncl > nclb || chi2 < fBestTrack.GetChi2()) { | |
569 | ResetBestTrack(); | |
570 | } | |
571 | } | |
572 | } | |
573 | ||
574 | } | |
575 | ||
576 | Int_t AliITStrackerV2::TakeNextProlongation() { | |
577 | //-------------------------------------------------------------------- | |
578 | // This function takes another track prolongation | |
579 | // | |
580 | // dEdx analysis by: Boris Batyunya, JINR, Boris.Batiounia@cern.ch | |
581 | //-------------------------------------------------------------------- | |
582 | AliITSlayer &layer=fgLayers[fI]; | |
583 | ResetTrackToFollow(fTracks[fI]); | |
584 | ||
585 | Double_t dz=7*TMath::Sqrt(fTrackToFollow.GetSigmaZ2() + AliITSReconstructor::GetRecoParam()->GetSigmaZ2(fI)); | |
586 | Double_t dy=7*TMath::Sqrt(fTrackToFollow.GetSigmaY2() + AliITSReconstructor::GetRecoParam()->GetSigmaY2(fI)); | |
587 | Double_t road=layer.GetRoad(); | |
588 | if (dz*dy>road*road) { | |
589 | Double_t dd=TMath::Sqrt(dz*dy), scz=dz/dd, scy=dy/dd; | |
590 | dz=road*scz; dy=road*scy; | |
591 | } | |
592 | ||
593 | const AliITSRecPoint *c=0; Int_t ci=-1; | |
594 | const AliITSRecPoint *cc=0; Int_t cci=-1; | |
595 | Double_t chi2=AliITSReconstructor::GetRecoParam()->GetMaxChi2(); | |
596 | while ((c=layer.GetNextCluster(ci))!=0) { | |
597 | Int_t idet=c->GetDetectorIndex(); | |
598 | ||
599 | if (fTrackToFollow.GetDetectorIndex()!=idet) { | |
600 | const AliITSdetector &det=layer.GetDetector(idet); | |
601 | ResetTrackToFollow(fTracks[fI]); | |
602 | if (!fTrackToFollow.Propagate(det.GetPhi(),det.GetR())) { | |
603 | //Warning("TakeNextProlongation","propagation failed !\n"); | |
604 | continue; | |
605 | } | |
606 | fTrackToFollow.SetDetectorIndex(idet); | |
607 | if (TMath::Abs(fTrackToFollow.GetZ()-GetZ())>layer.GetR()+dz) continue; | |
608 | } | |
609 | ||
610 | if (TMath::Abs(fTrackToFollow.GetZ() - c->GetZ()) > dz) continue; | |
611 | if (TMath::Abs(fTrackToFollow.GetY() - c->GetY()) > dy) continue; | |
612 | ||
613 | Double_t ch2=fTrackToFollow.GetPredictedChi2(c); | |
614 | if (ch2 > chi2) continue; | |
615 | chi2=ch2; | |
616 | cc=c; cci=ci; | |
617 | break; | |
618 | } | |
619 | ||
620 | if (!cc) return 0; | |
621 | ||
622 | {// Take into account the mis-alignment | |
623 | Double_t x = fTrackToFollow.GetX() + cc->GetX(); | |
624 | if (!fTrackToFollow.PropagateTo(x,0.,0.)) return 0; | |
625 | } | |
626 | if (!fTrackToFollow.Update(cc,chi2,(fI<<28)+cci)) { | |
627 | //Warning("TakeNextProlongation","filtering failed !\n"); | |
628 | return 0; | |
629 | } | |
630 | ||
631 | if (fTrackToFollow.GetNumberOfClusters()>1) | |
632 | if (TMath::Abs(fTrackToFollow.GetD(GetX(),GetY()))>4) return 0; | |
633 | ||
634 | fTrackToFollow. | |
635 | SetSampledEdx(cc->GetQ(),fTrackToFollow.GetNumberOfClusters()-1); //b.b. | |
636 | ||
637 | { | |
638 | Double_t x0; | |
639 | Double_t d=layer.GetThickness(fTrackToFollow.GetY(),fTrackToFollow.GetZ(),x0); | |
640 | fTrackToFollow.CorrectForMaterial(d,x0); | |
641 | } | |
642 | ||
643 | if (fConstraint[fPass]) { | |
644 | Double_t d=GetEffectiveThickness(0,0); //Think of this !!!! | |
645 | Double_t xyz[]={GetX(),GetY(),GetZ()}; | |
646 | Double_t ers[]={GetSigmaX(),GetSigmaY(),GetSigmaZ()}; | |
647 | fTrackToFollow.Improve(d,xyz,ers); | |
648 | } | |
649 | ||
650 | return 1; | |
651 | } | |
652 | ||
653 | ||
654 | AliITStrackerV2::AliITSlayer::AliITSlayer(): | |
655 | fR(0.), | |
656 | fPhiOffset(0.), | |
657 | fNladders(0), | |
658 | fZOffset(0.), | |
659 | fNdetectors(0), | |
660 | fDetectors(0), | |
661 | fNsel(0), | |
662 | fRoad(2*fR*TMath::Sqrt(3.14/1.)) //assuming that there's only one cluster | |
663 | { | |
664 | //-------------------------------------------------------------------- | |
665 | //default AliITSlayer constructor | |
666 | //-------------------------------------------------------------------- | |
667 | ||
668 | for (Int_t i=0; i<kNsector; i++) fN[i]=0; | |
669 | ||
670 | } | |
671 | ||
672 | AliITStrackerV2::AliITSlayer:: | |
673 | AliITSlayer(Double_t r,Double_t p,Double_t z,Int_t nl,Int_t nd): | |
674 | fR(r), | |
675 | fPhiOffset(p), | |
676 | fNladders(nl), | |
677 | fZOffset(z), | |
678 | fNdetectors(nd), | |
679 | fDetectors(new AliITSdetector[nl*nd]), | |
680 | fNsel(0), | |
681 | fRoad(2*r*TMath::Sqrt(3.14/1.)) //assuming that there's only one cluster | |
682 | { | |
683 | //-------------------------------------------------------------------- | |
684 | //main AliITSlayer constructor | |
685 | //-------------------------------------------------------------------- | |
686 | ||
687 | for (Int_t i=0; i<kNsector; i++) fN[i]=0; | |
688 | ||
689 | for (Int_t i=0; i<kMaxClusterPerLayer; i++) fClusters[i]=0; | |
690 | ||
691 | } | |
692 | ||
693 | AliITStrackerV2::AliITSlayer::~AliITSlayer() { | |
694 | //-------------------------------------------------------------------- | |
695 | // AliITSlayer destructor | |
696 | //-------------------------------------------------------------------- | |
697 | delete[] fDetectors; | |
698 | ResetClusters(); | |
699 | } | |
700 | ||
701 | void AliITStrackerV2::AliITSlayer::ResetClusters() { | |
702 | //-------------------------------------------------------------------- | |
703 | // This function removes loaded clusters | |
704 | //-------------------------------------------------------------------- | |
705 | for (Int_t s=0; s<kNsector; s++) { | |
706 | Int_t &n=fN[s]; | |
707 | while (n) { | |
708 | n--; | |
709 | delete fClusters[s*kMaxClusterPerSector+n]; | |
710 | } | |
711 | } | |
712 | } | |
713 | ||
714 | void AliITStrackerV2::AliITSlayer::ResetRoad() { | |
715 | //-------------------------------------------------------------------- | |
716 | // This function calculates the road defined by the cluster density | |
717 | //-------------------------------------------------------------------- | |
718 | Int_t n=0; | |
719 | for (Int_t s=0; s<kNsector; s++) { | |
720 | Int_t i=fN[s]; | |
721 | while (i--) | |
722 | if (TMath::Abs(fClusters[s*kMaxClusterPerSector+i]->GetZ())<fR) n++; | |
723 | } | |
724 | if (n>1) fRoad=2*fR*TMath::Sqrt(3.14/n); | |
725 | } | |
726 | ||
727 | Int_t AliITStrackerV2::AliITSlayer::InsertCluster(AliITSRecPoint *c) { | |
728 | //-------------------------------------------------------------------- | |
729 | // This function inserts a cluster to this layer in increasing | |
730 | // order of the cluster's fZ | |
731 | //-------------------------------------------------------------------- | |
732 | Float_t circ=TMath::TwoPi()*fR; | |
733 | Int_t sec=Int_t(kNsector*c->GetPhiR()/circ); | |
734 | if (sec>=kNsector) { | |
735 | ::Error("InsertCluster","Wrong sector !\n"); | |
736 | return 1; | |
737 | } | |
738 | Int_t &n=fN[sec]; | |
739 | if (n>=kMaxClusterPerSector) { | |
740 | ::Error("InsertCluster","Too many clusters !\n"); | |
741 | return 1; | |
742 | } | |
743 | if (n==0) fClusters[sec*kMaxClusterPerSector]=c; | |
744 | else { | |
745 | Int_t i=FindClusterIndex(c->GetZ(),sec); | |
746 | Int_t k=n-i+sec*kMaxClusterPerSector; | |
747 | memmove(fClusters+i+1 ,fClusters+i,k*sizeof(AliITSRecPoint*)); | |
748 | fClusters[i]=c; | |
749 | } | |
750 | n++; | |
751 | return 0; | |
752 | } | |
753 | ||
754 | Int_t | |
755 | AliITStrackerV2::AliITSlayer::FindClusterIndex(Float_t z,Int_t s) const { | |
756 | //-------------------------------------------------------------------- | |
757 | // For the sector "s", this function returns the index of the first | |
758 | // with its fZ >= "z". | |
759 | //-------------------------------------------------------------------- | |
760 | Int_t nc=fN[s]; | |
761 | if (nc==0) return kMaxClusterPerSector*s; | |
762 | ||
763 | Int_t b=kMaxClusterPerSector*s; | |
764 | if (z <= fClusters[b]->GetZ()) return b; | |
765 | ||
766 | Int_t e=b+nc-1; | |
767 | if (z > fClusters[e]->GetZ()) return e+1; | |
768 | ||
769 | Int_t m=(b+e)/2; | |
770 | for (; b<e; m=(b+e)/2) { | |
771 | if (z > fClusters[m]->GetZ()) b=m+1; | |
772 | else e=m; | |
773 | } | |
774 | return m; | |
775 | } | |
776 | ||
777 | Int_t AliITStrackerV2::AliITSlayer:: | |
778 | SelectClusters(Float_t zmin,Float_t zmax,Float_t ymin, Float_t ymax) { | |
779 | //-------------------------------------------------------------------- | |
780 | // This function selects clusters within the "window" | |
781 | //-------------------------------------------------------------------- | |
782 | Float_t circ=fR*TMath::TwoPi(); | |
783 | ||
784 | if (ymin>circ) ymin-=circ; else if (ymin<0) ymin+=circ; | |
785 | if (ymax>circ) ymax-=circ; else if (ymax<0) ymax+=circ; | |
786 | ||
787 | Int_t i1=Int_t(kNsector*ymin/circ); if (i1==kNsector) i1--; | |
788 | if (fN[i1]!=0) { | |
789 | Float_t ym = (ymax<ymin) ? ymax+circ : ymax; | |
790 | Int_t i=FindClusterIndex(zmin,i1), imax=i1*kMaxClusterPerSector+fN[i1]; | |
791 | for (; i<imax; i++) { | |
792 | AliITSRecPoint *c=fClusters[i]; | |
793 | if (c->IsUsed()) continue; | |
794 | if (c->GetZ()>zmax) break; | |
795 | if (c->GetPhiR()<=ymin) continue; | |
796 | if (c->GetPhiR()>ym) continue; | |
797 | fIndex[fNsel++]=i; | |
798 | } | |
799 | } | |
800 | ||
801 | Int_t i2=Int_t(kNsector*ymax/circ); if (i2==kNsector) i2--; | |
802 | if (i2==i1) return fNsel; | |
803 | ||
804 | if (fN[i2]!=0) { | |
805 | Float_t ym = (ymin>ymax) ? ymin-circ : ymin; | |
806 | Int_t i=FindClusterIndex(zmin,i2), imax=i2*kMaxClusterPerSector+fN[i2]; | |
807 | for (; i<imax; i++) { | |
808 | AliITSRecPoint *c=fClusters[i]; | |
809 | if (c->IsUsed()) continue; | |
810 | if (c->GetZ()>zmax) break; | |
811 | if (c->GetPhiR()<=ym) continue; | |
812 | if (c->GetPhiR()>ymax) continue; | |
813 | fIndex[fNsel++]=i; | |
814 | } | |
815 | } | |
816 | ||
817 | return fNsel; | |
818 | } | |
819 | ||
820 | const AliITSRecPoint *AliITStrackerV2::AliITSlayer::GetNextCluster(Int_t &ci){ | |
821 | //-------------------------------------------------------------------- | |
822 | // This function returns clusters within the "window" | |
823 | //-------------------------------------------------------------------- | |
824 | AliITSRecPoint *c=0; | |
825 | ci=-1; | |
826 | if (fNsel) { | |
827 | fNsel--; | |
828 | ci=fIndex[fNsel]; | |
829 | c=fClusters[ci]; | |
830 | } | |
831 | return c; | |
832 | } | |
833 | ||
834 | Int_t AliITStrackerV2::AliITSlayer::GetNumberOfClusters() const { | |
835 | Int_t n=0; | |
836 | for (Int_t s=0; s<kNsector; s++) n+=fN[s]; | |
837 | return n; | |
838 | } | |
839 | ||
840 | Int_t | |
841 | AliITStrackerV2::AliITSlayer::FindDetectorIndex(Double_t phi,Double_t z)const { | |
842 | //-------------------------------------------------------------------- | |
843 | //This function finds the detector crossed by the track | |
844 | //-------------------------------------------------------------------- | |
845 | Double_t dphi; | |
846 | if (fZOffset<0) // old geometry | |
847 | dphi = -(phi-fPhiOffset); | |
848 | else // new geometry | |
849 | dphi = phi-fPhiOffset; | |
850 | ||
851 | if (dphi < 0) dphi += 2*TMath::Pi(); | |
852 | else if (dphi >= 2*TMath::Pi()) dphi -= 2*TMath::Pi(); | |
853 | Int_t np=Int_t(dphi*fNladders*0.5/TMath::Pi()+0.5); | |
854 | if (np>=fNladders) np-=fNladders; | |
855 | if (np<0) np+=fNladders; | |
856 | ||
857 | Double_t dz=fZOffset-z; | |
858 | Int_t nz=Int_t(dz*(fNdetectors-1)*0.5/fZOffset+0.5); | |
859 | if (nz>=fNdetectors) return -1; | |
860 | if (nz<0) return -1; | |
861 | ||
862 | return np*fNdetectors + nz; | |
863 | } | |
864 | ||
865 | Double_t | |
866 | AliITStrackerV2::AliITSlayer::GetThickness(Double_t y,Double_t z,Double_t &x0) | |
867 | const { | |
868 | //-------------------------------------------------------------------- | |
869 | //This function returns the layer thickness at this point (units X0) | |
870 | //-------------------------------------------------------------------- | |
871 | Double_t d=0.0085; | |
872 | x0=21.82; | |
873 | ||
874 | if (43<fR&&fR<45) { //SSD2 | |
875 | Double_t dd=0.0034; | |
876 | d=dd; | |
877 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
878 | if (TMath::Abs(y-1.90)<0.45) {d+=(0.013-0.0034);} | |
879 | if (TMath::Abs(y+1.90)<0.45) {d+=(0.013-0.0034);} | |
880 | for (Int_t i=0; i<12; i++) { | |
881 | if (TMath::Abs(z-3.9*(i+0.5))<0.15) { | |
882 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
883 | d+=0.0034; | |
884 | break; | |
885 | } | |
886 | if (TMath::Abs(z+3.9*(i+0.5))<0.15) { | |
887 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
888 | d+=0.0034; | |
889 | break; | |
890 | } | |
891 | if (TMath::Abs(z-3.4-3.9*i)<0.50) {d+=(0.016-0.0034); break;} | |
892 | if (TMath::Abs(z+0.5+3.9*i)<0.50) {d+=(0.016-0.0034); break;} | |
893 | } | |
894 | } else | |
895 | if (37<fR&&fR<41) { //SSD1 | |
896 | Double_t dd=0.0034; | |
897 | d=dd; | |
898 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
899 | if (TMath::Abs(y-1.90)<0.45) {d+=(0.013-0.0034);} | |
900 | if (TMath::Abs(y+1.90)<0.45) {d+=(0.013-0.0034);} | |
901 | for (Int_t i=0; i<11; i++) { | |
902 | if (TMath::Abs(z-3.9*i)<0.15) { | |
903 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
904 | d+=dd; | |
905 | break; | |
906 | } | |
907 | if (TMath::Abs(z+3.9*i)<0.15) { | |
908 | if (TMath::Abs(y-0.00)>3.40) d+=dd; | |
909 | d+=dd; | |
910 | break; | |
911 | } | |
912 | if (TMath::Abs(z-1.85-3.9*i)<0.50) {d+=(0.016-0.0034); break;} | |
913 | if (TMath::Abs(z+2.05+3.9*i)<0.50) {d+=(0.016-0.0034); break;} | |
914 | } | |
915 | } else | |
916 | if (13<fR&&fR<26) { //SDD | |
917 | Double_t dd=0.0033; | |
918 | d=dd; | |
919 | if (TMath::Abs(y-0.00)>3.30) d+=dd; | |
920 | ||
921 | if (TMath::Abs(y-1.80)<0.55) { | |
922 | d+=0.016; | |
923 | for (Int_t j=0; j<20; j++) { | |
924 | if (TMath::Abs(z+0.7+1.47*j)<0.12) {d+=0.08; x0=9.; break;} | |
925 | if (TMath::Abs(z-0.7-1.47*j)<0.12) {d+=0.08; x0=9.; break;} | |
926 | } | |
927 | } | |
928 | if (TMath::Abs(y+1.80)<0.55) { | |
929 | d+=0.016; | |
930 | for (Int_t j=0; j<20; j++) { | |
931 | if (TMath::Abs(z-0.7-1.47*j)<0.12) {d+=0.08; x0=9.; break;} | |
932 | if (TMath::Abs(z+0.7+1.47*j)<0.12) {d+=0.08; x0=9.; break;} | |
933 | } | |
934 | } | |
935 | ||
936 | for (Int_t i=0; i<4; i++) { | |
937 | if (TMath::Abs(z-7.3*i)<0.60) { | |
938 | d+=dd; | |
939 | if (TMath::Abs(y-0.00)>3.30) d+=dd; | |
940 | break; | |
941 | } | |
942 | if (TMath::Abs(z+7.3*i)<0.60) { | |
943 | d+=dd; | |
944 | if (TMath::Abs(y-0.00)>3.30) d+=dd; | |
945 | break; | |
946 | } | |
947 | } | |
948 | } else | |
949 | if (6<fR&&fR<8) { //SPD2 | |
950 | Double_t dd=0.0063; x0=21.5; | |
951 | d=dd; | |
952 | if (TMath::Abs(y-3.08)>0.5) d+=dd; | |
953 | //if (TMath::Abs(y-3.08)>0.45) d+=dd; | |
954 | if (TMath::Abs(y-3.03)<0.10) {d+=0.014;} | |
955 | } else | |
956 | if (3<fR&&fR<5) { //SPD1 | |
957 | Double_t dd=0.0063; x0=21.5; | |
958 | d=dd; | |
959 | if (TMath::Abs(y+0.21)>0.6) d+=dd; | |
960 | //if (TMath::Abs(y+0.21)>0.45) d+=dd; | |
961 | if (TMath::Abs(y+0.10)<0.10) {d+=0.014;} | |
962 | } | |
963 | ||
964 | return d; | |
965 | } | |
966 | ||
967 | Double_t AliITStrackerV2::GetEffectiveThickness(Double_t y,Double_t z) const | |
968 | { | |
969 | //-------------------------------------------------------------------- | |
970 | //Returns the thickness between the current layer and the vertex (units X0) | |
971 | //-------------------------------------------------------------------- | |
972 | Double_t d=0.0028*3*3; //beam pipe | |
973 | Double_t x0=0; | |
974 | ||
975 | Double_t xn=fgLayers[fI].GetR(); | |
976 | for (Int_t i=0; i<fI; i++) { | |
977 | Double_t xi=fgLayers[i].GetR(); | |
978 | d+=fgLayers[i].GetThickness(y,z,x0)*xi*xi; | |
979 | } | |
980 | ||
981 | if (fI>1) { | |
982 | Double_t xi=9.; | |
983 | d+=0.0097*xi*xi; | |
984 | } | |
985 | ||
986 | if (fI>3) { | |
987 | Double_t xi=0.5*(fgLayers[3].GetR()+fgLayers[4].GetR()); | |
988 | d+=0.0034*xi*xi; | |
989 | } | |
990 | ||
991 | return d/(xn*xn); | |
992 | } | |
993 | ||
994 | Bool_t AliITStrackerV2::RefitAt(Double_t xx,AliITStrackV2 *t, | |
995 | const AliITStrackV2 *c, Bool_t extra) { | |
996 | //-------------------------------------------------------------------- | |
997 | // This function refits the track "t" at the position "x" using | |
998 | // the clusters from "c" | |
999 | // If "extra"==kTRUE, | |
1000 | // the clusters from overlapped modules get attached to "t" | |
1001 | //-------------------------------------------------------------------- | |
1002 | Int_t index[kMaxLayer]; | |
1003 | Int_t k; | |
1004 | for (k=0; k<kMaxLayer; k++) index[k]=-1; | |
1005 | Int_t nc=c->GetNumberOfClusters(); | |
1006 | for (k=0; k<nc; k++) { | |
1007 | Int_t idx=c->GetClusterIndex(k),nl=(idx&0xf0000000)>>28; | |
1008 | index[nl]=idx; | |
1009 | } | |
1010 | ||
1011 | Int_t from, to, step; | |
1012 | if (xx > t->GetX()) { | |
1013 | from=0; to=kMaxLayer; | |
1014 | step=+1; | |
1015 | } else { | |
1016 | from=kMaxLayer-1; to=-1; | |
1017 | step=-1; | |
1018 | } | |
1019 | ||
1020 | for (Int_t i=from; i != to; i += step) { | |
1021 | AliITSlayer &layer=fgLayers[i]; | |
1022 | Double_t r=layer.GetR(); | |
1023 | ||
1024 | { | |
1025 | Double_t hI=i-0.5*step; | |
1026 | if (TMath::Abs(hI-1.5)<0.01 || TMath::Abs(hI-3.5)<0.01) { | |
1027 | Double_t rs=0.5*(fgLayers[i-step].GetR() + r); | |
1028 | Double_t d=0.0034, x0=38.6; | |
1029 | if (TMath::Abs(hI-1.5)<0.01) {rs=9.; d=0.0097; x0=42;} | |
1030 | if (!t->PropagateTo(rs,-step*d,x0)) { | |
1031 | return kFALSE; | |
1032 | } | |
1033 | } | |
1034 | } | |
1035 | ||
1036 | // remember old position [SR, GSI 18.02.2003] | |
1037 | Double_t oldX=0., oldY=0., oldZ=0.; | |
1038 | if (t->IsStartedTimeIntegral() && step==1) { | |
1039 | t->GetGlobalXYZat(t->GetX(),oldX,oldY,oldZ); | |
1040 | } | |
1041 | // | |
1042 | ||
1043 | Double_t phi,z; | |
1044 | if (!t->GetPhiZat(r,phi,z)) { | |
1045 | return kFALSE; | |
1046 | } | |
1047 | ||
1048 | Int_t idet=layer.FindDetectorIndex(phi,z); | |
1049 | if (idet<0) { | |
1050 | return kFALSE; | |
1051 | } | |
1052 | const AliITSdetector &det=layer.GetDetector(idet); | |
1053 | phi=det.GetPhi(); | |
1054 | if (!t->Propagate(phi,det.GetR())) { | |
1055 | return kFALSE; | |
1056 | } | |
1057 | t->SetDetectorIndex(idet); | |
1058 | ||
1059 | const AliITSRecPoint *cl=0; | |
1060 | Double_t maxchi2=AliITSReconstructor::GetRecoParam()->GetMaxChi2(); | |
1061 | ||
1062 | Int_t idx=index[i]; | |
1063 | if (idx>=0) { | |
1064 | const AliITSRecPoint *c=(AliITSRecPoint *)GetCluster(idx); | |
1065 | if (idet != c->GetDetectorIndex()) { | |
1066 | idet=c->GetDetectorIndex(); | |
1067 | const AliITSdetector &det=layer.GetDetector(idet); | |
1068 | if (!t->Propagate(det.GetPhi(),det.GetR())) { | |
1069 | return kFALSE; | |
1070 | } | |
1071 | t->SetDetectorIndex(idet); | |
1072 | } | |
1073 | Double_t chi2=t->GetPredictedChi2(c); | |
1074 | if (chi2<maxchi2) { | |
1075 | cl=c; | |
1076 | maxchi2=chi2; | |
1077 | } else { | |
1078 | return kFALSE; | |
1079 | } | |
1080 | } | |
1081 | ||
1082 | if (cl) { | |
1083 | // Take into account the mis-alignment | |
1084 | Double_t x=t->GetX()+cl->GetX(); | |
1085 | if (!t->PropagateTo(x,0.,0.)) return kFALSE; | |
1086 | if (!t->Update(cl,maxchi2,idx)) { | |
1087 | return kFALSE; | |
1088 | } | |
1089 | t->SetSampledEdx(cl->GetQ(),t->GetNumberOfClusters()-1); | |
1090 | } | |
1091 | ||
1092 | { | |
1093 | Double_t x0; | |
1094 | Double_t d=layer.GetThickness(t->GetY(),t->GetZ(),x0); | |
1095 | t->CorrectForMaterial(-step*d,x0); | |
1096 | } | |
1097 | ||
1098 | if (extra) { //search for extra clusters | |
1099 | AliITStrackV2 tmp(*t); | |
1100 | Double_t dz=4*TMath::Sqrt(tmp.GetSigmaZ2()+AliITSReconstructor::GetRecoParam()->GetSigmaZ2(i)); | |
1101 | if (dz < 0.5*TMath::Abs(tmp.GetTgl())) dz=0.5*TMath::Abs(tmp.GetTgl()); | |
1102 | Double_t dy=4*TMath::Sqrt(t->GetSigmaY2()+AliITSReconstructor::GetRecoParam()->GetSigmaY2(i)); | |
1103 | if (dy < 0.5*TMath::Abs(tmp.GetSnp())) dy=0.5*TMath::Abs(tmp.GetSnp()); | |
1104 | Double_t zmin=t->GetZ() - dz; | |
1105 | Double_t zmax=t->GetZ() + dz; | |
1106 | Double_t ymin=t->GetY() + phi*r - dy; | |
1107 | Double_t ymax=t->GetY() + phi*r + dy; | |
1108 | layer.SelectClusters(zmin,zmax,ymin,ymax); | |
1109 | ||
1110 | const AliITSRecPoint *c=0; Int_t ci=-1,cci=-1; | |
1111 | Double_t maxchi2=1000.*AliITSReconstructor::GetRecoParam()->GetMaxChi2(), tolerance=0.1; | |
1112 | while ((c=layer.GetNextCluster(ci))!=0) { | |
1113 | if (idet == c->GetDetectorIndex()) continue; | |
1114 | ||
1115 | const AliITSdetector &det=layer.GetDetector(c->GetDetectorIndex()); | |
1116 | ||
1117 | if (!tmp.Propagate(det.GetPhi(),det.GetR())) continue; | |
1118 | ||
1119 | if (TMath::Abs(tmp.GetZ() - c->GetZ()) > tolerance) continue; | |
1120 | if (TMath::Abs(tmp.GetY() - c->GetY()) > tolerance) continue; | |
1121 | ||
1122 | Double_t chi2=tmp.GetPredictedChi2(c); | |
1123 | if (chi2<maxchi2) { maxchi2=chi2; cci=ci; } | |
1124 | } | |
1125 | if (cci>=0) t->SetExtraCluster(i,(i<<28)+cci); | |
1126 | } | |
1127 | ||
1128 | // track time update [SR, GSI 17.02.2003] | |
1129 | if (t->IsStartedTimeIntegral() && step==1) { | |
1130 | Double_t newX, newY, newZ; | |
1131 | t->GetGlobalXYZat(t->GetX(),newX,newY,newZ); | |
1132 | Double_t dL2 = (oldX-newX)*(oldX-newX) + (oldY-newY)*(oldY-newY) + | |
1133 | (oldZ-newZ)*(oldZ-newZ); | |
1134 | t->AddTimeStep(TMath::Sqrt(dL2)); | |
1135 | } | |
1136 | // | |
1137 | ||
1138 | } | |
1139 | ||
1140 | if (!t->PropagateTo(xx,0.,0.)) return kFALSE; | |
1141 | return kTRUE; | |
1142 | } | |
1143 | ||
1144 | void AliITStrackerV2::UseClusters(const AliKalmanTrack *t, Int_t from) const { | |
1145 | //-------------------------------------------------------------------- | |
1146 | // This function marks clusters assigned to the track | |
1147 | //-------------------------------------------------------------------- | |
1148 | AliTracker::UseClusters(t,from); | |
1149 | ||
1150 | Int_t clusterIndex = t->GetClusterIndex(0); | |
1151 | AliITSRecPoint *c= 0x0; | |
1152 | ||
1153 | if (clusterIndex>-1) | |
1154 | c = (AliITSRecPoint *)GetCluster(clusterIndex); | |
1155 | if (c && c->GetSigmaZ2()>0.1) c->UnUse(); | |
1156 | ||
1157 | c = 0x0; | |
1158 | clusterIndex = t->GetClusterIndex(1); | |
1159 | if (clusterIndex>-1) | |
1160 | c=(AliITSRecPoint *)GetCluster(clusterIndex); | |
1161 | if (c && c->GetSigmaZ2()>0.1) c->UnUse(); | |
1162 | ||
1163 | } |