]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITStrackerV2.h
Fixes added to make the slow simulation running with the current HEAD (from M. Masera)
[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
15 class AliITSclusterV2;
16 class AliITSgeom;
17 class TFile;
18
19
20 //-------------------------------------------------------------------------
21 class AliITStrackerV2 : public AliTracker {
22 public:
23   AliITStrackerV2():AliTracker(){}
24   AliITStrackerV2(const AliITSgeom *geom,Int_t event=0) throw (const Char_t *);
25   AliCluster *GetCluster(Int_t index) const;
26   Int_t Clusters2Tracks(const TFile *in, TFile *out);
27   Int_t PropagateBack(const TFile *in, TFile *out);
28   void SetupFirstPass(Int_t *flags, Double_t *cuts=0);
29   void SetupSecondPass(Int_t *flags, Double_t *cuts=0);
30   Bool_t RefitAt(Double_t x, AliITStrackV2 *t, Int_t *index);
31
32   class AliITSdetector {
33   public:
34     AliITSdetector(){}
35     AliITSdetector(Double_t r,Double_t phi) {fR=r; fPhi=phi;}
36     void *operator new(size_t s,AliITSdetector *p) {return p;}
37     Double_t GetR()   const {return fR;}
38     Double_t GetPhi() const {return fPhi;}
39   private:
40     Double_t fR;    // polar coordinates 
41     Double_t fPhi;  // of this detector
42   };
43
44   class AliITSlayer {
45   public:
46     AliITSlayer();
47     AliITSlayer(Double_t r, Double_t p, Double_t z, Int_t nl, Int_t nd);
48    ~AliITSlayer();
49     Int_t InsertCluster(AliITSclusterV2 *c);
50     void SelectClusters(Double_t zmi,Double_t zma,Double_t ymi,Double_t yma);
51     const AliITSclusterV2 *GetNextCluster(Int_t &ci);
52     void *operator new(size_t s, AliITSlayer *p) {return p;}
53     Double_t GetR() const {return fR;}
54     AliITSclusterV2 *GetCluster(Int_t i) const {return fClusters[i];} 
55     AliITSdetector &GetDetector(Int_t n) const { return fDetectors[n]; }
56     Int_t FindDetectorIndex(Double_t phi, Double_t z) const;
57     Double_t GetThickness(Double_t y, Double_t z) const;
58     Int_t InRoad() const ;
59     Int_t GetNumberOfClusters() const {return fN;}
60   private:
61     Double_t fR;                // mean radius of this layer
62     Double_t fPhiOffset;        // offset of the first detector in Phi
63     Int_t fNladders;            // number of ladders
64     Double_t fZOffset;          // offset of the first detector in Z
65     Int_t fNdetectors;          // detectors/ladder
66     AliITSdetector *fDetectors; // array of detectors
67     Int_t fN;                   // number of clusters
68     AliITSclusterV2 *fClusters[kMaxClusterPerLayer]; // pointers to clusters
69     Double_t fZmax;      //    edges
70     Double_t fYmin;      //   of  the
71     Double_t fYmax;      //   "window"
72     Int_t fI;            // index of the current cluster within the "window"
73     Int_t FindClusterIndex(Double_t z) const;
74   };
75
76 private:
77   void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
78   Double_t GetEffectiveThickness(Double_t y, Double_t z) const;
79   void  FollowProlongation();
80   Int_t TakeNextProlongation();
81   void ResetBestTrack() {
82      fBestTrack.~AliITStrackV2();
83      new(&fBestTrack) AliITStrackV2(fTrackToFollow);
84   }
85   void ResetTrackToFollow(const AliITStrackV2 &t) {
86      fTrackToFollow.~AliITStrackV2();
87      new(&fTrackToFollow) AliITStrackV2(t);
88   }
89   Int_t fEventN;                         //event number
90   Int_t fI;                              // index of the current layer
91   static AliITSlayer fLayers[kMaxLayer]; // ITS layers
92   AliITStrackV2 fTracks[kMaxLayer];      // track estimations at the ITS layers
93   AliITStrackV2 fBestTrack;              // "best" track 
94   AliITStrackV2 fTrackToFollow;          // followed track
95   Int_t fPass;                           // current pass through the data 
96   Int_t fConstraint[2];                  // constraint flags
97 };
98
99
100 inline void AliITStrackerV2::SetupFirstPass(Int_t *flags, Double_t *cuts) {
101   // This function sets up flags and cuts for the first tracking pass   
102   //
103   //   flags[0] - vertex constaint flag                                
104   //              negative means "skip the pass"                        
105   //              0        means "no constraint"                        
106   //              positive means "normal constraint"                    
107
108    fConstraint[0]=flags[0];
109    if (cuts==0) return;
110 }
111
112 inline void AliITStrackerV2::SetupSecondPass(Int_t *flags, Double_t *cuts) {
113   // This function sets up flags and cuts for the second tracking pass   
114   //
115   //   flags[0] - vertex constaint flag                                
116   //              negative means "skip the pass"                        
117   //              0        means "no constraint"                        
118   //              positive means "normal constraint"                    
119
120    fConstraint[1]=flags[0];
121    if (cuts==0) return;
122 }
123
124 inline void AliITStrackerV2::CookLabel(AliKalmanTrack *t,Float_t wrong) const {
125   //--------------------------------------------------------------------
126   //This function "cooks" a track label. If label<0, this track is fake.
127   //--------------------------------------------------------------------
128    Int_t tpcLabel=t->GetLabel();
129    if (tpcLabel<0) return;
130    AliTracker::CookLabel(t,wrong);
131    if (tpcLabel != t->GetLabel()) t->SetLabel(-tpcLabel); 
132 }
133
134 #endif