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