]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCtrackerMI.h
Tracking of secondaries (M.Ivanov)
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackerMI.h
1 #ifndef ALITPCTRACKERMI_H
2 #define ALITPCTRACKERMI_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //-------------------------------------------------------
9 //                       TPC trackerMI
10 //
11 //   Origin: 
12 //-------------------------------------------------------
13 #include "AliTracker.h"
14 #include "AliTPCtrack.h"
15 #include "AliTPCClustersArray.h"
16
17 #include "AliTPCreco.h" 
18 #include "Rtypes.h"
19
20 class TFile;
21 class AliTPCParam;
22 class AliTPCseed;
23 class AliTPCclusterMI;
24 class AliTPCTrackPoint;
25
26
27
28 class AliTPCclusterTracks {
29  public: 
30   AliTPCclusterTracks();
31   Float_t fDistance[3];   // distance to the 3 nerest track if there overlap with cluster
32   Short_t fTrackIndex[3]; // indexes of the  tracks overlapped with clusters 
33 };
34
35
36 class AliTPCseed : public AliTPCtrack {
37    public:
38      AliTPCseed();
39      virtual ~AliTPCseed();
40      AliTPCseed(const AliTPCtrack &t);
41      AliTPCseed(const AliKalmanTrack &t, Double_t a);
42      Int_t Compare(const TObject *o) const;
43      void Reset();
44      Int_t GetProlongation(Double_t xr, Double_t &y, Double_t & z) const;
45      virtual Double_t GetPredictedChi2(const AliTPCclusterMI *cluster) const;
46      virtual Int_t Update(const AliTPCclusterMI* c, Double_t chi2, UInt_t i);
47      AliTPCTrackPoint * GetTrackPoint(Int_t i);
48      void RebuildSeed(); // rebuild seed to be ready for storing
49      AliTPCseed(UInt_t index, const Double_t xx[5], 
50                 const Double_t cc[15], Double_t xr, Double_t alpha);
51      void SetClusterIndex(Int_t index){
52        fClusterIndex[fRow] = index;
53      }
54      void SetErrorY2(Float_t sy2){fErrorY2=sy2;}
55      void SetErrorZ2(Float_t sz2){fErrorZ2=sz2;}
56      void CookdEdx(Double_t low=0.05, Double_t up=0.70);
57      Bool_t IsActive(){ return !(fRemoval);}
58      void Desactivate(Int_t reason){ fRemoval = reason;} 
59      //     Float_t GetRadius(){ return (1-fP2)/fP4;}  
60      Int_t fRelativeSector;  // ! index of current relative sector
61      Int_t   fClusterIndex[200];  //array of cluster indexes
62     
63      Int_t fRemoval;               //reason - why was track removed - 0 - means still active     
64      TClonesArray * fPoints;              // array with points along the track   
65      TClonesArray * fEPoints;             // array with exact points - calculated in special macro not used in tracking
66      Int_t fRow;                 //! current row number  
67      Int_t fSector;              //!current sector number
68      Float_t fCurrentSigmaY;     //!expected current cluster sigma Y
69      Float_t fCurrentSigmaZ;     //!expected current cluster sigma Z
70      AliTPCclusterMI * fCurrentCluster; //!pointer to the current cluster for prolongation
71      Int_t   fCurrentClusterIndex1; //! index of the current cluster
72      Int_t   fCurrentClusterIndex2; //! index of the current cluster
73     
74      Float_t fErrorY2;   //!sigma of current cluster 
75      Float_t fErrorZ2;   //!sigma of current cluster    
76      Int_t   fNFoundable;      //number of foundable clusters - dead zone taken to the account
77      Bool_t  fInDead;         // indicate if the track is in dead zone
78      Int_t   fFirstPoint;    // first cluster position
79      Int_t   fLastPoint;     // last  cluster position     
80      Int_t   fNShared;       // number of shared points
81      Bool_t  fIsSeeding;     //indicates if it is proces of seeading
82      Bool_t  fStopped;      // indicate that track cann't be prolongate anymore (for secondaries)
83    private:
84      Float_t fSdEdx;           // sigma of dedx
85      Float_t fMAngular;        // mean angular factor
86      AliTPCTrackPoint   ** fTrackPoints;  //!track points - array track points
87      Float_t fDEDX[4];         // dedx according padrows
88      Float_t fSDEDX[4];        // sdedx according padrows
89      Int_t   fNCDEDX[4];       // number of clusters for dedx measurment
90    
91      ClassDef(AliTPCseed,1)  
92 };
93
94
95
96
97 class AliTPCtrackerMI : public AliTracker {
98 public:
99    AliTPCtrackerMI():AliTracker(),fkNIS(0),fkNOS(0) {
100       fInnerSec=fOuterSec=0; fSeeds=0; 
101    }
102    AliTPCtrackerMI(const AliTPCParam *par, Int_t eventn=0);
103   ~AliTPCtrackerMI();
104
105    Int_t ReadSeeds(const TFile *in);
106    void LoadClusters();
107    void UnloadClusters();
108
109    void LoadInnerSectors();
110    void LoadOuterSectors();
111    AliCluster * GetCluster (int) const {return 0;}
112    AliTPCclusterMI *GetClusterMI(Int_t index) const;
113    Int_t Clusters2Tracks(const TFile *in, TFile *out);
114    //   Int_t PropagateBack(const TFile *in, TFile *out);
115
116    virtual void  CookLabel(AliKalmanTrack *t,Float_t wrong) const; 
117
118    virtual Double_t ErrY2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
119    virtual Double_t ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);   
120
121    Double_t f1(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3); 
122    Double_t f2(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3); 
123    Double_t f3(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2); 
124 public:
125 //**************** Internal tracker class ********************** 
126    class AliTPCRow {
127    public:
128      AliTPCRow() {fN=0; fClusterTracks=0;}
129      ~AliTPCRow();
130      void InsertCluster(const AliTPCclusterMI *c, UInt_t index);
131      operator int() const {return fN;}
132      const AliTPCclusterMI* operator[](Int_t i) const {return fClusters[i];}
133      UInt_t GetIndex(Int_t i) const {return fIndex[i];}
134      Int_t Find(Double_t z) const; 
135      AliTPCclusterMI *  FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const;
136      void SetX(Double_t x) {fX=x;}
137      Double_t GetX() const {return fX;}
138      AliTPCclusterTracks *  GetClusterTracks(Int_t index){ return ( (index<fN) && fClusterTracks!=0)? &(fClusterTracks[index]):0;}
139      void UpdateClusterTrack(Int_t clindex, Int_t trindex,AliTPCseed * seed); 
140      void MakeClusterTracks();
141      void ClearClusterTracks();
142      Float_t fDeadZone;  // the width of the dead zone
143    private:
144      Int_t fN;                                          //number of clusters 
145      const AliTPCclusterMI *fClusters[kMaxClusterPerRow]; //pointers to clusters
146      UInt_t fIndex[kMaxClusterPerRow];                  //indeces of clusters
147      Double_t fX;                                 //X-coordinate of this row
148      AliTPCclusterTracks * fClusterTracks;        // array of cluster tracks - for overlap calculation
149    private:
150      AliTPCRow(const AliTPCRow& r);            //dummy copy constructor
151      AliTPCRow &operator=(const AliTPCRow& r); //dummy assignment operator
152    };
153
154 //**************** Internal tracker class ********************** 
155    class AliTPCSector {
156    public:
157      AliTPCSector() { fN=0; fRow = 0; }
158     ~AliTPCSector() { delete[] fRow; }
159      AliTPCRow& operator[](Int_t i) const { return *(fRow+i); }
160      Int_t GetNRows() const { return fN; }
161      void Setup(const AliTPCParam *par, Int_t flag);
162      Double_t GetX(Int_t l) const {return fRow[l].GetX();}
163      Double_t GetMaxY(Int_t l) const {
164          return GetX(l)*TMath::Tan(0.5*GetAlpha());
165      } 
166      Double_t GetAlpha() const {return fAlpha;}
167      Double_t GetAlphaShift() const {return fAlphaShift;}     
168      Int_t GetRowNumber(Double_t x) const {
169         //return pad row number for this x
170        Double_t r;
171        if (fN < 64){
172          r=fRow[fN-1].GetX();
173          if (x > r) return fN;
174          r=fRow[0].GetX();
175          if (x < r) return -1;
176          return Int_t((x-r)/fPadPitchLength + 0.5);}
177        else{    
178            r=fRow[fN-1].GetX();
179            if (x > r) return fN;
180            r=fRow[0].GetX();
181            if (x < r) return -1;
182           Double_t r1=fRow[64].GetX();
183           if(x<r1){       
184             return Int_t((x-r)/f1PadPitchLength + 0.5);}
185           else{
186             return (Int_t((x-r1)/f2PadPitchLength + 0.5)+64);} 
187        }
188      }
189      Double_t GetPadPitchWidth()  const {return fPadPitchWidth;}
190      Double_t GetPadPitchLength() const {return fPadPitchLength;}
191      Double_t GetPadPitchLength(Float_t x) const {return (x<200) ? fPadPitchLength:f2PadPitchLength ;}
192
193    private:
194      Int_t fN;                        //number of pad rows 
195      AliTPCRow *fRow;                    //array of pad rows
196      Double_t fAlpha;                    //opening angle
197      Double_t fAlphaShift;               //shift angle;
198      Double_t fPadPitchWidth;            //pad pitch width
199      Double_t fPadPitchLength;           //pad pitch length
200      Double_t f1PadPitchLength;           //pad pitch length
201      Double_t f2PadPitchLength;           //pad pitch length
202     
203    private:
204      AliTPCSector(const AliTPCSector &s);           //dummy copy contructor
205      AliTPCSector& operator=(const AliTPCSector &s);//dummy assignment operator
206    };
207
208    Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
209    void  SignShared(AliTPCseed * s1, AliTPCseed * s2);
210    void  RemoveOverlap(TObjArray * arr, Float_t factor, Int_t removalindex, Bool_t shared=kFALSE);
211 private:
212    Float_t  GetSigmaY(AliTPCseed * seed);
213    Float_t  GetSigmaZ(AliTPCseed * seed);
214
215    void MakeSeeds(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2);
216    void MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2);
217
218    TObjArray * MakeSeedsSectors(Int_t sec1, Int_t sec2);   // make seeds from all sectors
219    void MakeSeedsAll();
220    Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0);
221    //Int_t FollowProlongationFast(AliTPCseed& t, Int_t step);   
222    Int_t FollowBackProlongation(AliTPCseed& t, Int_t rf=0);
223
224    Int_t FollowToNext(AliTPCseed& t, Int_t nr);
225    Int_t UpdateClusters(AliTPCseed& t, Int_t trindex,  Int_t nr);
226    Int_t FollowToNextCluster( Int_t trindex, Int_t nr);
227
228    virtual Int_t PropagateBack (const TFile *, TFile *){return 0;}
229    void ParallelTracking(Int_t rfirst, Int_t rlast);
230    void SetSampledEdx(AliTPCseed *t, Float_t q, Int_t i) {;}
231    Int_t UpdateTrack(AliTPCseed *t,AliTPCclusterMI* c, Double_t chi2, UInt_t i); //update trackinfo
232
233    //   Int_t FollowBackProlongation(AliTPCseed &s, const AliTPCtrack &t);
234
235    AliTPCtrackerMI(const AliTPCtrackerMI& r);           //dummy copy constructor
236    AliTPCtrackerMI &operator=(const AliTPCtrackerMI& r);//dummy assignment operator
237
238    const Int_t fkNIS;        //number of inner sectors
239    AliTPCSector *fInnerSec;  //array of inner sectors;
240    const Int_t fkNOS;        //number of outer sectors
241    AliTPCSector *fOuterSec;  //array of outer sectors;
242
243    Int_t fN;               //number of loaded sectors
244    AliTPCSector *fSectors; //pointer to loaded sectors;
245
246    Int_t fEventN;                      //event number
247    AliTPCClustersArray fClustersArray; //array of TPC clusters
248    Int_t fNtracks;                     //current number of tracks
249    TObjArray *fSeeds;                  //array of track seeds
250    //   TObjArray * fTrackPointPool;        // ! pool with track points
251    const AliTPCParam *fParam;          //pointer to the parameters
252 };
253
254 #endif
255
256