Additional protection (Yu.Belikov)
[u/mrichter/AliRoot.git] / ITS / AliITStrackerV2.h
CommitLineData
18856a77 1#ifndef ALIITSTRACKERV2_H
2#define ALIITSTRACKERV2_H
006b5f7f 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
18856a77 8// reads AliITSclusterV2 clusters and creates AliITStrackV2 tracks
9// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
006b5f7f 10//-------------------------------------------------------------------------
64ea0cbc 11
12#include <TObjArray.h>
13
006b5f7f 14#include "AliTracker.h"
15#include "AliITSrecoV2.h"
16#include "AliITStrackV2.h"
17
18class AliITSclusterV2;
c630aafd 19class AliESD;
006b5f7f 20class AliITSgeom;
c630aafd 21class TTree;
006b5f7f 22
23
24//-------------------------------------------------------------------------
25class AliITStrackerV2 : public AliTracker {
26public:
27 AliITStrackerV2():AliTracker(){}
c630aafd 28 AliITStrackerV2(const AliITSgeom *geom);
006b5f7f 29 AliCluster *GetCluster(Int_t index) const;
235b705f 30 AliITSclusterV2 *GetClusterLayer(Int_t layn, Int_t ncl) const
31 {return fgLayers[layn].GetCluster(ncl);}
32 Int_t GetNumberOfClustersLayer(Int_t layn) const
33 {return fgLayers[layn].GetNumberOfClusters();}
c630aafd 34 Int_t LoadClusters(TTree *cf);
61ab8ea8 35 void UnloadClusters();
c630aafd 36 Int_t Clusters2Tracks(AliESD *event);
c630aafd 37 Int_t PropagateBack(AliESD *event);
c630aafd 38 Int_t RefitInward(AliESD *event);
39 Bool_t RefitAt(Double_t x, AliITStrackV2 *seed, const AliITStrackV2 *t);
7f6ddf58 40 void SetupFirstPass(Int_t *flags, Double_t *cuts=0);
41 void SetupSecondPass(Int_t *flags, Double_t *cuts=0);
42
c0dd5278 43 void SetLastLayerToTrackTo(Int_t l=0) {fLastLayerToTrackTo=l;}
44 void SetLayersNotToSkip(Int_t *l);
45
b87bd7cd 46 void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
47
babd135a 48 class AliITSdetector {
7f6ddf58 49 public:
50 AliITSdetector(){}
51 AliITSdetector(Double_t r,Double_t phi) {fR=r; fPhi=phi;}
7f6ddf58 52 Double_t GetR() const {return fR;}
53 Double_t GetPhi() const {return fPhi;}
54 private:
55 Double_t fR; // polar coordinates
56 Double_t fPhi; // of this detector
57 };
58
59 class AliITSlayer {
babd135a 60 friend class AliITStrackerV2;
7f6ddf58 61 public:
62 AliITSlayer();
63 AliITSlayer(Double_t r, Double_t p, Double_t z, Int_t nl, Int_t nd);
64 ~AliITSlayer();
65 Int_t InsertCluster(AliITSclusterV2 *c);
61ab8ea8 66 void ResetClusters();
babd135a 67 void ResetWeights();
7f6ddf58 68 void SelectClusters(Double_t zmi,Double_t zma,Double_t ymi,Double_t yma);
69 const AliITSclusterV2 *GetNextCluster(Int_t &ci);
b87bd7cd 70 void ResetRoad();
71 Double_t GetRoad() const {return fRoad;}
7f6ddf58 72 Double_t GetR() const {return fR;}
de5d3595 73 AliITSclusterV2 *GetCluster(Int_t i) const {return i<fN? fClusters[i]:0;}
babd135a 74 Float_t *GetWeight(Int_t i) {return i<fN ?&fClusterWeight[i]:0;}
7f6ddf58 75 AliITSdetector &GetDetector(Int_t n) const { return fDetectors[n]; }
76 Int_t FindDetectorIndex(Double_t phi, Double_t z) const;
61ab8ea8 77 Double_t GetThickness(Double_t y, Double_t z, Double_t &x0) const;
7f6ddf58 78 Int_t InRoad() const ;
79 Int_t GetNumberOfClusters() const {return fN;}
61ab8ea8 80 Int_t GetNladders() const {return fNladders;}
81 Int_t GetNdetectors() const {return fNdetectors;}
83ea0a45 82 Int_t FindClusterIndex(Double_t z) const;
235b705f 83 protected:
7f6ddf58 84 Double_t fR; // mean radius of this layer
85 Double_t fPhiOffset; // offset of the first detector in Phi
86 Int_t fNladders; // number of ladders
87 Double_t fZOffset; // offset of the first detector in Z
88 Int_t fNdetectors; // detectors/ladder
89 AliITSdetector *fDetectors; // array of detectors
90 Int_t fN; // number of clusters
91 AliITSclusterV2 *fClusters[kMaxClusterPerLayer]; // pointers to clusters
babd135a 92 Float_t fClusterWeight[kMaxClusterPerLayer]; // probabilistic weight of the cluster
7f6ddf58 93 Double_t fZmax; // edges
94 Double_t fYmin; // of the
95 Double_t fYmax; // "window"
96 Int_t fI; // index of the current cluster within the "window"
b87bd7cd 97 Double_t fRoad; // road defined by the cluster density
7f6ddf58 98 };
de5d3595 99
235b705f 100protected:
7f6ddf58 101 void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
a9a2d814 102 Double_t GetEffectiveThickness(Double_t y, Double_t z) const;
006b5f7f 103 void FollowProlongation();
104 Int_t TakeNextProlongation();
006b5f7f 105 void ResetBestTrack() {
106 fBestTrack.~AliITStrackV2();
107 new(&fBestTrack) AliITStrackV2(fTrackToFollow);
108 }
006b5f7f 109 void ResetTrackToFollow(const AliITStrackV2 &t) {
110 fTrackToFollow.~AliITStrackV2();
111 new(&fTrackToFollow) AliITStrackV2(t);
112 }
babd135a 113 Float_t *GetWeight(Int_t index);
de5d3595 114 void AddTrackHypothesys(AliITStrackV2 * track, Int_t esdindex);
babd135a 115 void SortTrackHypothesys(Int_t esdindex, Float_t likelihoodlevel);
116 void CompressTrackHypothesys(Int_t esdindex, Float_t likelihoodlevel, Int_t maxsize);
117 AliITStrackV2 * GetBestHypothesys(Int_t esdindex, AliITStrackV2 * original, Int_t checkmax);
118 AliITStrackV2 * GetBestHypothesysMIP(Int_t esdindex, AliITStrackV2 * original);
7f6ddf58 119 Int_t fI; // index of the current layer
18856a77 120 static AliITSlayer fgLayers[kMaxLayer];// ITS layers
7f6ddf58 121 AliITStrackV2 fTracks[kMaxLayer]; // track estimations at the ITS layers
122 AliITStrackV2 fBestTrack; // "best" track
123 AliITStrackV2 fTrackToFollow; // followed track
de5d3595 124 TObjArray fTrackHypothesys; // ! array with track hypothesys- ARRAY is the owner of tracks- MI
125 Int_t fCurrentEsdTrack; // ! current esd track - MI
7f6ddf58 126 Int_t fPass; // current pass through the data
127 Int_t fConstraint[2]; // constraint flags
8676d691 128
c0dd5278 129 Int_t fLayersNotToSkip[kMaxLayer]; // layer masks
130 Int_t fLastLayerToTrackTo; // the innermost layer to track to
c630aafd 131 ClassDef(AliITStrackerV2,1) //ITS tracker V2
006b5f7f 132};
133
134
7f6ddf58 135inline void AliITStrackerV2::SetupFirstPass(Int_t *flags, Double_t *cuts) {
136 // This function sets up flags and cuts for the first tracking pass
137 //
138 // flags[0] - vertex constaint flag
139 // negative means "skip the pass"
140 // 0 means "no constraint"
141 // positive means "normal constraint"
142
143 fConstraint[0]=flags[0];
144 if (cuts==0) return;
145}
146
147inline void AliITStrackerV2::SetupSecondPass(Int_t *flags, Double_t *cuts) {
148 // This function sets up flags and cuts for the second tracking pass
149 //
150 // flags[0] - vertex constaint flag
151 // negative means "skip the pass"
152 // 0 means "no constraint"
153 // positive means "normal constraint"
154
155 fConstraint[1]=flags[0];
156 if (cuts==0) return;
157}
158
159inline void AliITStrackerV2::CookLabel(AliKalmanTrack *t,Float_t wrong) const {
160 //--------------------------------------------------------------------
161 //This function "cooks" a track label. If label<0, this track is fake.
162 //--------------------------------------------------------------------
163 Int_t tpcLabel=t->GetLabel();
164 if (tpcLabel<0) return;
165 AliTracker::CookLabel(t,wrong);
babd135a 166 if (tpcLabel!=TMath::Abs(t->GetLabel())){
167 t->SetFakeRatio(1.);
168 }
169 if (tpcLabel !=t->GetLabel()) {
170 t->SetLabel(-tpcLabel);
171 }
7f6ddf58 172}
006b5f7f 173
174#endif