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 // AliTOFtrackerV1 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>
37 #include <TSeqCollection.h>
39 #include "AliESDtrack.h"
40 #include "AliESDEvent.h"
42 #include "AliTrackPointArray.h"
43 #include "AliGeomManager.h"
44 #include "AliCDBManager.h"
46 #include "AliTOFRecoParam.h"
47 #include "AliTOFReconstructor.h"
48 #include "AliTOFcluster.h"
49 #include "AliTOFGeometry.h"
50 #include "AliTOFtrackerV1.h"
51 #include "AliTOFtrack.h"
52 #include "AliTOFpidESD.h"
56 ClassImp(AliTOFtrackerV1)
58 //_____________________________________________________________________________
59 AliTOFtrackerV1::AliTOFtrackerV1():
69 fTracks(new TClonesArray("AliTOFtrack")),
70 fSeeds(new TClonesArray("AliESDtrack")),
83 //AliTOFtrackerV1 main Ctor
88 //_____________________________________________________________________________
89 AliTOFtrackerV1::~AliTOFtrackerV1() {
96 if(!(AliCDBManager::Instance()->GetCacheFlag())){
102 delete fHDigClusTime;
109 delete fHRecSigYVsPWin;
110 delete fHRecSigZVsPWin;
122 //_____________________________________________________________________________
123 Int_t AliTOFtrackerV1::PropagateBack(AliESDEvent* event) {
125 // Gets seeds from ESD event and Match with TOF Clusters
128 // initialize RecoParam for current event
130 AliInfo("Initializing params for TOF... ");
132 fRecoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER...
134 if (fRecoParam == 0x0) {
135 AliFatal("No Reco Param found for TOF!!!");
137 //fRecoParam->Dump();
138 //if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
139 //fRecoParam->PrintParameters();
142 parPID[0]=fRecoParam->GetTimeResolution();
143 parPID[1]=fRecoParam->GetTimeNSigma();
144 fPid=new AliTOFpidESD(parPID);
146 //Initialise some counters
155 Int_t ntrk=event->GetNumberOfTracks();
157 TClonesArray &aESDTrack = *fSeeds;
160 //Load ESD tracks into a local Array of ESD Seeds
162 for (Int_t i=0; i<fNseeds; i++) {
163 AliESDtrack *t=event->GetTrack(i);
164 new(aESDTrack[i]) AliESDtrack(*t);
167 //Prepare ESD tracks candidates for TOF Matching
173 AliInfo(Form("Number of matched tracks: %d",fnmatch));
174 AliInfo(Form("Number of good matched tracks: %d",fngoodmatch));
175 AliInfo(Form("Number of bad matched tracks: %d",fnbadmatch));
177 //Update the matched ESD tracks
179 for (Int_t i=0; i<ntrk; i++) {
180 AliESDtrack *t=event->GetTrack(i);
181 AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i);
183 if ( (seed->GetStatus()&AliESDtrack::kTOFin)!=0 ) {
184 t->SetStatus(AliESDtrack::kTOFin);
185 //if(seed->GetTOFsignal()>0){
186 if ( (seed->GetStatus()&AliESDtrack::kTOFout)!=0 ) {
187 t->SetStatus(AliESDtrack::kTOFout);
188 t->SetTOFsignal(seed->GetTOFsignal());
189 t->SetTOFcluster(seed->GetTOFcluster());
190 t->SetTOFsignalToT(seed->GetTOFsignalToT());
191 t->SetTOFsignalRaw(seed->GetTOFsignalRaw());
192 t->SetTOFsignalDz(seed->GetTOFsignalDz());
193 t->SetTOFCalChannel(seed->GetTOFCalChannel());
194 Int_t tlab[3]; seed->GetTOFLabel(tlab);
195 t->SetTOFLabel(tlab);
196 AliTOFtrack *track = new AliTOFtrack(*seed);
197 t->UpdateTrackParams(track,AliESDtrack::kTOFout); // to be checked - AdC
200 Double_t time[10]; t->GetIntegratedTimes(time);
201 AliDebug(2,Form(" %6d %f %f %f %f %6d %3d %f %f %f %f %f %f",
203 t->GetTOFsignalRaw(),
205 t->GetTOFsignalToT(),
207 t->GetTOFCalChannel(),
209 t->GetIntegratedLength(),
210 time[0], time[1], time[2], time[3], time[4]
217 //Handle Time Zero information
219 Double_t timeZero=0.;
220 Double_t timeZeroMax=99999.;
221 Bool_t usetimeZero = fRecoParam->UseTimeZero();
222 Bool_t timeZeroFromT0 = fRecoParam->GetTimeZerofromT0();
223 Bool_t timeZeroFromTOF = fRecoParam->GetTimeZerofromTOF();
225 AliDebug(2,Form("Use Time Zero?: %d",usetimeZero));
226 AliDebug(2,Form("Time Zero from T0? : %d",timeZeroFromT0));
227 AliDebug(2,Form("Time Zero From TOF? : %d",timeZeroFromTOF));
231 timeZero=GetTimeZerofromT0(event);
233 if(timeZeroFromTOF && (timeZero>timeZeroMax || !timeZeroFromT0)){
234 timeZero=GetTimeZerofromTOF(event);
237 AliDebug(2,Form("time Zero used in PID: %f",timeZero));
239 fPid->MakePID(event,timeZero);
246 //_________________________________________________________________________
247 void AliTOFtrackerV1::CollectESD() {
248 //prepare the set of ESD tracks to be matched to clusters in TOF
253 TClonesArray &aTOFTrack = *fTracks;
254 for (Int_t i=0; i<fNseeds; i++) {
256 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
257 if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
259 AliTOFtrack *track = new AliTOFtrack(*t); // New
260 Float_t x = (Float_t)track->GetX(); //New
262 // TRD 'good' tracks, already propagated at 371 cm
263 if ( ( (t->GetStatus()&AliESDtrack::kTRDout)!=0 ) &&
264 ( x >= AliTOFGeometry::Rmin() ) ) {
265 if ( track->PropagateToInnerTOF() ) {
267 AliDebug(1,Form(" TRD propagated track till rho = %fcm."
268 " And then the track has been propagated till rho = %fcm.",
269 x, (Float_t)track->GetX()));
271 track->SetSeedIndex(i);
272 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
273 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
280 // Propagate the rest of TPCbp
282 if ( track->PropagateToInnerTOF() ) {
284 AliDebug(1,Form(" TRD propagated track till rho = %fcm."
285 " And then the track has been propagated till rho = %fcm.",
286 x, (Float_t)track->GetX()));
288 track->SetSeedIndex(i);
289 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
290 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
298 AliInfo(Form("Number of TOF seeds %d",fNseedsTOF));
299 AliInfo(Form("Number of TOF seeds Type 1 %d",seedsTOF1));
300 AliInfo(Form("Number of TOF seeds Type 2 %d",seedsTOF2));
302 // Sort according uncertainties on track position
306 //_________________________________________________________________________
307 void AliTOFtrackerV1::MatchTracks( ){
309 //Match ESD tracks to clusters in TOF
313 // Parameters regulating the reconstruction
314 Float_t dY=AliTOFGeometry::XPad();
315 Float_t dZ=AliTOFGeometry::ZPad();
317 const Float_t kTimeOffset = 32.; // time offset for tracking algorithm [ps]
319 const Int_t kncmax = 100;
320 Float_t sensRadius = fRecoParam->GetSensRadius();
321 Float_t scaleFact = fRecoParam->GetWindowScaleFact();
322 Float_t dyMax=fRecoParam->GetWindowSizeMaxY();
323 Float_t dzMax=fRecoParam->GetWindowSizeMaxZ();
324 Double_t maxChi2=fRecoParam->GetMaxChi2();
325 Bool_t timeWalkCorr = fRecoParam->GetTimeWalkCorr();
326 AliDebug(1,"++++++++++++++TOF Reconstruction Parameters:++++++++++++ \n");
327 AliDebug(1,Form("TOF sens radius: %f",sensRadius));
328 AliDebug(1,Form("TOF Window scale factor: %f",scaleFact));
329 AliDebug(1,Form("TOF Window max dy: %f",dyMax));
330 AliDebug(1,Form("TOF Window max dz: %f",dzMax));
331 AliDebug(1,Form("TOF Max Chi2: %f",maxChi2));
332 AliDebug(1,Form("Time Walk Correction? : %d",timeWalkCorr));
336 for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) {
338 AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(iseed);
339 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex());
340 //if ( t->GetTOFsignal()>0. ) continue;
341 if ( (t->GetStatus()&AliESDtrack::kTOFout)!=0 ) continue;
342 AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
344 // Determine a window around the track
345 Double_t x,par[5]; trackTOFin->GetExternalParameters(x,par);
346 Double_t cov[15]; trackTOFin->GetExternalCovariance(cov);
348 if (cov[0]<0. || cov[2]<0.) {
349 AliWarning(Form("Very strange track (%d)! At least one of its covariance matrix diagonal elements is negative!",iseed));
355 Double_t dz = scaleFact*3.*TMath::Sqrt(cov[2]+dZ*dZ/12.);
356 Double_t dphi = scaleFact*3.*TMath::Sqrt(cov[0]+dY*dY/12.)/sensRadius;
358 Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
359 if (phi<-TMath::Pi())phi+=2*TMath::Pi();
360 if (phi>=TMath::Pi())phi-=2*TMath::Pi();
362 //upper limit on window's size.
363 if(dz> dzMax) dz=dzMax;
364 if(dphi*sensRadius> dyMax) dphi=dyMax/sensRadius;
366 // find the clusters inside the selected window
368 AliTOFcluster *clusters[kncmax]; // pointers to the clusters in the window
369 Int_t index[kncmax];//to keep track of the cluster index
370 for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
371 AliTOFcluster *c=fClusters[k];
372 // if(nc>kncmax)break; /* R+ fix (buffer overflow) */
374 AliWarning("No more matchable clusters can be stored! Please, increase the corresponding vectors size.");
375 break; /* R+ fix (buffer overflow protection) */
377 if(c->GetZ() > z+dz) break;
378 if(c->IsUsed()) continue;
379 if(!c->GetStatus()) {
380 AliDebug(1,"Cluster in channel declared bad!");
381 continue; // skip bad channels as declared in OCDB
383 Float_t xyz[3]; c->GetGlobalXYZ(xyz);
384 Double_t clPhi=TMath::ATan2(xyz[1],xyz[0]);
385 Double_t dph=TMath::Abs(clPhi-phi);
386 if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
387 if (TMath::Abs(dph)>dphi) continue;
393 AliDebug(1,Form(" Number of matchable TOF clusters for the track number %d: %d",iseed,nc));
395 //start propagation: go to the average TOF pad middle plane at ~379.5 cm
397 Float_t xTOF = sensRadius;
398 Double_t ymax = xTOF*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
399 Bool_t skip = kFALSE;
400 Double_t ysect = trackTOFin->GetYat(xTOF,skip);
403 if (!trackTOFin->Rotate(AliTOFGeometry::GetAlpha())) {
406 } else if (ysect <-ymax) {
407 if (!trackTOFin->Rotate(-AliTOFGeometry::GetAlpha())) {
411 if(!trackTOFin->PropagateTo(xTOF)) {
416 AliTOFcluster *bestCluster=0;
417 Double_t bestChi2=maxChi2;
419 // for (Int_t i=0; i<nc; i++){ /* R+ fix (unsafe) */
420 for (Int_t i=0; i<nc && i<kncmax; i++){ /* R+ fix (buffer overflow protection) */
421 AliTOFcluster *c=clusters[i]; // one of the preselected clusters
422 Double_t chi2=trackTOFin->GetPredictedChi2((AliCluster3D*)c);
423 if (chi2 >= bestChi2) continue;
429 if (!bestCluster) { // no matching , go to the next track
437 AliDebug(2, Form("%7i %7i %10i %10i %10i %10i %7i",
440 TMath::Abs(trackTOFin->GetLabel()),
441 bestCluster->GetLabel(0),
442 bestCluster->GetLabel(1),
443 bestCluster->GetLabel(2),
448 (bestCluster->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
450 (bestCluster->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel()))
452 (bestCluster->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
455 AliDebug(2,Form(" track label good %5d",trackTOFin->GetLabel()));
460 AliDebug(2,Form(" track label bad %5d",trackTOFin->GetLabel()));
463 //Propagate the track to the best matched cluster
464 trackTOFin->PropagateTo(bestCluster);
466 // Fill the track residual histograms.
467 FillResiduals(trackTOFin,bestCluster,kFALSE);
469 //now take the local distance in Z from the pad center for time walk correction
470 Float_t tiltangle = AliTOFGeometry::GetAngles(bestCluster->GetDetInd(1),bestCluster->GetDetInd(2))*TMath::DegToRad();
471 Double_t dzTW=trackTOFin->GetZ()-bestCluster->GetZ(); // in cm - in the ALICE RF -
472 dzTW/=TMath::Cos(tiltangle); // from ALICE/tracking RF to pad RF (1)
473 dzTW=-dzTW; // from ALICE/tracking RF to pad RF (2)
474 if (tiltangle!=0.) AliDebug(2,Form(" rho_track = %f --- rho_cluster = %f ",trackTOFin->GetX(),bestCluster->GetX()));
476 //update the ESD track and delete the TOFtrack
477 t->UpdateTrackParams(trackTOFin,AliESDtrack::kTOFout);
479 // Store quantities to be used in the TOF Calibration
480 Float_t tToT=AliTOFGeometry::ToTBinWidth()*bestCluster->GetToT()*1E-3; // in ns
481 t->SetTOFsignalToT(tToT);
482 Float_t rawTime=AliTOFGeometry::TdcBinWidth()*bestCluster->GetTDCRAW()+kTimeOffset; // RAW time,in ps
483 t->SetTOFsignalRaw(rawTime);
484 t->SetTOFsignalDz(dzTW);
487 ind[0]=bestCluster->GetDetInd(0);
488 ind[1]=bestCluster->GetDetInd(1);
489 ind[2]=bestCluster->GetDetInd(2);
490 ind[3]=bestCluster->GetDetInd(3);
491 ind[4]=bestCluster->GetDetInd(4);
492 Int_t calindex = AliTOFGeometry::GetIndex(ind);
493 t->SetTOFCalChannel(calindex);
495 // keep track of the track labels in the matched cluster
497 tlab[0]=bestCluster->GetLabel(0);
498 tlab[1]=bestCluster->GetLabel(1);
499 tlab[2]=bestCluster->GetLabel(2);
500 AliDebug(2,Form(" tdc time of the matched track %6d = ",bestCluster->GetTDC()));
501 Double_t tof=AliTOFGeometry::TdcBinWidth()*bestCluster->GetTDC()+kTimeOffset; // in ps
502 AliDebug(2,Form(" tof time of the matched track: %f = ",tof));
503 Double_t tofcorr=tof;
504 if(timeWalkCorr)tofcorr=CorrectTimeWalk(dzTW,tof);
505 AliDebug(2,Form(" tof time of the matched track, after TW corr: %f = ",tofcorr));
506 //Set TOF time signal and pointer to the matched cluster
507 t->SetTOFsignal(tofcorr);
508 t->SetTOFcluster(idclus); // pointing to the recPoints tree
509 t->SetTOFLabel(tlab);
511 AliDebug(2,Form(" Setting TOF raw time: %f z distance: %f corrected time: %f",rawTime,dzTW,tofcorr));
513 Double_t mom=t->GetP();
514 AliDebug(2,Form(" Momentum for track %d -> %f", iseed,mom));
515 // Fill Reco-QA histos for Reconstruction
516 fHRecNClus->Fill(nc);
517 fHRecChi2->Fill(bestChi2);
518 fHRecDistZ->Fill(dzTW);
519 fHRecSigYVsP->Fill(mom,TMath::Sqrt(cov[0]));
520 fHRecSigZVsP->Fill(mom,TMath::Sqrt(cov[2]));
521 fHRecSigYVsPWin->Fill(mom,dphi*sensRadius);
522 fHRecSigZVsPWin->Fill(mom,dz);
524 // Fill Tree for on-the-fly offline Calibration
525 // no longer there - all info is in the ESDs now
531 //_________________________________________________________________________
532 Int_t AliTOFtrackerV1::LoadClusters(TTree *cTree) {
533 //--------------------------------------------------------------------
534 //This function loads the TOF clusters
535 //--------------------------------------------------------------------
537 Int_t npadX = AliTOFGeometry::NpadX();
538 Int_t npadZ = AliTOFGeometry::NpadZ();
539 Int_t nStripA = AliTOFGeometry::NStripA();
540 Int_t nStripB = AliTOFGeometry::NStripB();
541 Int_t nStripC = AliTOFGeometry::NStripC();
543 TBranch *branch=cTree->GetBranch("TOF");
545 AliError("can't get the branch with the TOF clusters !");
549 static TClonesArray dummy("AliTOFcluster",10000);
551 TClonesArray *clusters=&dummy;
552 branch->SetAddress(&clusters);
555 Int_t nc=clusters->GetEntriesFast();
556 fHDigNClus->Fill(nc);
558 AliInfo(Form("Number of clusters: %d",nc));
560 for (Int_t i=0; i<nc; i++) {
561 AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
562 fClusters[i]=new AliTOFcluster(*c); fN++;
564 // Fill Digits QA histos
566 Int_t isector = c->GetDetInd(0);
567 Int_t iplate = c->GetDetInd(1);
568 Int_t istrip = c->GetDetInd(2);
569 Int_t ipadX = c->GetDetInd(4);
570 Int_t ipadZ = c->GetDetInd(3);
572 Float_t time =(AliTOFGeometry::TdcBinWidth()*c->GetTDC())*1E-3; // in ns
573 Float_t tot = (AliTOFGeometry::TdcBinWidth()*c->GetToT())*1E-3;//in ns
575 Int_t stripOffset = 0;
581 stripOffset = nStripC;
584 stripOffset = nStripC+nStripB;
587 stripOffset = nStripC+nStripB+nStripA;
590 stripOffset = nStripC+nStripB+nStripA+nStripB;
593 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
596 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
597 Int_t phiindex=npadX*isector+ipadX+1;
598 fHDigClusMap->Fill(zindex,phiindex);
599 fHDigClusTime->Fill(time);
600 fHDigClusToT->Fill(tot);
606 //_________________________________________________________________________
607 void AliTOFtrackerV1::UnloadClusters() {
608 //--------------------------------------------------------------------
609 //This function unloads TOF clusters
610 //--------------------------------------------------------------------
611 for (Int_t i=0; i<fN; i++) {
618 //_________________________________________________________________________
619 Int_t AliTOFtrackerV1::FindClusterIndex(Double_t z) const {
620 //--------------------------------------------------------------------
621 // This function returns the index of the nearest cluster
622 //--------------------------------------------------------------------
624 //Here we need to get the Z in the tracking system
627 if (z <= fClusters[0]->GetZ()) return 0;
628 if (z > fClusters[fN-1]->GetZ()) return fN;
629 Int_t b=0, e=fN-1, m=(b+e)/2;
630 for (; b<e; m=(b+e)/2) {
631 if (z > fClusters[m]->GetZ()) b=m+1;
637 //_________________________________________________________________________
638 Bool_t AliTOFtrackerV1::GetTrackPoint(Int_t index, AliTrackPoint& p) const
640 // Get track space point with index i
641 // Coordinates are in the global system
642 AliTOFcluster *cl = fClusters[index];
644 cl->GetGlobalXYZ(xyz);
645 Float_t phi=TMath::ATan2(xyz[1],xyz[0]);
646 Float_t phiangle = (Int_t(phi*TMath::RadToDeg()/20.)+0.5)*20.*TMath::DegToRad();
647 Float_t sinphi = TMath::Sin(phiangle), cosphi = TMath::Cos(phiangle);
648 Float_t tiltangle = AliTOFGeometry::GetAngles(cl->GetDetInd(1),cl->GetDetInd(2))*TMath::DegToRad();
649 Float_t sinth = TMath::Sin(tiltangle), costh = TMath::Cos(tiltangle);
650 Float_t sigmay2 = AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.;
651 Float_t sigmaz2 = AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.;
653 cov[0] = sinphi*sinphi*sigmay2 + cosphi*cosphi*sinth*sinth*sigmaz2;
654 cov[1] = -sinphi*cosphi*sigmay2 + sinphi*cosphi*sinth*sinth*sigmaz2;
655 cov[2] = -cosphi*sinth*costh*sigmaz2;
656 cov[3] = cosphi*cosphi*sigmay2 + sinphi*sinphi*sinth*sinth*sigmaz2;
657 cov[4] = -sinphi*sinth*costh*sigmaz2;
658 cov[5] = costh*costh*sigmaz2;
659 p.SetXYZ(xyz[0],xyz[1],xyz[2],cov);
661 // Detector numbering scheme
662 Int_t nSector = AliTOFGeometry::NSectors();
663 Int_t nPlate = AliTOFGeometry::NPlates();
664 Int_t nStripA = AliTOFGeometry::NStripA();
665 Int_t nStripB = AliTOFGeometry::NStripB();
666 Int_t nStripC = AliTOFGeometry::NStripC();
668 Int_t isector = cl->GetDetInd(0);
669 if (isector >= nSector)
670 AliError(Form("Wrong sector number in TOF (%d) !",isector));
671 Int_t iplate = cl->GetDetInd(1);
672 if (iplate >= nPlate)
673 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
674 Int_t istrip = cl->GetDetInd(2);
676 Int_t stripOffset = 0;
682 stripOffset = nStripC;
685 stripOffset = nStripC+nStripB;
688 stripOffset = nStripC+nStripB+nStripA;
691 stripOffset = nStripC+nStripB+nStripA+nStripB;
694 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
698 Int_t idet = (2*(nStripC+nStripB)+nStripA)*isector +
701 UShort_t volid = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF,idet);
702 p.SetVolumeID((UShort_t)volid);
705 //_________________________________________________________________________
706 void AliTOFtrackerV1::InitCheckHists() {
708 //Init histos for Digits/Reco QA and Calibration
710 TDirectory *dir = gDirectory;
711 TFile *logFileTOF = 0;
713 TSeqCollection *list = gROOT->GetListOfFiles();
714 int n = list->GetEntries();
715 Bool_t isThere=kFALSE;
716 for(int i=0; i<n; i++) {
717 logFileTOF = (TFile*)list->At(i);
718 if (strstr(logFileTOF->GetName(), "TOFQA.root")){
724 if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
728 fHDigClusMap = new TH2F("TOFDig_ClusMap", "",182,0.5,182.5,864, 0.5,864.5);
729 fHDigNClus = new TH1F("TOFDig_NClus", "",200,0.5,200.5);
730 fHDigClusTime = new TH1F("TOFDig_ClusTime", "",2000,0.,200.);
731 fHDigClusToT = new TH1F("TOFDig_ClusToT", "",500,0.,100);
734 fHRecNClus =new TH1F("TOFRec_NClusW", "",50,0.5,50.5);
735 fHRecDistZ=new TH1F("TOFRec_DistZ", "",50,0.5,10.5);
736 fHRecChi2=new TH1F("TOFRec_Chi2", "",100,0.,10.);
737 fHRecSigYVsP=new TH2F("TOFDig_SigYVsP", "",40,0.,4.,100, 0.,5.);
738 fHRecSigZVsP=new TH2F("TOFDig_SigZVsP", "",40,0.,4.,100, 0.,5.);
739 fHRecSigYVsPWin=new TH2F("TOFDig_SigYVsPWin", "",40,0.,4.,100, 0.,50.);
740 fHRecSigZVsPWin=new TH2F("TOFDig_SigZVsPWin", "",40,0.,4.,100, 0.,50.);
746 //_________________________________________________________________________
747 void AliTOFtrackerV1::SaveCheckHists() {
749 //write histos for Digits/Reco QA and Calibration
751 TDirectory *dir = gDirectory;
753 TFile *logFileTOF = 0;
755 TSeqCollection *list = gROOT->GetListOfFiles();
756 int n = list->GetEntries();
757 for(int i=0; i<n; i++) {
758 logFile = (TFile*)list->At(i);
759 if (strstr(logFile->GetName(), "AliESDs.root")) break;
762 Bool_t isThere=kFALSE;
763 for(int i=0; i<n; i++) {
764 logFileTOF = (TFile*)list->At(i);
765 if (strstr(logFileTOF->GetName(), "TOFQA.root")){
772 AliError(Form("File TOFQA.root not found!! not wring histograms...."));
776 fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
777 fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
778 fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
779 fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
780 fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
781 fHRecChi2->Write(fHRecChi2->GetName(), TObject::kOverwrite);
782 fHRecDistZ->Write(fHRecDistZ->GetName(), TObject::kOverwrite);
783 fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
784 fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
785 fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
786 fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
792 //_________________________________________________________________________
793 Float_t AliTOFtrackerV1::CorrectTimeWalk( Float_t dist, Float_t tof) {
795 //dummy, for the moment
797 if(dist<AliTOFGeometry::ZPad()*0.5){
799 //place here the actual correction
805 //_________________________________________________________________________
806 Float_t AliTOFtrackerV1::GetTimeZerofromT0(AliESDEvent *event) const {
808 //Returns TimeZero as measured by T0 detector
810 return event->GetT0();
812 //_________________________________________________________________________
813 Float_t AliTOFtrackerV1::GetTimeZerofromTOF(AliESDEvent * /*event*/) const {
815 //dummy, for the moment. T0 algorithm using tracks on TOF
817 //place T0 algo here...
821 //_________________________________________________________________________
823 void AliTOFtrackerV1::FillClusterArray(TObjArray* arr) const
826 // Returns the TOF cluster array
832 for (Int_t i=0; i<fN; ++i) arr->Add(fClusters[i]);