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