]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFcalib.cxx
ALIROOT-5564: fix in TOF calibration to account for new data structure
[u/mrichter/AliRoot.git] / TOF / AliTOFcalib.cxx
index b52764e57eabe03f2c0e2a9edf71ec8a5151e08a..b1b1f6cc6333fe370d71355893d49f31f90809b6 100644 (file)
@@ -2383,45 +2383,42 @@ AliTOFcalib::CalibrateESD(AliESDEvent *event)
     return;
   }
 
-  /* loop over tracks */
-  AliESDtrack *track = NULL;
   Int_t index, l0l1, deltaBC;
-  Double_t time, tot, corr, texp[AliPID::kSPECIESC];
+  Double_t time, tot, corr;
   UInt_t timestamp = event->GetTimeStamp();
-  for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++) {
 
-    /* get track */
-    track = event->GetTrack(itrk);
-    if (!track || !(track->GetStatus() & AliESDtrack::kTOFout)) continue;
-
-    /* calibrate TOF signal */
-    if (fCalibrateTOFsignal) {
-      /* get info */
-      index = track->GetTOFCalChannel();
-      time = track->GetTOFsignalRaw();
-      tot = track->GetTOFsignalToT();
-      l0l1 = track->GetTOFL0L1();
-      deltaBC = track->GetTOFDeltaBC();
-      /* get correction */
-      corr = GetTimeCorrection(index, tot, deltaBC, l0l1, timestamp);
-      /* apply correction */
-      time -= corr;
-      /* set new TOF signal */
-      track->SetTOFsignal(time);
+  // calibrating TOF hits
+
+  AliESDTOFHit* hit = NULL;
+  TClonesArray* esdTOFhits = event->GetESDTOFHits();
+    for (Int_t ihit = 0; ihit < esdTOFhits->GetEntriesFast(); ihit++) {
+      
+      /* get track */
+      hit = (AliESDTOFHit*)esdTOFhits->At(ihit);
+      //if (!track || !(track->GetStatus() & AliESDtrack::kTOFout)) continue;
+      if (!hit) continue;
+      
+      /* calibrate TOF signal */
+      if (fCalibrateTOFsignal) {
+       /* get info */
+       index = hit->GetTOFchannel();
+       time = hit->GetTimeRaw();
+       tot = hit->GetTOT();
+       l0l1 = hit->GetL0L1Latency();
+       deltaBC = hit->GetDeltaBC();
+       /* get correction */
+       corr = GetTimeCorrection(index, tot, deltaBC, l0l1, timestamp);
+       /* apply correction */
+       time -= corr;
+       /* set new TOF signal */
+       hit->SetTime(time);
+      }
+      
     }
-
-    /* correct expected time */
     if (fCorrectTExp) {
-      /* get integrated times */
-      track->GetIntegratedTimes(texp,AliPID::kSPECIESC);
-      /* loop over particle types and correct expected time */
-      for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
-       texp[ipart] += fResponseParams->EvalTExpCorr(ipart, track->P());
-      /* set integrated times */
-      track->SetIntegratedTimes(texp);
+      AliWarning("\n\nfCorrectTExp is a DEPRECATED flag, it will do NOTHING\n\n");
     }
 
-  }
 
 }
 
@@ -2535,6 +2532,9 @@ AliTOFcalib::TuneForMC(AliESDEvent *event, Double_t resolution)
    * tune for MC
    */
 
+  AliFatal("This method is DEPRECATED, doing NOTHING");
+  return 0.;
+
   /* get vertex spread and define T0-spread */
   Double_t diamond2 = TMath::Abs(event->GetSigma2DiamondZ());
   Double_t t0spread = TMath::Sqrt(diamond2) / 2.99792457999999984e-02;