]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITStrackerV2.h
New classes added
[u/mrichter/AliRoot.git] / ITS / AliITStrackerV2.h
1 #ifndef ALIITSTRACKER_H
2 #define ALIITSTRACKER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 //-------------------------------------------------------------------------
7 //                          ITS tracker
8 //
9 //       Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
10 //-------------------------------------------------------------------------
11 #include "AliTracker.h"
12 #include "AliITSrecoV2.h"
13 #include "AliITStrackV2.h"
14
15 class AliITSclusterV2;
16 class AliITSgeom;
17 class TFile;
18
19
20 //-------------------------------------------------------------------------
21 class AliITStrackerV2 : public AliTracker {
22 public:
23   AliITStrackerV2():AliTracker(){}
24   AliITStrackerV2(const AliITSgeom *geom);
25   AliCluster *GetCluster(Int_t index) const;
26   void LoadClusters();
27   void UnloadClusters();
28   Int_t Clusters2Tracks(const TFile *in, TFile *out);
29   Int_t PropagateBack(const TFile *in, TFile *out);
30   void SetupFirstPass(Int_t *flags, Double_t *cuts=0);
31   void SetupSecondPass(Int_t *flags, Double_t *cuts=0);
32   Bool_t RefitAt(Double_t x, AliITStrackV2 *t, Int_t *index);
33
34   class AliITSdetector {
35   public:
36     AliITSdetector(){}
37     AliITSdetector(Double_t r,Double_t phi) {fR=r; fPhi=phi;}
38     void *operator new(size_t s,AliITSdetector *p) {return p;}
39     Double_t GetR()   const {return fR;}
40     Double_t GetPhi() const {return fPhi;}
41   private:
42     Double_t fR;    // polar coordinates 
43     Double_t fPhi;  // of this detector
44   };
45
46   class AliITSlayer {
47   public:
48     AliITSlayer();
49     AliITSlayer(Double_t r, Double_t p, Double_t z, Int_t nl, Int_t nd);
50    ~AliITSlayer();
51     Int_t InsertCluster(AliITSclusterV2 *c);
52     void ResetClusters();
53     void SelectClusters(Double_t zmi,Double_t zma,Double_t ymi,Double_t yma);
54     const AliITSclusterV2 *GetNextCluster(Int_t &ci);
55     void *operator new(size_t s, AliITSlayer *p) {return p;}
56     Double_t GetR() const {return fR;}
57     AliITSclusterV2 *GetCluster(Int_t i) const {return fClusters[i];} 
58     AliITSdetector &GetDetector(Int_t n) const { return fDetectors[n]; }
59     Int_t FindDetectorIndex(Double_t phi, Double_t z) const;
60     Double_t GetThickness(Double_t y, Double_t z, Double_t &x0) const;
61     Int_t InRoad() const ;
62     Int_t GetNumberOfClusters() const {return fN;}
63     Int_t GetNladders() const {return fNladders;}
64     Int_t GetNdetectors() const {return fNdetectors;}
65   private:
66     Double_t fR;                // mean radius of this layer
67     Double_t fPhiOffset;        // offset of the first detector in Phi
68     Int_t fNladders;            // number of ladders
69     Double_t fZOffset;          // offset of the first detector in Z
70     Int_t fNdetectors;          // detectors/ladder
71     AliITSdetector *fDetectors; // array of detectors
72     Int_t fN;                   // number of clusters
73     AliITSclusterV2 *fClusters[kMaxClusterPerLayer]; // pointers to clusters
74     Double_t fZmax;      //    edges
75     Double_t fYmin;      //   of  the
76     Double_t fYmax;      //   "window"
77     Int_t fI;            // index of the current cluster within the "window"
78     Int_t FindClusterIndex(Double_t z) const;
79   };
80
81 private:
82   void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
83   Double_t GetEffectiveThickness(Double_t y, Double_t z) const;
84   void  FollowProlongation();
85   Int_t TakeNextProlongation();
86   void ResetBestTrack() {
87      fBestTrack.~AliITStrackV2();
88      new(&fBestTrack) AliITStrackV2(fTrackToFollow);
89   }
90   void ResetTrackToFollow(const AliITStrackV2 &t) {
91      fTrackToFollow.~AliITStrackV2();
92      new(&fTrackToFollow) AliITStrackV2(t);
93   }
94   Int_t fI;                              // index of the current layer
95   static AliITSlayer fLayers[kMaxLayer]; // ITS layers
96   AliITStrackV2 fTracks[kMaxLayer];      // track estimations at the ITS layers
97   AliITStrackV2 fBestTrack;              // "best" track 
98   AliITStrackV2 fTrackToFollow;          // followed track
99   Int_t fPass;                           // current pass through the data 
100   Int_t fConstraint[2];                  // constraint flags
101 };
102
103
104 inline void AliITStrackerV2::SetupFirstPass(Int_t *flags, Double_t *cuts) {
105   // This function sets up flags and cuts for the first tracking pass   
106   //
107   //   flags[0] - vertex constaint flag                                
108   //              negative means "skip the pass"                        
109   //              0        means "no constraint"                        
110   //              positive means "normal constraint"                    
111
112    fConstraint[0]=flags[0];
113    if (cuts==0) return;
114 }
115
116 inline void AliITStrackerV2::SetupSecondPass(Int_t *flags, Double_t *cuts) {
117   // This function sets up flags and cuts for the second tracking pass   
118   //
119   //   flags[0] - vertex constaint flag                                
120   //              negative means "skip the pass"                        
121   //              0        means "no constraint"                        
122   //              positive means "normal constraint"                    
123
124    fConstraint[1]=flags[0];
125    if (cuts==0) return;
126 }
127
128 inline void AliITStrackerV2::CookLabel(AliKalmanTrack *t,Float_t wrong) const {
129   //--------------------------------------------------------------------
130   //This function "cooks" a track label. If label<0, this track is fake.
131   //--------------------------------------------------------------------
132    Int_t tpcLabel=t->GetLabel();
133    if (tpcLabel<0) return;
134    AliTracker::CookLabel(t,wrong);
135    if (tpcLabel != t->GetLabel()) t->SetLabel(-tpcLabel); 
136 }
137
138 #endif