]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITStrackerUpgrade.h
- fixing warnings/coverity
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITStrackerUpgrade.h
1 #ifndef ALIITSTRACKERUPGRADE_H
2 #define ALIITSTRACKERUPGRADE_H 
3
4
5
6 #include "AliITStrackerMI.h"
7 #include "AliITSlayerUpgrade.h"
8 #include "AliITStrackU.h"
9
10 /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
11  * See cxx source for full Copyright notice                               */
12
13 /* $Id$ */
14 ////////////////////////////////////////////////////
15 //  ITS Upgrade Stand alone tracker class         //
16 //  Authors: A.Mastroserio C.Terrevoli            //
17 //  e-mail:annalisa.mastroserio@cern.ch           //
18 //         cristina.terrevoli@ba.infn.it          //
19 //  tracks are saved as AliITStrackV2 objects     //
20 ////////////////////////////////////////////////////
21
22 #include <TClonesArray.h>
23
24 class AliITSclusterTable;
25 class AliITStrackU;
26 class AliITSsegmentationUpgrade;
27 class AliESDVertex;
28 class AliESDEvent;
29 class AliITSVertexer;
30 class TTree;
31 class TArrayD;
32
33 class AliITStrackerUpgrade : public AliITStrackerMI {
34
35
36  public:
37
38   AliITStrackerUpgrade();
39   AliITStrackerUpgrade(Int_t nLay);
40   AliITStrackerUpgrade(const AliITStrackerUpgrade& tracker);
41   AliITStrackerUpgrade& operator=(const AliITStrackerUpgrade& source);
42   virtual ~AliITStrackerUpgrade();  
43   virtual Int_t Clusters2Tracks(AliESDEvent *event);  
44   Int_t FindTracks(AliESDEvent* event,Bool_t useAllClusters=kFALSE);
45   Int_t PropagateBack(AliESDEvent *event);
46   Int_t CorrectForPipeMaterial(AliITStrackU *t, TString direction="inward");  
47   Int_t RefitInward(AliESDEvent *event);
48   AliCluster *GetCluster(Int_t index) const;
49
50   AliITStrackV2* FitTrack(AliITStrackU* tr,Double_t* primaryVertex,Bool_t onePoint=kFALSE);
51   void StoreTrack(AliITStrackV2 *t,AliESDEvent *event, Bool_t pureSA) /*const*/; 
52   Int_t FindTrackLowChiSquare() const;
53   Int_t LoadClusters(TTree *clusTree);
54   void SetVertex(AliESDVertex *vtx){fVert = vtx;}
55   void SetClusterTree(TTree * itscl){fITSclusters = itscl;}
56
57   void SetOutwardFinding() {fInwardFlag=kFALSE;}
58   void SetInwardFinding() {fInwardFlag=kTRUE;}
59   void SetOuterStartLayer(Int_t osl = 0) {
60     if(osl>(fNLayers-2)) AliWarning("Minimum Number of layers is 2. OuterStartLayer set to Nlayers-2");
61     fOuterStartLayer = TMath::Min(fNLayers-2,osl);
62   }
63   Int_t GetOuterStartLayer() const {return fOuterStartLayer;}
64   void SetInnerStartLayer(Int_t isl = 5) {
65     if(isl<1) AliWarning("Minimum Number of layers is 2. InnerStartLayer set to 1");
66     fInnerStartLayer = TMath::Max(1,isl);
67   }
68   Int_t GetInnerStartLayer() const {return fInnerStartLayer;}
69   void SetSAFlag(Bool_t fl){fITSStandAlone=fl;}  // StandAlone flag setter
70   Bool_t GetSAFlag() const {return fITSStandAlone;} // StandAlone flag gett
71   void SetFixedWindowSizes(Int_t n=46, Double_t *phi=0, Double_t *lam=0);
72   void SetCalculatedWindowSizes(Int_t n=10, Float_t phimin=0.002, Float_t phimax=0.0145, Float_t lambdamin=0.003, Float_t lambdamax=0.008);
73   void UnloadClusters();
74   void SetMinNPoints(Int_t np){fMinNPoints=np;}
75   Int_t GetMinNPoints() const {return fMinNPoints;}
76   void SetMinimumChargeSDDSSD(Float_t minq=0.){fMinQ=minq;}
77   enum {kSAflag=0x8000}; //flag to mark clusters used in the SA tracker
78
79   void SetNlayers(Int_t nlay) {fNLayers = nlay;}
80
81  protected:
82
83   //Initialization
84   void Init();
85   void  CreateLayers(Int_t iEvent);
86   void ResetForFinding();
87   void ResetTrackToFollow(const AliITStrackU &t) {
88     fTrackToFollow.~AliITStrackU();
89     Bool_t trackMI = kTRUE;
90     new(&fTrackToFollow) AliITStrackU(t,trackMI);
91   }
92
93
94   void UpdatePoints();
95   Bool_t SetFirstPoint(Int_t lay, Int_t clu, Double_t* primaryVertex);
96   static Double_t Curvature(Double_t x1,Double_t y1,Double_t x2,Double_t y2,
97                             Double_t x3,Double_t y3);
98
99   Double_t ChoosePoint(Double_t p1, Double_t p2, Double_t pp); 
100
101   static Int_t   FindIntersection(Float_t a1, Float_t b1, Float_t c1, Float_t c2, 
102                                   Float_t& x1,Float_t& y1, Float_t& x2, Float_t& y2);
103   static Int_t   FindEquation(Float_t x1, Float_t y1, Float_t x2, Float_t y2, 
104                               Float_t x3, Float_t y3,Float_t& a, Float_t& b, 
105                               Float_t& c);
106  
107   Int_t FindLabel(AliITStrackV2* track) const;
108  
109   Int_t SearchClusters(Int_t layer,Double_t phiwindow,Double_t lambdawindow, 
110                        AliITStrackU* trs,Double_t zvertex,Int_t flagp); 
111
112   void GetCoorAngles(AliITSRecPoint* cl,Double_t &phi,Double_t &lambda,Double_t &x,Double_t &y,Double_t &z,Double_t* vertex);
113   void GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, Float_t &sz);
114   AliITSclusterTable* GetClusterCoord(Int_t layer,Int_t n) const {return (AliITSclusterTable*)fCluCoord[layer]->UncheckedAt(n);}
115   void RemoveClusterCoord(Int_t layer, Int_t n) {fCluCoord[layer]->RemoveAt(n);fCluCoord[layer]->Compress();}
116   Bool_t RefitAtBase(Double_t x, AliITStrackU *track,
117                      const Int_t *clusters);
118   Int_t UpdateMI(AliITStrackU* track, const AliITSRecPoint* cl,Double_t chi2,Int_t layer) const;
119   Int_t CorrectForLayerMaterial(AliITStrackU *t, Int_t layerindex, Double_t oldGlobXYZ[3], TString direction="inward");
120   Double_t GetPredictedChi2MI(AliITStrackU* track, const AliITSRecPoint *cluster,Int_t layer);
121   static Int_t GetError(Int_t layer,const AliITSRecPoint*cl,
122                         Float_t tgl,Float_t tgphitr,Float_t expQ,
123                         Float_t &erry,Float_t &errz,Float_t &covyz,
124                         Bool_t addMisalErr=kTRUE);
125   
126   static Int_t GetErrorOrigRecPoint(const AliITSRecPoint*cl,
127                                     Float_t &erry,Float_t &errz,Float_t &covyz);
128   static void GetNTeor(Int_t layer,const AliITSRecPoint* cl,
129                        Float_t tgl,Float_t tgphitr,
130                        Float_t &ny,Float_t &nz);
131   static const Int_t fgMaxNLayer = 8; //max number of layers in ITSUpgrade
132   Int_t fNLayers;//number of layer in ITSUpgrade
133   Double_t fPhiEstimate; //Estimation of phi angle on next layer
134   Bool_t fITSStandAlone; //Tracking is performed in the ITS alone if kTRUE
135   Float_t fPoint1[2];   //! coord. of 1-st point to evaluate the curvature
136   Float_t fPoint2[2];   //! coord. of 2-nd point to evaluate the curvature
137   Float_t fPoint3[2];   //! coord. of 3-rd point to evaluate the curvature
138   Float_t fPointc[2];   //! current point coord (for curvature eval.)
139   Double_t fLambdac;    //! current value of the Lambda angle in the window
140   Double_t fPhic;       //! current value of the Phi angle in the window
141   Float_t fCoef1;       //! param. of the equation of the circ. approx a layer
142   Float_t fCoef2;       //! param. of the equation of the circ. approx a layer
143   Float_t fCoef3;       //! param. of the equation of the circ. approx a layer
144   Int_t fNloop;         //  Number of iterqations on phi and lambda windows
145   Double_t *fPhiWin;    // phi window sizes
146   Double_t *fLambdaWin; // lambda window sizes
147   AliESDVertex *fVert;        //! primary vertex
148   AliITSVertexer *fVertexer;  //! vertexer 
149   TClonesArray *fListOfTracks;   //! container for found tracks 
150   TClonesArray *fListOfUTracks; //! container for found SA tracks 
151   TTree *fITSclusters;        //! pointer to ITS tree of clusters
152   Bool_t fInwardFlag;       // set to kTRUE for inward track finding
153   Int_t fOuterStartLayer;     // Outward search for tracks with <6 points: outer layer to start from
154   Int_t fInnerStartLayer;     // Inward search for tracks with <6 points: inner layer to start from
155   Int_t fMinNPoints;        // minimum number of clusters for a track
156   Float_t fMinQ;              // lower cut on cluster charge (SDD and SSD)
157   AliITStrackU fTrackToFollow;          
158
159   AliITSlayerUpgrade** fLayers;
160   AliITSsegmentationUpgrade *fSegmentation;
161
162   TClonesArray** fCluLayer; //! array with clusters 
163   TClonesArray** fCluCoord; //! array with cluster info
164
165   ClassDef(AliITStrackerUpgrade,2)
166     };
167
168 #endif
169
170