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