]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Splitting the AliTPCtrackerMI to the two files
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 18 May 2008 10:22:34 +0000 (10:22 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 18 May 2008 10:22:34 +0000 (10:22 +0000)
One file with helper classes AliTPCtrackerSector - for cluster navigation
and AliTPCtrackerMI for tracking

Preparation for possibility to use different cluster navigation
+ easier to test functionality
clases derived from TObject possibility to test it from command line

(Marian)

TPC/AliTPCtrackerMI.cxx
TPC/AliTPCtrackerMI.h
TPC/AliTPCtrackerSector.cxx [new file with mode: 0644]
TPC/AliTPCtrackerSector.h [new file with mode: 0644]
TPC/TPCrecLinkDef.h
TPC/libTPCrec.pkg

index 0c8960a976443dbb00c0ef7e3cc59f7f9d65f392..c148443e13e7a826bc17f4653ac90ade9587fd51 100644 (file)
 #include "AliTPCReconstructor.h"
 #include "AliTPCpolyTrack.h"
 #include "AliTPCreco.h"
-#include "AliTPCseed.h" 
+#include "AliTPCseed.h"
+
+#include "AliTPCtrackerSector.h" 
 #include "AliTPCtrackerMI.h"
 #include "TStopwatch.h"
 #include "AliTPCReconstructor.h"
 //
 
 ClassImp(AliTPCtrackerMI)
-ClassImp(AliTPCtrackerRow)
 
 
 class AliTPCFastMath {
@@ -350,8 +351,8 @@ AliTracker(),
   //---------------------------------------------------------------------
   // The main TPC tracker constructor
   //---------------------------------------------------------------------
-  fInnerSec=new AliTPCSector[fkNIS];         
-  fOuterSec=new AliTPCSector[fkNOS];
+  fInnerSec=new AliTPCtrackerSector[fkNIS];         
+  fOuterSec=new AliTPCtrackerSector[fkNOS];
  
   Int_t i;
   for (i=0; i<fkNIS; i++) fInnerSec[i].Setup(par,0);
@@ -6835,29 +6836,6 @@ Int_t AliTPCtrackerMI::CookLabel(AliTPCseed *t, Float_t wrong,Int_t first, Int_t
 }
 
 
-Int_t  AliTPCtrackerMI::AliTPCSector::GetRowNumber(Double_t x) const 
-{
-  //return pad row number for this x
-  Double_t r;
-  if (fN < 64){
-    r=fRow[fN-1].GetX();
-    if (x > r) return fN;
-    r=fRow[0].GetX();
-    if (x < r) return -1;
-    return Int_t((x-r)/fPadPitchLength + 0.5);}
-  else{    
-    r=fRow[fN-1].GetX();
-    if (x > r) return fN;
-    r=fRow[0].GetX();
-    if (x < r) return -1;
-    Double_t r1=fRow[64].GetX();
-    if(x<r1){       
-      return Int_t((x-r)/f1PadPitchLength + 0.5);}
-    else{
-      return (Int_t((x-r1)/f2PadPitchLength + 0.5)+64);} 
-  }
-}
-
 Int_t  AliTPCtrackerMI::GetRowNumber(Double_t x[3]) const 
 {
   //return pad row number for given x vector
@@ -6870,193 +6848,6 @@ Int_t  AliTPCtrackerMI::GetRowNumber(Double_t x[3]) const
   return GetRowNumber(localx);
 }
 
-//_________________________________________________________________________
-void AliTPCtrackerMI::AliTPCSector::Setup(const AliTPCParam *par, Int_t f) {
-  //-----------------------------------------------------------------------
-  // Setup inner sector
-  //-----------------------------------------------------------------------
-  if (f==0) {
-     fAlpha=par->GetInnerAngle();
-     fAlphaShift=par->GetInnerAngleShift();
-     fPadPitchWidth=par->GetInnerPadPitchWidth();
-     fPadPitchLength=par->GetInnerPadPitchLength();
-     fN=par->GetNRowLow();
-     if(fRow)delete [] fRow;fRow = 0;
-     fRow=new AliTPCtrackerRow[fN];
-     for (Int_t i=0; i<fN; i++) {
-       fRow[i].SetX(par->GetPadRowRadiiLow(i));
-       fRow[i].SetDeadZone(1.5);  //1.5 cm of dead zone
-     }
-  } else {
-     fAlpha=par->GetOuterAngle();
-     fAlphaShift=par->GetOuterAngleShift();
-     fPadPitchWidth  = par->GetOuterPadPitchWidth();
-     fPadPitchLength = par->GetOuter1PadPitchLength();
-     f1PadPitchLength = par->GetOuter1PadPitchLength();
-     f2PadPitchLength = par->GetOuter2PadPitchLength();
-     fN=par->GetNRowUp();
-     if(fRow)delete [] fRow;fRow = 0;
-     fRow=new AliTPCtrackerRow[fN];
-     for (Int_t i=0; i<fN; i++) {
-       fRow[i].SetX(par->GetPadRowRadiiUp(i)); 
-       fRow[i].SetDeadZone(1.5);  // 1.5 cm of dead zone
-     }
-  } 
-}
-
-AliTPCtrackerRow::AliTPCtrackerRow():
-  fDeadZone(0.),
-  fClusters1(0),
-  fN1(0),
-  fClusters2(0),
-  fN2(0),
-  fN(0),
-  fX(0.)
-{
-  //
-  // default constructor
-  //
-}
-
-AliTPCtrackerRow::~AliTPCtrackerRow(){
-  //
-  for (Int_t i = 0; i < fN1; i++)
-    fClusters1[i].~AliTPCclusterMI();
-  delete [] fClusters1;
-  for (Int_t i = 0; i < fN2; i++)
-    fClusters2[i].~AliTPCclusterMI();
-  delete [] fClusters2;
-}
-
-
-
-//_________________________________________________________________________
-void 
-AliTPCtrackerRow::InsertCluster(const AliTPCclusterMI* c, UInt_t index) {
-  //-----------------------------------------------------------------------
-  // Insert a cluster into this pad row in accordence with its y-coordinate
-  //-----------------------------------------------------------------------
-  if (fN==kMaxClusterPerRow) {
-    //AliInfo("AliTPCtrackerRow::InsertCluster(): Too many clusters"); 
-    return;
-  }
-  if (fN>=fN1+fN2) {
-    //AliInfo("AliTPCtrackerRow::InsertCluster(): Too many clusters !");
-  }
-
-  if (fN==0) {fIndex[0]=index; fClusters[fN++]=c; return;}
-  Int_t i=Find(c->GetZ());
-  memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTPCclusterMI*));
-  memmove(fIndex   +i+1 ,fIndex   +i,(fN-i)*sizeof(UInt_t));
-  fIndex[i]=index; fClusters[i]=c; fN++;
-}
-
-void AliTPCtrackerRow::ResetClusters() {
-   //
-   // reset clusters
-   // MvL: Need to call destructors for AliTPCclusterMI, to delete fInfo
-   for (Int_t i = 0; i < fN1; i++)
-     fClusters1[i].~AliTPCclusterMI();
-   delete [] fClusters1;  fClusters1=0;
-   for (Int_t i = 0; i < fN2; i++)
-     fClusters2[i].~AliTPCclusterMI();
-   delete [] fClusters2;  fClusters2=0;
-
-   fN  = 0; 
-   fN1 = 0;
-   fN2 = 0;
-   //delete[] fClusterArray; 
-
-   //fClusterArray=0;
-}
-
-
-//___________________________________________________________________
-Int_t AliTPCtrackerRow::Find(Double_t z) const {
-  //-----------------------------------------------------------------------
-  // Return the index of the nearest cluster 
-  //-----------------------------------------------------------------------
-  if (fN==0) return 0;
-  if (z <= fClusters[0]->GetZ()) return 0;
-  if (z > fClusters[fN-1]->GetZ()) return fN;
-  Int_t b=0, e=fN-1, m=(b+e)/2;
-  for (; b<e; m=(b+e)/2) {
-    if (z > fClusters[m]->GetZ()) b=m+1;
-    else e=m; 
-  }
-  return m;
-}
-
-
-
-//___________________________________________________________________
-AliTPCclusterMI * AliTPCtrackerRow::FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const {
-  //-----------------------------------------------------------------------
-  // Return the index of the nearest cluster in z y 
-  //-----------------------------------------------------------------------
-  Float_t maxdistance = roady*roady + roadz*roadz;
-
-  AliTPCclusterMI *cl =0;
-  for (Int_t i=Find(z-roadz); i<fN; i++) {
-      AliTPCclusterMI *c=(AliTPCclusterMI*)(fClusters[i]);
-      if (c->GetZ() > z+roadz) break;
-      if ( (c->GetY()-y) >  roady ) continue;
-      Float_t distance = (c->GetZ()-z)*(c->GetZ()-z)+(c->GetY()-y)*(c->GetY()-y);
-      if (maxdistance>distance) {
-       maxdistance = distance;
-       cl=c;       
-      }
-  }
-  return cl;      
-}
-
-AliTPCclusterMI * AliTPCtrackerRow::FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz,UInt_t & index) const 
-{
-  //-----------------------------------------------------------------------
-  // Return the index of the nearest cluster in z y 
-  //-----------------------------------------------------------------------
-  Float_t maxdistance = roady*roady + roadz*roadz;
-  AliTPCclusterMI *cl =0;
-
-  //PH Check boundaries. 510 is the size of fFastCluster
-  Int_t iz1 = Int_t(z-roadz+254.5);
-  if (iz1<0 || iz1>=510) return cl;
-  iz1 = TMath::Max(GetFastCluster(iz1)-1,0);
-  Int_t iz2 = Int_t(z+roadz+255.5);
-  if (iz2<0 || iz2>=510) return cl;
-  iz2 = TMath::Min(GetFastCluster(iz2)+1,fN);
-  Bool_t skipUsed = !(AliTPCReconstructor::GetRecoParam()->GetClusterSharing());
-  //FindNearest3(y,z,roady,roadz,index);
-  //  for (Int_t i=Find(z-roadz); i<fN; i++) {
-  for (Int_t i=iz1; i<iz2; i++) {
-      AliTPCclusterMI *c=(AliTPCclusterMI*)(fClusters[i]);
-      if (c->GetZ() > z+roadz) break;
-      if ( c->GetY()-y >  roady ) continue;
-      if ( y-c->GetY() >  roady ) continue;
-      if (skipUsed && c->IsUsed(11)) continue;
-      Float_t distance = (c->GetZ()-z)*(c->GetZ()-z)+(c->GetY()-y)*(c->GetY()-y);
-      if (maxdistance>distance) {
-       maxdistance = distance;
-       cl=c;       
-       index =i;
-       //roady = TMath::Sqrt(maxdistance);
-      }
-  }
-  return cl;      
-}
-
-
-void AliTPCtrackerRow::SetFastCluster(Int_t i, Short_t cl){
-  //
-  // Set cluster info for fast navigation
-  //
-  if (i>510|| i<0){
-  }else{
-    fFastCluster[i]=cl;
-  }
-}
-
-
 
 
 void AliTPCtrackerMI::MakeBitmaps(AliTPCseed *t)
