1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //--------------------------------------------------------------------//
18 // AliTOFtracker Class //
19 // Task: Perform association of the ESD tracks to TOF Clusters //
20 // and Update ESD track with associated TOF Cluster parameters //
22 // -- Authors : S. Arcelli, C. Zampolli (Bologna University and INFN) //
23 // -- Contacts: Annalisa.De.Caro@cern.ch //
24 // -- : Chiara.Zampolli@bo.infn.it //
25 // -- : Silvia.Arcelli@bo.infn.it //
27 //--------------------------------------------------------------------//
32 #include <TSeqCollection.h>
33 #include <TClonesArray.h>
34 #include <TObjArray.h>
35 #include <TGeoManager.h>
40 #include "AliGeomManager.h"
41 #include "AliESDtrack.h"
42 #include "AliESDEvent.h"
43 #include "AliESDpid.h"
45 #include "AliTrackPointArray.h"
46 #include "AliCDBManager.h"
48 //#include "AliTOFpidESD.h"
49 #include "AliTOFRecoParam.h"
50 #include "AliTOFReconstructor.h"
51 #include "AliTOFcluster.h"
52 #include "AliTOFGeometry.h"
53 #include "AliTOFtracker.h"
54 #include "AliTOFtrack.h"
56 extern TGeoManager *gGeoManager;
57 //extern TROOT *gROOT;
60 ClassImp(AliTOFtracker)
62 //_____________________________________________________________________________
63 AliTOFtracker::AliTOFtracker():
74 fTracks(new TClonesArray("AliTOFtrack")),
75 fSeeds(new TObjArray(100)),
76 fTOFtrackPoints(new TObjArray(10)),
96 //AliTOFtracker main Ctor
98 for (Int_t ii=0; ii<kMaxCluster; ii++) fClusters[ii]=0x0;
100 // Getting the geometry
101 fGeom = new AliTOFGeometry();
103 for(Int_t i=0; i< 20000;i++){
104 fClusterESD[i] = NULL;
111 //_____________________________________________________________________________
112 AliTOFtracker::~AliTOFtracker() {
119 if(!(AliCDBManager::Instance()->GetCacheFlag())){
125 delete fHDigClusTime;
131 delete fHRecSigYVsPWin;
132 delete fHRecSigZVsPWin;
144 if (fTOFtrackPoints){
145 fTOFtrackPoints->Delete();
146 delete fTOFtrackPoints;
150 for (Int_t ii=0; ii<kMaxCluster; ii++)
151 if (fClusters[ii]) fClusters[ii]->Delete();
154 for(Int_t i=0; i< 20000;i++){
156 delete fClusterESD[i];
157 fClusterESD[i] = NULL;
167 //_____________________________________________________________________________
168 void AliTOFtracker::GetPidSettings(AliESDpid *esdPID) {
170 // Sets TOF resolution from RecoParams
173 esdPID->GetTOFResponse().SetTimeResolution(fkRecoParam->GetTimeResolution());
175 AliWarning("fkRecoParam not yet set; cannot set PID settings");
177 //_____________________________________________________________________________
178 Int_t AliTOFtracker::PropagateBack(AliESDEvent * const event) {
180 // Gets seeds from ESD event and Match with TOF Clusters
185 AliInfo("No TOF recPoints to be matched with reconstructed tracks");
189 // initialize RecoParam for current event
190 AliDebug(1,"Initializing params for TOF");
192 fkRecoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER...
194 if (fkRecoParam == 0x0) {
195 AliFatal("No Reco Param found for TOF!!!");
197 //fkRecoParam->Dump();
198 //if(fkRecoParam->GetApplyPbPbCuts())fkRecoParam=fkRecoParam->GetPbPbparam();
199 //fkRecoParam->PrintParameters();
202 // create clusters from hit
203 for(Int_t i=0;i < fNTOFmatched;i++){
204 fClusterESD[i] = new AliESDTOFCluster(fHit[i],event);
205 fClusterESD[i]->SetStatus(fClusters[i]->GetStatus());
208 //Initialise some counters
217 Int_t ntrk=event->GetNumberOfTracks();
221 //Load ESD tracks into a local Array of ESD Seeds
222 for (Int_t i=0; i<fNseeds; i++){
223 fSeeds->AddLast(event->GetTrack(i));
224 // event->GetTrack(i)->SetESDEvent(event); // RS: Why this is needed? The event is already set
226 //Prepare ESD tracks candidates for TOF Matching
229 if (fNseeds==0 || fNseedsTOF==0) {
230 AliInfo("No seeds to try TOF match");
236 //First Step with Strict Matching Criterion
239 //Second Step with Looser Matching Criterion
242 //Third Step without kTOFout flag (just to update clusters)
245 //RS? event->SetTOFcluster(fNTOFmatched,fClusterESD);
248 AliInfo("No TOF recPoints to be matched with reconstructed tracks");
254 AliInfo(Form("Number of matched tracks = %d (good = %d, bad = %d)",fnmatch,fngoodmatch,fnbadmatch));
256 //Update the matched ESD tracks
258 for (Int_t i=0; i<ntrk; i++) {
259 // RS: This is a bogus code since t and seed are the same object
260 // AliESDtrack *t=event->GetTrack(i);
261 AliESDtrack *seed =(AliESDtrack*)fSeeds->At(i);
262 if ( (seed->GetStatus()&AliESDtrack::kTOFin)!=0 ) {
263 //t->SetStatus(AliESDtrack::kTOFin);
264 //if(seed->GetTOFsignal()>0){
265 if ( (seed->GetStatus()&AliESDtrack::kTOFout)!=0 ) {
266 //t->SetStatus(AliESDtrack::kTOFout);
267 //t->SetTOFsignal(seed->GetTOFsignal());
268 //t->SetTOFcluster(seed->GetTOFcluster());
269 //t->SetTOFsignalToT(seed->GetTOFsignalToT());
270 //t->SetTOFsignalRaw(seed->GetTOFsignalRaw());
271 //t->SetTOFsignalDz(seed->GetTOFsignalDz());
272 //t->SetTOFsignalDx(seed->GetTOFsignalDx());
273 //t->SetTOFDeltaBC(seed->GetTOFDeltaBC());
274 //t->SetTOFL0L1(seed->GetTOFL0L1());
275 //t->SetTOFCalChannel(seed->GetTOFCalChannel());
276 Int_t tlab[3]; seed->GetTOFLabel(tlab);
277 //t->SetTOFLabel(tlab);
279 Double_t alphaA = (Double_t)seed->GetAlpha();
280 Double_t xA = (Double_t)seed->GetX();
281 Double_t yA = (Double_t)seed->GetY();
282 Double_t zA = (Double_t)seed->GetZ();
283 Double_t p1A = (Double_t)seed->GetSnp();
284 Double_t p2A = (Double_t)seed->GetTgl();
285 Double_t p3A = (Double_t)seed->GetSigned1Pt();
286 const Double_t *covA = (Double_t*)seed->GetCovariance();
288 // Make attention, please:
289 // AliESDtrack::fTOFInfo array does not be stored in the AliESDs.root file
290 // it is there only for a check during the reconstruction step.
291 Float_t info[10]; seed->GetTOFInfo(info);
292 //t->SetTOFInfo(info);
293 AliDebug(3,Form(" distance=%f; residual in the pad reference frame: dX=%f, dZ=%f", info[0],info[1],info[2]));
296 // by calling the AliESDtrack::UpdateTrackParams,
297 // the current track parameters are changed
298 // and it could cause refit problems.
299 // We need to update only the following track parameters:
300 // the track length and expected times.
301 // Removed AliESDtrack::UpdateTrackParams call
302 // Called AliESDtrack::SetIntegratedTimes(...) and
303 // AliESDtrack::SetIntegratedLength() routines.
305 AliTOFtrack *track = new AliTOFtrack(*seed);
306 t->UpdateTrackParams(track,AliESDtrack::kTOFout); // to be checked - AdC
308 Double_t time[AliPID::kSPECIESC]; t->GetIntegratedTimes(time);
311 Double_t time[AliPID::kSPECIESC]; seed->GetIntegratedTimes(time,AliPID::kSPECIESC);
312 //t->SetIntegratedTimes(time);
314 //Double_t length = seed->GetIntegratedLength();
315 //t->SetIntegratedLength(length);
317 Double_t alphaB = (Double_t)seed->GetAlpha();
318 Double_t xB = (Double_t)seed->GetX();
319 Double_t yB = (Double_t)seed->GetY();
320 Double_t zB = (Double_t)seed->GetZ();
321 Double_t p1B = (Double_t)seed->GetSnp();
322 Double_t p2B = (Double_t)seed->GetTgl();
323 Double_t p3B = (Double_t)seed->GetSigned1Pt();
324 const Double_t *covB = (Double_t*)seed->GetCovariance();
325 AliDebug(3,"Track params -now(before)-:");
326 AliDebug(3,Form(" X: %f(%f), Y: %f(%f), Z: %f(%f) --- alpha: %f(%f)",
331 AliDebug(3,Form(" p1: %f(%f), p2: %f(%f), p3: %f(%f)",
335 AliDebug(3,Form(" cov1: %f(%f), cov2: %f(%f), cov3: %f(%f)"
336 " cov4: %f(%f), cov5: %f(%f), cov6: %f(%f)"
337 " cov7: %f(%f), cov8: %f(%f), cov9: %f(%f)"
338 " cov10: %f(%f), cov11: %f(%f), cov12: %f(%f)"
339 " cov13: %f(%f), cov14: %f(%f), cov15: %f(%f)",
356 AliDebug(2,Form(" TOF params: %6d %f %f %f %f %f %6d %3d %f",
358 seed->GetTOFsignalRaw(),
359 seed->GetTOFsignal(),
360 seed->GetTOFsignalToT(),
361 seed->GetTOFsignalDz(),
362 seed->GetTOFsignalDx(),
363 seed->GetTOFCalChannel(),
364 seed->GetTOFcluster(),
365 seed->GetIntegratedLength()));
366 AliDebug(2,Form(" %f %f %f %f %f %f %f %f %f",
367 time[0], time[1], time[2], time[3], time[4], time[5], time[6], time[7], time[8]));
373 Int_t *matchmap = new Int_t[fNTOFmatched];
374 event->SetTOFcluster(fNTOFmatched,fClusterESD,matchmap);
375 for (Int_t i=0; i<ntrk; i++) { // remapping after TOF matching selection
376 AliESDtrack *t=event->GetTrack(i);
377 t->ReMapTOFcluster(fNTOFmatched,matchmap);
385 // Now done in AliESDpid
386 // fPid->MakePID(event,timeZero);
394 //_________________________________________________________________________
395 void AliTOFtracker::CollectESD() {
396 //prepare the set of ESD tracks to be matched to clusters in TOF
402 TClonesArray &aTOFTrack = *fTracks;
403 for (Int_t i=0; i<fNseeds; i++) {
405 AliESDtrack *t =(AliESDtrack*)fSeeds->At(i);
406 if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
408 AliTOFtrack *track = new AliTOFtrack(*t); // New
409 Float_t x = (Float_t)track->GetX(); //New
412 if ( ( (t->GetStatus()&AliESDtrack::kTRDout)!=0 ) ) {
414 AliDebug(1,Form(" Before propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength()));
416 // TRD 'good' tracks, already propagated at 371 cm
417 if( x >= AliTOFGeometry::Rmin() ) {
419 if ( track->PropagateToInnerTOF() ) {
421 AliDebug(1,Form(" TRD propagated track till rho = %fcm."
422 " And then the track has been propagated till rho = %fcm.",
423 x, (Float_t)track->GetX()));
425 track->SetSeedIndex(i);
426 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
427 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
431 AliDebug(1,Form(" After propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength()));
436 else { // TRD 'good' tracks, propagated rho<371cm
438 if ( track->PropagateToInnerTOF() ) {
440 AliDebug(1,Form(" TRD propagated track till rho = %fcm."
441 " And then the track has been propagated till rho = %fcm.",
442 x, (Float_t)track->GetX()));
444 track->SetSeedIndex(i);
445 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
446 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
450 AliDebug(1,Form(" After propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength()));
458 else { // Propagate the rest of TPCbp
460 AliDebug(1,Form(" Before propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength()));
462 if ( track->PropagateToInnerTOF() ) {
464 AliDebug(1,Form(" TPC propagated track till rho = %fcm."
465 " And then the track has been propagated till rho = %fcm.",
466 x, (Float_t)track->GetX()));
468 track->SetSeedIndex(i);
469 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
470 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
474 AliDebug(1,Form(" After propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength()));
480 AliInfo(Form("Number of TOF seeds = %d (kTRDout371 = %d, kTRDoutLess371 = %d, !kTRDout = %d)",fNseedsTOF,seedsTOF1,seedsTOF3,seedsTOF2));
482 // Sort according uncertainties on track position
487 //_________________________________________________________________________
488 void AliTOFtracker::MatchTracks( Int_t mLastStep){
490 // Parameters used/regulating the reconstruction
492 //static Float_t corrLen=0.;//0.75;
493 static Float_t detDepth=18.;
494 static Float_t padDepth=0.5;
496 const Float_t kSpeedOfLight= 2.99792458e-2; // speed of light [cm/ps]
497 const Float_t kTimeOffset = 0.; // time offset for tracking algorithm [ps]
499 Float_t dY=AliTOFGeometry::XPad();
500 Float_t dZ=AliTOFGeometry::ZPad();
502 Float_t sensRadius = fkRecoParam->GetSensRadius();
503 Float_t stepSize = fkRecoParam->GetStepSize();
504 Float_t scaleFact = fkRecoParam->GetWindowScaleFact();
505 Float_t dyMax=fkRecoParam->GetWindowSizeMaxY();
506 Float_t dzMax=fkRecoParam->GetWindowSizeMaxZ();
507 Float_t dCut=fkRecoParam->GetDistanceCut();
508 if (dCut==3. && fNseedsTOF<=10) {
510 AliInfo(Form("Matching window=%f, since low multiplicity event (fNseedsTOF=%d)",
517 Double_t maxChi2=fkRecoParam->GetMaxChi2TRD();
518 Bool_t timeWalkCorr = fkRecoParam->GetTimeWalkCorr();
520 AliDebug(1,"++++++++++++++TOF Reconstruction Parameters:++++++++++++");
521 AliDebug(1,Form("TOF sens radius: %f",sensRadius));
522 AliDebug(1,Form("TOF step size: %f",stepSize));
523 AliDebug(1,Form("TOF Window scale factor: %f",scaleFact));
524 AliDebug(1,Form("TOF Window max dy: %f",dyMax));
525 AliDebug(1,Form("TOF Window max dz: %f",dzMax));
526 AliDebug(1,Form("TOF distance Cut: %f",dCut));
527 AliDebug(1,Form("TOF Max Chi2: %f",maxChi2));
528 AliDebug(1,Form("Time Walk Correction? : %d",timeWalkCorr));
531 //Match ESD tracks to clusters in TOF
533 // Get the number of propagation steps
534 Int_t nSteps=(Int_t)(detDepth/stepSize);
535 AliDebug(1,Form(" Number of steps to be done %d",nSteps));
537 AliDebug(1,"++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
539 //PH Arrays (moved outside of the loop)
540 Float_t * trackPos[4];
541 for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
542 Int_t * clind = new Int_t[fN];
545 const Int_t kNclusterMax = 1000; // related to fN value
546 TGeoHMatrix global[kNclusterMax];
549 for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) {
551 fTOFtrackPoints->Delete();
553 for (Int_t ii=0; ii<kNclusterMax; ii++)
555 AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(iseed);
556 AliESDtrack *t =(AliESDtrack*)fSeeds->At(track->GetSeedIndex());
557 //if ( t->GetTOFsignal()>0. ) continue;
558 if ( ((t->GetStatus()&AliESDtrack::kTOFout)!=0 ) && mLastStep < 2) continue;
559 AliTOFtrack *trackTOFin = new AliTOFtrack(*track);
561 // Determine a window around the track
563 trackTOFin->GetExternalParameters(x,par);
565 trackTOFin->GetExternalCovariance(cov);
567 if (cov[0]<0. || cov[2]<0.) {
568 AliWarning(Form("Very strange track (%d)! At least one of its covariance matrix diagonal elements is negative!",iseed));
575 ((5*TMath::Sqrt(TMath::Abs(cov[0])) + 0.5*dY + 2.5*TMath::Abs(par[2]))/sensRadius);
578 (5*TMath::Sqrt(TMath::Abs(cov[2])) + 0.5*dZ + 2.5*TMath::Abs(par[3]));
580 Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
581 if (phi<-TMath::Pi())phi+=2*TMath::Pi();
582 if (phi>=TMath::Pi())phi-=2*TMath::Pi();
585 //upper limit on window's size.
586 if (dz> dzMax) dz=dzMax;
587 if (dphi*sensRadius> dyMax) dphi=dyMax/sensRadius;
590 // find the clusters in the window of the track
592 for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
594 if (nc>=kNclusterMax) {
595 AliWarning("No more matchable clusters can be stored! Please, increase the corresponding vectors size.");
599 AliTOFcluster *c=fClusters[k];
600 if (c->GetZ() > z+dz) break;
601 if (c->IsUsed() && mLastStep < 2) continue;
602 if (!c->GetStatus()) {
603 AliDebug(1,"Cluster in channel declared bad!");
604 continue; // skip bad channels as declared in OCDB
607 Double_t dph=TMath::Abs(c->GetPhi()-phi);
608 if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
609 if (TMath::Abs(dph)>dphi) continue;
611 Double_t yc=(c->GetPhi() - trackTOFin->GetAlpha())*c->GetR();
612 Double_t p[2]={yc, c->GetZ()};
613 Double_t cov2[3]= {dY*dY/12., 0., dZ*dZ/12.};
614 if (trackTOFin->AliExternalTrackParam::GetPredictedChi2(p,cov2) > maxChi2)continue;
619 ind[0]=c->GetDetInd(0);
620 ind[1]=c->GetDetInd(1);
621 ind[2]=c->GetDetInd(2);
622 ind[3]=c->GetDetInd(3);
623 ind[4]=c->GetDetInd(4);
624 fGeom->GetVolumePath(ind,path);
625 gGeoManager->cd(path);
626 global[nc] = *gGeoManager->GetCurrentMatrix();
631 AliDebug(1,Form("No available clusters for the track number %d",iseed));
637 AliDebug(1,Form(" Number of available TOF clusters for the track number %d: %d",iseed,nc));
639 //start fine propagation
641 Int_t nStepsDone = 0;
642 for( Int_t istep=0; istep<nSteps; istep++){
644 // First of all, propagate the track...
645 Float_t xs = AliTOFGeometry::RinTOF()+istep*stepSize;
646 if (!(trackTOFin->PropagateTo(xs))) break;
648 // ...and then, if necessary, rotate the track
649 Double_t ymax = xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
650 Double_t ysect = trackTOFin->GetY();
652 if (!(trackTOFin->Rotate(AliTOFGeometry::GetAlpha()))) break;
653 } else if (ysect <-ymax) {
654 if (!(trackTOFin->Rotate(-AliTOFGeometry::GetAlpha()))) break;
658 AliDebug(3,Form(" current step %d (%d) - nStepsDone=%d",istep,nSteps,nStepsDone));
660 // store the running point (Globalrf) - fine propagation
663 trackTOFin->GetXYZ(r);
664 trackPos[0][nStepsDone-1]= (Float_t) r[0];
665 trackPos[1][nStepsDone-1]= (Float_t) r[1];
666 trackPos[2][nStepsDone-1]= (Float_t) r[2];
667 trackPos[3][nStepsDone-1]= trackTOFin->GetIntegratedLength();
677 Bool_t accept = kFALSE;
678 Bool_t isInside = kFALSE;
679 for (Int_t istep=0; istep<nStepsDone; istep++) {
681 Float_t ctrackPos[3];
682 ctrackPos[0] = trackPos[0][istep];
683 ctrackPos[1] = trackPos[1][istep];
684 ctrackPos[2] = trackPos[2][istep];
686 //now see whether the track matches any of the TOF clusters
690 for (Int_t i=0; i<nc; i++) {
691 isInside = fGeom->IsInsideThePad((TGeoHMatrix*)(&global[i]),ctrackPos,dist3d);
694 Float_t yLoc = dist3d[1];
695 Float_t rLoc = TMath::Sqrt(dist3d[0]*dist3d[0]+dist3d[2]*dist3d[2]);
696 accept = (TMath::Abs(yLoc)<padDepth*0.5 && rLoc<dCut);
697 AliDebug(3," I am in the case mLastStep==kTRUE ");
704 fTOFtrackPoints->AddLast(new AliTOFtrackPoint(clind[i],
705 TMath::Sqrt(dist3d[0]*dist3d[0] + dist3d[1]*dist3d[1] + dist3d[2]*dist3d[2]),
706 dist3d[2],dist3d[0],dist3d[1],
707 AliTOFGeometry::RinTOF()+istep*stepSize,trackPos[3][istep]));
709 AliDebug(3,Form(" dist3dLoc[0] = %f, dist3dLoc[1] = %f, dist3dLoc[2] = %f ",dist3d[0],dist3d[1],dist3d[2]));
711 if(accept &&!mLastStep)break;
714 } //end for on the clusters
715 if(accept &&!mLastStep)break;
716 } //end for on the steps
723 if ( nStepsDone == 0 ) {
724 AliDebug(1,Form(" No track points for the track number %d",iseed));
730 AliDebug(2,Form(" Number of steps done for the track number %d: %d",iseed,nStepsDone));
736 Int_t *isClusterMatchable = NULL;
738 isClusterMatchable = new Int_t[nc];
739 for (Int_t i=0; i<nc; i++) isClusterMatchable[i] = kFALSE;
743 Bool_t accept = kFALSE;
744 Bool_t isInside = kFALSE;
745 for (Int_t istep=0; istep<nStepsDone; istep++) {
747 Bool_t gotInsideCluster = kFALSE;
748 Int_t trackInsideCluster = -1;
750 Float_t ctrackPos[3];
751 ctrackPos[0] = trackPos[0][istep];
752 ctrackPos[1] = trackPos[1][istep];
753 ctrackPos[2] = trackPos[2][istep];
755 //now see whether the track matches any of the TOF clusters
757 Float_t dist3d[3]={0.,0.,0.};
759 for (Int_t i=0; i<nc; i++) {
762 /* check whether track was inside another cluster
763 * and in case inhibit this cluster.
764 * this will allow to only go on and add track points for
765 * that cluster where the track got inside first */
766 if (gotInsideCluster && trackInsideCluster != i) {
767 AliDebug(3,Form(" A - istep=%d ~ %d %d ~ nfound=%d",istep,trackInsideCluster,i,nfound));
770 AliDebug(3,Form(" B - istep=%d ~ %d %d ~ nfound=%d",istep,trackInsideCluster,i,nfound));
772 /* check whether track is inside this cluster */
773 for (Int_t hh=0; hh<3; hh++) dist3d[hh]=0.;
774 isInside = fGeom->IsInsideThePad((TGeoHMatrix*)(&global[i]),ctrackPos,dist3d);
777 /* if track is inside this cluster set flags which will then
778 * inhibit to add track points for the other clusters */
780 gotInsideCluster = kTRUE;
781 trackInsideCluster = i;
785 Float_t yLoc = dist3d[1];
786 Float_t rLoc = TMath::Sqrt(dist3d[0]*dist3d[0]+dist3d[2]*dist3d[2]);
787 accept = (TMath::Abs(yLoc)<padDepth*0.5 && rLoc<dCut);
788 AliDebug(3," I am in the case mLastStep==kTRUE ");
792 /* add point everytime that:
793 * - the track is inside the cluster
794 * - the track got inside the cluster, even when it eventually exited the cluster
795 * - the tracks is within dCut from the cluster
797 if (accept || isInside || gotInsideCluster) {
799 fTOFtrackPoints->AddLast(new AliTOFtrackPoint(clind[i],
800 TMath::Sqrt(dist3d[0]*dist3d[0] + dist3d[1]*dist3d[1] + dist3d[2]*dist3d[2]),
801 dist3d[2],dist3d[0],dist3d[1],
802 AliTOFGeometry::RinTOF()+istep*stepSize,trackPos[3][istep]));
804 AliDebug(2,Form(" dist3dLoc[0] = %f, dist3dLoc[1] = %f, dist3dLoc[2] = %f ",dist3d[0],dist3d[1],dist3d[2]));
807 AliDebug(3,Form(" C - istep=%d ~ %d %d ~ nfound=%d",istep,trackInsideCluster,i,nfound));
809 // store the match in the ESD
810 if (mLastStep==2 && !isClusterMatchable[i]) { // add TOF clusters to the track
812 isClusterMatchable[i] = kTRUE;
814 Double_t mom=t->GetP();
815 AliDebug(3,Form(" Momentum for track %d -> %f", iseed,mom));
816 Double_t time[AliPID::kSPECIESC];
817 // read from old structure (the one used by TPC in reco)
818 for(Int_t isp=0;isp<AliPID::kSPECIESC;isp++){
819 time[isp] = t->GetIntegratedTimesOld(isp); // in ps
820 Double_t mass=AliPID::ParticleMass(isp);
821 Double_t momz = mom*AliPID::ParticleCharge(isp);
822 time[isp]+=(trackPos[3][istep]-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(momz*momz+mass*mass)/momz;
823 //time[isp]+=(trackPos[3][istep]-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(mom*mom+mass*mass)/mom;
826 AliESDTOFCluster* esdTOFCl = GetESDTOFCluster(clind[i]);
827 if(!esdTOFCl->Update(t->GetID(),dist3d[0],dist3d[1],dist3d[2],trackPos[3][istep],time))//x,y,z -> tracking RF
828 t->AddTOFcluster(esdTOFCl->GetESDID());
832 /* do not break loop in any case
833 * if the track got inside a cluster all other clusters
835 // if(accept &&!mLastStep)break;
839 } //end for on the clusters
842 /* do not break loop in any case
843 * if the track got inside a cluster all other clusters
844 * are inhibited but we want to go on adding track points */
845 // if(accept &&!mLastStep)break;
847 } //end for on the steps
848 if(nc) delete[] isClusterMatchable;
851 AliDebug(1,Form("No track points for the track number %d",iseed));
857 AliDebug(1,Form(" Number of track points for the track number %d: %d",iseed,nfound));
859 // now choose the cluster to be matched with the track.
864 Float_t mindist=1000.;
867 Float_t mindistX=stepSize;
868 for (Int_t iclus= 0; iclus<nfound;iclus++) {
869 AliTOFtrackPoint *matchableTOFcluster = (AliTOFtrackPoint*)fTOFtrackPoints->At(iclus);
870 //if ( matchableTOFcluster->Distance()<mindist ) {
871 if ( TMath::Abs(matchableTOFcluster->DistanceX())<TMath::Abs(mindistX) &&
872 TMath::Abs(matchableTOFcluster->DistanceX())<=stepSize ) {
873 mindist = matchableTOFcluster->Distance();
874 mindistZ = matchableTOFcluster->DistanceZ(); // Z distance in the
879 mindistY = matchableTOFcluster->DistanceY(); // Y distance in the
884 mindistX = matchableTOFcluster->DistanceX(); // X distance in the
889 xpos = matchableTOFcluster->PropRadius();
890 idclus = matchableTOFcluster->Index();
891 recL = matchableTOFcluster->Length();// + corrLen*0.5;
893 AliDebug(2,Form(" %d(%d) --- %f (%f, %f, %f), step=%f -- idclus=%d --- seed=%d, trackId=%d, trackLab=%d", iclus,nfound,
894 mindist,mindistX,mindistY,mindistZ,stepSize,idclus,iseed,track->GetSeedIndex(),track->GetLabel()));
897 } // loop on found TOF track points
899 if (TMath::Abs(mindistX)>stepSize && idclus!=-1) {
900 AliInfo(Form(" %d - not matched --- but idclus=%d, trackId=%d, trackLab=%d",iseed,
901 idclus,track->GetSeedIndex(),track->GetLabel()));
906 AliDebug(1,Form("Reconstructed track %d doesn't match any TOF cluster", iseed));
912 AliDebug(1,Form(" %d - matched",iseed));
916 AliTOFcluster *c=fClusters[idclus];
918 AliDebug(3, Form("%7d %7d %10d %10d %10d %10d %7d",
921 TMath::Abs(trackTOFin->GetLabel()),
922 c->GetLabel(0), c->GetLabel(1), c->GetLabel(2),
927 // Track length correction for matching Step 2
930 Float_t rc = TMath::Sqrt(c->GetR()*c->GetR() + c->GetZ()*c->GetZ());
931 Float_t rt = TMath::Sqrt(trackPos[0][70]*trackPos[0][70]
932 +trackPos[1][70]*trackPos[1][70]
933 +trackPos[2][70]*trackPos[2][70]);
935 recL=trackPos[3][70]+dlt;
939 (c->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
941 (c->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel()))
943 (c->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
947 AliDebug(2,Form(" track label good %5d",trackTOFin->GetLabel()));
953 AliDebug(2,Form(" track label bad %5d",trackTOFin->GetLabel()));
959 // Store quantities to be used in the TOF Calibration
960 Float_t tToT=AliTOFGeometry::ToTBinWidth()*c->GetToT()*1E-3; // in ns
961 // t->SetTOFsignalToT(tToT);
962 Float_t rawTime=AliTOFGeometry::TdcBinWidth()*c->GetTDCRAW()+kTimeOffset; // RAW time,in ps
963 // t->SetTOFsignalRaw(rawTime);
964 // t->SetTOFsignalDz(mindistZ);
965 // t->SetTOFsignalDx(mindistY);
966 // t->SetTOFDeltaBC(c->GetDeltaBC());
967 // t->SetTOFL0L1(c->GetL0L1Latency());
969 Float_t info[10] = {mindist,mindistY,mindistZ,
970 0.,0.,0.,0.,0.,0.,0.};
972 AliDebug(3,Form(" distance=%f; residual in the pad reference frame: dX=%f, dZ=%f", info[0],info[1],info[2]));
976 ind[0]=c->GetDetInd(0);
977 ind[1]=c->GetDetInd(1);
978 ind[2]=c->GetDetInd(2);
979 ind[3]=c->GetDetInd(3);
980 ind[4]=c->GetDetInd(4);
981 Int_t calindex = AliTOFGeometry::GetIndex(ind);
982 // t->SetTOFCalChannel(calindex);
984 // keep track of the track labels in the matched cluster
986 tlab[0]=c->GetLabel(0);
987 tlab[1]=c->GetLabel(1);
988 tlab[2]=c->GetLabel(2);
989 AliDebug(3,Form(" tdc time of the matched track %6d = ",c->GetTDC()));
990 Double_t tof=AliTOFGeometry::TdcBinWidth()*c->GetTDC()+kTimeOffset; // in ps
991 AliDebug(3,Form(" tof time of the matched track: %f = ",tof));
992 Double_t tofcorr=tof;
993 if(timeWalkCorr)tofcorr=CorrectTimeWalk(mindistZ,tof);
994 AliDebug(3,Form(" tof time of the matched track, after TW corr: %f = ",tofcorr));
995 //Set TOF time signal and pointer to the matched cluster
996 // t->SetTOFsignal(tofcorr);
997 t->SetTOFcluster(idclus); // pointing to the recPoints tree
999 AliDebug(3,Form(" Setting TOF raw time: %f, z distance: %f corrected time: %f ",rawTime,mindistZ,tofcorr));
1002 Double_t time[AliPID::kSPECIESC];
1003 // read from old structure (the one used by TPC in reco)
1004 for(Int_t isp=0;isp<AliPID::kSPECIESC;isp++){
1005 time[isp] = t->GetIntegratedTimesOld(isp); // in ps
1007 Double_t mom=t->GetP();
1008 AliDebug(3,Form(" Momentum for track %d -> %f", iseed,mom));
1009 for (Int_t j=0;j<AliPID::kSPECIESC;j++) {
1010 Double_t mass=AliPID::ParticleMass(j);
1011 Double_t momz = mom*AliPID::ParticleCharge(j);
1012 time[j]+=(recL-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(momz*momz+mass*mass)/momz;
1013 //time[j]+=(recL-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(mom*mom+mass*mass)/mom;
1016 AliTOFtrack *trackTOFout = new AliTOFtrack(*t);
1017 if (!(trackTOFout->PropagateTo(xpos))) {
1022 // If necessary, rotate the track
1023 Double_t yATxposMax=xpos*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
1024 Double_t yATxpos=trackTOFout->GetY();
1025 if (yATxpos > yATxposMax) {
1026 if (!(trackTOFout->Rotate(AliTOFGeometry::GetAlpha()))) {
1030 } else if (yATxpos < -yATxposMax) {
1031 if (!(trackTOFout->Rotate(-AliTOFGeometry::GetAlpha()))) {
1037 // Fill the track residual histograms and update track only if in the first two step (0 and 1)
1039 FillResiduals(trackTOFout,c,kFALSE);
1041 t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);
1043 // don't update old structure with TOF info
1044 // t->SetIntegratedLength(recL);
1045 // t->SetIntegratedTimes(time);
1046 // t->SetTOFLabel(tlab);
1048 // add tof cluster to the track also for step 2
1049 AliESDTOFCluster* esdTOFCl = GetESDTOFCluster(idclus);
1050 esdTOFCl->Update(t->GetID(),mindistY,mindist,mindistZ,recL,time);
1051 t->AddTOFcluster(esdTOFCl->GetESDID());
1054 fClusterESD[idclus]->Update(t->GetID(),mindistY,mindist,mindistZ,recL,time);//x,y,z -> tracking RF
1056 t->AddTOFcluster(idclus);
1059 AliInfo("Too many TOF clusters matched with tracks (> 20000)");
1063 // Fill Reco-QA histos for Reconstruction
1064 fHRecNClus->Fill(nc);
1065 fHRecDist->Fill(mindist);
1067 fHRecSigYVsP->Fill(mom,TMath::Sqrt(cov[0]));
1069 fHRecSigYVsP->Fill(mom,-TMath::Sqrt(-cov[0]));
1071 fHRecSigZVsP->Fill(mom,TMath::Sqrt(cov[2]));
1073 fHRecSigZVsP->Fill(mom,-TMath::Sqrt(-cov[2]));
1074 fHRecSigYVsPWin->Fill(mom,dphi*sensRadius);
1075 fHRecSigZVsPWin->Fill(mom,dz);
1077 // Fill Tree for on-the-fly offline Calibration
1079 if ( !((t->GetStatus() & AliESDtrack::kTIME)==0 ) ) {
1092 for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
1096 //_________________________________________________________________________
1097 Int_t AliTOFtracker::LoadClusters(TTree *cTree) {
1098 //--------------------------------------------------------------------
1099 //This function loads the TOF clusters
1100 //--------------------------------------------------------------------
1102 Int_t npadX = AliTOFGeometry::NpadX();
1103 Int_t npadZ = AliTOFGeometry::NpadZ();
1104 Int_t nStripA = AliTOFGeometry::NStripA();
1105 Int_t nStripB = AliTOFGeometry::NStripB();
1106 Int_t nStripC = AliTOFGeometry::NStripC();
1108 TBranch *branch=cTree->GetBranch("TOF");
1110 AliError("can't get the branch with the TOF clusters !");
1114 static TClonesArray dummy("AliTOFcluster",10000);
1116 TClonesArray *clusters=&dummy;
1117 branch->SetAddress(&clusters);
1120 Int_t nc=clusters->GetEntriesFast();
1121 fHDigNClus->Fill(nc);
1123 AliInfo(Form("Number of clusters: %d",nc));
1128 for (Int_t i=0; i<nc; i++) {
1129 AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
1130 //PH fClusters[i]=new AliTOFcluster(*c); fN++;
1131 fClusters[i]=c; fN++;
1133 // Fill Digits QA histos
1135 Int_t isector = c->GetDetInd(0);
1136 Int_t iplate = c->GetDetInd(1);
1137 Int_t istrip = c->GetDetInd(2);
1138 Int_t ipadX = c->GetDetInd(4);
1139 Int_t ipadZ = c->GetDetInd(3);
1141 Float_t time =(AliTOFGeometry::TdcBinWidth()*c->GetTDC())*1E-3; // in ns
1142 Float_t tot = (AliTOFGeometry::TdcBinWidth()*c->GetToT())*1E-3;//in ns
1151 Int_t calindex = AliTOFGeometry::GetIndex(ind);
1152 Int_t tofLabels[3]={c->GetLabel(0),c->GetLabel(1),c->GetLabel(2)};
1154 Int_t stripOffset = 0;
1160 stripOffset = nStripC;
1163 stripOffset = nStripC+nStripB;
1166 stripOffset = nStripC+nStripB+nStripA;
1169 stripOffset = nStripC+nStripB+nStripA+nStripB;
1172 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
1175 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
1176 Int_t phiindex=npadX*isector+ipadX+1;
1177 fHDigClusMap->Fill(zindex,phiindex);
1178 fHDigClusTime->Fill(time);
1179 fHDigClusToT->Fill(tot);
1181 fNTOFmatched++; // RS: Actually number of clusters
1183 if(fNTOFmatched < 20000){
1184 fHit[fNTOFmatched] = new AliESDTOFHit(AliTOFGeometry::TdcBinWidth()*c->GetTDC(),
1185 AliTOFGeometry::TdcBinWidth()*c->GetTDCRAW(),
1186 AliTOFGeometry::ToTBinWidth()*c->GetToT()*1E-3,
1187 calindex,tofLabels,c->GetL0L1Latency(),
1188 c->GetDeltaBC(),i,c->GetZ(),c->GetR(),c->GetPhi());
1196 //_________________________________________________________________________
1197 void AliTOFtracker::UnloadClusters() {
1198 //--------------------------------------------------------------------
1199 //This function unloads TOF clusters
1200 //--------------------------------------------------------------------
1201 for (Int_t i=0; i<fN; i++) {
1202 //PH delete fClusters[i];
1206 for(Int_t i=0; i< 20000;i++){
1208 delete fClusterESD[i];
1209 fClusterESD[i] = NULL;
1221 //_________________________________________________________________________
1222 Int_t AliTOFtracker::FindClusterIndex(Double_t z) const {
1223 //--------------------------------------------------------------------
1224 // This function returns the index of the nearest cluster
1225 //--------------------------------------------------------------------
1226 if (fN==0) return 0;
1227 if (z <= fClusters[0]->GetZ()) return 0;
1228 if (z > fClusters[fN-1]->GetZ()) return fN;
1229 Int_t b=0, e=fN-1, m=(b+e)/2;
1230 for (; b<e; m=(b+e)/2) {
1231 if (z > fClusters[m]->GetZ()) b=m+1;
1237 //_________________________________________________________________________
1238 Bool_t AliTOFtracker::GetTrackPoint(Int_t index, AliTrackPoint& p) const
1240 // Get track space point with index i
1241 // Coordinates are in the global system
1242 AliTOFcluster *cl = fClusters[index];
1244 xyz[0] = cl->GetR()*TMath::Cos(cl->GetPhi());
1245 xyz[1] = cl->GetR()*TMath::Sin(cl->GetPhi());
1246 xyz[2] = cl->GetZ();
1247 Float_t phiangle = (Int_t(cl->GetPhi()*TMath::RadToDeg()/20.)+0.5)*20.*TMath::DegToRad();
1248 Float_t sinphi = TMath::Sin(phiangle), cosphi = TMath::Cos(phiangle);
1249 Float_t tiltangle = AliTOFGeometry::GetAngles(cl->GetDetInd(1),cl->GetDetInd(2))*TMath::DegToRad();
1250 Float_t sinth = TMath::Sin(tiltangle), costh = TMath::Cos(tiltangle);
1251 Float_t sigmay2 = AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.;
1252 Float_t sigmaz2 = AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.;
1254 cov[0] = sinphi*sinphi*sigmay2 + cosphi*cosphi*sinth*sinth*sigmaz2;
1255 cov[1] = -sinphi*cosphi*sigmay2 + sinphi*cosphi*sinth*sinth*sigmaz2;
1256 cov[2] = -cosphi*sinth*costh*sigmaz2;
1257 cov[3] = cosphi*cosphi*sigmay2 + sinphi*sinphi*sinth*sinth*sigmaz2;
1258 cov[4] = -sinphi*sinth*costh*sigmaz2;
1259 cov[5] = costh*costh*sigmaz2;
1260 p.SetXYZ(xyz[0],xyz[1],xyz[2],cov);
1262 // Detector numbering scheme
1263 Int_t nSector = AliTOFGeometry::NSectors();
1264 Int_t nPlate = AliTOFGeometry::NPlates();
1265 Int_t nStripA = AliTOFGeometry::NStripA();
1266 Int_t nStripB = AliTOFGeometry::NStripB();
1267 Int_t nStripC = AliTOFGeometry::NStripC();
1269 Int_t isector = cl->GetDetInd(0);
1270 if (isector >= nSector)
1271 AliError(Form("Wrong sector number in TOF (%d) !",isector));
1272 Int_t iplate = cl->GetDetInd(1);
1273 if (iplate >= nPlate)
1274 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
1275 Int_t istrip = cl->GetDetInd(2);
1277 Int_t stripOffset = 0;
1283 stripOffset = nStripC;
1286 stripOffset = nStripC+nStripB;
1289 stripOffset = nStripC+nStripB+nStripA;
1292 stripOffset = nStripC+nStripB+nStripA+nStripB;
1295 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
1299 Int_t idet = (2*(nStripC+nStripB)+nStripA)*isector +
1302 UShort_t volid = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF,idet);
1303 p.SetVolumeID((UShort_t)volid);
1306 //_________________________________________________________________________
1307 void AliTOFtracker::InitCheckHists() {
1309 //Init histos for Digits/Reco QA and Calibration
1312 TDirectory *dir = gDirectory;
1313 TFile *logFileTOF = 0;
1315 TSeqCollection *list = gROOT->GetListOfFiles();
1316 int n = list->GetEntries();
1317 Bool_t isThere=kFALSE;
1318 for(int i=0; i<n; i++) {
1319 logFileTOF = (TFile*)list->At(i);
1320 if (strstr(logFileTOF->GetName(), "TOFQA.root")){
1326 if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
1329 fCalTree = new TTree("CalTree", "Tree for TOF calibration");
1330 fCalTree->Branch("TOFchannelindex",&fIch,"iTOFch/I");
1331 fCalTree->Branch("ToT",&fToT,"TOFToT/F");
1332 fCalTree->Branch("TOFtime",&fTime,"TOFtime/F");
1333 fCalTree->Branch("PionExpTime",&fExpTimePi,"PiExpTime/F");
1334 fCalTree->Branch("KaonExpTime",&fExpTimeKa,"KaExpTime/F");
1335 fCalTree->Branch("ProtonExpTime",&fExpTimePr,"PrExpTime/F");
1338 fHDigClusMap = new TH2F("TOFDig_ClusMap", "",182,0.5,182.5,864, 0.5,864.5);
1339 fHDigNClus = new TH1F("TOFDig_NClus", "",200,0.5,200.5);
1340 fHDigClusTime = new TH1F("TOFDig_ClusTime", "",2000,0.,200.);
1341 fHDigClusToT = new TH1F("TOFDig_ClusToT", "",500,0.,100);
1344 fHRecNClus =new TH1F("TOFRec_NClusW", "",50,0.5,50.5);
1345 fHRecDist=new TH1F("TOFRec_Dist", "",50,0.5,10.5);
1346 fHRecSigYVsP=new TH2F("TOFDig_SigYVsP", "",40,0.,4.,100, 0.,5.);
1347 fHRecSigZVsP=new TH2F("TOFDig_SigZVsP", "",40,0.,4.,100, 0.,5.);
1348 fHRecSigYVsPWin=new TH2F("TOFDig_SigYVsPWin", "",40,0.,4.,100, 0.,50.);
1349 fHRecSigZVsPWin=new TH2F("TOFDig_SigZVsPWin", "",40,0.,4.,100, 0.,50.);
1355 //_________________________________________________________________________
1356 void AliTOFtracker::SaveCheckHists() {
1358 //write histos for Digits/Reco QA and Calibration
1360 TDirectory *dir = gDirectory;
1361 TFile *logFileTOF = 0;
1363 TSeqCollection *list = gROOT->GetListOfFiles();
1364 int n = list->GetEntries();
1365 Bool_t isThere=kFALSE;
1366 for(int i=0; i<n; i++) {
1367 logFileTOF = (TFile*)list->At(i);
1368 if (strstr(logFileTOF->GetName(), "TOFQA.root")){
1375 AliError(Form("File TOFQA.root not found!! not wring histograms...."));
1379 fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
1380 fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
1381 fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
1382 fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
1383 fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
1384 fHRecDist->Write(fHRecDist->GetName(), TObject::kOverwrite);
1385 fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
1386 fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
1387 fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
1388 fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
1389 fCalTree->Write(fCalTree->GetName(),TObject::kOverwrite);
1390 logFileTOF->Flush();
1394 //_________________________________________________________________________
1395 Float_t AliTOFtracker::CorrectTimeWalk( Float_t dist, Float_t tof) const {
1397 //dummy, for the moment
1399 if(dist<AliTOFGeometry::ZPad()*0.5){
1401 //place here the actual correction
1407 //_________________________________________________________________________
1409 void AliTOFtracker::FillClusterArray(TObjArray* arr) const
1412 // Returns the TOF cluster array
1418 for (Int_t i=0; i<fN; ++i) arr->Add(fClusters[i]);
1422 //_________________________________________________________________________
1423 AliESDTOFCluster* AliTOFtracker::GetESDTOFCluster(int clID)
1425 // get ESDTOFcluster corresponding to fClusters[clID]. If the original cluster
1426 // was not stored yet in the ESD, first do this
1427 AliTOFcluster *c = fClusters[clID];
1428 AliESDTOFCluster *clESD = 0;
1429 int esdID = c->GetESDID(); // was this cluster already stored in the ESD clusters?
1430 TClonesArray* esdTOFClArr = fESDEv->GetESDTOFClusters();
1431 if (esdID<0) { // cluster was not stored yet, do this
1432 esdID = esdTOFClArr->GetEntriesFast();
1434 // first store the hits of the cluster
1435 TClonesArray* esdTOFHitArr = fESDEv->GetESDTOFHits();
1436 int nh = esdTOFHitArr->GetEntriesFast();
1437 Int_t tofLabels[3]={c->GetLabel(0),c->GetLabel(1),c->GetLabel(2)};
1438 Int_t ind[5] = {c->GetDetInd(0), c->GetDetInd(1), c->GetDetInd(2), c->GetDetInd(3), c->GetDetInd(4) };
1439 Int_t calindex = AliTOFGeometry::GetIndex(ind);
1440 /*AliESDTOFHit* esdHit = */
1441 new ( (*esdTOFHitArr)[nh] )
1442 AliESDTOFHit( AliTOFGeometry::TdcBinWidth()*c->GetTDC(),
1443 AliTOFGeometry::TdcBinWidth()*c->GetTDCRAW(),
1444 AliTOFGeometry::ToTBinWidth()*c->GetToT()*1E-3,
1445 calindex,tofLabels,c->GetL0L1Latency(),
1446 c->GetDeltaBC(),esdID,c->GetZ(),c->GetR(),c->GetPhi());
1448 clESD = new( (*esdTOFClArr)[esdID] ) AliESDTOFCluster( clID );
1449 clESD->SetEvent(fESDEv);
1450 clESD->SetStatus( c->GetStatus() );
1451 clESD->SetESDID(esdID);
1453 // register hits in the cluster
1454 clESD->AddESDTOFHitIndex(nh);
1456 else clESD = (AliESDTOFCluster*)esdTOFClArr->At(esdID); // cluster is aready stored in the ESD