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