]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFtrackerV1.cxx
Related to the previous commit.
[u/mrichter/AliRoot.git] / TOF / AliTOFtrackerV1.cxx
index a20f6018029bf8dd9eb212f0335eef8b6091d42d..84883dab38aba346df288f9275f912576e0dfc2b 100644 (file)
@@ -179,18 +179,38 @@ Int_t AliTOFtrackerV1::PropagateBack(AliESDEvent* event) {
   for (Int_t i=0; i<ntrk; i++) {
     AliESDtrack *t=event->GetTrack(i);
     AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i);
-    if(seed->GetTOFsignal()>0){
-      t->SetTOFsignal(seed->GetTOFsignal());
-      t->SetTOFcluster(seed->GetTOFcluster());
-      t->SetTOFsignalToT(seed->GetTOFsignalToT());
-      t->SetTOFsignalRaw(seed->GetTOFsignalRaw());
-      t->SetTOFsignalDz(seed->GetTOFsignalDz());
-      t->SetTOFCalChannel(seed->GetTOFCalChannel());
-      Int_t tlab[3]; seed->GetTOFLabel(tlab);    
-      t->SetTOFLabel(tlab);
-      AliTOFtrack *track = new AliTOFtrack(*seed); 
-      t->UpdateTrackParams(track,AliESDtrack::kTOFout);   
-      delete track;
+
+    if ( (seed->GetStatus()&AliESDtrack::kTOFin)!=0 ) {
+      t->SetStatus(AliESDtrack::kTOFin);
+      //if(seed->GetTOFsignal()>0){
+      if ( (seed->GetStatus()&AliESDtrack::kTOFout)!=0 ) {
+       t->SetStatus(AliESDtrack::kTOFout);
+       t->SetTOFsignal(seed->GetTOFsignal());
+       t->SetTOFcluster(seed->GetTOFcluster());
+       t->SetTOFsignalToT(seed->GetTOFsignalToT());
+       t->SetTOFsignalRaw(seed->GetTOFsignalRaw());
+       t->SetTOFsignalDz(seed->GetTOFsignalDz());
+       t->SetTOFCalChannel(seed->GetTOFCalChannel());
+       Int_t tlab[3]; seed->GetTOFLabel(tlab);
+       t->SetTOFLabel(tlab);
+       AliTOFtrack *track = new AliTOFtrack(*seed);
+       t->UpdateTrackParams(track,AliESDtrack::kTOFout); // to be checked - AdC
+       delete track;
+
+       Double_t time[10]; t->GetIntegratedTimes(time);
+       AliDebug(1,Form(" %6d  %f %f %f %f %6d %3d %f  %f %f %f %f %f",
+                       i,
+                       t->GetTOFsignalRaw(),
+                       t->GetTOFsignal(),
+                       t->GetTOFsignalToT(),
+                       t->GetTOFsignalDz(),
+                       t->GetTOFCalChannel(),
+                       t->GetTOFcluster(),
+                       t->GetIntegratedLength(),
+                       time[0], time[1], time[2], time[3], time[4]
+                       )
+                );
+      }
     }
   }
 
@@ -236,27 +256,37 @@ void AliTOFtrackerV1::CollectESD() {
     AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
     if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
 
-    // TRD 'good' tracks, already propagated at 372 cm
-
     AliTOFtrack *track = new AliTOFtrack(*t); // New
-    Double_t x = track->GetX(); //New
-
-    if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) && 
-        ( x >= AliTOFGeometry::RinTOF()) ){
-      track->SetSeedIndex(i);
-      t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
-      new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
-      fNseedsTOF++;
-      seedsTOF1++;
+    Float_t x = (Float_t)track->GetX(); //New
+
+    // TRD 'good' tracks, already propagated at 371 cm
+    if ( ( (t->GetStatus()&AliESDtrack::kTRDout)!=0 ) && 
+        ( x >= AliTOFGeometry::Rmin() ) ) {
+      if ( track->PropagateToInnerTOF() ) {
+
+       AliDebug(1,Form(" TRD propagated track till rho = %fcm."
+                       " And then the track has been propagated till rho = %fcm.",
+                       x, (Float_t)track->GetX()));
+
+       track->SetSeedIndex(i);
+       t->UpdateTrackParams(track,AliESDtrack::kTOFin);
+       new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
+       fNseedsTOF++;
+       seedsTOF1++;
+      }
       delete track;
     }
 
-    // Propagate the rest of TPCbp  
-
+    // Propagate the rest of TPCbp
     else {
-      if(track->PropagateToInnerTOF()){ 
+      if ( track->PropagateToInnerTOF() ) {
+
+       AliDebug(1,Form(" TRD propagated track till rho = %fcm."
+                       " And then the track has been propagated till rho = %fcm.",
+                       x, (Float_t)track->GetX()));
+
        track->SetSeedIndex(i);
-       t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
+       t->UpdateTrackParams(track,AliESDtrack::kTOFin);
        new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
        fNseedsTOF++;
        seedsTOF2++;
@@ -265,9 +295,9 @@ void AliTOFtrackerV1::CollectESD() {
     }
   }
 
-  AliInfo(Form("Number of TOF seeds %i",fNseedsTOF));
-  AliInfo(Form("Number of TOF seeds Type 1 %i",seedsTOF1));
-  AliInfo(Form("Number of TOF seeds Type 2 %i",seedsTOF2));
+  AliInfo(Form("Number of TOF seeds %d",fNseedsTOF));
+  AliInfo(Form("Number of TOF seeds Type 1 %d",seedsTOF1));
+  AliInfo(Form("Number of TOF seeds Type 2 %d",seedsTOF2));
 
   // Sort according uncertainties on track position 
   fTracks->Sort();
@@ -284,6 +314,8 @@ void AliTOFtrackerV1::MatchTracks( ){
   Float_t dY=AliTOFGeometry::XPad(); 
   Float_t dZ=AliTOFGeometry::ZPad(); 
 
+  const Float_t kTimeOffset = 32.; // time offset for tracking algorithm [ps]
+
   const Int_t kncmax = 100;
   Float_t sensRadius = fRecoParam->GetSensRadius();
   Float_t scaleFact   = fRecoParam->GetWindowScaleFact();
@@ -301,12 +333,12 @@ void AliTOFtrackerV1::MatchTracks( ){
 
 
   //The matching loop
-
   for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) {
 
     AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(iseed);
     AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex());
-    if(t->GetTOFsignal()>0. ) continue;
+    //if ( t->GetTOFsignal()>0. ) continue;
+    if ( (t->GetStatus()&AliESDtrack::kTOFout)!=0 ) continue;
     AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
      
     // Determine a window around the track
@@ -410,12 +442,12 @@ void AliTOFtrackerV1::MatchTracks( ){
        (bestCluster->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
        ) {
       fngoodmatch++;
-       AliDebug(2,Form(" track label good %5i",trackTOFin->GetLabel()));
+       AliDebug(2,Form(" track label good %5d",trackTOFin->GetLabel()));
 
     }
     else{
       fnbadmatch++;
-      AliDebug(2,Form(" track label bad %5i",trackTOFin->GetLabel()));
+      AliDebug(2,Form(" track label bad %5d",trackTOFin->GetLabel()));
     }
 
     //Propagate the track to the best matched cluster
@@ -426,20 +458,21 @@ void AliTOFtrackerV1::MatchTracks( ){
 
     //now take the local distance in Z from the pad center for time walk correction
     Float_t tiltangle = AliTOFGeometry::GetAngles(bestCluster->GetDetInd(1),bestCluster->GetDetInd(2))*TMath::DegToRad();
-    Double_t dzTW=trackTOFin->GetZ()-bestCluster->GetZ(); // in cm
-    dzTW/=TMath::Cos(tiltangle);
+    Double_t dzTW=trackTOFin->GetZ()-bestCluster->GetZ(); // in cm - in the ALICE RF -
+    dzTW/=TMath::Cos(tiltangle); // from ALICE/tracking RF to pad RF (1)
+    dzTW=-dzTW; // from ALICE/tracking RF to pad RF (2)
+    if (tiltangle!=0.) AliDebug(2,Form(" rho_track = %f --- rho_cluster = %f ",trackTOFin->GetX(),bestCluster->GetX()));
 
     //update the ESD track and delete the TOFtrack
-    t->UpdateTrackParams(trackTOFin,AliESDtrack::kTOFout);    
-    delete trackTOFin;
+    t->UpdateTrackParams(trackTOFin,AliESDtrack::kTOFout);
 
     //  Store quantities to be used in the TOF Calibration
     Float_t tToT=AliTOFGeometry::ToTBinWidth()*bestCluster->GetToT()*1E-3; // in ns
     t->SetTOFsignalToT(tToT);
-    Float_t rawTime=AliTOFGeometry::TdcBinWidth()*bestCluster->GetTDCRAW()+32; // RAW time,in ps
+    Float_t rawTime=AliTOFGeometry::TdcBinWidth()*bestCluster->GetTDCRAW()+kTimeOffset; // RAW time,in ps
     t->SetTOFsignalRaw(rawTime);
     t->SetTOFsignalDz(dzTW);
-    AliDebug(2,Form(" Setting TOF raw time: %f  z distance: %f time: %f = ",rawTime,dzTW));    
+
     Int_t ind[5];
     ind[0]=bestCluster->GetDetInd(0);
     ind[1]=bestCluster->GetDetInd(1);
@@ -454,9 +487,9 @@ void AliTOFtrackerV1::MatchTracks( ){
     tlab[0]=bestCluster->GetLabel(0);
     tlab[1]=bestCluster->GetLabel(1);
     tlab[2]=bestCluster->GetLabel(2);
-    AliDebug(2,Form(" tdc time of the matched track %i = ",bestCluster->GetTDC()));    
-    Double_t tof=AliTOFGeometry::TdcBinWidth()*bestCluster->GetTDC()+32; // in ps
-    AliDebug(2,Form(" tof time of the matched track: %f = ",tof));    
+    AliDebug(2,Form(" tdc time of the matched track %6d = ",bestCluster->GetTDC()));    
+    Double_t tof=AliTOFGeometry::TdcBinWidth()*bestCluster->GetTDC()+kTimeOffset; // in ps
+    AliDebug(2,Form(" tof time of the matched track: %f = ",tof));
     Double_t tofcorr=tof;
     if(timeWalkCorr)tofcorr=CorrectTimeWalk(dzTW,tof);
     AliDebug(2,Form(" tof time of the matched track, after TW corr: %f = ",tofcorr));    
@@ -465,7 +498,10 @@ void AliTOFtrackerV1::MatchTracks( ){
     t->SetTOFcluster(idclus); // pointing to the recPoints tree
     t->SetTOFLabel(tlab);
 
+    AliDebug(2,Form(" Setting TOF raw time: %f  z distance: %f  corrected time: %f",rawTime,dzTW,tofcorr));
+
     Double_t mom=t->GetP();
+    AliDebug(1,Form(" Momentum for track %d -> %f", iseed,mom));
     // Fill Reco-QA histos for Reconstruction
     fHRecNClus->Fill(nc);
     fHRecChi2->Fill(bestChi2);
@@ -478,6 +514,7 @@ void AliTOFtrackerV1::MatchTracks( ){
     // Fill Tree for on-the-fly offline Calibration
     // no longer there - all info is in the ESDs now
 
+    delete trackTOFin;
   }
 
 }