index 8ea8111ab29cd2e25b3388a00d48c8d03bcdbdbe..84068b99967da9080c90eaefa81465f9304ce239 100644 (file)
@@ -18,6 +18,7 @@
 #include "AliTPCreco.h"
 #include "AliPID.h"
 #include "AliTPCclusterMI.h"
+#include "AliTPCtrackerSector.h"
 
 
 class TFile;
@@ -31,59 +32,6 @@ class TTreeSRedirector;
 class AliTrackPoint;
 
 
-class AliTPCtrackerRow : public TObject{
-public:
-  AliTPCtrackerRow();
-  ~AliTPCtrackerRow();
-  void InsertCluster(const AliTPCclusterMI *c, UInt_t index);
-  void ResetClusters();
-  operator int() const {return fN;}
-  Int_t GetN() const {return fN;}
-  const AliTPCclusterMI* operator[](Int_t i) const {return fClusters[i];}
-  UInt_t GetIndex(Int_t i) const {return fIndex[i];}
-  inline Int_t Find(Double_t z) const; 
-  AliTPCclusterMI *  FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const;
-  AliTPCclusterMI *  FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
-  
-  void SetX(Double_t x) {fX=x;}
-  Double_t GetX() const {return fX;}
-  Float_t GetDeadZone() const {return fDeadZone;}
-  void SetDeadZone(Float_t d) {fDeadZone=d;}
-  Int_t GetN1() const {return fN1;}
-  void SetN1(Int_t n) {fN1=n;}
-  Int_t GetN2() const {return fN2;}
-  void SetN2(Int_t n) {fN2=n;}
-  AliTPCclusterMI* GetClusters1() const {return fClusters1;}
-  AliTPCclusterMI* GetClusters2() const {return fClusters2;}
-  void SetClusters1(AliTPCclusterMI* cl) {fClusters1=cl;}
-  void SetClusters2(AliTPCclusterMI* cl) {fClusters2=cl;}
-  void SetCluster1(Int_t i, const AliTPCclusterMI &cl) {fClusters1[i]=cl;}
-  void SetCluster2(Int_t i, const AliTPCclusterMI &cl) {fClusters2[i]=cl;}
-  AliTPCclusterMI* GetCluster1(Int_t i) const {return &fClusters1[i];}
-  AliTPCclusterMI* GetCluster2(Int_t i) const {return &fClusters2[i];}
-  Short_t GetFastCluster(Int_t i) const {return fFastCluster[i];}
-  void SetFastCluster(Int_t i, Short_t cl);
-  
-private:  
-  AliTPCtrackerRow & operator=(const AliTPCtrackerRow & );
-  AliTPCtrackerRow(const AliTPCtrackerRow& /*r*/);           //dummy copy constructor
-  Float_t fDeadZone;  // the width of the dead zone
-  AliTPCclusterMI *fClusters1; //array with clusters 1
-  Int_t fN1;  //number of clusters on left side
-  AliTPCclusterMI *fClusters2; //array with clusters 2
-  Int_t fN2; // number of clusters on right side of the TPC
-  Short_t fFastCluster[510];   //index of the nearest cluster at given position
-  Int_t fN;                                          //number of clusters 
-  const AliTPCclusterMI *fClusters[kMaxClusterPerRow]; //pointers to clusters
-  // indexes for cluster at given position z  
-  // AliTPCclusterMI *fClustersArray;                     // 
-  UInt_t fIndex[kMaxClusterPerRow];                  //indeces of clusters
-  Double_t fX;                                 //X-coordinate of this row  
-  ClassDef(AliTPCtrackerRow,0)
-};
-
-
-
 
 class AliTPCtrackerMI : public AliTracker {
 public:
@@ -158,51 +106,7 @@ public:
    Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z);
 
  public:
