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