]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITStrackerV2.h
dd514a799dd369805419e8c1365632438dc370b1
[u/mrichter/AliRoot.git] / ITS / AliITStrackerV2.h
1 #ifndef ALIITSTRACKERV2_H
2 #define ALIITSTRACKERV2_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 //     reads AliITSRecPoint clusters and creates AliITStrackV2 tracks
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 AliITSRecPoint;
16 class AliESD;
17 class AliITSgeomTGeo;
18 class TTree;
19
20
21 //-------------------------------------------------------------------------
22 class AliITStrackerV2 : public AliTracker {
23 public:
24   AliITStrackerV2();
25   AliITStrackerV2(const AliITSgeomTGeo *geom);
26   ~AliITStrackerV2(){}
27   AliCluster *GetCluster(Int_t index) const;
28   AliITSRecPoint *GetCluster(Int_t l, Int_t c) const {
29     return fgLayers[l].GetCluster(c);
30   }
31   Int_t GetNumberOfClustersLayer(Int_t n) const {
32      return fgLayers[n].GetNumberOfClusters();
33   }   
34   Int_t LoadClusters(TTree *cf);
35   void UnloadClusters();
36   Int_t Clusters2Tracks(AliESD *event);
37   Int_t PropagateBack(AliESD *event);
38   Int_t RefitInward(AliESD *event);
39   Bool_t RefitAt(Double_t x, AliITStrackV2 *seed, 
40                  const AliITStrackV2 *t, Bool_t extra=kFALSE);
41   void SetupFirstPass(Int_t *flags, Double_t *cuts=0);
42   void SetupSecondPass(Int_t *flags, Double_t *cuts=0);
43
44   void SetLastLayerToTrackTo(Int_t l=0) {fLastLayerToTrackTo=l;} 
45   void SetLayersNotToSkip(Int_t *l);
46
47   void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
48
49   class AliITSdetector {
50   public:
51     AliITSdetector():fR(0.),fPhi(0.){}
52     AliITSdetector(Double_t r,Double_t phi):fR(r),fPhi(phi){}
53     Double_t GetR()   const {return fR;}
54     Double_t GetPhi() const {return fPhi;}
55   private:
56     Double_t fR;    // polar coordinates 
57     Double_t fPhi;  // of this detector
58   };
59
60   class AliITSlayer {
61   public:
62     enum {kNsector=5, kMaxClusterPerSector=kMaxClusterPerLayer/kNsector};
63     AliITSlayer();
64     AliITSlayer(Double_t r, Double_t p, Double_t z, Int_t nl, Int_t nd);
65    ~AliITSlayer();
66     Int_t InsertCluster(AliITSRecPoint *c);
67     void ResetClusters();
68     Int_t SelectClusters(Float_t zmi, Float_t zma, Float_t ymi, Float_t yma);
69     const AliITSRecPoint *GetNextCluster(Int_t &ci);
70     void ResetRoad();
71     Double_t GetRoad() const {return fRoad;}
72     Double_t GetR() const {return fR;}
73     AliITSRecPoint *GetCluster(Int_t i) const { return fClusters[i]; } 
74     AliITSdetector &GetDetector(Int_t n) const { return fDetectors[n]; }
75     Int_t FindDetectorIndex(Double_t phi, Double_t z) const;
76     Double_t GetThickness(Double_t y, Double_t z, Double_t &x0) const;
77     Int_t GetNladders() const {return fNladders;}
78     Int_t GetNdetectors() const {return fNdetectors;}
79     Int_t GetNumberOfClusters() const;
80   protected:
81     AliITSlayer(const AliITSlayer&);
82     AliITSlayer &operator=(const AliITSlayer &tr);  
83     Double_t fR;                // mean radius of this layer
84     Double_t fPhiOffset;        // offset of the first detector in Phi
85     Int_t fNladders;            // number of ladders
86     Double_t fZOffset;          // offset of the first detector in Z
87     Int_t fNdetectors;          // detectors/ladder
88     AliITSdetector *fDetectors; // array of detectors
89
90     AliITSRecPoint *fClusters[kMaxClusterPerLayer]; // pointers to clusters
91     Int_t fN[kNsector];         // numbers of clusters sector by sector 
92
93     Int_t fIndex[kMaxClusterPerLayer]; // indexes of selected clusters 
94     Int_t fNsel;                       // number of selected clusters
95
96     Double_t fRoad;     // road defined by the cluster density
97     Int_t FindClusterIndex(Float_t z, Int_t s) const;
98   };
99
100 protected:
101   AliITStrackerV2(const AliITStrackerV2&);
102   void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
103   Double_t GetEffectiveThickness(Double_t y, Double_t z) const;
104   void  FollowProlongation();
105   Int_t TakeNextProlongation();
106   void ResetBestTrack() {
107      fBestTrack.~AliITStrackV2();
108      new(&fBestTrack) AliITStrackV2(fTrackToFollow);
109   }
110   void ResetTrackToFollow(const AliITStrackV2 &t) {
111      fTrackToFollow.~AliITStrackV2();
112      new(&fTrackToFollow) AliITStrackV2(t);
113   }
114   Int_t fI;                              // index of the current layer
115   static AliITSlayer fgLayers[kMaxLayer];// ITS layers
116   AliITStrackV2 fTracks[kMaxLayer];      // track estimations at the ITS layers
117   AliITStrackV2 fBestTrack;              // "best" track 
118   AliITStrackV2 fTrackToFollow;          // followed track
119   Int_t fPass;                           // current pass through the data 
120   Int_t fConstraint[2];                  // constraint flags
121
122   Int_t fLayersNotToSkip[kMaxLayer];     // layer masks
123   Int_t fLastLayerToTrackTo;             // the innermost layer to track to
124
125 private:
126   AliITStrackerV2 &operator=(const AliITStrackerV2 &tr);  
127   ClassDef(AliITStrackerV2,1)   //ITS tracker V2
128 };
129
130
131 inline void AliITStrackerV2::SetupFirstPass(Int_t *flags, Double_t *cuts) {
132   // This function sets up flags and cuts for the first tracking pass   
133   //
134   //   flags[0] - vertex constaint flag                                
135   //              negative means "skip the pass"                        
136   //              0        means "no constraint"                        
137   //              positive means "normal constraint"                    
138
139    fConstraint[0]=flags[0];
140    if (cuts==0) return;
141 }
142
143 inline void AliITStrackerV2::SetupSecondPass(Int_t *flags, Double_t *cuts) {
144   // This function sets up flags and cuts for the second tracking pass   
145   //
146   //   flags[0] - vertex constaint flag                                
147   //              negative means "skip the pass"                        
148   //              0        means "no constraint"                        
149   //              positive means "normal constraint"                    
150
151    fConstraint[1]=flags[0];
152    if (cuts==0) return;
153 }
154
155 inline void AliITStrackerV2::CookLabel(AliKalmanTrack *t,Float_t wrong) const {
156   //--------------------------------------------------------------------
157   //This function "cooks" a track label. If label<0, this track is fake.
158   //--------------------------------------------------------------------
159    Int_t tpcLabel=t->GetLabel();
160    if (tpcLabel<0) return;
161    AliTracker::CookLabel(t,wrong);
162    if (tpcLabel != t->GetLabel()) t->SetLabel(-tpcLabel); 
163 }
164
165 #endif