-//**************** Internal tracker class ********************** 
-   class AliTPCSector;
-
-//**************** Internal tracker class ********************** 
-   class AliTPCSector {
-   public:
-     AliTPCSector():
-       fN(0),
-       fRow(0),
-       fAlpha(0.),
-       fAlphaShift(0.),
-       fPadPitchWidth(0.),
-       fPadPitchLength(0.),
-       f1PadPitchLength(0.),
-       f2PadPitchLength(0.){}
-    ~AliTPCSector() { delete[] fRow; }
-    AliTPCtrackerRow& operator[](Int_t i) const { return *(fRow+i); }
-    Int_t GetNRows() const { return fN; }
-    void Setup(const AliTPCParam *par, Int_t flag);
-    Double_t GetX(Int_t l) const {return fRow[l].GetX();}
-    Double_t GetMaxY(Int_t l) const {
-      return GetX(l)*TMath::Tan(0.5*GetAlpha());
-    } 
-    Double_t GetAlpha() const {return fAlpha;}
-    Double_t GetAlphaShift() const {return fAlphaShift;}     
-    //Int_t GetFirst(){return fFirstRow;}
-    Int_t GetRowNumber(Double_t  x) const;
-    Double_t GetPadPitchWidth()  const {return fPadPitchWidth;}
-    Double_t GetPadPitchLength() const {return fPadPitchLength;}
-    Double_t GetPadPitchLength(Float_t x) const {return (x<200) ? fPadPitchLength:f2PadPitchLength ;}
-    
-   private:
-    AliTPCSector & operator=(const AliTPCSector & );
-    AliTPCSector(const AliTPCSector &/*s*/);           //dummy copy contructor 
-    Int_t fN;                        //number of pad rows 
-    //Int_t fFirstRow;                 //offset
-    AliTPCtrackerRow *fRow;                    //array of pad rows
-    Double_t fAlpha;                    //opening angle
-    Double_t fAlphaShift;               //shift angle;
-    Double_t fPadPitchWidth;            //pad pitch width
-    Double_t fPadPitchLength;           //pad pitch length
-    Double_t f1PadPitchLength;           //pad pitch length
-    Double_t f2PadPitchLength;           //pad pitch length
-    
-   };
+
 
    Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
    void  SignShared(AliTPCseed * s1, AliTPCseed * s2);
