]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliSplineFit.h
Updated PaintContour() method
[u/mrichter/AliRoot.git] / STEER / AliSplineFit.h
1 #ifndef ALISPLINEFIT_H
2 #define ALISPLINEFIT_H
3 /* Copyright(c) 2006-07, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 #include "TGraph.h"
7 #include "TGraphSmooth.h"
8 #include "TRandom.h"
9 #include "TSpline.h"
10 #include "TLinearFitter.h"
11 #include "TDecompSVD.h"
12 #include "TDecompSparse.h"
13 #include "TMatrixDSparse.h"
14 #include "TF1.h"
15 #include "TH1F.h"
16 #include "TObject.h"
17 #include "TClonesArray.h"
18
19 #include "TTreeStream.h"
20
21 class AliSplineFit : public TObject {
22  public:
23   AliSplineFit();
24   AliSplineFit(const AliSplineFit&);
25   ~AliSplineFit();
26   AliSplineFit& operator=(const AliSplineFit&);
27   Double_t   Eval(Double_t x, Int_t deriv=0) const;
28   void       InitKnots(TGraph * graph, Int_t min, Int_t iter, Double_t maxDelta);
29   void       MakeKnots0(TGraph * graph, Double_t maxdelta, Int_t minpoints);
30   void       SplineFit(Int_t nder);
31   void       MakeSmooth(TGraph * graph, Float_t ratio, char * type);
32   void       Update(TSpline3 *spline, Int_t nknots);
33   Int_t      GetKnots() const {return fN;} 
34   Double_t*  GetX() const {return fX;}
35   Double_t*  GetY0() const {return fY0;}
36   Double_t*  GetY1() const {return fY1;}
37   //
38   // Test functions
39   //
40   TGraph * MakeGraph(Double_t xmin, Double_t xmax, Int_t npoints, Int_t deriv=0) const ;
41   TGraph * MakeDiff(TGraph * graph) const ;
42   TH1F   * MakeDiffHisto(TGraph * graph) const;
43   //
44   static void Test(Int_t npoints=2000, Int_t ntracks=100, Float_t snoise=0.05);
45   //
46   static TGraph * GenerGraph(Int_t npoints, Double_t fraction, Double_t s1, Double_t s2, Double_t s3, Int_t der=0);
47   static TGraph * GenerNoise(TGraph * graph0, Double_t s0);
48
49  protected:
50
51   //
52   // working parameters for spline fit
53   //
54   Int_t    OptimizeKnots(Int_t nIter);
55   Float_t  CheckKnot(Int_t iKnot);
56   Bool_t   RefitKnot(Int_t iKnot);
57   //
58   Bool_t        fBDump;   //  dump debug information flag
59   TGraph       *fGraph;   //! initial graph
60   Int_t         fNmin;    //  number of points per one knot in iteration 0
61   Double_t      fSigma;   //  locally estimated sigma
62   Double_t      fMaxDelta;//  maximal deviation of the spline fit 
63   Int_t         fN0;      //  number of knots in iteration 0 
64   TClonesArray *fParams;  //  object array of parameters in knots
65   TClonesArray *fCovars;  //  object array of covariance in knots
66   Int_t        *fIndex;   //  [fN0] index of point corresponding to knot
67   static TLinearFitter* fitterStatic(); // static fitter to save processing time
68   //
69   // 
70   //
71   Int_t    fN;            //  number of knots after compression 
72   Double_t fChi2;         //  chi2 per degree of freedom 
73   Double_t *fX;           //  [fN] - xknot value
74   Double_t *fY0;          //  [fN] - y value at X
75   Double_t *fY1;          //  [fN] - y derivative value at X
76   Double_t *fChi2I;       //  [fN] - chi2 on interval
77   ClassDef(AliSplineFit, 0);
78 };
79 #endif