]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCtracker.cxx
Overlap between rails and ITSD corrected.
[u/mrichter/AliRoot.git] / TPC / AliTPCtracker.cxx
index 5ae5a556b1ee6451fdb77a7d2999e5fa558dbb90..e7976c58833551421f07689631e470abe60dc761 100644 (file)
 
 /*
 $Log$
+Revision 1.6  2001/03/13 14:25:47  hristov
+New design of tracking classes (Yu.Belikov)
+
+Revision 1.5  2000/12/20 07:51:59  kowal2
+Changes suggested by Alessandra and Paolo to avoid overlapped
+data fields in encapsulated classes.
+
+Revision 1.4  2000/11/02 07:27:16  kowal2
+code corrections
+
 Revision 1.2  2000/06/30 12:07:50  kowal2
 Updated from the TPC-PreRelease branch
 
@@ -29,13 +39,15 @@ Splitted from AliTPCtracking
 //   Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
 //-------------------------------------------------------
 
-#include "AliTPCtracker.h"
-#include "AliTPCcluster.h"
 #include <TObjArray.h>
 #include <TFile.h>
+#include <TTree.h>
+#include <iostream.h>
+
+#include "AliTPCtracker.h"
+#include "AliTPCcluster.h"
 #include "AliTPCClustersArray.h"
 #include "AliTPCClustersRow.h"
-#include <TTree.h>
 
 const AliTPCParam *AliTPCtracker::AliTPCSector::fgParam;
 
@@ -138,8 +150,8 @@ Int_t s, Int_t rf)
   //-----------------------------------------------------------------
   // This function tries to find a track prolongation.
   //-----------------------------------------------------------------
-  const Int_t kSKIP=(t.GetNumberOfClusters()<10) ? 
-                        10 : Int_t(0.5*sec->GetNRows());
+  const Int_t kSKIP=(t.GetNumberOfClusters()<10) ? 10 : 
+                    Int_t(0.5*sec->GetNRows());
   Int_t tryAgain=kSKIP;
   Double_t alpha=sec->GetAlpha();
   Int_t ns=Int_t(2*TMath::Pi()/alpha+0.5);
@@ -152,7 +164,7 @@ Int_t s, Int_t rf)
     UInt_t index=0;
     Double_t maxchi2=12.;
     const AliTPCRow &krow=sec[s][nr];
-    Double_t sy2=SigmaY2(t.GetX(),t.GetTgl(),t.GetPt());
+    Double_t sy2=SigmaY2(t.GetX(),t.GetTgl(),1./t.Get1Pt());
     Double_t sz2=SigmaZ2(t.GetX(),t.GetTgl());
     Double_t road=4.*sqrt(t.GetSigmaY2() + sy2), y=t.GetY(), z=t.GetZ();
 
@@ -165,7 +177,7 @@ Int_t s, Int_t rf)
 
     if (krow) {
       for (Int_t i=krow.Find(y-road); i<krow; i++) {
-       AliTPCclusterc=(AliTPCcluster*)(krow[i]);
+       AliTPCcluster *c=(AliTPCcluster*)(krow[i]);
        if (c->GetY() > y+road) break;
        if (c->IsUsed()) continue;
        if ((c->GetZ()-z)*(c->GetZ()-z) > 16.*(t.GetSigmaZ2()+sz2)) continue;
@@ -179,8 +191,9 @@ Int_t s, Int_t rf)
     if (cl) {
       Float_t l=sec->GetPadPitchWidth();
       t.SetSampledEdx(cl->GetQ()/l,t.GetNumberOfClusters());
-      t.Update(cl,maxchi2,index);
-      tryAgain=kSKIP;
+      if (!t.Update(cl,maxchi2,index)) {
+         if (!tryAgain--) return 0;
+      } else tryAgain=kSKIP;
     } else {
       if (tryAgain==0) break;
       if (y > ymax) {
@@ -253,26 +266,26 @@ Int_t i1, Int_t i2)
 
        x[0]=y1;
        x[1]=z1;
-       x[2]=f1(x1,y1,x2,y2,x3,y3);
-       if (TMath::Abs(x[2]) >= 0.0066) continue;
-       x[3]=f2(x1,y1,x2,y2,x3,y3);
-       //if (TMath::Abs(x[2]*x1-x[3]) >= 0.99999) continue;
+       x[3]=f1(x1,y1,x2,y2,x3,y3);
+       if (TMath::Abs(x[3]) >= 0.0066) continue;
+       x[2]=f2(x1,y1,x2,y2,x3,y3);
+       //if (TMath::Abs(x[3]*x1-x[2]) >= 0.99999) continue;
        x[4]=f3(x1,y1,x2,y2,z1,z2);
        if (TMath::Abs(x[4]) > 1.2) continue;
-       Double_t a=asin(x[3]);
-       Double_t zv=z1 - x[4]/x[2]*(a+asin(x[2]*x1-x[3]));
+       Double_t a=asin(x[2]);
+       Double_t zv=z1 - x[4]/x[3]*(a+asin(x[3]*x1-x[2]));
        if (TMath::Abs(zv)>10.) continue; 
 
         Double_t sy1=kr1[is]->GetSigmaY2(), sz1=kr1[is]->GetSigmaZ2();
         Double_t sy2=kcl->GetSigmaY2(),     sz2=kcl->GetSigmaZ2();
        Double_t sy3=100*0.025, sy=0.1, sz=0.1;
 
-       Double_t f20=(f1(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy;
-       Double_t f22=(f1(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy;
-       Double_t f24=(f1(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy;
-       Double_t f30=(f2(x1,y1+sy,x2,y2,x3,y3)-x[3])/sy;
-       Double_t f32=(f2(x1,y1,x2,y2+sy,x3,y3)-x[3])/sy;
-       Double_t f34=(f2(x1,y1,x2,y2,x3,y3+sy)-x[3])/sy;
+       Double_t f30=(f1(x1,y1+sy,x2,y2,x3,y3)-x[3])/sy;
+       Double_t f32=(f1(x1,y1,x2,y2+sy,x3,y3)-x[3])/sy;
+       Double_t f34=(f1(x1,y1,x2,y2,x3,y3+sy)-x[3])/sy;
+       Double_t f20=(f2(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy;
+       Double_t f22=(f2(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy;
+       Double_t f24=(f2(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy;
        Double_t f40=(f3(x1,y1+sy,x2,y2,z1,z2)-x[4])/sy;
        Double_t f41=(f3(x1,y1,x2,y2,z1+sz,z2)-x[4])/sz;
        Double_t f42=(f3(x1,y1,x2,y2+sy,z1,z2)-x[4])/sy;
@@ -293,7 +306,7 @@ Int_t i1, Int_t i2)
         track->SetSampledEdx(kr1[is]->GetQ()/l,0);
 
         Int_t rc=FindProlongation(*track,sec,ns,i2);
-        if (rc<0 || track->GetNumberOfClusters()<(i1-i2)/2) delete track;
+        if (rc==0 || track->GetNumberOfClusters()<(i1-i2)/2) delete track;
         else seeds.AddLast(track); 
       }
     }
@@ -301,15 +314,15 @@ Int_t i1, Int_t i2)
 }
 
 //_____________________________________________________________________________
-void AliTPCtracker::Clusters2Tracks(const AliTPCParam *par, TFile *of) {
+Int_t AliTPCtracker::Clusters2Tracks(const AliTPCParam *par, TFile *of) {
   //-----------------------------------------------------------------
   // This is a track finder.
   //-----------------------------------------------------------------
   TDirectory *savedir=gDirectory; 
 
   if (!of->IsOpen()) {
-     cerr<<"AliTPC::Clusters2Tracks(): output file not open !\n";
-     return;
+     cerr<<"AliTPCtracker::Clusters2Tracks(): output file not open !\n";
+     return 1;
   }
 
   AliTPCClustersArray carray;
@@ -421,7 +434,7 @@ void AliTPCtracker::Clusters2Tracks(const AliTPCParam *par, TFile *of) {
              iotrack=pt;
              tracktree.Fill();
              t.UseClusters(&carray,nc);
-             cerr<<found++<<'\r';
+             found++;
           }
        }
     }
@@ -443,6 +456,8 @@ void AliTPCtracker::Clusters2Tracks(const AliTPCParam *par, TFile *of) {
   delete[] lsec;
 
   savedir->cd();
+
+  return 0;
 }
 
 //_________________________________________________________________________
@@ -482,20 +497,22 @@ void AliTPCtracker::AliTPCseed::CookdEdx(Double_t low, Double_t up) {
   // This funtion calculates dE/dX within the "low" and "up" cuts.
   //-----------------------------------------------------------------
   Int_t i;
+  Int_t nc=GetNumberOfClusters();
 
   Int_t swap;//stupid sorting
   do {
     swap=0;
-    for (i=0; i<fN-1; i++) {
-      if (fdEdx[i]<=fdEdx[i+1]) continue;
-      Float_t tmp=fdEdx[i]; fdEdx[i]=fdEdx[i+1]; fdEdx[i+1]=tmp;
+    for (i=0; i<nc-1; i++) {
+      if (fdEdxSample[i]<=fdEdxSample[i+1]) continue;
+      Float_t tmp=fdEdxSample[i];
+      fdEdxSample[i]=fdEdxSample[i+1]; fdEdxSample[i+1]=tmp;
       swap++;
     }
   } while (swap);
 
-  Int_t nl=Int_t(low*fN), nu=Int_t(up*fN);
+  Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
   Float_t dedx=0;
-  for (i=nl; i<=nu; i++) dedx += fdEdx[i];
+  for (i=nl; i<=nu; i++) dedx += fdEdxSample[i];
   dedx /= (nu-nl+1);
   SetdEdx(dedx);
 }
@@ -505,8 +522,10 @@ void AliTPCtracker::AliTPCseed::UseClusters(AliTPCClustersArray *ca, Int_t n) {
   //-----------------------------------------------------------------
   // This function marks clusters associated with this track.
   //-----------------------------------------------------------------
+  Int_t nc=GetNumberOfClusters();
   Int_t sec,row,ncl;
-  for (Int_t i=n; i<fN; i++) {
+
+  for (Int_t i=n; i<nc; i++) {
      GetCluster(i,sec,row,ncl);
      AliTPCClustersRow *clrow=ca->GetRow(sec,row);
      AliTPCcluster *c=(AliTPCcluster*)(*clrow)[ncl];