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