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 <TClonesArray.h>
33 #include <TGeoManager.h>
38 #include "AliAlignObj.h"
39 #include "AliESDtrack.h"
42 #include "AliTrackPointArray.h"
44 #include "AliTOFcalib.h"
45 #include "AliTOFRecoParam.h"
46 #include "AliTOFcluster.h"
47 #include "AliTOFGeometryV5.h"
48 #include "AliTOFtracker.h"
49 #include "AliTOFtrack.h"
51 extern TGeoManager *gGeoManager;
54 ClassImp(AliTOFtracker)
56 //_____________________________________________________________________________
57 AliTOFtracker::AliTOFtracker():
88 //AliTOFtracker main Ctor
90 fRecoParam=new AliTOFRecoParam();
91 if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
92 fGeom=new AliTOFGeometryV5();
94 parPID[0]=fRecoParam->GetTimeResolution();
95 parPID[1]=fRecoParam->GetTimeNSigma();
96 AliDebug(2,Form("TOF PiD pars: %f %f",parPID[0],parPID[1]));
97 fPid=new AliTOFpidESD(parPID);
101 //_____________________________________________________________________________
102 AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):
124 fHRecSigYVsPWin(0x0),
125 fHRecSigZVsPWin(0x0),
134 //AliTOFtracker copy Ctor
138 fNseedsTOF=t.fNseedsTOF;
139 fngoodmatch=t.fngoodmatch;
140 fnbadmatch=t.fnbadmatch;
141 fnunmatch=t.fnunmatch;
143 fRecoParam=t.fRecoParam;
151 //_____________________________________________________________________________
152 AliTOFtracker& AliTOFtracker::operator=(const AliTOFtracker &t)
154 //AliTOFtracker assignment operator
156 this->fNseeds=t.fNseeds;
157 this->fNseedsTOF=t.fNseedsTOF;
158 this->fngoodmatch=t.fngoodmatch;
159 this->fnbadmatch=t.fnbadmatch;
160 this->fnunmatch=t.fnunmatch;
161 this->fnmatch=t.fnmatch;
162 this->fRecoParam = t.fRecoParam;
163 this->fGeom = t.fGeom;
165 this->fSeeds=t.fSeeds;
166 this->fTracks=t.fTracks;
171 //_____________________________________________________________________________
172 AliTOFtracker::~AliTOFtracker() {
184 delete fHDigClusTime;
190 delete fHRecSigYVsPWin;
191 delete fHRecSigZVsPWin;
194 //_____________________________________________________________________________
195 Int_t AliTOFtracker::PropagateBack(AliESD* event) {
197 // Gets seeds from ESD event and Match with TOF Clusters
201 //Initialise some counters
210 Int_t ntrk=event->GetNumberOfTracks();
212 fSeeds= new TClonesArray("AliESDtrack",ntrk);
213 TClonesArray &aESDTrack = *fSeeds;
216 //Load ESD tracks into a local Array of ESD Seeds
218 for (Int_t i=0; i<fNseeds; i++) {
219 AliESDtrack *t=event->GetTrack(i);
220 new(aESDTrack[i]) AliESDtrack(*t);
223 //Prepare ESD tracks candidates for TOF Matching
226 //First Step with Strict Matching Criterion
229 //Second Step with Looser Matching Criterion
232 AliInfo(Form("Number of matched tracks: %d",fnmatch));
233 AliInfo(Form("Number of good matched tracks: %d",fngoodmatch));
234 AliInfo(Form("Number of bad matched tracks: %d",fnbadmatch));
236 //Update the matched ESD tracks
238 for (Int_t i=0; i<ntrk; i++) {
239 AliESDtrack *t=event->GetTrack(i);
240 AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i);
241 if(seed->GetTOFsignal()>0){
242 t->SetTOFsignal(seed->GetTOFsignal());
243 t->SetTOFcluster(seed->GetTOFcluster());
244 t->SetTOFsignalToT(seed->GetTOFsignalToT());
245 t->SetTOFCalChannel(seed->GetTOFCalChannel());
246 Int_t tlab[3]; seed->GetTOFLabel(tlab);
247 t->SetTOFLabel(tlab);
248 AliTOFtrack *track = new AliTOFtrack(*seed);
249 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
254 //Handle Time Zero information
255 Double_t timeZero=0.;
256 Double_t timeZeroMax=99999.;
257 Bool_t usetimeZero = fRecoParam->UseTimeZero();
258 Bool_t timeZeroFromT0 = fRecoParam->GetTimeZerofromT0();
259 Bool_t timeZeroFromTOF = fRecoParam->GetTimeZerofromTOF();
260 AliDebug(2,Form("Use Time Zero?: %d",usetimeZero));
261 AliDebug(2,Form("Time Zero from T0? : %d",timeZeroFromT0));
262 AliDebug(2,Form("Time Zero From TOF? : %d",timeZeroFromTOF));
266 timeZero=GetTimeZerofromT0(event);
268 if(timeZeroFromTOF && (timeZero>timeZeroMax || !timeZeroFromT0)){
269 timeZero=GetTimeZerofromTOF(event);
272 AliDebug(2,Form("time Zero used in PID: %f",timeZero));
274 fPid->MakePID(event,timeZero);
289 //_________________________________________________________________________
290 void AliTOFtracker::CollectESD() {
291 //prepare the set of ESD tracks to be matched to clusters in TOF
293 fTracks= new TClonesArray("AliTOFtrack");
294 TClonesArray &aTOFTrack = *fTracks;
295 for (Int_t i=0; i<fNseeds; i++) {
297 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
298 if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
300 // TRD good tracks, already propagated at 371 cm
302 AliTOFtrack *track = new AliTOFtrack(*t); // New
303 Double_t x = track->GetX(); //New
305 if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) &&
306 ( x >= fGeom->RinTOF()) ){
307 track->SetSeedIndex(i);
308 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
309 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
314 // Propagate the rest of TPCbp
317 if(track->PropagateToInnerTOF()){
318 track->SetSeedIndex(i);
319 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
320 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
327 AliInfo(Form("Number of TOF seedds %i",fNseedsTOF));
329 // Sort according uncertainties on track position
333 //_________________________________________________________________________
334 void AliTOFtracker::MatchTracks( Bool_t mLastStep){
337 // Parameters used/regulating the reconstruction
339 static Float_t corrLen=0.75;
340 static Float_t detDepth=15.3;
342 Float_t dY=fGeom->XPad();
343 Float_t dZ=fGeom->ZPad();
345 Float_t sensRadius = fRecoParam->GetSensRadius();
346 Float_t stepSize = fRecoParam->GetStepSize();
347 Float_t scaleFact = fRecoParam->GetWindowScaleFact();
348 Float_t dyMax=fRecoParam->GetWindowSizeMaxY();
349 Float_t dzMax=fRecoParam->GetWindowSizeMaxZ();
350 Float_t dCut=fRecoParam->GetDistanceCut();
351 Double_t maxChi2=fRecoParam->GetMaxChi2();
353 Bool_t timeWalkCorr = fRecoParam->GetTimeWalkCorr();
355 AliDebug(2,Form("Time Walk Correction? : %d",timeWalkCorr));
357 AliDebug(2,"TOF RecPars pars: \n");
358 AliDebug(2,Form("TOF sens radius: %f",sensRadius));
359 AliDebug(2,Form("TOF step size: %f",stepSize));
360 AliDebug(2,Form("TOF Window scale factor: %f",scaleFact));
361 AliDebug(2,Form("TOF Window max dy: %f",dyMax));
362 AliDebug(2,Form("TOF Window max dz: %f",dzMax));
363 AliDebug(2,Form("TOF distance Cut: %f",dCut));
365 //Match ESD tracks to clusters in TOF
368 // Get the number of propagation steps
370 Int_t nSteps=(Int_t)(detDepth/stepSize);
372 AliTOFcalib *calib = new AliTOFcalib(fGeom);
374 //PH Arrays (moved outside of the loop)
376 Float_t * trackPos[4];
377 for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
379 for (Int_t ii=0;ii<6;ii++) clind[ii] = new Int_t[fN];
381 for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) {
383 AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(iseed);
384 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex());
385 if(t->GetTOFsignal()>0. ) continue;
386 AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
392 Float_t distZ[10000];
393 Float_t cxpos[10000];
394 Float_t crecL[10000];
395 TGeoHMatrix global[1000];
397 // Determine a window around the track
400 trackTOFin->GetExternalParameters(x,par);
402 trackTOFin->GetExternalCovariance(cov);
406 ((5*TMath::Sqrt(cov[0]) + 0.5*dY + 2.5*TMath::Abs(par[2]))/sensRadius);
409 (5*TMath::Sqrt(cov[2]) + 0.5*dZ + 2.5*TMath::Abs(par[3]));
411 Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
412 if (phi<-TMath::Pi())phi+=2*TMath::Pi();
413 if (phi>=TMath::Pi())phi-=2*TMath::Pi();
416 //upper limit on window's size.
418 if(dz> dzMax) dz=dzMax;
419 if(dphi*sensRadius> dyMax) dphi=dyMax/sensRadius;
424 // find the clusters in the window of the track
426 for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
428 AliTOFcluster *c=fClusters[k];
429 if (c->GetZ() > z+dz) break;
430 if (c->IsUsed()) continue;
432 if (!c->GetStatus()) continue; // skip bad channels as declared in OCDB
434 Double_t dph=TMath::Abs(c->GetPhi()-phi);
435 if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
436 if (TMath::Abs(dph)>dphi) continue;
438 Double_t yc=(c->GetPhi() - trackTOFin->GetAlpha())*c->GetR();
439 Double_t p[2]={yc, c->GetZ()};
440 Double_t cov[3]= {dY*dY/12., 0., dZ*dZ/12.};
441 if (trackTOFin->AliExternalTrackParam::GetPredictedChi2(p,cov) > maxChi2)continue;
443 clind[0][nc] = c->GetDetInd(0);
444 clind[1][nc] = c->GetDetInd(1);
445 clind[2][nc] = c->GetDetInd(2);
446 clind[3][nc] = c->GetDetInd(3);
447 clind[4][nc] = c->GetDetInd(4);
456 fGeom->GetVolumePath(ind,path);
457 gGeoManager->cd(path);
458 global[nc] = *gGeoManager->GetCurrentMatrix();
462 //start fine propagation
464 Int_t nStepsDone = 0;
465 for( Int_t istep=0; istep<nSteps; istep++){
467 Float_t xs=fGeom->RinTOF()+istep*0.1;
468 Double_t ymax=xs*TMath::Tan(0.5*fGeom->GetAlpha());
471 Double_t ysect=trackTOFin->GetYat(xs,skip);
474 if (!trackTOFin->Rotate(fGeom->GetAlpha())) {
477 } else if (ysect <-ymax) {
478 if (!trackTOFin->Rotate(fGeom->GetAlpha())) {
483 if(!trackTOFin->PropagateTo(xs)) {
489 // store the running point (Globalrf) - fine propagation
492 trackTOFin->GetXYZ(r);
493 trackPos[0][istep]= (Float_t) r[0];
494 trackPos[1][istep]= (Float_t) r[1];
495 trackPos[2][istep]= (Float_t) r[2];
496 trackPos[3][istep]= trackTOFin->GetIntegratedLength();
501 for (Int_t istep=0; istep<nStepsDone; istep++) {
503 Bool_t isInside =kFALSE;
504 Float_t ctrackPos[3];
506 ctrackPos[0]= trackPos[0][istep];
507 ctrackPos[1]= trackPos[1][istep];
508 ctrackPos[2]= trackPos[2][istep];
510 //now see whether the track matches any of the TOF clusters
512 for (Int_t i=0; i<nc; i++){
514 cind[0]= clind[0][i];
515 cind[1]= clind[1][i];
516 cind[2]= clind[2][i];
517 cind[3]= clind[3][i];
518 cind[4]= clind[4][i];
519 Bool_t accept = kFALSE;
520 if( mLastStep)accept = (fGeom->DistanceToPad(cind,global[i],ctrackPos)<dCut);
521 if(!mLastStep)accept = (fGeom->IsInsideThePad(cind,global[i],ctrackPos));
523 if(!mLastStep)isInside=kTRUE;
525 dist[nfound]=fGeom->DistanceToPad(cind,global[i],ctrackPos,dist3d);
526 distZ[nfound]=dist3d[2];
527 crecL[nfound]=trackPos[3][istep];
528 index[nfound]=clind[5][i]; // store cluster id
529 cxpos[nfound]=fGeom->RinTOF()+istep*0.1; //store prop.radius
533 } //end for on the clusters
537 } //end for on the steps
549 // now choose the cluster to be matched with the track.
554 Float_t mindist=1000.;
556 for (Int_t iclus= 0; iclus<nfound;iclus++){
557 if (dist[iclus]< mindist){
558 mindist = dist[iclus];
559 mindistZ = distZ[iclus];
561 idclus =index[iclus];
562 recL=crecL[iclus]+corrLen*0.5;
566 AliTOFcluster *c=fClusters[idclus];
569 // Track length correction for matching Step 2
572 Float_t rc=TMath::Sqrt(c->GetR()*c->GetR() + c->GetZ()*c->GetZ());
573 Float_t rt=TMath::Sqrt(trackPos[0][70]*trackPos[0][70]
574 +trackPos[1][70]*trackPos[1][70]
575 +trackPos[2][70]*trackPos[2][70]);
577 recL=trackPos[3][70]+dlt;
581 (c->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
583 (c->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel()))
585 (c->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
589 AliDebug(2,Form(" track label good %5i",trackTOFin->GetLabel()));
595 AliDebug(2,Form(" track label bad %5i",trackTOFin->GetLabel()));
601 // Store quantities to be used in the TOF Calibration
602 Float_t tToT=fGeom->TdcBinWidth()*c->GetToT()*1E-3; // in ns
603 t->SetTOFsignalToT(tToT);
605 ind[0]=c->GetDetInd(0);
606 ind[1]=c->GetDetInd(1);
607 ind[2]=c->GetDetInd(2);
608 ind[3]=c->GetDetInd(3);
609 ind[4]=c->GetDetInd(4);
610 Int_t calindex = calib->GetIndex(ind);
611 t->SetTOFCalChannel(calindex);
613 // keep track of the track labels in the matched cluster
615 tlab[0]=c->GetLabel(0);
616 tlab[1]=c->GetLabel(1);
617 tlab[2]=c->GetLabel(2);
619 Double_t tof=fGeom->TdcBinWidth()*c->GetTDC()+32; // in ps
620 AliDebug(2,Form("tof before correction : %f",tof));
621 if(timeWalkCorr)tof=CorrectTimeWalk(mindistZ,tof);
622 AliDebug(2,Form("tof after correction : %f",tof));
623 t->SetTOFsignal(tof);
624 t->SetTOFcluster(idclus); // pointing to the recPoints tree
625 Double_t time[10]; t->GetIntegratedTimes(time);
626 Double_t mom=t->GetP();
627 for(Int_t j=0;j<=AliPID::kSPECIES;j++){
628 Double_t mass=AliPID::ParticleMass(j);
629 time[j]+=(recL-trackPos[3][0])/3e-2*TMath::Sqrt(mom*mom+mass*mass)/mom;
632 AliTOFtrack *trackTOFout = new AliTOFtrack(*t);
633 trackTOFout->PropagateTo(xpos);
634 t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);
635 t->SetIntegratedLength(recL);
636 t->SetIntegratedTimes(time);
637 t->SetTOFLabel(tlab);
638 // Fill Reco-QA histos for Reconstruction
639 fHRecNClus->Fill(nc);
640 fHRecDist->Fill(mindist);
641 fHRecSigYVsP->Fill(mom,TMath::Sqrt(cov[0]));
642 fHRecSigZVsP->Fill(mom,TMath::Sqrt(cov[2]));
643 fHRecSigYVsPWin->Fill(mom,dphi*sensRadius);
644 fHRecSigZVsPWin->Fill(mom,dz);
646 // Fill Tree for on-the-fly offline Calibration
648 if ( !((t->GetStatus() & AliESDtrack::kTIME)==0 )){
649 Float_t rawtime=fGeom->TdcBinWidth()*c->GetTDCRAW()+32; // RAW time,in ps
660 for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
661 for (Int_t ii=0;ii<6;ii++) delete [] clind[ii];
664 //_________________________________________________________________________
665 Int_t AliTOFtracker::LoadClusters(TTree *cTree) {
666 //--------------------------------------------------------------------
667 //This function loads the TOF clusters
668 //--------------------------------------------------------------------
670 Int_t npadX = fGeom->NpadX();
671 Int_t npadZ = fGeom->NpadZ();
672 Int_t nStripA = fGeom->NStripA();
673 Int_t nStripB = fGeom->NStripB();
674 Int_t nStripC = fGeom->NStripC();
676 TBranch *branch=cTree->GetBranch("TOF");
678 AliError("can't get the branch with the TOF clusters !");
682 TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy;
683 branch->SetAddress(&clusters);
686 Int_t nc=clusters->GetEntriesFast();
687 fHDigNClus->Fill(nc);
689 AliInfo(Form("Number of clusters: %d",nc));
691 for (Int_t i=0; i<nc; i++) {
692 AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
693 fClusters[i]=new AliTOFcluster(*c); fN++;
695 // Fill Digits QA histos
697 Int_t isector = c->GetDetInd(0);
698 Int_t iplate = c->GetDetInd(1);
699 Int_t istrip = c->GetDetInd(2);
700 Int_t ipadX = c->GetDetInd(4);
701 Int_t ipadZ = c->GetDetInd(3);
703 Float_t time =(fGeom->TdcBinWidth()*c->GetTDC())*1E-3; // in ns
704 Float_t tot = (fGeom->TdcBinWidth()*c->GetToT())*1E-3;//in ns
706 Int_t stripOffset = 0;
712 stripOffset = nStripC;
715 stripOffset = nStripC+nStripB;
718 stripOffset = nStripC+nStripB+nStripA;
721 stripOffset = nStripC+nStripB+nStripA+nStripB;
724 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
727 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
728 Int_t phiindex=npadX*isector+ipadX+1;
729 fHDigClusMap->Fill(zindex,phiindex);
730 fHDigClusTime->Fill(time);
731 fHDigClusToT->Fill(tot);
738 //_________________________________________________________________________
739 void AliTOFtracker::UnloadClusters() {
740 //--------------------------------------------------------------------
741 //This function unloads TOF clusters
742 //--------------------------------------------------------------------
743 for (Int_t i=0; i<fN; i++) {
750 //_________________________________________________________________________
751 Int_t AliTOFtracker::FindClusterIndex(Double_t z) const {
752 //--------------------------------------------------------------------
753 // This function returns the index of the nearest cluster
754 //--------------------------------------------------------------------
756 if (z <= fClusters[0]->GetZ()) return 0;
757 if (z > fClusters[fN-1]->GetZ()) return fN;
758 Int_t b=0, e=fN-1, m=(b+e)/2;
759 for (; b<e; m=(b+e)/2) {
760 if (z > fClusters[m]->GetZ()) b=m+1;
766 //_________________________________________________________________________
767 Bool_t AliTOFtracker::GetTrackPoint(Int_t index, AliTrackPoint& p) const
769 // Get track space point with index i
770 // Coordinates are in the global system
771 AliTOFcluster *cl = fClusters[index];
773 xyz[0] = cl->GetR()*TMath::Cos(cl->GetPhi());
774 xyz[1] = cl->GetR()*TMath::Sin(cl->GetPhi());
776 Float_t phiangle = (Int_t(cl->GetPhi()*TMath::RadToDeg()/20.)+0.5)*20.*TMath::DegToRad();
777 Float_t sinphi = TMath::Sin(phiangle), cosphi = TMath::Cos(phiangle);
778 Float_t tiltangle = fGeom->GetAngles(cl->GetDetInd(1),cl->GetDetInd(2))*TMath::DegToRad();
779 Float_t sinth = TMath::Sin(tiltangle), costh = TMath::Cos(tiltangle);
780 Float_t sigmay2 = fGeom->XPad()*fGeom->XPad()/12.;
781 Float_t sigmaz2 = fGeom->ZPad()*fGeom->ZPad()/12.;
783 cov[0] = sinphi*sinphi*sigmay2 + cosphi*cosphi*sinth*sinth*sigmaz2;
784 cov[1] = -sinphi*cosphi*sigmay2 + sinphi*cosphi*sinth*sinth*sigmaz2;
785 cov[2] = -cosphi*sinth*costh*sigmaz2;
786 cov[3] = cosphi*cosphi*sigmay2 + sinphi*sinphi*sinth*sinth*sigmaz2;
787 cov[4] = -sinphi*sinth*costh*sigmaz2;
788 cov[5] = costh*costh*sigmaz2;
789 p.SetXYZ(xyz[0],xyz[1],xyz[2],cov);
791 // Detector numbering scheme
792 Int_t nSector = fGeom->NSectors();
793 Int_t nPlate = fGeom->NPlates();
794 Int_t nStripA = fGeom->NStripA();
795 Int_t nStripB = fGeom->NStripB();
796 Int_t nStripC = fGeom->NStripC();
798 Int_t isector = cl->GetDetInd(0);
799 if (isector >= nSector)
800 AliError(Form("Wrong sector number in TOF (%d) !",isector));
801 Int_t iplate = cl->GetDetInd(1);
802 if (iplate >= nPlate)
803 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
804 Int_t istrip = cl->GetDetInd(2);
806 Int_t stripOffset = 0;
812 stripOffset = nStripC;
815 stripOffset = nStripC+nStripB;
818 stripOffset = nStripC+nStripB+nStripA;
821 stripOffset = nStripC+nStripB+nStripA+nStripB;
824 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
828 Int_t idet = (2*(nStripC+nStripB)+nStripA)*isector +
831 UShort_t volid = AliAlignObj::LayerToVolUID(AliAlignObj::kTOF,idet);
832 p.SetVolumeID((UShort_t)volid);
835 //_________________________________________________________________________
836 void AliTOFtracker::InitCheckHists() {
838 //Init histos for Digits/Reco QA and Calibration
841 fCalTree = new TTree("CalTree", "Tree for TOF calibration");
842 fCalTree->Branch("TOFchannelindex",&fIch,"iTOFch/I");
843 fCalTree->Branch("ToT",&fToT,"TOFToT/F");
844 fCalTree->Branch("TOFtime",&fTime,"TOFtime/F");
845 fCalTree->Branch("PionExpTime",&fExpTimePi,"PiExpTime/F");
846 fCalTree->Branch("KaonExpTime",&fExpTimeKa,"KaExpTime/F");
847 fCalTree->Branch("ProtonExpTime",&fExpTimePr,"PrExpTime/F");
850 fHDigClusMap = new TH2F("TOFDig_ClusMap", "",182,0.5,182.5,864, 0.5,864.5);
851 fHDigNClus = new TH1F("TOFDig_NClus", "",200,0.5,200.5);
852 fHDigClusTime = new TH1F("TOFDig_ClusTime", "",2000,0.,200.);
853 fHDigClusToT = new TH1F("TOFDig_ClusToT", "",500,0.,100);
856 fHRecNClus =new TH1F("TOFRec_NClusW", "",50,0.5,50.5);
857 fHRecDist=new TH1F("TOFRec_Dist", "",50,0.5,10.5);
858 fHRecSigYVsP=new TH2F("TOFDig_SigYVsP", "",40,0.,4.,100, 0.,5.);
859 fHRecSigZVsP=new TH2F("TOFDig_SigZVsP", "",40,0.,4.,100, 0.,5.);
860 fHRecSigYVsPWin=new TH2F("TOFDig_SigYVsPWin", "",40,0.,4.,100, 0.,50.);
861 fHRecSigZVsPWin=new TH2F("TOFDig_SigZVsPWin", "",40,0.,4.,100, 0.,50.);
864 //_________________________________________________________________________
865 void AliTOFtracker::SaveCheckHists() {
867 //write histos for Digits/Reco QA and Calibration
869 TDirectory *dir = gDirectory;
871 TFile *logFileTOF = 0;
873 TSeqCollection *list = gROOT->GetListOfFiles();
874 int n = list->GetEntries();
875 for(int i=0; i<n; i++) {
876 logFile = (TFile*)list->At(i);
877 if (strstr(logFile->GetName(), "AliESDs.root")) break;
880 Bool_t isThere=kFALSE;
881 for(int i=0; i<n; i++) {
882 logFileTOF = (TFile*)list->At(i);
883 if (strstr(logFileTOF->GetName(), "TOFQA.root")){
890 fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
891 fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
892 fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
893 fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
894 fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
895 fHRecDist->Write(fHRecDist->GetName(), TObject::kOverwrite);
896 fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
897 fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
898 fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
899 fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
900 fCalTree->Write(fCalTree->GetName(),TObject::kOverwrite);
903 if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
905 fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
906 fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
907 fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
908 fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
909 fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
910 fHRecDist->Write(fHRecDist->GetName(), TObject::kOverwrite);
911 fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
912 fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
913 fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
914 fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
915 fCalTree->Write(fCalTree->GetName(),TObject::kOverwrite);
920 //_________________________________________________________________________
921 Float_t AliTOFtracker::CorrectTimeWalk( Float_t dist, Float_t tof) {
923 //dummy, for the moment
925 if(dist<fGeom->ZPad()*0.5){
927 //place here the actual correction
933 //_________________________________________________________________________
934 Float_t AliTOFtracker::GetTimeZerofromT0(AliESD *event) {
936 //Returns TimeZero as measured by T0 detector
938 return event->GetT0();
940 //_________________________________________________________________________
941 Float_t AliTOFtracker::GetTimeZerofromTOF(AliESD *event) {
943 //dummy, for the moment. T0 algorithm using tracks on TOF
945 //place T0 algo here...