]>
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 | |
00a7cc50 | 18 | // It reads AliITSRecPoint clusters and creates AliITStrackV2 tracks |
18856a77 | 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 | ||
75fb37cc | 26 | #include <TError.h> |
006b5f7f | 27 | #include <TFile.h> |
28 | #include <TTree.h> | |
29 | #include <TRandom.h> | |
a504d56f | 30 | #include <TGeoMatrix.h> |
006b5f7f | 31 | |
e341247d | 32 | #include "AliITSgeomTGeo.h" |
a504d56f | 33 | #include "AliAlignObj.h" |
006b5f7f | 34 | #include "AliITSRecPoint.h" |
af885e0f | 35 | #include "AliESDEvent.h" |
00a7cc50 | 36 | #include "AliITSRecPoint.h" |
44347160 | 37 | #include "AliITSReconstructor.h" |
006b5f7f | 38 | #include "AliITStrackerV2.h" |
39 | ||
8676d691 | 40 | ClassImp(AliITStrackerV2) |
006b5f7f | 41 | |
a504d56f | 42 | AliITStrackerV2::AliITSlayer AliITStrackerV2::fgLayers[kMaxLayer]; //ITS layers |
006b5f7f | 43 | |
6c94f330 | 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 | ||
44347160 | 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()}; | |
6c94f330 | 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 | ||
44347160 | 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()}; | |
6c94f330 | 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 | ||
1f3e997f | 102 | AliITStrackerV2::AliITStrackerV2(const Char_t *geom) : |
6c94f330 | 103 | AliTracker(), |
104 | fI(kMaxLayer), | |
105 | fBestTrack(), | |
106 | fTrackToFollow(), | |
107 | fPass(0), | |
108 | fLastLayerToTrackTo(kLastLayerToTrackTo) | |
109 | { | |
006b5f7f | 110 | //-------------------------------------------------------------------- |
61ab8ea8 | 111 | //This is the AliITStrackerV2 constructor |
006b5f7f | 112 | //-------------------------------------------------------------------- |
e341247d | 113 | if (geom) { |
114 | AliWarning("\"geom\" is actually a dummy argument !"); | |
115 | } | |
006b5f7f | 116 | |
e341247d | 117 | for (Int_t i=1; i<kMaxLayer+1; i++) { |
118 | Int_t nlad=AliITSgeomTGeo::GetNLadders(i); | |
119 | Int_t ndet=AliITSgeomTGeo::GetNDetectors(i); | |
006b5f7f | 120 | |
e341247d | 121 | Double_t xyz[3], &x=xyz[0], &y=xyz[1], &z=xyz[2]; |
122 | AliITSgeomTGeo::GetOrigTranslation(i,1,1,xyz); | |
006b5f7f | 123 | Double_t poff=TMath::ATan2(y,x); |
124 | Double_t zoff=z; | |
a504d56f | 125 | Double_t r=TMath::Sqrt(x*x + y*y); |
006b5f7f | 126 | |
e341247d | 127 | AliITSgeomTGeo::GetOrigTranslation(i,1,2,xyz); |
006b5f7f | 128 | r += TMath::Sqrt(x*x + y*y); |
e341247d | 129 | AliITSgeomTGeo::GetOrigTranslation(i,2,1,xyz); |
006b5f7f | 130 | r += TMath::Sqrt(x*x + y*y); |
e341247d | 131 | AliITSgeomTGeo::GetOrigTranslation(i,2,2,xyz); |
006b5f7f | 132 | r += TMath::Sqrt(x*x + y*y); |
133 | r*=0.25; | |
134 | ||
18856a77 | 135 | new (fgLayers+i-1) AliITSlayer(r,poff,zoff,nlad,ndet); |
006b5f7f | 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 | |
e341247d | 139 | TGeoHMatrix m; AliITSgeomTGeo::GetOrigMatrix(i,j,k,m); |
1f3e997f | 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]); | |
c219fd63 | 146 | |
147 | if (phi<0) phi+=TMath::TwoPi(); | |
148 | else if (phi>=TMath::TwoPi()) phi-=TMath::TwoPi(); | |
149 | ||
18856a77 | 150 | AliITSdetector &det=fgLayers[i-1].GetDetector((j-1)*ndet + k-1); |
006b5f7f | 151 | new(&det) AliITSdetector(r,phi); |
152 | } | |
153 | } | |
c630aafd | 154 | |
006b5f7f | 155 | } |
156 | ||
c219fd63 | 157 | fConstraint[0]=1; fConstraint[1]=0; |
8676d691 | 158 | |
44347160 | 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()}; | |
8676d691 | 165 | SetVertex(xyz,ers); |
c0dd5278 | 166 | |
167 | for (Int_t i=0; i<kMaxLayer; i++) fLayersNotToSkip[i]=kLayersNotToSkip[i]; | |
c0dd5278 | 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]; | |
61ab8ea8 | 176 | } |
006b5f7f | 177 | |
c630aafd | 178 | Int_t AliITStrackerV2::LoadClusters(TTree *cTree) { |
61ab8ea8 | 179 | //-------------------------------------------------------------------- |
180 | //This function loads ITS clusters | |
181 | //-------------------------------------------------------------------- | |
00a7cc50 | 182 | TBranch *branch=cTree->GetBranch("ITSRecPoints"); |
61ab8ea8 | 183 | if (!branch) { |
c630aafd | 184 | Error("LoadClusters"," can't get the branch !\n"); |
8676d691 | 185 | return 1; |
61ab8ea8 | 186 | } |
006b5f7f | 187 | |
00a7cc50 | 188 | TClonesArray dummy("AliITSRecPoint",10000), *clusters=&dummy; |
61ab8ea8 | 189 | branch->SetAddress(&clusters); |
006b5f7f | 190 | |
61ab8ea8 | 191 | Int_t j=0; |
192 | for (Int_t i=0; i<kMaxLayer; i++) { | |
18856a77 | 193 | Int_t ndet=fgLayers[i].GetNdetectors(); |
194 | Int_t jmax = j + fgLayers[i].GetNladders()*ndet; | |
c219fd63 | 195 | |
196 | Double_t r=fgLayers[i].GetR(); | |
197 | Double_t circ=TMath::TwoPi()*r; | |
198 | ||
61ab8ea8 | 199 | for (; j<jmax; j++) { |
200 | if (!cTree->GetEvent(j)) continue; | |
201 | Int_t ncl=clusters->GetEntriesFast(); | |
1f3e997f | 202 | |
61ab8ea8 | 203 | while (ncl--) { |
00a7cc50 | 204 | AliITSRecPoint *c=(AliITSRecPoint*)clusters->UncheckedAt(ncl); |
c219fd63 | 205 | |
75fb37cc | 206 | if (!c->Misalign()) AliWarning("Can't misalign this cluster !"); |
1f3e997f | 207 | |
c219fd63 | 208 | Int_t idx=c->GetDetectorIndex(); |
a504d56f | 209 | AliITSdetector &det=fgLayers[i].GetDetector(idx); |
210 | ||
a504d56f | 211 | Double_t y=r*det.GetPhi()+c->GetY(); |
c219fd63 | 212 | if (y>circ) y-=circ; else if (y<0) y+=circ; |
213 | c->SetPhiR(y); | |
214 | ||
00a7cc50 | 215 | fgLayers[i].InsertCluster(new AliITSRecPoint(*c)); |
61ab8ea8 | 216 | } |
217 | clusters->Delete(); | |
218 | } | |
18856a77 | 219 | fgLayers[i].ResetRoad(); //road defined by the cluster density |
006b5f7f | 220 | } |
c630aafd | 221 | |
8676d691 | 222 | return 0; |
61ab8ea8 | 223 | } |
006b5f7f | 224 | |
61ab8ea8 | 225 | void AliITStrackerV2::UnloadClusters() { |
226 | //-------------------------------------------------------------------- | |
227 | //This function unloads ITS clusters | |
228 | //-------------------------------------------------------------------- | |
18856a77 | 229 | for (Int_t i=0; i<kMaxLayer; i++) fgLayers[i].ResetClusters(); |
006b5f7f | 230 | } |
231 | ||
880f41b9 | 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; | |
ba1a3e1a | 257 | if (!t->PropagateTo(riw+0.001,-diw,x0iw)) return 1; |
880f41b9 | 258 | } else { |
259 | ::Error("CorrectForDeadZoneMaterial","track is already in the dead zone !"); | |
260 | return 1; | |
261 | } | |
262 | ||
263 | return 0; | |
264 | } | |
265 | ||
af885e0f | 266 | Int_t AliITStrackerV2::Clusters2Tracks(AliESDEvent *event) { |
006b5f7f | 267 | //-------------------------------------------------------------------- |
c630aafd | 268 | // This functions reconstructs ITS tracks |
269 | // The clusters must be already loaded ! | |
006b5f7f | 270 | //-------------------------------------------------------------------- |
c630aafd | 271 | TObjArray itsTracks(15000); |
006b5f7f | 272 | |
c630aafd | 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 | ||
ba1a3e1a | 279 | if ((esd->GetStatus()&AliESDtrack::kTPCin)==0) continue; |
280 | if (esd->GetStatus()&AliESDtrack::kTPCout) continue; | |
281 | if (esd->GetStatus()&AliESDtrack::kITSin) continue; | |
c630aafd | 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 | } | |
6c94f330 | 291 | if (TMath::Abs(t->GetD(GetX(),GetY()))>4) { |
ebd8369c | 292 | delete t; |
293 | continue; | |
294 | } | |
006b5f7f | 295 | |
c630aafd | 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(); | |
15dd636f | 308 | |
c630aafd | 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); | |
15dd636f | 314 | if (t==0) continue; //this track has been already tracked |
c630aafd | 315 | Int_t tpcLabel=t->GetLabel(); //save the TPC track label |
316 | ||
317 | ResetTrackToFollow(*t); | |
318 | ResetBestTrack(); | |
319 | ||
320 | for (FollowProlongation(); fI<kMaxLayer; fI++) { | |
15dd636f | 321 | while (TakeNextProlongation()) FollowProlongation(); |
c630aafd | 322 | } |
323 | ||
de5d3595 | 324 | if (fBestTrack.GetNumberOfClusters() == 0) continue; |
15dd636f | 325 | |
c630aafd | 326 | if (fConstraint[fPass]) { |
15dd636f | 327 | ResetTrackToFollow(*t); |
328 | if (!RefitAt(3.7, &fTrackToFollow, &fBestTrack)) continue; | |
329 | ResetBestTrack(); | |
330 | } | |
331 | ||
c630aafd | 332 | fBestTrack.SetLabel(tpcLabel); |
333 | fBestTrack.CookdEdx(); | |
334 | CookLabel(&fBestTrack,0.); //For comparison only | |
335 | fBestTrack.UpdateESDtrack(AliESDtrack::kITSin); | |
15dd636f | 336 | UseClusters(&fBestTrack); |
c630aafd | 337 | delete itsTracks.RemoveAt(i); |
338 | ntrk++; | |
339 | } | |
340 | } | |
babd135a | 341 | |
c630aafd | 342 | itsTracks.Delete(); |
2257f27e | 343 | |
c630aafd | 344 | Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk); |
345 | ||
346 | return 0; | |
347 | } | |
348 | ||
af885e0f | 349 | Int_t AliITStrackerV2::PropagateBack(AliESDEvent *event) { |
c630aafd | 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 | ||
ba1a3e1a | 361 | if ((esd->GetStatus()&AliESDtrack::kITSin)==0) continue; |
362 | if (esd->GetStatus()&AliESDtrack::kITSout) continue; | |
c630aafd | 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] | |
a9459f9c | 376 | // Start Time measurement [SR, GSI 17.02.2003], corrected by I.Belikov |
377 | if (fTrackToFollow.PropagateTo(3.,0.0028,65.19)) { | |
6c94f330 | 378 | if (fTrackToFollow.PropagateToVertex(event->GetVertex())) { |
a9459f9c | 379 | fTrackToFollow.StartTimeIntegral(); |
380 | } | |
381 | fTrackToFollow.PropagateTo(3.,-0.0028,65.19); | |
382 | } | |
c630aafd | 383 | |
6c94f330 | 384 | fTrackToFollow.ResetCovariance(10.); fTrackToFollow.ResetClusters(); |
c630aafd | 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()); | |
ba1a3e1a | 393 | //fTrackToFollow.CookdEdx(); |
c630aafd | 394 | CookLabel(&fTrackToFollow,0.); //For comparison only |
395 | fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSout); | |
15dd636f | 396 | UseClusters(&fTrackToFollow); |
c630aafd | 397 | ntrk++; |
398 | } | |
399 | delete t; | |
400 | } | |
401 | ||
402 | Info("PropagateBack","Number of back propagated ITS tracks: %d\n",ntrk); | |
61ab8ea8 | 403 | |
83d73500 | 404 | return 0; |
405 | } | |
406 | ||
af885e0f | 407 | Int_t AliITStrackerV2::RefitInward(AliESDEvent *event) { |
83d73500 | 408 | //-------------------------------------------------------------------- |
409 | // This functions refits ITS tracks using the | |
410 | // "inward propagated" TPC tracks | |
c630aafd | 411 | // The clusters must be loaded ! |
83d73500 | 412 | //-------------------------------------------------------------------- |
c630aafd | 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 | ||
ba1a3e1a | 420 | if ((esd->GetStatus()&AliESDtrack::kITSout) == 0) continue; |
421 | if (esd->GetStatus()&AliESDtrack::kITSrefit) continue; | |
422 | if (esd->GetStatus()&AliESDtrack::kTPCout) | |
15dd636f | 423 | if ((esd->GetStatus()&AliESDtrack::kTPCrefit)==0) continue; |
c630aafd | 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... | |
ef7253ac | 445 | if (RefitAt(3.7, &fTrackToFollow, t, kTRUE)) { |
c630aafd | 446 | fTrackToFollow.SetLabel(t->GetLabel()); |
447 | fTrackToFollow.CookdEdx(); | |
15dd636f | 448 | CookLabel(&fTrackToFollow,0.); //For comparison only |
18856a77 | 449 | |
49d13e89 | 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++; | |
67c3dcbe | 457 | } |
c630aafd | 458 | } |
459 | delete t; | |
460 | } | |
461 | ||
462 | Info("RefitInward","Number of refitted tracks: %d\n",ntrk); | |
83d73500 | 463 | |
c630aafd | 464 | return 0; |
465 | } | |
83d73500 | 466 | |
006b5f7f | 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; | |
18856a77 | 473 | return fgLayers[l].GetCluster(c); |
006b5f7f | 474 | } |
475 | ||
476 | ||
477 | void AliITStrackerV2::FollowProlongation() { | |
478 | //-------------------------------------------------------------------- | |
479 | //This function finds a track prolongation | |
480 | //-------------------------------------------------------------------- | |
c0dd5278 | 481 | while (fI>fLastLayerToTrackTo) { |
a9a2d814 | 482 | Int_t i=fI-1; |
8676d691 | 483 | |
18856a77 | 484 | AliITSlayer &layer=fgLayers[i]; |
a9a2d814 | 485 | AliITStrackV2 &track=fTracks[i]; |
006b5f7f | 486 | |
14825d5a | 487 | Double_t r=layer.GetR(); |
61ab8ea8 | 488 | |
a9a2d814 | 489 | if (i==3 || i==1) { |
18856a77 | 490 | Double_t rs=0.5*(fgLayers[i+1].GetR() + r); |
61ab8ea8 | 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)) { | |
8676d691 | 494 | //Warning("FollowProlongation","propagation failed !\n"); |
c0dd5278 | 495 | return; |
a9a2d814 | 496 | } |
006b5f7f | 497 | } |
498 | ||
499 | //find intersection | |
8602c008 | 500 | Double_t phi,z; |
501 | if (!fTrackToFollow.GetPhiZat(r,phi,z)) { | |
8676d691 | 502 | //Warning("FollowProlongation","failed to estimate track !\n"); |
c0dd5278 | 503 | return; |
006b5f7f | 504 | } |
f363d377 | 505 | |
006b5f7f | 506 | Int_t idet=layer.FindDetectorIndex(phi,z); |
507 | if (idet<0) { | |
8676d691 | 508 | //Warning("FollowProlongation","failed to find a detector !\n"); |
c0dd5278 | 509 | return; |
006b5f7f | 510 | } |
511 | ||
512 | //propagate to the intersection | |
513 | const AliITSdetector &det=layer.GetDetector(idet); | |
14825d5a | 514 | phi=det.GetPhi(); |
a9a2d814 | 515 | if (!fTrackToFollow.Propagate(phi,det.GetR())) { |
8676d691 | 516 | //Warning("FollowProlongation","propagation failed !\n"); |
c0dd5278 | 517 | return; |
006b5f7f | 518 | } |
519 | fTrackToFollow.SetDetectorIndex(idet); | |
520 | ||
521 | //Select possible prolongations and store the current track estimation | |
522 | track.~AliITStrackV2(); new(&track) AliITStrackV2(fTrackToFollow); | |
44347160 | 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)); | |
8676d691 | 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 | } | |
b87bd7cd | 530 | |
44347160 | 531 | //Double_t dz=4*TMath::Sqrt(track.GetSigmaZ2() + AliITSReconstructor::GetRecoParam()->GetSigmaZ2(i)); |
14825d5a | 532 | if (dz < 0.5*TMath::Abs(track.GetTgl())) dz=0.5*TMath::Abs(track.GetTgl()); |
44347160 | 533 | if (dz > AliITSReconstructor::GetRecoParam()->GetMaxRoad()) { |
8676d691 | 534 | //Warning("FollowProlongation","too broad road in Z !\n"); |
c0dd5278 | 535 | return; |
006b5f7f | 536 | } |
a9a2d814 | 537 | |
15dd636f | 538 | if (TMath::Abs(fTrackToFollow.GetZ()-GetZ()) > r+dz) return; |
a9a2d814 | 539 | |
44347160 | 540 | //Double_t dy=4*TMath::Sqrt(track.GetSigmaY2() + AliITSReconstructor::GetRecoParam()->GetSigmaY2(i)); |
14825d5a | 541 | if (dy < 0.5*TMath::Abs(track.GetSnp())) dy=0.5*TMath::Abs(track.GetSnp()); |
44347160 | 542 | if (dy > AliITSReconstructor::GetRecoParam()->GetMaxRoad()) { |
8676d691 | 543 | //Warning("FollowProlongation","too broad road in Y !\n"); |
c0dd5278 | 544 | return; |
006b5f7f | 545 | } |
a9a2d814 | 546 | |
c219fd63 | 547 | fI--; |
548 | ||
7f6ddf58 | 549 | Double_t zmin=track.GetZ() - dz; |
006b5f7f | 550 | Double_t zmax=track.GetZ() + dz; |
14825d5a | 551 | Double_t ymin=track.GetY() + r*phi - dy; |
552 | Double_t ymax=track.GetY() + r*phi + dy; | |
c219fd63 | 553 | if (layer.SelectClusters(zmin,zmax,ymin,ymax)==0) |
554 | if (fLayersNotToSkip[fI]) return; | |
006b5f7f | 555 | |
15dd636f | 556 | if (!TakeNextProlongation()) |
557 | if (fLayersNotToSkip[fI]) return; | |
558 | ||
006b5f7f | 559 | } |
560 | ||
561 | //deal with the best track | |
562 | Int_t ncl=fTrackToFollow.GetNumberOfClusters(); | |
563 | Int_t nclb=fBestTrack.GetNumberOfClusters(); | |
15dd636f | 564 | if (ncl) |
565 | if (ncl >= nclb) { | |
566 | Double_t chi2=fTrackToFollow.GetChi2(); | |
44347160 | 567 | if (chi2/ncl < AliITSReconstructor::GetRecoParam()->GetChi2PerCluster()) { |
15dd636f | 568 | if (ncl > nclb || chi2 < fBestTrack.GetChi2()) { |
569 | ResetBestTrack(); | |
006b5f7f | 570 | } |
15dd636f | 571 | } |
006b5f7f | 572 | } |
15dd636f | 573 | |
006b5f7f | 574 | } |
575 | ||
006b5f7f | 576 | Int_t AliITStrackerV2::TakeNextProlongation() { |
577 | //-------------------------------------------------------------------- | |
a9a2d814 | 578 | // This function takes another track prolongation |
579 | // | |
580 | // dEdx analysis by: Boris Batyunya, JINR, Boris.Batiounia@cern.ch | |
006b5f7f | 581 | //-------------------------------------------------------------------- |
18856a77 | 582 | AliITSlayer &layer=fgLayers[fI]; |
4ab260d6 | 583 | ResetTrackToFollow(fTracks[fI]); |
006b5f7f | 584 | |
44347160 | 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)); | |
8676d691 | 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 | } | |
006b5f7f | 592 | |
00a7cc50 | 593 | const AliITSRecPoint *c=0; Int_t ci=-1; |
594 | const AliITSRecPoint *cc=0; Int_t cci=-1; | |
44347160 | 595 | Double_t chi2=AliITSReconstructor::GetRecoParam()->GetMaxChi2(); |
006b5f7f | 596 | while ((c=layer.GetNextCluster(ci))!=0) { |
006b5f7f | 597 | Int_t idet=c->GetDetectorIndex(); |
15dd636f | 598 | |
4ab260d6 | 599 | if (fTrackToFollow.GetDetectorIndex()!=idet) { |
006b5f7f | 600 | const AliITSdetector &det=layer.GetDetector(idet); |
4ab260d6 | 601 | ResetTrackToFollow(fTracks[fI]); |
602 | if (!fTrackToFollow.Propagate(det.GetPhi(),det.GetR())) { | |
8676d691 | 603 | //Warning("TakeNextProlongation","propagation failed !\n"); |
006b5f7f | 604 | continue; |
605 | } | |
4ab260d6 | 606 | fTrackToFollow.SetDetectorIndex(idet); |
607 | if (TMath::Abs(fTrackToFollow.GetZ()-GetZ())>layer.GetR()+dz) continue; | |
006b5f7f | 608 | } |
609 | ||
4ab260d6 | 610 | if (TMath::Abs(fTrackToFollow.GetZ() - c->GetZ()) > dz) continue; |
611 | if (TMath::Abs(fTrackToFollow.GetY() - c->GetY()) > dy) continue; | |
006b5f7f | 612 | |
c219fd63 | 613 | Double_t ch2=fTrackToFollow.GetPredictedChi2(c); |
614 | if (ch2 > chi2) continue; | |
615 | chi2=ch2; | |
616 | cc=c; cci=ci; | |
617 | break; | |
006b5f7f | 618 | } |
619 | ||
c219fd63 | 620 | if (!cc) return 0; |
006b5f7f | 621 | |
1f3e997f | 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 | } | |
c219fd63 | 626 | if (!fTrackToFollow.Update(cc,chi2,(fI<<28)+cci)) { |
8676d691 | 627 | //Warning("TakeNextProlongation","filtering failed !\n"); |
006b5f7f | 628 | return 0; |
629 | } | |
15dd636f | 630 | |
4ab260d6 | 631 | if (fTrackToFollow.GetNumberOfClusters()>1) |
6c94f330 | 632 | if (TMath::Abs(fTrackToFollow.GetD(GetX(),GetY()))>4) return 0; |
4ab260d6 | 633 | |
a9a2d814 | 634 | fTrackToFollow. |
c219fd63 | 635 | SetSampledEdx(cc->GetQ(),fTrackToFollow.GetNumberOfClusters()-1); //b.b. |
a9a2d814 | 636 | |
637 | { | |
880f41b9 | 638 | Double_t x0; |
61ab8ea8 | 639 | Double_t d=layer.GetThickness(fTrackToFollow.GetY(),fTrackToFollow.GetZ(),x0); |
880f41b9 | 640 | fTrackToFollow.CorrectForMaterial(d,x0); |
a9a2d814 | 641 | } |
4ab260d6 | 642 | |
a9a2d814 | 643 | if (fConstraint[fPass]) { |
4ab260d6 | 644 | Double_t d=GetEffectiveThickness(0,0); //Think of this !!!! |
8676d691 | 645 | Double_t xyz[]={GetX(),GetY(),GetZ()}; |
646 | Double_t ers[]={GetSigmaX(),GetSigmaY(),GetSigmaZ()}; | |
647 | fTrackToFollow.Improve(d,xyz,ers); | |
a9a2d814 | 648 | } |
006b5f7f | 649 | |
006b5f7f | 650 | return 1; |
651 | } | |
652 | ||
653 | ||
6c94f330 | 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 | { | |
006b5f7f | 664 | //-------------------------------------------------------------------- |
665 | //default AliITSlayer constructor | |
666 | //-------------------------------------------------------------------- | |
c219fd63 | 667 | |
668 | for (Int_t i=0; i<kNsector; i++) fN[i]=0; | |
c219fd63 | 669 | |
006b5f7f | 670 | } |
671 | ||
672 | AliITStrackerV2::AliITSlayer:: | |
6c94f330 | 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 | { | |
006b5f7f | 683 | //-------------------------------------------------------------------- |
684 | //main AliITSlayer constructor | |
685 | //-------------------------------------------------------------------- | |
006b5f7f | 686 | |
c219fd63 | 687 | for (Int_t i=0; i<kNsector; i++) fN[i]=0; |
c219fd63 | 688 | |
689 | for (Int_t i=0; i<kMaxClusterPerLayer; i++) fClusters[i]=0; | |
b87bd7cd | 690 | |
006b5f7f | 691 | } |
692 | ||
693 | AliITStrackerV2::AliITSlayer::~AliITSlayer() { | |
694 | //-------------------------------------------------------------------- | |
695 | // AliITSlayer destructor | |
696 | //-------------------------------------------------------------------- | |
697 | delete[] fDetectors; | |
c219fd63 | 698 | ResetClusters(); |
006b5f7f | 699 | } |
700 | ||
61ab8ea8 | 701 | void AliITStrackerV2::AliITSlayer::ResetClusters() { |
702 | //-------------------------------------------------------------------- | |
703 | // This function removes loaded clusters | |
704 | //-------------------------------------------------------------------- | |
c219fd63 | 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 | } | |
61ab8ea8 | 712 | } |
713 | ||
b87bd7cd | 714 | void AliITStrackerV2::AliITSlayer::ResetRoad() { |
715 | //-------------------------------------------------------------------- | |
716 | // This function calculates the road defined by the cluster density | |
717 | //-------------------------------------------------------------------- | |
718 | Int_t n=0; | |
c219fd63 | 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++; | |
b87bd7cd | 723 | } |
724 | if (n>1) fRoad=2*fR*TMath::Sqrt(3.14/n); | |
725 | } | |
726 | ||
00a7cc50 | 727 | Int_t AliITStrackerV2::AliITSlayer::InsertCluster(AliITSRecPoint *c) { |
006b5f7f | 728 | //-------------------------------------------------------------------- |
c219fd63 | 729 | // This function inserts a cluster to this layer in increasing |
730 | // order of the cluster's fZ | |
006b5f7f | 731 | //-------------------------------------------------------------------- |
c219fd63 | 732 | Float_t circ=TMath::TwoPi()*fR; |
733 | Int_t sec=Int_t(kNsector*c->GetPhiR()/circ); | |
81e97e0d | 734 | if (sec>=kNsector) { |
735 | ::Error("InsertCluster","Wrong sector !\n"); | |
736 | return 1; | |
737 | } | |
c219fd63 | 738 | Int_t &n=fN[sec]; |
739 | if (n>=kMaxClusterPerSector) { | |
740 | ::Error("InsertCluster","Too many clusters !\n"); | |
741 | return 1; | |
006b5f7f | 742 | } |
c219fd63 | 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; | |
00a7cc50 | 747 | memmove(fClusters+i+1 ,fClusters+i,k*sizeof(AliITSRecPoint*)); |
c219fd63 | 748 | fClusters[i]=c; |
749 | } | |
750 | n++; | |
006b5f7f | 751 | return 0; |
752 | } | |
753 | ||
c219fd63 | 754 | Int_t |
755 | AliITStrackerV2::AliITSlayer::FindClusterIndex(Float_t z,Int_t s) const { | |
006b5f7f | 756 | //-------------------------------------------------------------------- |
c219fd63 | 757 | // For the sector "s", this function returns the index of the first |
758 | // with its fZ >= "z". | |
006b5f7f | 759 | //-------------------------------------------------------------------- |
c219fd63 | 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; | |
006b5f7f | 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 | ||
c219fd63 | 777 | Int_t AliITStrackerV2::AliITSlayer:: |
778 | SelectClusters(Float_t zmin,Float_t zmax,Float_t ymin, Float_t ymax) { | |
006b5f7f | 779 | //-------------------------------------------------------------------- |
c219fd63 | 780 | // This function selects clusters within the "window" |
006b5f7f | 781 | //-------------------------------------------------------------------- |
c219fd63 | 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 | ||
521f4796 | 787 | Int_t i1=Int_t(kNsector*ymin/circ); if (i1==kNsector) i1--; |
c219fd63 | 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++) { | |
00a7cc50 | 792 | AliITSRecPoint *c=fClusters[i]; |
c219fd63 | 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 | ||
521f4796 | 801 | Int_t i2=Int_t(kNsector*ymax/circ); if (i2==kNsector) i2--; |
c219fd63 | 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++) { | |
00a7cc50 | 808 | AliITSRecPoint *c=fClusters[i]; |
c219fd63 | 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; | |
006b5f7f | 818 | } |
819 | ||
00a7cc50 | 820 | const AliITSRecPoint *AliITStrackerV2::AliITSlayer::GetNextCluster(Int_t &ci){ |
006b5f7f | 821 | //-------------------------------------------------------------------- |
822 | // This function returns clusters within the "window" | |
823 | //-------------------------------------------------------------------- | |
00a7cc50 | 824 | AliITSRecPoint *c=0; |
c219fd63 | 825 | ci=-1; |
826 | if (fNsel) { | |
827 | fNsel--; | |
828 | ci=fIndex[fNsel]; | |
829 | c=fClusters[ci]; | |
006b5f7f | 830 | } |
c219fd63 | 831 | return c; |
832 | } | |
7f6ddf58 | 833 | |
c219fd63 | 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; | |
006b5f7f | 838 | } |
839 | ||
c219fd63 | 840 | Int_t |
841 | AliITStrackerV2::AliITSlayer::FindDetectorIndex(Double_t phi,Double_t z)const { | |
006b5f7f | 842 | //-------------------------------------------------------------------- |
843 | //This function finds the detector crossed by the track | |
844 | //-------------------------------------------------------------------- | |
31fb8575 | 845 | Double_t dphi; |
846 | if (fZOffset<0) // old geometry | |
847 | dphi = -(phi-fPhiOffset); | |
848 | else // new geometry | |
849 | dphi = phi-fPhiOffset; | |
850 | ||
006b5f7f | 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); | |
3e3e8427 | 854 | if (np>=fNladders) np-=fNladders; |
855 | if (np<0) np+=fNladders; | |
006b5f7f | 856 | |
857 | Double_t dz=fZOffset-z; | |
858 | Int_t nz=Int_t(dz*(fNdetectors-1)*0.5/fZOffset+0.5); | |
3e3e8427 | 859 | if (nz>=fNdetectors) return -1; |
860 | if (nz<0) return -1; | |
006b5f7f | 861 | |
006b5f7f | 862 | return np*fNdetectors + nz; |
863 | } | |
864 | ||
865 | Double_t | |
61ab8ea8 | 866 | AliITStrackerV2::AliITSlayer::GetThickness(Double_t y,Double_t z,Double_t &x0) |
867 | const { | |
a9a2d814 | 868 | //-------------------------------------------------------------------- |
869 | //This function returns the layer thickness at this point (units X0) | |
870 | //-------------------------------------------------------------------- | |
871 | Double_t d=0.0085; | |
61ab8ea8 | 872 | x0=21.82; |
a9a2d814 | 873 | |
874 | if (43<fR&&fR<45) { //SSD2 | |
61ab8ea8 | 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);} | |
a9a2d814 | 880 | for (Int_t i=0; i<12; i++) { |
61ab8ea8 | 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;} | |
a9a2d814 | 893 | } |
894 | } else | |
895 | if (37<fR&&fR<41) { //SSD1 | |
61ab8ea8 | 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);} | |
a9a2d814 | 901 | for (Int_t i=0; i<11; i++) { |
61ab8ea8 | 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;} | |
a9a2d814 | 914 | } |
915 | } else | |
916 | if (13<fR&&fR<26) { //SDD | |
61ab8ea8 | 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 | } | |
a9a2d814 | 947 | } |
948 | } else | |
949 | if (6<fR&&fR<8) { //SPD2 | |
61ab8ea8 | 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;} | |
a9a2d814 | 955 | } else |
956 | if (3<fR&&fR<5) { //SPD1 | |
61ab8ea8 | 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;} | |
a9a2d814 | 962 | } |
963 | ||
a9a2d814 | 964 | return d; |
965 | } | |
006b5f7f | 966 | |
a9a2d814 | 967 | Double_t AliITStrackerV2::GetEffectiveThickness(Double_t y,Double_t z) const |
006b5f7f | 968 | { |
969 | //-------------------------------------------------------------------- | |
a9a2d814 | 970 | //Returns the thickness between the current layer and the vertex (units X0) |
006b5f7f | 971 | //-------------------------------------------------------------------- |
61ab8ea8 | 972 | Double_t d=0.0028*3*3; //beam pipe |
973 | Double_t x0=0; | |
006b5f7f | 974 | |
18856a77 | 975 | Double_t xn=fgLayers[fI].GetR(); |
006b5f7f | 976 | for (Int_t i=0; i<fI; i++) { |
18856a77 | 977 | Double_t xi=fgLayers[i].GetR(); |
978 | d+=fgLayers[i].GetThickness(y,z,x0)*xi*xi; | |
006b5f7f | 979 | } |
980 | ||
981 | if (fI>1) { | |
61ab8ea8 | 982 | Double_t xi=9.; |
983 | d+=0.0097*xi*xi; | |
006b5f7f | 984 | } |
985 | ||
986 | if (fI>3) { | |
18856a77 | 987 | Double_t xi=0.5*(fgLayers[3].GetR()+fgLayers[4].GetR()); |
61ab8ea8 | 988 | d+=0.0034*xi*xi; |
006b5f7f | 989 | } |
61ab8ea8 | 990 | |
006b5f7f | 991 | return d/(xn*xn); |
992 | } | |
993 | ||
ef7253ac | 994 | Bool_t AliITStrackerV2::RefitAt(Double_t xx,AliITStrackV2 *t, |
995 | const AliITStrackV2 *c, Bool_t extra) { | |
4ab260d6 | 996 | //-------------------------------------------------------------------- |
c630aafd | 997 | // This function refits the track "t" at the position "x" using |
998 | // the clusters from "c" | |
ef7253ac | 999 | // If "extra"==kTRUE, |
1000 | // the clusters from overlapped modules get attached to "t" | |
4ab260d6 | 1001 | //-------------------------------------------------------------------- |
880f41b9 | 1002 | Int_t index[kMaxLayer]; |
1003 | Int_t k; | |
1004 | for (k=0; k<kMaxLayer; k++) index[k]=-1; | |
c630aafd | 1005 | Int_t nc=c->GetNumberOfClusters(); |
880f41b9 | 1006 | for (k=0; k<nc; k++) { |
c630aafd | 1007 | Int_t idx=c->GetClusterIndex(k),nl=(idx&0xf0000000)>>28; |
880f41b9 | 1008 | index[nl]=idx; |
1009 | } | |
880f41b9 | 1010 | |
4ab260d6 | 1011 | Int_t from, to, step; |
ee34184f | 1012 | if (xx > t->GetX()) { |
4ab260d6 | 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) { | |
18856a77 | 1021 | AliITSlayer &layer=fgLayers[i]; |
4ab260d6 | 1022 | Double_t r=layer.GetR(); |
1023 | ||
1024 | { | |
1025 | Double_t hI=i-0.5*step; | |
880f41b9 | 1026 | if (TMath::Abs(hI-1.5)<0.01 || TMath::Abs(hI-3.5)<0.01) { |
18856a77 | 1027 | Double_t rs=0.5*(fgLayers[i-step].GetR() + r); |
61ab8ea8 | 1028 | Double_t d=0.0034, x0=38.6; |
880f41b9 | 1029 | if (TMath::Abs(hI-1.5)<0.01) {rs=9.; d=0.0097; x0=42;} |
1030 | if (!t->PropagateTo(rs,-step*d,x0)) { | |
4ab260d6 | 1031 | return kFALSE; |
1032 | } | |
1033 | } | |
1034 | } | |
1035 | ||
880f41b9 | 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 | ||
8602c008 | 1043 | Double_t phi,z; |
1044 | if (!t->GetPhiZat(r,phi,z)) { | |
4ab260d6 | 1045 | return kFALSE; |
1046 | } | |
8602c008 | 1047 | |
4ab260d6 | 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 | ||
00a7cc50 | 1059 | const AliITSRecPoint *cl=0; |
44347160 | 1060 | Double_t maxchi2=AliITSReconstructor::GetRecoParam()->GetMaxChi2(); |
4ab260d6 | 1061 | |
1062 | Int_t idx=index[i]; | |
c0342e67 | 1063 | if (idx>=0) { |
00a7cc50 | 1064 | const AliITSRecPoint *c=(AliITSRecPoint *)GetCluster(idx); |
4ab260d6 | 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); | |
c630aafd | 1074 | if (chi2<maxchi2) { |
1075 | cl=c; | |
1076 | maxchi2=chi2; | |
1077 | } else { | |
1078 | return kFALSE; | |
1079 | } | |
4ab260d6 | 1080 | } |
ef7253ac | 1081 | |
4ab260d6 | 1082 | if (cl) { |
1f3e997f | 1083 | // Take into account the mis-alignment |
1084 | Double_t x=t->GetX()+cl->GetX(); | |
1085 | if (!t->PropagateTo(x,0.,0.)) return kFALSE; | |
4ab260d6 | 1086 | if (!t->Update(cl,maxchi2,idx)) { |
1087 | return kFALSE; | |
1088 | } | |
880f41b9 | 1089 | t->SetSampledEdx(cl->GetQ(),t->GetNumberOfClusters()-1); |
4ab260d6 | 1090 | } |
1091 | ||
1092 | { | |
61ab8ea8 | 1093 | Double_t x0; |
1094 | Double_t d=layer.GetThickness(t->GetY(),t->GetZ(),x0); | |
1095 | t->CorrectForMaterial(-step*d,x0); | |
4ab260d6 | 1096 | } |
880f41b9 | 1097 | |
ef7253ac | 1098 | if (extra) { //search for extra clusters |
1099 | AliITStrackV2 tmp(*t); | |
44347160 | 1100 | Double_t dz=4*TMath::Sqrt(tmp.GetSigmaZ2()+AliITSReconstructor::GetRecoParam()->GetSigmaZ2(i)); |
ef7253ac | 1101 | if (dz < 0.5*TMath::Abs(tmp.GetTgl())) dz=0.5*TMath::Abs(tmp.GetTgl()); |
44347160 | 1102 | Double_t dy=4*TMath::Sqrt(t->GetSigmaY2()+AliITSReconstructor::GetRecoParam()->GetSigmaY2(i)); |
ef7253ac | 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; | |
44347160 | 1111 | Double_t maxchi2=1000.*AliITSReconstructor::GetRecoParam()->GetMaxChi2(), tolerance=0.1; |
ef7253ac | 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 | ||
880f41b9 | 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 | // | |
4ab260d6 | 1137 | |
1138 | } | |
1139 | ||
ee34184f | 1140 | if (!t->PropagateTo(xx,0.,0.)) return kFALSE; |
4ab260d6 | 1141 | return kTRUE; |
1142 | } | |
1143 | ||
b87bd7cd | 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); | |
880f41b9 | 1149 | |
5482d29d | 1150 | Int_t clusterIndex = t->GetClusterIndex(0); |
1151 | AliITSRecPoint *c= 0x0; | |
1152 | ||
1153 | if (clusterIndex>-1) | |
1154 | c = (AliITSRecPoint *)GetCluster(clusterIndex); | |
d920bdee | 1155 | if (c && c->GetSigmaZ2()>0.1) c->UnUse(); |
5482d29d | 1156 | |
1157 | c = 0x0; | |
1158 | clusterIndex = t->GetClusterIndex(1); | |
1159 | if (clusterIndex>-1) | |
1160 | c=(AliITSRecPoint *)GetCluster(clusterIndex); | |
d920bdee | 1161 | if (c && c->GetSigmaZ2()>0.1) c->UnUse(); |
880f41b9 | 1162 | |
b87bd7cd | 1163 | } |