]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSRiemannFit.h
New access to conditions database
[u/mrichter/AliRoot.git] / ITS / AliITSRiemannFit.h
1 #ifndef ALIITSRIEMANNFIT_H
2 #define ALIITSRIEMANNFIT_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7 /////////////////////////////////////////////////////////////////////
8 // Class for helix fit on the Riemann sphere                       //
9 /////////////////////////////////////////////////////////////////////
10 #include<TLorentzVector.h>
11 class TTree;
12 class TVector3;
13
14 class AliITSRiemannFit : public TObject{
15  public:
16   AliITSRiemannFit();
17   AliITSRiemannFit(Int_t size,Int_t ntracks);
18   AliITSRiemannFit(const AliITSRiemannFit& rec);
19   AliITSRiemannFit& operator=(const AliITSRiemannFit &source);
20
21   ~AliITSRiemannFit();
22   class  AliPointtl {
23     public :
24       AliPointtl();
25     // getters
26       Int_t GetLay() const {return fLay;}
27       Int_t GetLad() const {return fLad;}
28       Int_t GetDet() const {return fDet;}
29       Int_t GetTrack() const {return fTrack;}
30       Float_t GetX() const {return fx;}
31       Float_t GetY() const {return fy;}
32       Float_t GetZ() const {return fz;}
33       Float_t GetR() const {return fr;}
34       Float_t GetdE() const {return fdE;}
35       Float_t GetdX() const {return fdx;}
36       Float_t GetdY() const {return fdy;}
37       Float_t GetdZ() const {return fdz;}
38       TLorentzVector* GetOrigin() const {return fOrigin;}
39       TLorentzVector* GetMomentum() const {return fMomentum;}
40       Int_t GetCode() const {return fCode;}
41       Char_t* GetName() {return fName;}
42       Float_t GetPt() const {return fPt;}
43       Float_t GetPhi() const {return fPhi;}
44       Float_t GetEta() const {return fEta;}
45       Float_t GetVertexPhi() const {return fVertexPhi;}
46       //setters
47       void SetLay(Int_t l=0) { fLay = l;}
48       void SetLad(Int_t l=0) { fLad = l;}
49       void SetDet(Int_t d=0) { fDet = d;}
50       void SetTrack(Int_t t=0) { fTrack = t;}
51       void SetX(Float_t x=0) { fx = x;}
52       void SetY(Float_t y=0) { fy = y;}
53       void SetZ(Float_t z=0) { fz = z;}
54       void SetR(Float_t r=0) { fr = r;}
55       void SetdE(Float_t de=0) { fdE = de;}
56       void SetdX(Float_t dx=0) { fdx = dx;}
57       void SetdY(Float_t dy=0) { fdy = dy;}
58       void SetdZ(Float_t dz=0) { fdz = dz;}
59       void SetOrigin(TLorentzVector *ori=0) { fOrigin = ori;}
60       void SetMomentum(TLorentzVector *mo=0) { fMomentum = mo;}
61       void SetCode(Int_t c=0) { fCode = c;}
62       void SetName(Char_t *n=0) { fName = n;}
63       void SetPt(Float_t pt=0) { fPt = pt;}
64       void SetPhi(Float_t phi=0) { fPhi = phi;}
65       void SetEta(Float_t eta=0) { fEta = eta;}
66       void SetVertexPhi(Float_t vert=0) { fVertexPhi = vert;}
67     private :
68       // copy constructor (NO copy ctr. allowed)
69       AliPointtl(const AliPointtl& /*ap */) {}
70     // assignment operator (NO assignment allowed)
71       AliPointtl& operator=(const AliPointtl& /* ap */) {return *this;}
72       Int_t fLay,fLad,fDet,fTrack;       // layer,ladder,detector and track
73       Float_t fx,fy,fz,fr;               // global position of point 
74       Float_t fdE,fdx,fdy,fdz;               // Errors
75       TLorentzVector* fOrigin;    // position and momentum of 
76       TLorentzVector* fMomentum;  //  particle at its origin
77       Int_t fCode;                       // Geant code of particle
78       Char_t *fName;                    // name
79       Float_t fPt;                       // Pt at the origin
80       Float_t fPhi,fEta,fVertexPhi;         // phi eta on layer and phi on vertex
81   };
82   Int_t GetSize() const {return this->fSizeEvent;}
83   Int_t GetPrimaryTracks() const {return this->fPrimaryTracks;}
84   Int_t GetPoints() const {return this->fPoints;}
85   Int_t GetParticles() const {return this->fParticles;}
86   Int_t GetLayPoints(Int_t layer) const {return this->fPLay[layer-1];}
87   AliPointtl **GetPointRecs() const {return this->fPointRecs;}
88   Float_t GetX(Int_t i) const {return this->fPointRecs[i]->GetX();}
89   Float_t GetY(Int_t i) const {return this->fPointRecs[i]->GetY();}
90   Float_t GetZ(Int_t i) const {return this->fPointRecs[i]->GetZ();}
91   Float_t GetdX(Int_t i) const {return this->fPointRecs[i]->GetdX();}
92   Float_t GetdY(Int_t i) const {return this->fPointRecs[i]->GetdY();}
93   Float_t GetdZ(Int_t i) const {return this->fPointRecs[i]->GetdZ();}
94   
95   void     InitPoints(Int_t ntracks,TTree *TR,Int_t nparticles);
96   void     WritePoints(void);
97   void     ReadPoints(void);
98   static Int_t SolveCubic(Double_t a,Double_t b,Double_t c,Double_t& x1,Double_t& x2,Double_t& x3);
99   Int_t FitHelix(Int_t tracknumber,Double_t Px,Double_t Py,Double_t Pz,
100                  Double_t& fd0,Double_t& fphi,Double_t& u0, Double_t& v0, Double_t& rho,
101                  Double_t& omega, Double_t& z0,
102                  Double_t& vpar,Double_t& chisql,Double_t& fCorrLin,Double_t& fFit,
103                  Int_t first=1,Int_t second=1,Int_t third=1,Int_t fourth=1,Int_t fifth=1,Int_t sixth=1);  
104  Int_t FitHelix(Int_t NPoints, TVector3** fPointRecs,
105                  TVector3** fPointRecErrors,Float_t& f1, 
106                  Float_t& f2, Float_t& f3);
107  Int_t LinearFit(Int_t npoints, TVector3 **input, 
108                   TVector3 **errors, Double_t omega,
109                   Double_t &thu0, Double_t &thv0, Double_t &phi,TVector2 &zData, TVector3 &zError, 
110                   Double_t &corrLin);
111
112  private:
113
114   static Double_t Fitfunction(Double_t *x, Double_t* par);
115
116   Int_t fSizeEvent;      // size of array 
117   Int_t fPrimaryTracks;  // number of primary tracks in the event
118   Int_t fPoints;         // number of Reconstructed Points in the event
119   Int_t fParticles;      // number of particles in the event
120   Int_t fPLay[6];           // number of points in each layer
121   AliPointtl **fPointRecs;    //rec points
122
123   
124   ClassDef(AliITSRiemannFit,1)  // Fast fit of helices on ITS RecPoints
125     };
126 #endif
127