]>
Commit | Line | Data |
---|---|---|
596a855f | 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 | **************************************************************************/ | |
74ea065c | 15 | // AliTOFtracker Class |
16 | // Task: Perform association of the ESD tracks to TOF Clusters | |
17 | // and Update ESD track with associated TOF Cluster parameters | |
18 | // | |
19 | // -- Authors : S. Arcelli, C. Zampolli (Bologna University and INFN) | |
20 | // -- Contacts: Annalisa.De.Caro@cern.ch | |
21 | // -- : Chiara.Zampolli@bo.infn.it | |
22 | // -- : Silvia.Arcelli@bo.infn.it | |
23 | //-------------------------------------------------------------------- | |
596a855f | 24 | |
2871e58d | 25 | #include <Rtypes.h> |
571dda3d | 26 | |
74ea065c | 27 | #include "TClonesArray.h" |
571dda3d | 28 | |
d076c8d5 | 29 | #include "AliLog.h" |
74ea065c | 30 | #include "AliRun.h" |
31 | #include "AliModule.h" | |
596a855f | 32 | |
571dda3d | 33 | #include "AliTOFcluster.h" |
34 | #include "AliTOFtrack.h" | |
35 | #include "AliTOFGeometry.h" | |
36 | #include "AliTOFtracker.h" | |
37 | ||
d4754572 | 38 | |
39 | #include "AliTrackPointArray.h" | |
40 | #include "AliAlignObj.h" | |
41 | ||
596a855f | 42 | ClassImp(AliTOFtracker) |
43 | ||
74ea065c | 44 | //_____________________________________________________________________________ |
45 | AliTOFtracker::AliTOFtracker(AliTOFGeometry * geom, Double_t parPID[2]) { | |
46 | //AliTOFtracker main Ctor | |
47 | ||
d3c7bfac | 48 | //fHoles=true; |
74ea065c | 49 | fNseeds=0; |
50 | fNseedsTOF=0; | |
51 | fngoodmatch=0; | |
52 | fnbadmatch=0; | |
53 | fnunmatch=0; | |
54 | fnmatch=0; | |
55 | fGeom = geom; | |
56 | fTOFpid = new AliTOFpidESD(parPID); | |
57 | fR=378.; | |
58 | fTOFHeigth=15.3; | |
59 | fdCut=3.; | |
60 | fDy=AliTOFGeometry::XPad(); | |
61 | fDz=AliTOFGeometry::ZPad(); | |
62 | fDx=1.5; | |
63 | fSeeds=0x0; | |
64 | fTracks=0x0; | |
65 | fN=0; | |
d3c7bfac | 66 | fHoles = fGeom->GetHoles(); |
74ea065c | 67 | } |
68 | //_____________________________________________________________________________ | |
69 | AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):AliTracker() { | |
70 | //AliTOFtracker copy Ctor | |
71 | ||
72 | fHoles=t.fHoles; | |
73 | fNseeds=t.fNseeds; | |
74 | fNseedsTOF=t.fNseedsTOF; | |
75 | fngoodmatch=t.fngoodmatch; | |
76 | fnbadmatch=t.fnbadmatch; | |
77 | fnunmatch=t.fnunmatch; | |
78 | fnmatch=t.fnmatch; | |
79 | fGeom = t.fGeom; | |
80 | fTOFpid = t.fTOFpid; | |
81 | fR=t.fR; | |
82 | fTOFHeigth=t.fTOFHeigth; | |
83 | fdCut=t.fdCut; | |
84 | fDy=t.fDy; | |
85 | fDz=t.fDz; | |
86 | fDx=1.5; | |
87 | fSeeds=t.fSeeds; | |
88 | fTracks=t.fTracks; | |
89 | fN=t.fN; | |
90 | } | |
91 | //_____________________________________________________________________________ | |
74ea065c | 92 | Int_t AliTOFtracker::PropagateBack(AliESD* event) { |
93 | // | |
94 | // Gets seeds from ESD event and Match with TOF Clusters | |
95 | // | |
96 | ||
97 | ||
98 | //Initialise some counters | |
99 | ||
100 | fNseeds=0; | |
101 | fNseedsTOF=0; | |
102 | fngoodmatch=0; | |
103 | fnbadmatch=0; | |
104 | fnunmatch=0; | |
105 | fnmatch=0; | |
106 | ||
107 | Int_t ntrk=event->GetNumberOfTracks(); | |
108 | fNseeds = ntrk; | |
7b61cd9c | 109 | fSeeds= new TClonesArray("AliESDtrack",ntrk); |
74ea065c | 110 | TClonesArray &aESDTrack = *fSeeds; |
111 | ||
112 | ||
113 | //Load ESD tracks into a local Array of ESD Seeds | |
114 | ||
115 | for (Int_t i=0; i<fNseeds; i++) { | |
116 | AliESDtrack *t=event->GetTrack(i); | |
117 | new(aESDTrack[i]) AliESDtrack(*t); | |
118 | } | |
119 | ||
120 | //Prepare ESD tracks candidates for TOF Matching | |
121 | CollectESD(); | |
122 | ||
123 | //First Step with Strict Matching Criterion | |
124 | MatchTracks(kFALSE); | |
7b61cd9c | 125 | /* |
126 | for (Int_t ijk=0; ijk<fN; ijk++) { | |
127 | AliInfo(Form("%4i %4i %f %f %f %f %f %2i %1i %2i %1i %2i",ijk, fClusters[ijk]->GetIndex(),fClusters[ijk]->GetZ(),fClusters[ijk]->GetR(),fClusters[ijk]->GetPhi(), fClusters[ijk]->GetTDC(),fClusters[ijk]->GetADC(),fClusters[ijk]->GetDetInd(0),fClusters[ijk]->GetDetInd(1),fClusters[ijk]->GetDetInd(2),fClusters[ijk]->GetDetInd(3),fClusters[ijk]->GetDetInd(4))); | |
128 | } | |
129 | */ | |
74ea065c | 130 | |
131 | //Second Step with Looser Matching Criterion | |
132 | MatchTracks(kTRUE); | |
133 | ||
d076c8d5 | 134 | AliInfo(Form("Number of matched tracks: %d",fnmatch)); |
135 | AliInfo(Form("Number of good matched tracks: %d",fngoodmatch)); | |
136 | AliInfo(Form("Number of bad matched tracks: %d",fnbadmatch)); | |
74ea065c | 137 | |
138 | //Update the matched ESD tracks | |
139 | ||
140 | for (Int_t i=0; i<ntrk; i++) { | |
141 | AliESDtrack *t=event->GetTrack(i); | |
142 | AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i); | |
143 | if(seed->GetTOFsignal()>0){ | |
144 | t->SetTOFsignal(seed->GetTOFsignal()); | |
145 | t->SetTOFcluster(seed->GetTOFcluster()); | |
146 | AliTOFtrack *track = new AliTOFtrack(*seed); | |
147 | t->UpdateTrackParams(track,AliESDtrack::kTOFout); | |
148 | delete track; | |
149 | } | |
150 | } | |
151 | ||
152 | ||
153 | //Make TOF PID | |
154 | fTOFpid->MakePID(event); | |
155 | ||
7bf28302 | 156 | if (fSeeds) { |
157 | fSeeds->Delete(); | |
158 | delete fSeeds; | |
159 | fSeeds = 0x0; | |
160 | } | |
161 | if (fTracks) { | |
162 | fTracks->Delete(); | |
163 | delete fTracks; | |
164 | fTracks = 0x0; | |
165 | } | |
74ea065c | 166 | return 0; |
167 | ||
168 | } | |
169 | //_________________________________________________________________________ | |
170 | void AliTOFtracker::CollectESD() { | |
171 | //prepare the set of ESD tracks to be matched to clusters in TOF | |
172 | ||
173 | fTracks= new TClonesArray("AliTOFtrack"); | |
174 | TClonesArray &aTOFTrack = *fTracks; | |
175 | for (Int_t i=0; i<fNseeds; i++) { | |
176 | ||
177 | AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i); | |
178 | if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue; | |
179 | ||
180 | // TRD good tracks, already propagated at 371 cm | |
181 | ||
56da420e | 182 | AliTOFtrack *track = new AliTOFtrack(*t); // New |
183 | Double_t x = track->GetX(); //New | |
184 | ||
185 | if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) && | |
d3c7bfac | 186 | ( x >= fGeom->RinTOF()) ){ |
74ea065c | 187 | track->SetSeedIndex(i); |
188 | t->UpdateTrackParams(track,AliESDtrack::kTOFout); | |
189 | new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track); | |
190 | fNseedsTOF++; | |
191 | delete track; | |
192 | } | |
193 | ||
194 | // Propagate the rest of TPCbp | |
195 | ||
196 | else { | |
74ea065c | 197 | if(track->PropagateToInnerTOF(fHoles)){ // temporary solution |
198 | // if(track->PropagateToInnerTOF(fGeom->GetHoles())){ | |
199 | track->SetSeedIndex(i); | |
200 | t->UpdateTrackParams(track,AliESDtrack::kTOFout); | |
201 | new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track); | |
202 | fNseedsTOF++; | |
203 | } | |
204 | delete track; | |
205 | } | |
206 | } | |
207 | ||
7b61cd9c | 208 | AliInfo(Form("Number of TOF seedds %i",fNseedsTOF)); |
209 | ||
74ea065c | 210 | // Sort according uncertainties on track position |
211 | fTracks->Sort(); | |
212 | ||
213 | } | |
214 | //_________________________________________________________________________ | |
215 | void AliTOFtracker::MatchTracks( Bool_t mLastStep){ | |
216 | ||
217 | //Match ESD tracks to clusters in TOF | |
218 | ||
74ea065c | 219 | Int_t nSteps=(Int_t)(fTOFHeigth/0.1); |
7bf28302 | 220 | |
221 | //PH Arrays (moved outside of the loop) | |
222 | Float_t * trackPos[4]; | |
223 | for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps]; | |
224 | Int_t * clind[6]; | |
225 | for (Int_t ii=0;ii<6;ii++) clind[ii] = new Int_t[fN]; | |
74ea065c | 226 | |
227 | for (Int_t i=0; i<fNseedsTOF; i++) { | |
228 | ||
229 | AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(i); | |
230 | AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex()); | |
7bf28302 | 231 | if(t->GetTOFsignal()>0. ) continue; |
74ea065c | 232 | AliTOFtrack *trackTOFin =new AliTOFtrack(*track); |
74ea065c | 233 | |
d3c7bfac | 234 | // Some init |
74ea065c | 235 | |
236 | Int_t index[10000]; | |
237 | Float_t dist[10000]; | |
238 | Float_t cxpos[10000]; | |
239 | Float_t crecL[10000]; | |
74ea065c | 240 | |
241 | // Determine a window around the track | |
242 | ||
243 | Double_t x,par[5]; | |
244 | trackTOFin->GetExternalParameters(x,par); | |
245 | Double_t cov[15]; | |
246 | trackTOFin->GetExternalCovariance(cov); | |
247 | Float_t scalefact=3.; | |
248 | Double_t dphi= | |
249 | scalefact* | |
250 | ((5*TMath::Sqrt(cov[0]) + 0.5*fDy + 2.5*TMath::Abs(par[2]))/fR); | |
251 | Double_t dz= | |
252 | scalefact* | |
253 | (5*TMath::Sqrt(cov[2]) + 0.5*fDz + 2.5*TMath::Abs(par[3])); | |
254 | ||
255 | Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha(); | |
256 | if (phi<-TMath::Pi())phi+=2*TMath::Pi(); | |
257 | if (phi>=TMath::Pi())phi-=2*TMath::Pi(); | |
258 | Double_t z=par[1]; | |
259 | ||
74ea065c | 260 | Int_t nc=0; |
7b61cd9c | 261 | |
74ea065c | 262 | // find the clusters in the window of the track |
263 | ||
264 | for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) { | |
7b61cd9c | 265 | |
74ea065c | 266 | AliTOFcluster *c=fClusters[k]; |
267 | if (c->GetZ() > z+dz) break; | |
268 | if (c->IsUsed()) continue; | |
269 | ||
7b61cd9c | 270 | //AliInfo(Form(" fClusters[k]->GetZ() (%f) z-dz (%f) %4i ", fClusters[k]->GetZ(), z-dz, k)); |
271 | ||
74ea065c | 272 | Double_t dph=TMath::Abs(c->GetPhi()-phi); |
273 | if (dph>TMath::Pi()) dph-=2.*TMath::Pi(); | |
9b49e4c9 | 274 | if (TMath::Abs(dph)>dphi) continue; |
74ea065c | 275 | |
276 | clind[0][nc] = c->GetDetInd(0); | |
277 | clind[1][nc] = c->GetDetInd(1); | |
278 | clind[2][nc] = c->GetDetInd(2); | |
279 | clind[3][nc] = c->GetDetInd(3); | |
280 | clind[4][nc] = c->GetDetInd(4); | |
281 | clind[5][nc] = k; | |
282 | nc++; | |
283 | } | |
284 | ||
7b61cd9c | 285 | //if (nc) AliInfo(Form("seed for TOF %4i and number of clusters in the track window %4i (cluster index %4i) %4i",i,nc, clind[5][0], fN)); |
286 | ||
74ea065c | 287 | //start fine propagation |
288 | ||
289 | Int_t nStepsDone = 0; | |
290 | for( Int_t istep=0; istep<nSteps; istep++){ | |
291 | ||
d3c7bfac | 292 | Float_t xs=fGeom->RinTOF()+istep*0.1; |
74ea065c | 293 | Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha()); |
294 | ||
295 | Bool_t skip=kFALSE; | |
296 | Double_t ysect=trackTOFin->GetYat(xs,skip); | |
297 | if(skip)break; | |
298 | if (ysect > ymax) { | |
299 | if (!trackTOFin->Rotate(AliTOFGeometry::GetAlpha())) { | |
300 | break; | |
301 | } | |
302 | } else if (ysect <-ymax) { | |
303 | if (!trackTOFin->Rotate(-AliTOFGeometry::GetAlpha())) { | |
304 | break; | |
305 | } | |
306 | } | |
307 | ||
308 | if(!trackTOFin->PropagateTo(xs)) { | |
309 | break; | |
310 | } | |
311 | ||
312 | nStepsDone++; | |
313 | ||
314 | // store the running point (Globalrf) - fine propagation | |
315 | ||
316 | Double_t x,y,z; | |
317 | trackTOFin->GetGlobalXYZ(x,y,z); | |
318 | trackPos[0][istep]= (Float_t) x; | |
319 | trackPos[1][istep]= (Float_t) y; | |
320 | trackPos[2][istep]= (Float_t) z; | |
321 | trackPos[3][istep]= trackTOFin->GetIntegratedLength(); | |
322 | } | |
323 | ||
324 | ||
325 | Int_t nfound = 0; | |
326 | for (Int_t istep=0; istep<nStepsDone; istep++) { | |
327 | ||
328 | Bool_t isInside =kFALSE; | |
329 | Float_t ctrackPos[3]; | |
330 | ||
331 | ctrackPos[0]= trackPos[0][istep]; | |
332 | ctrackPos[1]= trackPos[1][istep]; | |
333 | ctrackPos[2]= trackPos[2][istep]; | |
334 | ||
335 | //now see whether the track matches any of the TOF clusters | |
336 | ||
337 | for (Int_t i=0; i<nc; i++){ | |
338 | Int_t cind[5]; | |
339 | cind[0]= clind[0][i]; | |
340 | cind[1]= clind[1][i]; | |
341 | cind[2]= clind[2][i]; | |
342 | cind[3]= clind[3][i]; | |
343 | cind[4]= clind[4][i]; | |
344 | Bool_t accept = kFALSE; | |
345 | if( mLastStep)accept = (fGeom->DistanceToPad(cind,ctrackPos)<fdCut); | |
346 | if(!mLastStep)accept = (fGeom->IsInsideThePad(cind,ctrackPos)); | |
347 | if(accept){ | |
348 | if(!mLastStep)isInside=kTRUE; | |
349 | dist[nfound]=fGeom->DistanceToPad(cind,ctrackPos); | |
350 | crecL[nfound]=trackPos[3][istep]; | |
351 | index[nfound]=clind[5][i]; // store cluster id | |
d3c7bfac | 352 | cxpos[nfound]=fGeom->RinTOF()+istep*0.1; //store prop.radius |
74ea065c | 353 | nfound++; |
354 | if(isInside)break; | |
355 | }//end if accept | |
356 | } //end for on the clusters | |
9b49e4c9 | 357 | |
358 | ||
74ea065c | 359 | if(isInside)break; |
360 | } //end for on the steps | |
361 | ||
9b49e4c9 | 362 | |
363 | ||
74ea065c | 364 | if (nfound == 0 ) { |
365 | fnunmatch++; | |
7bf28302 | 366 | delete trackTOFin; |
74ea065c | 367 | continue; |
368 | } | |
369 | ||
370 | fnmatch++; | |
371 | ||
372 | // now choose the cluster to be matched with the track. | |
373 | ||
374 | Int_t idclus=0; | |
375 | Float_t recL = 0.; | |
376 | Float_t xpos=0.; | |
377 | Float_t mindist=1000.; | |
378 | for (Int_t iclus= 0; iclus<nfound;iclus++){ | |
379 | if (dist[iclus]< mindist){ | |
380 | mindist = dist[iclus]; | |
381 | xpos = cxpos[iclus]; | |
382 | idclus =index[iclus]; | |
383 | recL=crecL[iclus]+fDx*0.5; | |
384 | } | |
385 | } | |
386 | ||
387 | AliTOFcluster *c=fClusters[idclus]; | |
7b61cd9c | 388 | c->Use(); //AliInfo(Form("I am usig the cluster")); |
74ea065c | 389 | |
390 | // Track length correction for matching Step 2 | |
391 | ||
392 | if(mLastStep){ | |
393 | Float_t rc=TMath::Sqrt(c->GetR()*c->GetR() + c->GetZ()*c->GetZ()); | |
394 | Float_t rt=TMath::Sqrt(trackPos[0][70]*trackPos[0][70] | |
395 | +trackPos[1][70]*trackPos[1][70] | |
396 | +trackPos[2][70]*trackPos[2][70]); | |
397 | Float_t dlt=rc-rt; | |
398 | recL=trackPos[3][70]+dlt; | |
399 | } | |
400 | ||
401 | if ( | |
402 | (c->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel())) | |
403 | || | |
404 | (c->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel())) | |
405 | || | |
406 | (c->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel())) | |
407 | ) { | |
408 | fngoodmatch++; | |
d3c7bfac | 409 | |
410 | //AliInfo(Form(" track label good %5i",trackTOFin->GetLabel())); | |
411 | ||
74ea065c | 412 | } |
413 | else{ | |
414 | fnbadmatch++; | |
d3c7bfac | 415 | |
416 | //AliInfo(Form(" track label bad %5i",trackTOFin->GetLabel())); | |
417 | ||
74ea065c | 418 | } |
419 | ||
420 | delete trackTOFin; | |
421 | ||
43f77f2d | 422 | //Double_t tof=50*c->GetTDC()+32; // in ps |
423 | Double_t tof=AliTOFGeometry::TdcBinWidth()*c->GetTDC()+32; // in ps | |
74ea065c | 424 | t->SetTOFsignal(tof); |
ee77ad87 | 425 | //t->SetTOFcluster(c->GetIndex()); // pointing to the digits tree |
426 | t->SetTOFcluster(idclus); // pointing to the recPoints tree | |
74ea065c | 427 | Double_t time[10]; t->GetIntegratedTimes(time); |
428 | Double_t mom=t->GetP(); | |
304864ab | 429 | for(Int_t j=0;j<=AliPID::kSPECIES;j++){ |
430 | Double_t mass=AliPID::ParticleMass(j); | |
74ea065c | 431 | time[j]+=(recL-trackPos[3][0])/3e-2*TMath::Sqrt(mom*mom+mass*mass)/mom; |
432 | } | |
433 | ||
434 | AliTOFtrack *trackTOFout = new AliTOFtrack(*t); | |
435 | trackTOFout->PropagateTo(xpos); | |
436 | t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout); | |
437 | t->SetIntegratedLength(recL); | |
438 | t->SetIntegratedTimes(time); | |
439 | ||
440 | delete trackTOFout; | |
441 | } | |
7bf28302 | 442 | for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii]; |
443 | for (Int_t ii=0;ii<6;ii++) delete [] clind[ii]; | |
74ea065c | 444 | } |
445 | //_________________________________________________________________________ | |
7b61cd9c | 446 | Int_t AliTOFtracker::LoadClusters(TTree *cTree) { |
74ea065c | 447 | //-------------------------------------------------------------------- |
448 | //This function loads the TOF clusters | |
449 | //-------------------------------------------------------------------- | |
450 | ||
7b61cd9c | 451 | TBranch *branch=cTree->GetBranch("TOF"); |
74ea065c | 452 | if (!branch) { |
7b61cd9c | 453 | AliError("can't get the branch with the TOF clusters !"); |
74ea065c | 454 | return 1; |
455 | } | |
456 | ||
7b61cd9c | 457 | TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy; |
458 | branch->SetAddress(&clusters); | |
74ea065c | 459 | |
7b61cd9c | 460 | cTree->GetEvent(0); |
461 | Int_t nc=clusters->GetEntriesFast(); | |
462 | AliInfo(Form("Number of clusters: %d",nc)); | |
74ea065c | 463 | |
7b61cd9c | 464 | for (Int_t i=0; i<nc; i++) { |
465 | AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i); | |
466 | /* | |
467 | for (Int_t jj=0; jj<5; jj++) dig[jj]=c->GetDetInd(jj); | |
74ea065c | 468 | |
469 | Double_t h[5]; | |
7b61cd9c | 470 | h[0]=c->GetR(); |
471 | h[1]=c->GetPhi(); | |
472 | h[2]=c->GetZ(); | |
473 | h[3]=c->GetTDC(); | |
474 | h[4]=c->GetADC(); | |
475 | ||
476 | Int_t indexDig[3]; | |
477 | for (Int_t jj=0; jj<3; jj++) indexDig[jj] = c->GetLabel(jj); | |
478 | ||
479 | AliTOFcluster *cl=new AliTOFcluster(h,c->GetTracks(),dig,i); | |
480 | */ | |
481 | ||
482 | // fClusters[i]=c; fN++; | |
483 | fClusters[i]=new AliTOFcluster(*c); fN++; | |
484 | ||
485 | //AliInfo(Form("%4i %4i %f %f %f %f %f %2i %1i %2i %1i %2i",i, fClusters[i]->GetIndex(),fClusters[i]->GetZ(),fClusters[i]->GetR(),fClusters[i]->GetPhi(), fClusters[i]->GetTDC(),fClusters[i]->GetADC(),fClusters[i]->GetDetInd(0),fClusters[i]->GetDetInd(1),fClusters[i]->GetDetInd(2),fClusters[i]->GetDetInd(3),fClusters[i]->GetDetInd(4))); | |
486 | //AliInfo(Form("%i %f",i, fClusters[i]->GetZ())); | |
487 | } | |
74ea065c | 488 | |
7b61cd9c | 489 | //AliInfo(Form("Number of clusters: %d",fN)); |
74ea065c | 490 | |
491 | return 0; | |
492 | } | |
493 | //_________________________________________________________________________ | |
494 | void AliTOFtracker::UnloadClusters() { | |
495 | //-------------------------------------------------------------------- | |
496 | //This function unloads TOF clusters | |
497 | //-------------------------------------------------------------------- | |
7b61cd9c | 498 | for (Int_t i=0; i<fN; i++) { |
499 | delete fClusters[i]; | |
500 | fClusters[i] = 0x0; | |
74ea065c | 501 | } |
7b61cd9c | 502 | fN=0; |
74ea065c | 503 | } |
504 | ||
505 | //_________________________________________________________________________ | |
506 | Int_t AliTOFtracker::FindClusterIndex(Double_t z) const { | |
507 | //-------------------------------------------------------------------- | |
508 | // This function returns the index of the nearest cluster | |
509 | //-------------------------------------------------------------------- | |
510 | if (fN==0) return 0; | |
511 | if (z <= fClusters[0]->GetZ()) return 0; | |
512 | if (z > fClusters[fN-1]->GetZ()) return fN; | |
513 | Int_t b=0, e=fN-1, m=(b+e)/2; | |
514 | for (; b<e; m=(b+e)/2) { | |
515 | if (z > fClusters[m]->GetZ()) b=m+1; | |
516 | else e=m; | |
517 | } | |
518 | return m; | |
519 | } | |
d4754572 | 520 | |
521 | //_________________________________________________________________________ | |
522 | Bool_t AliTOFtracker::GetTrackPoint(Int_t index, AliTrackPoint& p) const | |
523 | { | |
524 | // Get track space point with index i | |
525 | // Coordinates are in the global system | |
526 | AliTOFcluster *cl = fClusters[index]; | |
527 | Float_t xyz[3]; | |
528 | xyz[0] = cl->GetR()*TMath::Cos(cl->GetPhi()); | |
529 | xyz[1] = cl->GetR()*TMath::Sin(cl->GetPhi()); | |
530 | xyz[2] = cl->GetZ(); | |
531 | p.SetXYZ(xyz[0],xyz[1],xyz[2]); | |
532 | ||
533 | // Detector numbering scheme | |
534 | Int_t nSector = fGeom->NSectors(); | |
535 | Int_t nPlate = fGeom->NPlates(); | |
536 | Int_t nStripA = fGeom->NStripA(); | |
537 | Int_t nStripB = fGeom->NStripB(); | |
538 | Int_t nStripC = fGeom->NStripC(); | |
539 | ||
540 | Int_t isector = cl->GetDetInd(0); | |
541 | if (isector >= nSector) | |
542 | AliError(Form("Wrong sector number in TOF (%d) !",isector)); | |
543 | Int_t iplate = cl->GetDetInd(1); | |
544 | if (iplate >= nPlate) | |
545 | AliError(Form("Wrong plate number in TOF (%d) !",iplate)); | |
546 | Int_t istrip = cl->GetDetInd(2); | |
547 | ||
548 | Int_t stripOffset = 0; | |
549 | switch (iplate) { | |
550 | case 0: | |
551 | stripOffset = 0; | |
552 | break; | |
553 | case 1: | |
554 | stripOffset = nStripC; | |
555 | break; | |
556 | case 2: | |
557 | stripOffset = nStripC+nStripB; | |
558 | break; | |
559 | case 3: | |
560 | stripOffset = nStripC+nStripB+nStripA; | |
561 | break; | |
562 | case 4: | |
563 | stripOffset = nStripC+nStripB+nStripA+nStripB; | |
564 | break; | |
565 | default: | |
566 | AliError(Form("Wrong plate number in TOF (%d) !",iplate)); | |
567 | break; | |
568 | }; | |
569 | ||
570 | Int_t idet = (2*(nStripC+nStripB)+nStripA)*isector + | |
571 | stripOffset + | |
572 | istrip; | |
573 | UShort_t volid = AliAlignObj::LayerToVolUID(AliAlignObj::kTOF,idet); | |
574 | p.SetVolumeID((UShort_t)volid); | |
575 | return kTRUE; | |
576 | } |