]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Implementation of refit inward (T.Kuhr)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Nov 2003 18:34:50 +0000 (18:34 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Nov 2003 18:34:50 +0000 (18:34 +0000)
TRD/AliTRDtrack.cxx
TRD/AliTRDtrack.h
TRD/AliTRDtracker.cxx
TRD/AliTRDtracker.h

index 3efe196aa324700ec2d4dfca0b172c362ffce017..ec0be0dc73fb68266e3a1cf70aec4765a28f16ab 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.24  2003/09/18 09:06:07  cblume
+Geometry update, Removal of compiler warnings
+
 Revision 1.23  2003/07/22 15:56:14  hristov
 Implementing ESD functionality in the NewIO (Yu.Belikov)
 
 Revision 1.23  2003/07/22 15:56:14  hristov
 Implementing ESD functionality in the NewIO (Yu.Belikov)
 
@@ -243,8 +246,7 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack& t)
   SetLabel(t.GetLabel());
   SetChi2(0.);
   SetMass(t.GetMass());
   SetLabel(t.GetLabel());
   SetChi2(0.);
   SetMass(t.GetMass());
-  SetNumberOfClusters(0); 
-  // WARNING: cluster indices are NOT copied !!!
+  SetNumberOfClusters(t.GetTRDclusters(fIndex)); 
 
   fdEdx=0;
 
 
   fdEdx=0;
 
index 8c96176a570244cab19fa5bfcd7869b3eaf31b95..fa8b1f0ceed4b8ccc20675ee73ef231e1a5bb359 100644 (file)
@@ -71,8 +71,19 @@ public:
    Double_t GetY()    const {return fY;}
    Double_t GetZ()    const {return fZ;}
 
    Double_t GetY()    const {return fY;}
    Double_t GetZ()    const {return fZ;}
 
+   Double_t GetYat(Double_t xk) const {
+//-----------------------------------------------------------------
+// This function calculates the Y-coordinate of a track at the plane x=xk.
+// Needed for matching with the TOF (I.Belikov)
+//-----------------------------------------------------------------
+      Double_t c1=fC*fX - fE, r1=TMath::Sqrt(1.- c1*c1);
+      Double_t c2=fC*xk - fE, r2=TMath::Sqrt(1.- c2*c2);
+      return fY + (xk-fX)*(c1+c2)/(r1+r2);
+   }
+
    Int_t    PropagateTo(Double_t xr, Double_t x0=8.72, Double_t rho=5.86e-3);
    void     ResetCovariance();   
    Int_t    PropagateTo(Double_t xr, Double_t x0=8.72, Double_t rho=5.86e-3);
    void     ResetCovariance();   
+   void ResetClusters() { SetChi2(0.); SetNumberOfClusters(0); }
    Int_t    Rotate(Double_t angle);
 
    void     SetdEdx(Float_t dedx) {fdEdx=dedx;}  
    Int_t    Rotate(Double_t angle);
 
    void     SetdEdx(Float_t dedx) {fdEdx=dedx;}  
