Using TMath functions
[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;
61ab8ea8 26 void LoadClusters();
27 void UnloadClusters();
006b5f7f 28 Int_t Clusters2Tracks(const TFile *in, TFile *out);
14825d5a 29 Int_t PropagateBack(const TFile *in, TFile *out);
7f6ddf58 30 void SetupFirstPass(Int_t *flags, Double_t *cuts=0);
31 void SetupSecondPass(Int_t *flags, Double_t *cuts=0);
4ab260d6 32 Bool_t RefitAt(Double_t x, AliITStrackV2 *t, Int_t *index);
7f6ddf58 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();
006b5f7f 91 void ResetBestTrack() {
92 fBestTrack.~AliITStrackV2();
93 new(&fBestTrack) AliITStrackV2(fTrackToFollow);
94 }
006b5f7f 95 void ResetTrackToFollow(const AliITStrackV2 &t) {
96 fTrackToFollow.~AliITStrackV2();
97 new(&fTrackToFollow) AliITStrackV2(t);
98 }
7f6ddf58 99 Int_t fI; // index of the current layer
006b5f7f 100 static AliITSlayer fLayers[kMaxLayer]; // ITS layers
7f6ddf58 101 AliITStrackV2 fTracks[kMaxLayer]; // track estimations at the ITS layers
102 AliITStrackV2 fBestTrack; // "best" track
103 AliITStrackV2 fTrackToFollow; // followed track
104 Int_t fPass; // current pass through the data
105 Int_t fConstraint[2]; // constraint flags
006b5f7f 106};
107
108
7f6ddf58 109inline void AliITStrackerV2::SetupFirstPass(Int_t *flags, Double_t *cuts) {
110 // This function sets up flags and cuts for the first tracking pass
111 //
112 // flags[0] - vertex constaint flag
113 // negative means "skip the pass"
114 // 0 means "no constraint"
115 // positive means "normal constraint"
116
117 fConstraint[0]=flags[0];
118 if (cuts==0) return;
119}
120
121inline void AliITStrackerV2::SetupSecondPass(Int_t *flags, Double_t *cuts) {
122 // This function sets up flags and cuts for the second tracking pass
123 //
124 // flags[0] - vertex constaint flag
125 // negative means "skip the pass"
126 // 0 means "no constraint"
127 // positive means "normal constraint"
128
129 fConstraint[1]=flags[0];
130 if (cuts==0) return;
131}
132
133inline void AliITStrackerV2::CookLabel(AliKalmanTrack *t,Float_t wrong) const {
134 //--------------------------------------------------------------------
135 //This function "cooks" a track label. If label<0, this track is fake.
136 //--------------------------------------------------------------------
137 Int_t tpcLabel=t->GetLabel();
138 if (tpcLabel<0) return;
139 AliTracker::CookLabel(t,wrong);
140 if (tpcLabel != t->GetLabel()) t->SetLabel(-tpcLabel);
141}
006b5f7f 142
143#endif