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