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 "AliTOFcluster.h"
46 #include "AliTOFGeometry.h"
47 #include "AliTOFtracker.h"
48 #include "AliTOFtrack.h"
50 extern TGeoManager *gGeoManager;
52 ClassImp(AliTOFtracker)
54 //_____________________________________________________________________________
55 AliTOFtracker::AliTOFtracker(AliTOFGeometry * geom, Double_t parPID[2]):
57 fTOFpid(new AliTOFpidESD(parPID)),
94 //AliTOFtracker main Ctor
96 fDy=AliTOFGeometry::XPad();
97 fDz=AliTOFGeometry::ZPad();
100 //_____________________________________________________________________________
101 AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):
131 fHRecSigYVsPWin(0x0),
132 fHRecSigZVsPWin(0x0),
141 //AliTOFtracker copy Ctor
145 fNseedsTOF=t.fNseedsTOF;
146 fngoodmatch=t.fngoodmatch;
147 fnbadmatch=t.fnbadmatch;
148 fnunmatch=t.fnunmatch;
153 fTOFHeigth=t.fTOFHeigth;
165 //_____________________________________________________________________________
166 AliTOFtracker& AliTOFtracker::operator=(const AliTOFtracker &t)
168 //AliTOFtracker assignment operator
170 this->fHoles=t.fHoles;
171 this->fNseeds=t.fNseeds;
172 this->fNseedsTOF=t.fNseedsTOF;
173 this->fngoodmatch=t.fngoodmatch;
174 this->fnbadmatch=t.fnbadmatch;
175 this->fnunmatch=t.fnunmatch;
176 this->fnmatch=t.fnmatch;
177 this->fGeom = t.fGeom;
178 this->fTOFpid = t.fTOFpid;
180 this->fTOFHeigth=t.fTOFHeigth;
185 this->fDzMax=t.fDzMax;
186 this->fDyMax=t.fDyMax;
187 this->fSeeds=t.fSeeds;
188 this->fTracks=t.fTracks;
193 //_____________________________________________________________________________
194 AliTOFtracker::~AliTOFtracker() {
202 delete fHDigClusTime;
208 delete fHRecSigYVsPWin;
209 delete fHRecSigZVsPWin;
212 //_____________________________________________________________________________
213 Int_t AliTOFtracker::PropagateBack(AliESD* event) {
215 // Gets seeds from ESD event and Match with TOF Clusters
219 //Initialise some counters
228 Int_t ntrk=event->GetNumberOfTracks();
230 fSeeds= new TClonesArray("AliESDtrack",ntrk);
231 TClonesArray &aESDTrack = *fSeeds;
234 //Load ESD tracks into a local Array of ESD Seeds
236 for (Int_t i=0; i<fNseeds; i++) {
237 AliESDtrack *t=event->GetTrack(i);
238 new(aESDTrack[i]) AliESDtrack(*t);
241 //Prepare ESD tracks candidates for TOF Matching
244 //First Step with Strict Matching Criterion
247 for (Int_t ijk=0; ijk<fN; ijk++) {
248 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)));
252 //Second Step with Looser Matching Criterion
255 AliInfo(Form("Number of matched tracks: %d",fnmatch));
256 AliInfo(Form("Number of good matched tracks: %d",fngoodmatch));
257 AliInfo(Form("Number of bad matched tracks: %d",fnbadmatch));
259 //Update the matched ESD tracks
261 for (Int_t i=0; i<ntrk; i++) {
262 AliESDtrack *t=event->GetTrack(i);
263 AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i);
264 if(seed->GetTOFsignal()>0){
265 t->SetTOFsignal(seed->GetTOFsignal());
266 t->SetTOFcluster(seed->GetTOFcluster());
267 t->SetTOFsignalToT(seed->GetTOFsignalToT());
268 t->SetTOFCalChannel(seed->GetTOFCalChannel());
269 Int_t tlab[3]; seed->GetTOFLabel(tlab);
270 t->SetTOFLabel(tlab);
271 AliTOFtrack *track = new AliTOFtrack(*seed);
272 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
279 fTOFpid->MakePID(event);
294 //_________________________________________________________________________
295 void AliTOFtracker::CollectESD() {
296 //prepare the set of ESD tracks to be matched to clusters in TOF
298 fTracks= new TClonesArray("AliTOFtrack");
299 TClonesArray &aTOFTrack = *fTracks;
300 for (Int_t i=0; i<fNseeds; i++) {
302 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
303 if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
305 // TRD good tracks, already propagated at 371 cm
307 AliTOFtrack *track = new AliTOFtrack(*t); // New
308 Double_t x = track->GetX(); //New
310 if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) &&
311 ( x >= fGeom->RinTOF()) ){
312 track->SetSeedIndex(i);
313 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
314 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
319 // Propagate the rest of TPCbp
322 if(track->PropagateToInnerTOF(fHoles)){ // temporary solution
323 // if(track->PropagateToInnerTOF(fGeom->GetHoles())){
324 track->SetSeedIndex(i);
325 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
326 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
333 AliInfo(Form("Number of TOF seedds %i",fNseedsTOF));
335 // Sort according uncertainties on track position
339 //_________________________________________________________________________
340 void AliTOFtracker::MatchTracks( Bool_t mLastStep){
342 //Match ESD tracks to clusters in TOF
345 Int_t nSteps=(Int_t)(fTOFHeigth/0.1);
347 AliTOFcalib *calib = new AliTOFcalib(fGeom);
348 //PH Arrays (moved outside of the loop)
349 Float_t * trackPos[4];
350 for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
352 for (Int_t ii=0;ii<6;ii++) clind[ii] = new Int_t[fN];
354 for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) {
356 AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(iseed);
357 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex());
358 if(t->GetTOFsignal()>0. ) continue;
359 AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
365 Float_t cxpos[10000];
366 Float_t crecL[10000];
367 TGeoHMatrix global[1000];
369 // Determine a window around the track
372 trackTOFin->GetExternalParameters(x,par);
374 trackTOFin->GetExternalCovariance(cov);
376 Float_t scalefact=3.;
379 ((5*TMath::Sqrt(cov[0]) + 0.5*fDy + 2.5*TMath::Abs(par[2]))/fR);
382 (5*TMath::Sqrt(cov[2]) + 0.5*fDz + 2.5*TMath::Abs(par[3]));
384 Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
385 if (phi<-TMath::Pi())phi+=2*TMath::Pi();
386 if (phi>=TMath::Pi())phi-=2*TMath::Pi();
389 //upper limit on window's size.
391 if(dz> fDzMax) dz=fDzMax;
392 if(dphi*fR>fDyMax) dphi=fDyMax/fR;
397 // find the clusters in the window of the track
399 for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
401 AliTOFcluster *c=fClusters[k];
402 if (c->GetZ() > z+dz) break;
403 if (c->IsUsed()) continue;
405 if (!c->GetStatus()) continue; // skip bad channels as declared in OCDB
407 //AliInfo(Form(" fClusters[k]->GetZ() (%f) z-dz (%f) %4i ", fClusters[k]->GetZ(), z-dz, k));
409 Double_t dph=TMath::Abs(c->GetPhi()-phi);
410 if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
411 if (TMath::Abs(dph)>dphi) continue;
414 //Double_t maxChi2=150.; // "calibration constant". Needs to be tuned.
415 Double_t yc=(c->GetPhi() - trackTOFin->GetAlpha())*c->GetR();
416 Double_t p[2]={yc, c->GetZ()};
417 Double_t cov[3]={fDy*fDy/12., 0., fDz*fDz/12.};
418 if (trackTOFin->AliExternalTrackParam::GetPredictedChi2(p,cov) > 150.)
422 clind[0][nc] = c->GetDetInd(0);
423 clind[1][nc] = c->GetDetInd(1);
424 clind[2][nc] = c->GetDetInd(2);
425 clind[3][nc] = c->GetDetInd(3);
426 clind[4][nc] = c->GetDetInd(4);
435 fGeom->GetVolumePath(ind,path);
436 gGeoManager->cd(path);
437 global[nc] = *gGeoManager->GetCurrentMatrix();
441 //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));
443 //start fine propagation
445 Int_t nStepsDone = 0;
446 for( Int_t istep=0; istep<nSteps; istep++){
448 Float_t xs=fGeom->RinTOF()+istep*0.1;
449 Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
452 Double_t ysect=trackTOFin->GetYat(xs,skip);
455 if (!trackTOFin->Rotate(AliTOFGeometry::GetAlpha())) {
458 } else if (ysect <-ymax) {
459 if (!trackTOFin->Rotate(-AliTOFGeometry::GetAlpha())) {
464 if(!trackTOFin->PropagateTo(xs)) {
470 // store the running point (Globalrf) - fine propagation
473 trackTOFin->GetXYZ(r);
474 trackPos[0][istep]= (Float_t) r[0];
475 trackPos[1][istep]= (Float_t) r[1];
476 trackPos[2][istep]= (Float_t) r[2];
477 trackPos[3][istep]= trackTOFin->GetIntegratedLength();
482 for (Int_t istep=0; istep<nStepsDone; istep++) {
484 Bool_t isInside =kFALSE;
485 Float_t ctrackPos[3];
487 ctrackPos[0]= trackPos[0][istep];
488 ctrackPos[1]= trackPos[1][istep];
489 ctrackPos[2]= trackPos[2][istep];
491 //now see whether the track matches any of the TOF clusters
493 for (Int_t i=0; i<nc; i++){
495 cind[0]= clind[0][i];
496 cind[1]= clind[1][i];
497 cind[2]= clind[2][i];
498 cind[3]= clind[3][i];
499 cind[4]= clind[4][i];
500 Bool_t accept = kFALSE;
501 if( mLastStep)accept = (fGeom->DistanceToPad(cind,global[i],ctrackPos)<fdCut);
502 if(!mLastStep)accept = (fGeom->IsInsideThePad(cind,global[i],ctrackPos));
504 if(!mLastStep)isInside=kTRUE;
505 dist[nfound]=fGeom->DistanceToPad(cind,global[i],ctrackPos);
506 crecL[nfound]=trackPos[3][istep];
507 index[nfound]=clind[5][i]; // store cluster id
508 cxpos[nfound]=fGeom->RinTOF()+istep*0.1; //store prop.radius
512 } //end for on the clusters
516 } //end for on the steps
528 // now choose the cluster to be matched with the track.
533 Float_t mindist=1000.;
534 for (Int_t iclus= 0; iclus<nfound;iclus++){
535 if (dist[iclus]< mindist){
536 mindist = dist[iclus];
538 idclus =index[iclus];
539 recL=crecL[iclus]+fDx*0.5;
543 AliTOFcluster *c=fClusters[idclus];
544 c->Use(); //AliInfo(Form("I am using the cluster"));
546 // Track length correction for matching Step 2
549 Float_t rc=TMath::Sqrt(c->GetR()*c->GetR() + c->GetZ()*c->GetZ());
550 Float_t rt=TMath::Sqrt(trackPos[0][70]*trackPos[0][70]
551 +trackPos[1][70]*trackPos[1][70]
552 +trackPos[2][70]*trackPos[2][70]);
554 recL=trackPos[3][70]+dlt;
558 (c->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
560 (c->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel()))
562 (c->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
566 //AliInfo(Form(" track label good %5i",trackTOFin->GetLabel()));
572 //AliInfo(Form(" track label bad %5i",trackTOFin->GetLabel()));
578 // Store quantities to be used in the TOF Calibration
579 Float_t tToT=AliTOFGeometry::TdcBinWidth()*c->GetToT()*1E-3; // in ns
580 t->SetTOFsignalToT(tToT);
582 ind[0]=c->GetDetInd(0);
583 ind[1]=c->GetDetInd(1);
584 ind[2]=c->GetDetInd(2);
585 ind[3]=c->GetDetInd(3);
586 ind[4]=c->GetDetInd(4);
587 Int_t calindex = calib->GetIndex(ind);
588 t->SetTOFCalChannel(calindex);
590 // keep track of the track labels in the matched cluster
592 tlab[0]=c->GetLabel(0);
593 tlab[1]=c->GetLabel(1);
594 tlab[2]=c->GetLabel(2);
596 Double_t tof=AliTOFGeometry::TdcBinWidth()*c->GetTDC()+32; // in ps
597 t->SetTOFsignal(tof);
598 //t->SetTOFcluster(c->GetIndex()); // pointing to the digits tree
599 t->SetTOFcluster(idclus); // pointing to the recPoints tree
600 Double_t time[10]; t->GetIntegratedTimes(time);
601 Double_t mom=t->GetP();
602 for(Int_t j=0;j<=AliPID::kSPECIES;j++){
603 Double_t mass=AliPID::ParticleMass(j);
604 time[j]+=(recL-trackPos[3][0])/3e-2*TMath::Sqrt(mom*mom+mass*mass)/mom;
607 AliTOFtrack *trackTOFout = new AliTOFtrack(*t);
608 trackTOFout->PropagateTo(xpos);
609 t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);
610 t->SetIntegratedLength(recL);
611 t->SetIntegratedTimes(time);
612 t->SetTOFLabel(tlab);
613 // Fill Reco-QA histos for Reconstruction
614 fHRecNClus->Fill(nc);
615 fHRecDist->Fill(mindist);
616 fHRecSigYVsP->Fill(mom,TMath::Sqrt(cov[0]));
617 fHRecSigZVsP->Fill(mom,TMath::Sqrt(cov[2]));
618 fHRecSigYVsPWin->Fill(mom,dphi*fR);
619 fHRecSigZVsPWin->Fill(mom,dz);
621 // Fill Tree for on-the-fly offline Calibration
623 if ( !((t->GetStatus() & AliESDtrack::kTIME)==0 )){
624 Float_t rawtime=AliTOFGeometry::TdcBinWidth()*c->GetTDCRAW()+32; // RAW time,in ps
635 for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
636 for (Int_t ii=0;ii<6;ii++) delete [] clind[ii];
639 //_________________________________________________________________________
640 Int_t AliTOFtracker::LoadClusters(TTree *cTree) {
641 //--------------------------------------------------------------------
642 //This function loads the TOF clusters
643 //--------------------------------------------------------------------
645 Int_t npadX = fGeom->NpadX();
646 Int_t npadZ = fGeom->NpadZ();
647 Int_t nStripA = fGeom->NStripA();
648 Int_t nStripB = fGeom->NStripB();
649 Int_t nStripC = fGeom->NStripC();
651 TBranch *branch=cTree->GetBranch("TOF");
653 AliError("can't get the branch with the TOF clusters !");
657 TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy;
658 branch->SetAddress(&clusters);
661 Int_t nc=clusters->GetEntriesFast();
662 fHDigNClus->Fill(nc);
664 AliInfo(Form("Number of clusters: %d",nc));
666 for (Int_t i=0; i<nc; i++) {
667 AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
668 fClusters[i]=new AliTOFcluster(*c); fN++;
670 // Fill Digits QA histos
672 Int_t isector = c->GetDetInd(0);
673 Int_t iplate = c->GetDetInd(1);
674 Int_t istrip = c->GetDetInd(2);
675 Int_t ipadX = c->GetDetInd(4);
676 Int_t ipadZ = c->GetDetInd(3);
678 Float_t time = (AliTOFGeometry::TdcBinWidth()*c->GetTDC())*1E-3; // in ns
679 Float_t tot = (AliTOFGeometry::TdcBinWidth()*c->GetToT())*1E-3;//in ns
681 Int_t stripOffset = 0;
687 stripOffset = nStripC;
690 stripOffset = nStripC+nStripB;
693 stripOffset = nStripC+nStripB+nStripA;
696 stripOffset = nStripC+nStripB+nStripA+nStripB;
699 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
702 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
703 Int_t phiindex=npadX*isector+ipadX+1;
704 fHDigClusMap->Fill(zindex,phiindex);
705 fHDigClusTime->Fill(time);
706 fHDigClusToT->Fill(tot);
708 //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)));
709 //AliInfo(Form("%i %f",i, fClusters[i]->GetZ()));
712 //AliInfo(Form("Number of clusters: %d",fN));
716 //_________________________________________________________________________
717 void AliTOFtracker::UnloadClusters() {
718 //--------------------------------------------------------------------
719 //This function unloads TOF clusters
720 //--------------------------------------------------------------------
721 for (Int_t i=0; i<fN; i++) {
728 //_________________________________________________________________________
729 Int_t AliTOFtracker::FindClusterIndex(Double_t z) const {
730 //--------------------------------------------------------------------
731 // This function returns the index of the nearest cluster
732 //--------------------------------------------------------------------
734 if (z <= fClusters[0]->GetZ()) return 0;
735 if (z > fClusters[fN-1]->GetZ()) return fN;
736 Int_t b=0, e=fN-1, m=(b+e)/2;
737 for (; b<e; m=(b+e)/2) {
738 if (z > fClusters[m]->GetZ()) b=m+1;
744 //_________________________________________________________________________
745 Bool_t AliTOFtracker::GetTrackPoint(Int_t index, AliTrackPoint& p) const
747 // Get track space point with index i
748 // Coordinates are in the global system
749 AliTOFcluster *cl = fClusters[index];
751 xyz[0] = cl->GetR()*TMath::Cos(cl->GetPhi());
752 xyz[1] = cl->GetR()*TMath::Sin(cl->GetPhi());
754 Float_t phiangle = (Int_t(cl->GetPhi()*TMath::RadToDeg()/20.)+0.5)*20.*TMath::DegToRad();
755 Float_t sinphi = TMath::Sin(phiangle), cosphi = TMath::Cos(phiangle);
756 Float_t tiltangle = fGeom->GetAngles(cl->GetDetInd(1),cl->GetDetInd(2))*TMath::DegToRad();
757 Float_t sinth = TMath::Sin(tiltangle), costh = TMath::Cos(tiltangle);
758 Float_t sigmay2 = fGeom->XPad()*fGeom->XPad()/12.;
759 Float_t sigmaz2 = fGeom->ZPad()*fGeom->ZPad()/12.;
761 cov[0] = sinphi*sinphi*sigmay2 + cosphi*cosphi*sinth*sinth*sigmaz2;
762 cov[1] = -sinphi*cosphi*sigmay2 + sinphi*cosphi*sinth*sinth*sigmaz2;
763 cov[2] = -cosphi*sinth*costh*sigmaz2;
764 cov[3] = cosphi*cosphi*sigmay2 + sinphi*sinphi*sinth*sinth*sigmaz2;
765 cov[4] = -sinphi*sinth*costh*sigmaz2;
766 cov[5] = costh*costh*sigmaz2;
767 p.SetXYZ(xyz[0],xyz[1],xyz[2],cov);
769 // Detector numbering scheme
770 Int_t nSector = fGeom->NSectors();
771 Int_t nPlate = fGeom->NPlates();
772 Int_t nStripA = fGeom->NStripA();
773 Int_t nStripB = fGeom->NStripB();
774 Int_t nStripC = fGeom->NStripC();
776 Int_t isector = cl->GetDetInd(0);
777 if (isector >= nSector)
778 AliError(Form("Wrong sector number in TOF (%d) !",isector));
779 Int_t iplate = cl->GetDetInd(1);
780 if (iplate >= nPlate)
781 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
782 Int_t istrip = cl->GetDetInd(2);
784 Int_t stripOffset = 0;
790 stripOffset = nStripC;
793 stripOffset = nStripC+nStripB;
796 stripOffset = nStripC+nStripB+nStripA;
799 stripOffset = nStripC+nStripB+nStripA+nStripB;
802 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
806 Int_t idet = (2*(nStripC+nStripB)+nStripA)*isector +
809 UShort_t volid = AliAlignObj::LayerToVolUID(AliAlignObj::kTOF,idet);
810 p.SetVolumeID((UShort_t)volid);
813 //_________________________________________________________________________
814 void AliTOFtracker::InitCheckHists() {
816 //Init histos for Digits/Reco QA and Calibration
819 fCalTree = new TTree("CalTree", "Tree for TOF calibration");
820 fCalTree->Branch("TOFchannelindex",&fIch,"iTOFch/I");
821 fCalTree->Branch("ToT",&fToT,"TOFToT/F");
822 fCalTree->Branch("TOFtime",&fTime,"TOFtime/F");
823 fCalTree->Branch("PionExpTime",&fExpTimePi,"PiExpTime/F");
824 fCalTree->Branch("KaonExpTime",&fExpTimeKa,"KaExpTime/F");
825 fCalTree->Branch("ProtonExpTime",&fExpTimePr,"PrExpTime/F");
828 fHDigClusMap = new TH2F("TOFDig_ClusMap", "",182,0.5,182.5,864, 0.5,864.5);
829 fHDigNClus = new TH1F("TOFDig_NClus", "",200,0.5,200.5);
830 fHDigClusTime = new TH1F("TOFDig_ClusTime", "",2000,0.,200.);
831 fHDigClusToT = new TH1F("TOFDig_ClusToT", "",500,0.,100);
834 fHRecNClus =new TH1F("TOFRec_NClusW", "",50,0.5,50.5);
835 fHRecDist=new TH1F("TOFRec_Dist", "",50,0.5,10.5);
836 fHRecSigYVsP=new TH2F("TOFDig_SigYVsP", "",40,0.,4.,100, 0.,5.);
837 fHRecSigZVsP=new TH2F("TOFDig_SigZVsP", "",40,0.,4.,100, 0.,5.);
838 fHRecSigYVsPWin=new TH2F("TOFDig_SigYVsPWin", "",40,0.,4.,100, 0.,50.);
839 fHRecSigZVsPWin=new TH2F("TOFDig_SigZVsPWin", "",40,0.,4.,100, 0.,50.);
842 //_________________________________________________________________________
843 void AliTOFtracker::SaveCheckHists() {
845 //write histos for Digits/Reco QA and Calibration
847 TDirectory *dir = gDirectory;
849 TFile *logFileTOF = 0;
851 TSeqCollection *list = gROOT->GetListOfFiles();
852 int N = list->GetEntries();
853 for(int i=0; i<N; i++) {
854 logFile = (TFile*)list->At(i);
855 if (strstr(logFile->GetName(), "AliESDs.root")) break;
858 Bool_t isThere=kFALSE;
859 for(int i=0; i<N; i++) {
860 logFileTOF = (TFile*)list->At(i);
861 if (strstr(logFileTOF->GetName(), "TOFQA.root")){
868 fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
869 fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
870 fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
871 fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
872 fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
873 fHRecDist->Write(fHRecDist->GetName(), TObject::kOverwrite);
874 fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
875 fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
876 fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
877 fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
878 fCalTree->Write(fCalTree->GetName(),TObject::kOverwrite);
881 if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
883 fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
884 fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
885 fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
886 fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
887 fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
888 fHRecDist->Write(fHRecDist->GetName(), TObject::kOverwrite);
889 fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
890 fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
891 fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
892 fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
893 fCalTree->Write(fCalTree->GetName(),TObject::kOverwrite);