index addbcb455b6e183e59f92fada84251e63bc6e2ab..5000020a7b7a57ade44d28a6c21585ed289b4f2f 100644 (file)
@@ -15,6 +15,9 @@
                                                       
 /*
 $Log$
                                                       
 /*
 $Log$
+Revision 1.31  2003/11/06 09:28:15  cblume
+Next round of coding conventions
+
 Revision 1.30  2003/09/18 09:06:07  cblume
 Geometry update, Removal of compiler warnings
 
 Revision 1.30  2003/09/18 09:06:07  cblume
 Geometry update, Removal of compiler warnings
 
@@ -937,16 +940,84 @@ Int_t AliTRDtracker::PropagateBack(AliESD* event) {
       //found++;
     }
 
       //found++;
     }
 
-    if (track->PropagateTo(376.)) { //Propagation to the TOF (I.Belikov)
+    //Propagation to the TOF (I.Belikov)
+    Double_t xtof=378.;
+    Double_t c2=track->GetC()*xtof - track->GetEta();
+    if (TMath::Abs(c2)>=0.9999999) continue;
+
+    Double_t ymax=xtof*TMath::Tan(0.5*AliTRDgeometry::GetAlpha());
+    Double_t y=track->GetYat(xtof);
+    if (y > ymax) {
+       if (!track->Rotate(AliTRDgeometry::GetAlpha())) return 1;
+    } else if (y <-ymax) {
+       if (!track->Rotate(-AliTRDgeometry::GetAlpha())) return 1;
+    }
+
+    if (track->PropagateTo(xtof)) {
        seed->UpdateTrackParams(track, AliESDtrack::kTRDout);
        found++;
     }
        seed->UpdateTrackParams(track, AliESDtrack::kTRDout);
        found++;
     }
+    //End of propagation to the TOF
 
   }
   
   cerr<<"Number of seeds: "<<fNseeds<<endl;  
   cerr<<"Number of back propagated TRD tracks: "<<found<<endl;
 
 
   }
   
   cerr<<"Number of seeds: "<<fNseeds<<endl;  
   cerr<<"Number of back propagated TRD tracks: "<<found<<endl;
 
+  fSeeds->Clear(); fNseeds=0;
+
+  return 0;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDtracker::RefitInward(AliESD* event)
+{
+  //
+  // Refits tracks within the TRD. The ESD event is expected to contain seeds 
+  // at the outer part of the TRD. 
+  // The tracks are propagated to the innermost time bin 
+  // of the TRD and the ESD event is updated
+  // Origin: Thomas KUHR (Thomas.Kuhr@cern.ch)
+  //
+
+  Int_t timeBins = fTrSec[0]->GetNumberOfTimeBins();
+  Float_t foundMin = fgkMinClustersInTrack * timeBins; 
+  Int_t nseed = 0;
+  Int_t found = 0;
+  Int_t innerTB = fTrSec[0]->GetInnerTimeBin();
+
+  Int_t n = event->GetNumberOfTracks();
+  for (Int_t i=0; i<n; i++) {
+    AliESDtrack* seed=event->GetTrack(i);
+    ULong_t status=seed->GetStatus();
+    if ( (status & AliESDtrack::kTRDout ) == 0 ) continue;
+    if ( (status & AliESDtrack::kTRDin) != 0 ) continue;
+    nseed++;
+
+    AliTRDtrack* seed2 = new AliTRDtrack(*seed);
+    seed2->ResetCovariance(); 
+    AliTRDtrack *pt = new AliTRDtrack(*seed2,seed2->GetAlpha());
+    AliTRDtrack &t=*pt; 
+    FollowProlongation(t, innerTB); 
+    if (t.GetNumberOfClusters() >= foundMin) {
+      UseClusters(&t);
+      CookLabel(pt, 1-fgkLabelFraction);
+      //      t.CookdEdx();
+    }
+    found++;
+//    cout<<found<<'\r';     
+
+    if(PropagateToTPC(t)) {
+      seed->UpdateTrackParams(pt, AliESDtrack::kTRDin);
+    }  
+    delete seed2;
+    delete pt;
+  }     
+
+  cout<<"Number of loaded seeds: "<<nseed<<endl;  
+  cout<<"Number of found tracks from loaded seeds: "<<found<<endl;
+
   return 0;
 
 }
   return 0;
 
 }
@@ -1444,6 +1515,102 @@ Int_t AliTRDtracker::FollowBackProlongation(AliTRDtrack& t)
 
 }         
 
 
 }         
 
+//---------------------------------------------------------------------------
+Int_t AliTRDtracker::Refit(AliTRDtrack& t, Int_t rf)
+{
+  // Starting from current position on track=t this function tries
+  // to extrapolate the track up to timeBin=0 and to reuse already
+  // assigned clusters. Returns the number of clusters
+  // expected to be found in sensitive layers
+  // get indices of assigned clusters for each layer
+  // Origin: Thomas KUHR (Thomas.Kuhr@cern.ch)
+
+  Int_t iCluster[90];
+  for (Int_t i = 0; i < 90; i++) iCluster[i] = 0;
+  for (Int_t i = 0; i < t.GetNumberOfClusters(); i++) {
+    Int_t index = t.GetClusterIndex(i);
+    AliTRDcluster *cl=(AliTRDcluster*) GetCluster(index);
+    if (!cl) continue;
+    Int_t detector=cl->GetDetector();
+    Int_t localTimeBin=cl->GetLocalTimeBin();
+    Int_t sector=fGeom->GetSector(detector);
+    Int_t plane=fGeom->GetPlane(detector);
+
+    Int_t trackingSector = CookSectorIndex(sector);
+
+    Int_t gtb = fTrSec[trackingSector]->CookTimeBinIndex(plane,localTimeBin);
+    if(gtb < 0) continue; 
+    Int_t layer = fTrSec[trackingSector]->GetLayerNumber(gtb);
+    iCluster[layer] = index;
+  }
+  t.ResetClusters();
+
+  Int_t ns=Int_t(2*TMath::Pi()/AliTRDgeometry::GetAlpha()+0.5);     
+
+  Double_t alpha=t.GetAlpha();
+  alpha = TVector2::Phi_0_2pi(alpha);
+
+  Int_t s=Int_t(alpha/AliTRDgeometry::GetAlpha())%AliTRDgeometry::kNsect;  
+  Double_t radLength, rho, x, dx, y, ymax, z;
+
+  Int_t expectedNumberOfClusters = 0;
+  Bool_t lookForCluster;
+
+  alpha=AliTRDgeometry::GetAlpha();  // note: change in meaning
+
+  for (Int_t nr=fTrSec[0]->GetLayerNumber(t.GetX()); nr>rf; nr--) { 
+
+    y = t.GetY(); z = t.GetZ();
+
+    // first propagate to the inner surface of the current time bin 
+    fTrSec[s]->GetLayer(nr)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
+    x = fTrSec[s]->GetLayer(nr)->GetX()-dx/2; y = t.GetY(); z = t.GetZ();
+    if(!t.PropagateTo(x,radLength,rho)) break;
+    y = t.GetY();
+    ymax = x*TMath::Tan(0.5*alpha);
+    if (y > ymax) {
+      s = (s+1) % ns;
+      if (!t.Rotate(alpha)) break;
+      if(!t.PropagateTo(x,radLength,rho)) break;
+    } else if (y <-ymax) {
+      s = (s-1+ns) % ns;                           
+      if (!t.Rotate(-alpha)) break;   
+      if(!t.PropagateTo(x,radLength,rho)) break;
+    } 
+
+    y = t.GetY(); z = t.GetZ();
+
+    // now propagate to the middle plane of the next time bin 
+    fTrSec[s]->GetLayer(nr-1)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
+    x = fTrSec[s]->GetLayer(nr-1)->GetX(); y = t.GetY(); z = t.GetZ();
+    if(!t.PropagateTo(x,radLength,rho)) break;
+    y = t.GetY();
+    ymax = x*TMath::Tan(0.5*alpha);
+    if (y > ymax) {
+      s = (s+1) % ns;
+      if (!t.Rotate(alpha)) break;
+      if(!t.PropagateTo(x,radLength,rho)) break;
+    } else if (y <-ymax) {
+      s = (s-1+ns) % ns;                           
+      if (!t.Rotate(-alpha)) break;   
+      if(!t.PropagateTo(x,radLength,rho)) break;
+    } 
+
+    if(lookForCluster) expectedNumberOfClusters++;       
+
+    // use assigned cluster
+    if (!iCluster[nr-1]) continue;
+    AliTRDcluster *cl=(AliTRDcluster*)GetCluster(iCluster[nr-1]);
+    Double_t h01 = GetTiltFactor(cl);
+    Double_t chi2=t.GetPredictedChi2(cl, h01);
+    t.SetSampledEdx(cl->GetQ()/dx,t.GetNumberOfClusters()); 
+    t.Update(cl,chi2,iCluster[nr-1],h01);
+  }
+
+  return expectedNumberOfClusters;
+}                
+
 //___________________________________________________________________
 
 Int_t AliTRDtracker::PropagateToOuterPlane(AliTRDtrack& t, Double_t xToGo)
 //___________________________________________________________________
 
 Int_t AliTRDtracker::PropagateToOuterPlane(AliTRDtrack& t, Double_t xToGo)
index e74b15a1dfe84ed2444b7d9d8adf0c1df54dc63e..f150aac94a72d7ac7d7781334b84a2f21bfb2e09 100644 (file)
@@ -38,7 +38,7 @@ class AliTRDtracker : public AliTracker {
   Int_t         Clusters2Tracks(AliESD* event);
   Int_t         PropagateBack(const TFile *in, TFile *out);
   Int_t         PropagateBack(AliESD* event);
   Int_t         Clusters2Tracks(AliESD* event);
   Int_t         PropagateBack(const TFile *in, TFile *out);
   Int_t         PropagateBack(AliESD* event);
-  Int_t         RefitInward(AliESD* /*event*/) {return 0;}
+  Int_t         RefitInward(AliESD* event);
 
   Int_t         LoadClusters(TTree *cTree);
   void          UnloadClusters(){UnloadEvent();}
 
   Int_t         LoadClusters(TTree *cTree);
   void          UnloadClusters(){UnloadEvent();}
@@ -260,7 +260,7 @@ class AliTRDtracker : public AliTracker {
 
   Int_t         FollowProlongation(AliTRDtrack& t, Int_t rf);
   Int_t         FollowBackProlongation(AliTRDtrack& t);
 
   Int_t         FollowProlongation(AliTRDtrack& t, Int_t rf);
   Int_t         FollowBackProlongation(AliTRDtrack& t);
-  //Int_t         FolowRefitInward(AliTRDtrack *seed, AliTPCtrack *track);
+  Int_t         Refit(AliTRDtrack& t, Int_t rf);
 
   Int_t         PropagateToTPC(AliTRDtrack& t);
   Int_t         PropagateToOuterPlane(AliTRDtrack& t, Double_t x);
 
   Int_t         PropagateToTPC(AliTRDtrack& t);
   Int_t         PropagateToOuterPlane(AliTRDtrack& t, Double_t x);