]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITStrackerV2.h
Transition to NewIO
[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 #include "AliConfig.h"
15
16 class AliITSclusterV2;
17 class AliITSgeom;
18 class TFile;
19
20
21 //-------------------------------------------------------------------------
22 class AliITStrackerV2 : public AliTracker {
23 public:
24   AliITStrackerV2():AliTracker(){}
25
26   AliITStrackerV2(const AliITSgeom *geom, Int_t event=0,
27                   const char* evfoldname = AliConfig::fgkDefaultEventFolderName);
28
29   AliCluster *GetCluster(Int_t index) const;
30   Int_t LoadClusters();
31   void UnloadClusters();
32   Int_t Clusters2Tracks();//
33   Int_t PropagateBack();//
34   Int_t RefitInward();//
35
36   void SetupFirstPass(Int_t *flags, Double_t *cuts=0);
37   void SetupSecondPass(Int_t *flags, Double_t *cuts=0);
38   //PH  Bool_t RefitAt(Double_t x, AliITStrackV2 *t, Int_t *index);
39
40   void SetLastLayerToTrackTo(Int_t l=0) {fLastLayerToTrackTo=l;} 
41   void SetLayersNotToSkip(Int_t *l);
42
43   void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
44
45   class AliITSdetector {
46   public:
47     AliITSdetector(){}
48     AliITSdetector(Double_t r,Double_t phi) {fR=r; fPhi=phi;}
49     void *operator new(size_t s,AliITSdetector *p) {return p;}
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 *operator new(size_t s, AliITSlayer *p) {return p;}
67     void ResetRoad();
68     Double_t GetRoad() const {return fRoad;}
69     Double_t GetR() const {return fR;}
70     AliITSclusterV2 *GetCluster(Int_t i) const {return fClusters[i];} 
71     AliITSdetector &GetDetector(Int_t n) const { return fDetectors[n]; }
72     Int_t FindDetectorIndex(Double_t phi, Double_t z) const;
73     Double_t GetThickness(Double_t y, Double_t z, Double_t &x0) const;
74     Int_t InRoad() const ;
75     Int_t GetNumberOfClusters() const {return fN;}
76     Int_t GetNladders() const {return fNladders;}
77     Int_t GetNdetectors() const {return fNdetectors;}
78   private:
79     Double_t fR;                // mean radius of this layer
80     Double_t fPhiOffset;        // offset of the first detector in Phi
81     Int_t fNladders;            // number of ladders
82     Double_t fZOffset;          // offset of the first detector in Z
83     Int_t fNdetectors;          // detectors/ladder
84     AliITSdetector *fDetectors; // array of detectors
85     Int_t fN;                   // number of clusters
86     AliITSclusterV2 *fClusters[kMaxClusterPerLayer]; // pointers to clusters
87     Double_t fZmax;      //    edges
88     Double_t fYmin;      //   of  the
89     Double_t fYmax;      //   "window"
90     Int_t fI;            // index of the current cluster within the "window"
91     Double_t fRoad;      // road defined by the cluster density
92     Int_t FindClusterIndex(Double_t z) const;
93   };
94
95 private:
96   void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
97   Double_t GetEffectiveThickness(Double_t y, Double_t z) const;
98   void  FollowProlongation();
99   Int_t TakeNextProlongation();
100   Bool_t RefitAt(Double_t x, const AliITStrackV2 *t, AliITStrackV2 *tt);
101   void ResetBestTrack() {
102      fBestTrack.~AliITStrackV2();
103      new(&fBestTrack) AliITStrackV2(fTrackToFollow);
104   }
105   void ResetTrackToFollow(const AliITStrackV2 &t) {
106      fTrackToFollow.~AliITStrackV2();
107      new(&fTrackToFollow) AliITStrackV2(t);
108   }
109   Int_t fI;                              // index of the current layer
110   static AliITSlayer fLayers[kMaxLayer]; // ITS layers
111   AliITStrackV2 fTracks[kMaxLayer];      // track estimations at the ITS layers
112   AliITStrackV2 fBestTrack;              // "best" track 
113   AliITStrackV2 fTrackToFollow;          // followed track
114   Int_t fPass;                           // current pass through the data 
115   Int_t fConstraint[2];                  // constraint flags
116   TString fEvFolderName;  //event folder name
117
118   Int_t fLayersNotToSkip[kMaxLayer];     // layer masks
119   Int_t fLastLayerToTrackTo;             // the innermost layer to track to
120
121   ClassDef(AliITStrackerV2,2)   //ITS tracker V2
122 };
123
124
125 inline void AliITStrackerV2::SetupFirstPass(Int_t *flags, Double_t *cuts) {
126   // This function sets up flags and cuts for the first tracking pass   
127   //
128   //   flags[0] - vertex constaint flag                                
129   //              negative means "skip the pass"                        
130   //              0        means "no constraint"                        
131   //              positive means "normal constraint"                    
132
133    fConstraint[0]=flags[0];
134    if (cuts==0) return;
135 }
136
137 inline void AliITStrackerV2::SetupSecondPass(Int_t *flags, Double_t *cuts) {
138   // This function sets up flags and cuts for the second tracking pass   
139   //
140   //   flags[0] - vertex constaint flag                                
141   //              negative means "skip the pass"                        
142   //              0        means "no constraint"                        
143   //              positive means "normal constraint"                    
144
145    fConstraint[1]=flags[0];
146    if (cuts==0) return;
147 }
148
149 inline void AliITStrackerV2::CookLabel(AliKalmanTrack *t,Float_t wrong) const {
150   //--------------------------------------------------------------------
151   //This function "cooks" a track label. If label<0, this track is fake.
152   //--------------------------------------------------------------------
153    Int_t tpcLabel=t->GetLabel();
154    if (tpcLabel<0) return;
155    AliTracker::CookLabel(t,wrong);
156    if (tpcLabel != t->GetLabel()) t->SetLabel(-tpcLabel); 
157 }
158
159 #endif