]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITStrackerUpgrade.h
fix for memory leak and mods according to ITStrackerV2
[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 "AliITStrackMI.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 AliITStrackSA;
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(const AliITStrackerUpgrade& tracker);
40   AliITStrackerUpgrade& operator=(const AliITStrackerUpgrade& source);
41   virtual ~AliITStrackerUpgrade();  
42  virtual Int_t Clusters2Tracks(AliESDEvent *event);  
43  Int_t FindTracks(AliESDEvent* event,Bool_t useAllClusters=kFALSE);
44   Int_t PropagateBack(AliESDEvent *event);
45   Int_t CorrectForPipeMaterial(AliITStrackMI *t, TString direction="inward");  
46   Int_t RefitInward(AliESDEvent *event);//{return 0;}
47   AliCluster *GetCluster(Int_t index) const;
48
49   AliITStrackV2* FitTrack(AliITStrackSA* tr,Double_t* primaryVertex,Bool_t onePoint=kFALSE);
50   void StoreTrack(AliITStrackV2 *t,AliESDEvent *event, Bool_t pureSA) /*const*/; 
51   Int_t FindTrackLowChiSquare() const;
52   Int_t LoadClusters(TTree *clusTree);
53   void SetVertex(AliESDVertex *vtx){fVert = vtx;}
54   void SetClusterTree(TTree * itscl){fITSclusters = itscl;}
55
56   void SetOutwardFinding() {fInwardFlag=kFALSE;}
57   void SetInwardFinding() {fInwardFlag=kTRUE;}
58   void SetOuterStartLayer(Int_t osl = 0) {
59     if(osl>(fNLayer-2)) AliWarning("Minimum Number of layers is 2. OuterStartLayer set to Nlayers-2");
60     fOuterStartLayer = TMath::Min(fNLayer-2,osl);
61   }
62   Int_t GetOuterStartLayer() const {return fOuterStartLayer;}
63   void SetInnerStartLayer(Int_t isl = 5) {
64     if(isl<1) AliWarning("Minimum Number of layers is 2. InnerStartLayer set to 1");
65     fInnerStartLayer = TMath::Max(1,isl);
66   }
67   Int_t GetInnerStartLayer() const {return fInnerStartLayer;}
68   void SetSAFlag(Bool_t fl){fITSStandAlone=fl;}  // StandAlone flag setter
69   Bool_t GetSAFlag() const {return fITSStandAlone;} // StandAlone flag gett
70   void SetFixedWindowSizes(Int_t n=46, Double_t *phi=0, Double_t *lam=0);
71   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);
72   void UnloadClusters();
73   void SetMinNPoints(Int_t np){fMinNPoints=np;}
74   Int_t GetMinNPoints() const {return fMinNPoints;}
75   void SetMinimumChargeSDDSSD(Float_t minq=0.){fMinQ=minq;}
76   enum {kSAflag=0x8000}; //flag to mark clusters used in the SA tracker
77
78  protected:
79
80   //Initialization
81   void Init();
82   void  CreateLayers(Int_t iEvent);
83   void ResetForFinding();
84   void UpdatePoints();
85   Bool_t SetFirstPoint(Int_t lay, Int_t clu, Double_t* primaryVertex);
86   static Double_t Curvature(Double_t x1,Double_t y1,Double_t x2,Double_t y2,
87                      Double_t x3,Double_t y3);
88
89   Double_t ChoosePoint(Double_t p1, Double_t p2, Double_t pp); 
90
91   static Int_t   FindIntersection(Float_t a1, Float_t b1, Float_t c1, Float_t c2, 
92                            Float_t& x1,Float_t& y1, Float_t& x2, Float_t& y2);
93   static Int_t   FindEquation(Float_t x1, Float_t y1, Float_t x2, Float_t y2, 
94                        Float_t x3, Float_t y3,Float_t& a, Float_t& b, 
95                        Float_t& c);
96  
97   static Int_t FindLabel(Int_t l1, Int_t l2, Int_t l3, Int_t l4, Int_t l5, Int_t l6);
98   static Int_t Label(Int_t gl1, Int_t gl2, Int_t gl3, Int_t gl4, Int_t gl5, 
99               Int_t gl6,Int_t gl7, Int_t gl8, Int_t gl9, Int_t gl10,Int_t gl11,
100               Int_t gl12, Int_t gl13, Int_t gl14,Int_t gl15, Int_t gl16, 
101               Int_t gl17, Int_t gl18, Int_t numberofpoints=6);
102  
103   Int_t SearchClusters(Int_t layer,Double_t phiwindow,Double_t lambdawindow, 
104                        AliITStrackSA* trs,Double_t zvertex,Int_t flagp); 
105
106   void GetCoorAngles(AliITSRecPoint* cl,Double_t &phi,Double_t &lambda,Double_t &x,Double_t &y,Double_t &z,Double_t* vertex);
107   void GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, Float_t &sz);
108   AliITSclusterTable* GetClusterCoord(Int_t layer,Int_t n) const {return (AliITSclusterTable*)fCluCoord[layer]->UncheckedAt(n);}
109   void RemoveClusterCoord(Int_t layer, Int_t n) {fCluCoord[layer]->RemoveAt(n);fCluCoord[layer]->Compress();}
110   Bool_t RefitAtBase(Double_t x, AliITStrackMI *track,
111                  const Int_t *clusters);
112   Int_t UpdateMI(AliITStrackMI* track, const AliITSRecPoint* cl,Double_t chi2,Int_t layer) const;
113  Int_t CorrectForLayerMaterial(AliITStrackMI *t, Int_t layerindex, Double_t oldGlobXYZ[3], TString direction="inward");
114   Double_t GetPredictedChi2MI(AliITStrackMI* track, const AliITSRecPoint *cluster,Int_t layer);
115   static Int_t GetError(Int_t layer,const AliITSRecPoint*cl,
116                         Float_t tgl,Float_t tgphitr,Float_t expQ,
117                         Float_t &erry,Float_t &errz,Float_t &covyz,
118                         Bool_t addMisalErr=kTRUE);
119   
120   static Int_t GetErrorOrigRecPoint(const AliITSRecPoint*cl,
121                                     Float_t &erry,Float_t &errz,Float_t &covyz);
122   static void GetNTeor(Int_t layer,const AliITSRecPoint* cl,
123                        Float_t tgl,Float_t tgphitr,
124                        Float_t &ny,Float_t &nz);
125
126   Int_t fNLayer;//number of layer in ITSUpgrade
127   Double_t fPhiEstimate; //Estimation of phi angle on next layer
128   Bool_t fITSStandAlone; //Tracking is performed in the ITS alone if kTRUE
129   Float_t fPoint1[2];   //! coord. of 1-st point to evaluate the curvature
130   Float_t fPoint2[2];   //! coord. of 2-nd point to evaluate the curvature
131   Float_t fPoint3[2];   //! coord. of 3-rd point to evaluate the curvature
132   Float_t fPointc[2];   //! current point coord (for curvature eval.)
133   Double_t fLambdac;    //! current value of the Lambda angle in the window
134   Double_t fPhic;       //! current value of the Phi angle in the window
135   Float_t fCoef1;       //! param. of the equation of the circ. approx a layer
136   Float_t fCoef2;       //! param. of the equation of the circ. approx a layer
137   Float_t fCoef3;       //! param. of the equation of the circ. approx a layer
138   Int_t fNloop;         //  Number of iterqations on phi and lambda windows
139   Double_t *fPhiWin;    // phi window sizes
140   Double_t *fLambdaWin; // lambda window sizes
141   AliESDVertex *fVert;        //! primary vertex
142   AliITSVertexer *fVertexer;  //! vertexer 
143   TClonesArray *fListOfTracks;   //! container for found tracks 
144   TClonesArray *fListOfSATracks; //! container for found SA tracks 
145   TTree *fITSclusters;        //! pointer to ITS tree of clusters
146   Bool_t fInwardFlag;       // set to kTRUE for inward track finding
147   Int_t fOuterStartLayer;     // Outward search for tracks with <6 points: outer layer to start from
148   Int_t fInnerStartLayer;     // Inward search for tracks with <6 points: inner layer to start from
149   Int_t fMinNPoints;        // minimum number of clusters for a track
150   Float_t fMinQ;              // lower cut on cluster charge (SDD and SSD)
151   AliITSlayerUpgrade** fLayers;
152   AliITSsegmentationUpgrade *fSegmentation;
153
154   TClonesArray** fCluLayer; //! array with clusters 
155   TClonesArray** fCluCoord; //! array with cluster info
156
157   ClassDef(AliITStrackerUpgrade,2)
158 };
159
160 #endif
161
162