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