@@ -263,12 +167,12 @@ private:
    void MakeBitmaps(AliTPCseed *t);
 
    const Int_t fkNIS;        //number of inner sectors
-   AliTPCSector *fInnerSec;  //array of inner sectors;
+   AliTPCtrackerSector *fInnerSec;  //array of inner sectors;
    const Int_t fkNOS;        //number of outer sectors
-   AliTPCSector *fOuterSec;  //array of outer sectors;
+   AliTPCtrackerSector *fOuterSec;  //array of outer sectors;
 
    Int_t fN;               //number of loaded sectors
-   AliTPCSector *fSectors; //pointer to loaded sectors;
+   AliTPCtrackerSector *fSectors; //pointer to loaded sectors;
    //
    TTree * fInput;       // input tree with clusters
    TTree * fOutput;      // output tree with tracks
diff --git a/TPC/AliTPCtrackerSector.cxx b/TPC/AliTPCtrackerSector.cxx
new file mode 100644 (file)
index 0000000..7dcd4fc
--- /dev/null
@@ -0,0 +1,265 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+//-------------------------------------------------------
+//          Implementation of the TPC tracker helper clasess
+//  AliTPCtrackerRow
+//  AliTPCtrackerSector
+//
+//   Origin: Marian Ivanov   Marian.Ivanov@cern.ch
+// 
+//  AliTPCtrakerMI -  parallel tracker helper clases
+//
+
+/* $Id: AliTPCtrackerSector.cxx 25837 2008-05-16 16:39:00Z marian $ */
+
+#include "Riostream.h"
+#include <TClonesArray.h>
+#include "AliLog.h"
+#include "AliComplexCluster.h"
+#include "AliTPCcluster.h"
+#include "AliTPCclusterMI.h"
+#include "AliTPCClustersRow.h"
+#include "AliTPCParam.h"
+#include "AliTPCReconstructor.h"
+#include "AliTPCreco.h"
+//
+#include "AliTPCtrackerSector.h"
+#include "TStopwatch.h"
+#include "TTreeStream.h"
+
+//
+
+ClassImp(AliTPCtrackerRow)
+ClassImp(AliTPCtrackerSector)
+
+
+
+AliTPCtrackerRow::AliTPCtrackerRow():
+  fDeadZone(0.),
+  fClusters1(0),
+  fN1(0),
+  fClusters2(0),
+  fN2(0),
+  fN(0),
+  fX(0.)
+{
+  //
+  // default constructor
+  //
+}
+
+AliTPCtrackerRow::~AliTPCtrackerRow(){
+  //
+  for (Int_t i = 0; i < fN1; i++)
+    fClusters1[i].~AliTPCclusterMI();
+  delete [] fClusters1;
+  for (Int_t i = 0; i < fN2; i++)
+    fClusters2[i].~AliTPCclusterMI();
+  delete [] fClusters2;
+}
+
+
+
+//_________________________________________________________________________
+void 
+AliTPCtrackerRow::InsertCluster(const AliTPCclusterMI* c, UInt_t index) {
+  //-----------------------------------------------------------------------
+  // Insert a cluster into this pad row in accordence with its y-coordinate
+  //-----------------------------------------------------------------------
+  if (fN==kMaxClusterPerRow) {
+    //AliInfo("AliTPCtrackerRow::InsertCluster(): Too many clusters"); 
+    return;
+  }
+  if (fN>=fN1+fN2) {
+    //AliInfo("AliTPCtrackerRow::InsertCluster(): Too many clusters !");
+  }
+
+  if (fN==0) {fIndex[0]=index; fClusters[fN++]=c; return;}
+  Int_t i=Find(c->GetZ());
+  memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTPCclusterMI*));
+  memmove(fIndex   +i+1 ,fIndex   +i,(fN-i)*sizeof(UInt_t));
+  fIndex[i]=index; fClusters[i]=c; fN++;
+}
+
+void AliTPCtrackerRow::ResetClusters() {
+   //
+   // reset clusters
+   // MvL: Need to call destructors for AliTPCclusterMI, to delete fInfo
+   for (Int_t i = 0; i < fN1; i++)
+     fClusters1[i].~AliTPCclusterMI();
+   delete [] fClusters1;  fClusters1=0;
+   for (Int_t i = 0; i < fN2; i++)
+     fClusters2[i].~AliTPCclusterMI();
+   delete [] fClusters2;  fClusters2=0;
+
+   fN  = 0; 
+   fN1 = 0;
+   fN2 = 0;
+   //delete[] fClusterArray; 
+
+   //fClusterArray=0;
+}
+
+
+//___________________________________________________________________
+Int_t AliTPCtrackerRow::Find(Double_t z) const {
+  //-----------------------------------------------------------------------
+  // Return the index of the nearest cluster 
+  //-----------------------------------------------------------------------
+  if (fN==0) return 0;
+  if (z <= fClusters[0]->GetZ()) return 0;
+  if (z > fClusters[fN-1]->GetZ()) return fN;
+  Int_t b=0, e=fN-1, m=(b+e)/2;
+  for (; b<e; m=(b+e)/2) {
+    if (z > fClusters[m]->GetZ()) b=m+1;
+    else e=m; 
+  }
+  return m;
+}
+
+
+
+//___________________________________________________________________
+AliTPCclusterMI * AliTPCtrackerRow::FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const {
+  //-----------------------------------------------------------------------
+  // Return the index of the nearest cluster in z y 
+  //-----------------------------------------------------------------------
+  Float_t maxdistance = roady*roady + roadz*roadz;
+
+  AliTPCclusterMI *cl =0;
+  for (Int_t i=Find(z-roadz); i<fN; i++) {
+      AliTPCclusterMI *c=(AliTPCclusterMI*)(fClusters[i]);
+      if (c->GetZ() > z+roadz) break;
+      if ( (c->GetY()-y) >  roady ) continue;
+      Float_t distance = (c->GetZ()-z)*(c->GetZ()-z)+(c->GetY()-y)*(c->GetY()-y);
+      if (maxdistance>distance) {
+       maxdistance = distance;
+       cl=c;       
+      }
+  }
+  return cl;      
+}
+
+AliTPCclusterMI * AliTPCtrackerRow::FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz,UInt_t & index) const 
+{
+  //-----------------------------------------------------------------------
+  // Return the index of the nearest cluster in z y 
+  //-----------------------------------------------------------------------
+  Float_t maxdistance = roady*roady + roadz*roadz;
+  AliTPCclusterMI *cl =0;
+
+  //PH Check boundaries. 510 is the size of fFastCluster
+  Int_t iz1 = Int_t(z-roadz+254.5);
+  if (iz1<0 || iz1>=510) return cl;
+  iz1 = TMath::Max(GetFastCluster(iz1)-1,0);
+  Int_t iz2 = Int_t(z+roadz+255.5);
+  if (iz2<0 || iz2>=510) return cl;
+  iz2 = TMath::Min(GetFastCluster(iz2)+1,fN);
+  Bool_t skipUsed = !(AliTPCReconstructor::GetRecoParam()->GetClusterSharing());
+  //FindNearest3(y,z,roady,roadz,index);
+  //  for (Int_t i=Find(z-roadz); i<fN; i++) {
+  for (Int_t i=iz1; i<iz2; i++) {
+      AliTPCclusterMI *c=(AliTPCclusterMI*)(fClusters[i]);
+      if (c->GetZ() > z+roadz) break;
+      if ( c->GetY()-y >  roady ) continue;
+      if ( y-c->GetY() >  roady ) continue;
+      if (skipUsed && c->IsUsed(11)) continue;
+      Float_t distance = (c->GetZ()-z)*(c->GetZ()-z)+(c->GetY()-y)*(c->GetY()-y);
+      if (maxdistance>distance) {
+       maxdistance = distance;
+       cl=c;       
+       index =i;
+       //roady = TMath::Sqrt(maxdistance);
+      }
+  }
+  return cl;      
+}
+
+
+void AliTPCtrackerRow::SetFastCluster(Int_t i, Short_t cl){
+  //
+  // Set cluster info for fast navigation
+  //
+  if (i>510|| i<0){
+  }else{
+    fFastCluster[i]=cl;
+  }
+}
+
+
+Int_t  AliTPCtrackerSector::GetRowNumber(Double_t x) const 
+{
+  //return pad row number for this x
+  Double_t r;
+  if (fN < 64){
+    r=fRow[fN-1].GetX();
+    if (x > r) return fN;
+    r=fRow[0].GetX();
+    if (x < r) return -1;
+    return Int_t((x-r)/fPadPitchLength + 0.5);}
+  else{    
+    r=fRow[fN-1].GetX();
+    if (x > r) return fN;
+    r=fRow[0].GetX();
+    if (x < r) return -1;
+    Double_t r1=fRow[64].GetX();
+    if(x<r1){       
+      return Int_t((x-r)/f1PadPitchLength + 0.5);}
+    else{
+      return (Int_t((x-r1)/f2PadPitchLength + 0.5)+64);} 
+  }
+}
+
+//_________________________________________________________________________
+void AliTPCtrackerSector::Setup(const AliTPCParam *par, Int_t f) {
+  //-----------------------------------------------------------------------
+  // Setup inner sector
+  //-----------------------------------------------------------------------
+  if (f==0) {
+     fAlpha=par->GetInnerAngle();
+     fAlphaShift=par->GetInnerAngleShift();
+     fPadPitchWidth=par->GetInnerPadPitchWidth();
+     fPadPitchLength=par->GetInnerPadPitchLength();
+     fN=par->GetNRowLow();
+     if(fRow)delete [] fRow;fRow = 0;
+     fRow=new AliTPCtrackerRow[fN];
+     for (Int_t i=0; i<fN; i++) {
+       fRow[i].SetX(par->GetPadRowRadiiLow(i));
+       fRow[i].SetDeadZone(1.5);  //1.5 cm of dead zone
+     }
+  } else {
+     fAlpha=par->GetOuterAngle();
+     fAlphaShift=par->GetOuterAngleShift();
+     fPadPitchWidth  = par->GetOuterPadPitchWidth();
+     fPadPitchLength = par->GetOuter1PadPitchLength();
+     f1PadPitchLength = par->GetOuter1PadPitchLength();
+     f2PadPitchLength = par->GetOuter2PadPitchLength();
+     fN=par->GetNRowUp();
+     if(fRow)delete [] fRow;fRow = 0;
+     fRow=new AliTPCtrackerRow[fN];
+     for (Int_t i=0; i<fN; i++) {
+       fRow[i].SetX(par->GetPadRowRadiiUp(i)); 
+       fRow[i].SetDeadZone(1.5);  // 1.5 cm of dead zone
+     }
+  } 
+}
+
+
+
+
+
+
diff --git a/TPC/AliTPCtrackerSector.h b/TPC/AliTPCtrackerSector.h
new file mode 100644 (file)
index 0000000..63aa91d
--- /dev/null
@@ -0,0 +1,123 @@
+#ifndef ALITPCTRACKERSECTOR_H
+#define ALITPCTRACKERSECTOR_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+/* $Id: AliTPCtrackerSector.h 25837 2008-05-16 16:39:00Z marian $ */
+
+//-------------------------------------------------------
+//   TPC tracker - helper classes for cluster storing
+//                 and navigation                   
+//   
+//
+//   Origin: 
+//-------------------------------------------------------
+
+
+//class TFile;
+class AliTPCParam;
+class TTreeSRedirector;
+
+
+
+class AliTPCtrackerRow : public TObject{
+public:
+  AliTPCtrackerRow();
+  ~AliTPCtrackerRow();
+  void InsertCluster(const AliTPCclusterMI *c, UInt_t index);
+  void ResetClusters();
+  operator int() const {return fN;}
+  Int_t GetN() const {return fN;}
+  const AliTPCclusterMI* operator[](Int_t i) const {return fClusters[i];}
+  UInt_t GetIndex(Int_t i) const {return fIndex[i];}
+  inline Int_t Find(Double_t z) const; 
+  AliTPCclusterMI *  FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const;
+  AliTPCclusterMI *  FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
+  
+  void SetX(Double_t x) {fX=x;}
+  Double_t GetX() const {return fX;}
+  Float_t GetDeadZone() const {return fDeadZone;}
+  void SetDeadZone(Float_t d) {fDeadZone=d;}
+  Int_t GetN1() const {return fN1;}
+  void SetN1(Int_t n) {fN1=n;}
+  Int_t GetN2() const {return fN2;}
+  void SetN2(Int_t n) {fN2=n;}
+  AliTPCclusterMI* GetClusters1() const {return fClusters1;}
+  AliTPCclusterMI* GetClusters2() const {return fClusters2;}
+  void SetClusters1(AliTPCclusterMI* cl) {fClusters1=cl;}
+  void SetClusters2(AliTPCclusterMI* cl) {fClusters2=cl;}
+  void SetCluster1(Int_t i, const AliTPCclusterMI &cl) {fClusters1[i]=cl;}
+  void SetCluster2(Int_t i, const AliTPCclusterMI &cl) {fClusters2[i]=cl;}
+  AliTPCclusterMI* GetCluster1(Int_t i) const {return &fClusters1[i];}
+  AliTPCclusterMI* GetCluster2(Int_t i) const {return &fClusters2[i];}
+  Short_t GetFastCluster(Int_t i) const {return fFastCluster[i];}
+  void SetFastCluster(Int_t i, Short_t cl);
+  
+private:  
+  AliTPCtrackerRow & operator=(const AliTPCtrackerRow & );
+  AliTPCtrackerRow(const AliTPCtrackerRow& /*r*/);           //dummy copy constructor
+  Float_t fDeadZone;  // the width of the dead zone
+  AliTPCclusterMI *fClusters1; //array with clusters 1
+  Int_t fN1;  //number of clusters on left side
+  AliTPCclusterMI *fClusters2; //array with clusters 2
+  Int_t fN2; // number of clusters on right side of the TPC
+  Short_t fFastCluster[510];   //index of the nearest cluster at given position
+  Int_t fN;                                          //number of clusters 
+  const AliTPCclusterMI *fClusters[kMaxClusterPerRow]; //pointers to clusters
+  // indexes for cluster at given position z  
+  // AliTPCclusterMI *fClustersArray;                     // 
+  UInt_t fIndex[kMaxClusterPerRow];                  //indeces of clusters
+  Double_t fX;                                 //X-coordinate of this row  
+  ClassDef(AliTPCtrackerRow,0)
+};
+
+
+//**************** Internal tracker class ********************** 
+class AliTPCtrackerSector: public TObject {
+ public:
+  AliTPCtrackerSector():
+    fN(0),
+    fRow(0),
+    fAlpha(0.),
+    fAlphaShift(0.),
+    fPadPitchWidth(0.),
+    fPadPitchLength(0.),
+    f1PadPitchLength(0.),
+    f2PadPitchLength(0.){}
+    ~AliTPCtrackerSector() { delete[] fRow; }
+    AliTPCtrackerRow& operator[](Int_t i) const { return *(fRow+i); }
+    Int_t GetNRows() const { return fN; }
+    void Setup(const AliTPCParam *par, Int_t flag);
+    Double_t GetX(Int_t l) const {return fRow[l].GetX();}
+    Double_t GetMaxY(Int_t l) const {
+      return GetX(l)*TMath::Tan(0.5*GetAlpha());
+    } 
+    Double_t GetAlpha() const {return fAlpha;}
+    Double_t GetAlphaShift() const {return fAlphaShift;}     
+    //Int_t GetFirst(){return fFirstRow;}
+    Int_t GetRowNumber(Double_t  x) const;
+    Double_t GetPadPitchWidth()  const {return fPadPitchWidth;}
+    Double_t GetPadPitchLength() const {return fPadPitchLength;}
+    Double_t GetPadPitchLength(Float_t x) const {return (x<200) ? fPadPitchLength:f2PadPitchLength ;}
+    
+ private:
+    AliTPCtrackerSector & operator=(const AliTPCtrackerSector & );
+    AliTPCtrackerSector(const AliTPCtrackerSector &/*s*/);           //dummy copy contructor 
+    Int_t fN;                           //number of pad rows 
+    //Int_t fFirstRow;                  //offset
+    AliTPCtrackerRow *fRow;             //array of pad rows
+    Double_t fAlpha;                    //opening angle
+    Double_t fAlphaShift;               //shift angle;
+    Double_t fPadPitchWidth;            //pad pitch width
+    Double_t fPadPitchLength;           //pad pitch length
+    Double_t f1PadPitchLength;          //pad pitch length
+    Double_t f2PadPitchLength;          //pad pitch length  
+    ClassDef(AliTPCtrackerSector,1)
+};
+
+
+
+#endif
+
+
index c3df5f5da7ac7e233cc74c2c4fec98ba7ca591c5..af0401eb4f75ad30b17733809ae65d3e65a93753 100644 (file)
@@ -36,6 +36,7 @@
 #pragma link C++ class AliTPCpolyTrack+;
 #pragma link C++ class AliTPCseed+;         
 #pragma link C++ class AliTPCtrackerRow+;
+#pragma link C++ class AliTPCtrackerSector+;
 #pragma link C++ class AliTPCtrackerMI+;
 
 #pragma link C++ class AliTPCPid+;
index acb9aa689548348b3799c39f414616db484f0d30..d33e5a2f35ca273369d349ff13a3bea0380201d0 100644 (file)
@@ -7,6 +7,7 @@ SRCS:=  AliTPCcluster.cxx \
        AliTPCclusterer.cxx AliTPCclustererMI.cxx \
        AliTPCtrack.cxx AliTPCtracker.cxx \
        AliTPCpolyTrack.cxx  AliTPCseed.cxx AliTPCtrackerMI.cxx \
+       AliTPCtrackerSector.cxx \
        AliTPCPid.cxx AliTPCtrackPid.cxx AliTPCpidESD.cxx \
        AliTPCReconstructor.cxx AliTPCRecoParam.cxx AliTPCClusterParam.cxx  \
         AliTPCTracklet.cxx AliTPCQADataMakerRec.cxx \