Processing SPD Mean Vertex only in PHYSICS runs.
[u/mrichter/AliRoot.git] / STEER / AliSplineFit.h
CommitLineData
0dd3a2ac 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"
52fdcd41 18#include "TMath.h"
0dd3a2ac 19
20#include "TTreeStream.h"
21
22class AliSplineFit : public TObject {
23 public:
24 AliSplineFit();
25 AliSplineFit(const AliSplineFit&);
26 ~AliSplineFit();
27 AliSplineFit& operator=(const AliSplineFit&);
28 Double_t Eval(Double_t x, Int_t deriv=0) const;
29 void InitKnots(TGraph * graph, Int_t min, Int_t iter, Double_t maxDelta);
30 void MakeKnots0(TGraph * graph, Double_t maxdelta, Int_t minpoints);
31 void SplineFit(Int_t nder);
52fdcd41 32 void CopyGraph();
a6e0ebfe 33 void MakeSmooth(TGraph * graph, Float_t ratio, Option_t * type);
0dd3a2ac 34 void Update(TSpline3 *spline, Int_t nknots);
8625679a 35 void Cleanup();
52fdcd41 36 Int_t GetKnots() const {return fN;}
0dd3a2ac 37 Double_t* GetX() const {return fX;}
38 Double_t* GetY0() const {return fY0;}
39 Double_t* GetY1() const {return fY1;}
40 //
41 // Test functions
42 //
43 TGraph * MakeGraph(Double_t xmin, Double_t xmax, Int_t npoints, Int_t deriv=0) const ;
44 TGraph * MakeDiff(TGraph * graph) const ;
45 TH1F * MakeDiffHisto(TGraph * graph) const;
46 //
47 static void Test(Int_t npoints=2000, Int_t ntracks=100, Float_t snoise=0.05);
48 //
49 static TGraph * GenerGraph(Int_t npoints, Double_t fraction, Double_t s1, Double_t s2, Double_t s3, Int_t der=0);
50 static TGraph * GenerNoise(TGraph * graph0, Double_t s0);
51
52fdcd41 52 void SetGraph (TGraph* graph) { fGraph=graph; }
53 void SetMinPoints (Int_t minPoints) { fMinPoints=minPoints;}
f12d42ce 54 Int_t GetMinPoints() const { return fMinPoints; }
52fdcd41 55
0dd3a2ac 56 protected:
57
58 //
59 // working parameters for spline fit
60 //
61 Int_t OptimizeKnots(Int_t nIter);
62 Float_t CheckKnot(Int_t iKnot);
63 Bool_t RefitKnot(Int_t iKnot);
64 //
65 Bool_t fBDump; // dump debug information flag
66 TGraph *fGraph; //! initial graph
67 Int_t fNmin; // number of points per one knot in iteration 0
52fdcd41 68 Int_t fMinPoints; // minimum number of points to create AliSplineFit
0dd3a2ac 69 Double_t fSigma; // locally estimated sigma
52fdcd41 70 Double_t fMaxDelta;// maximal deviation of the spline fit
71 Int_t fN0; // number of knots in iteration 0
0dd3a2ac 72 TClonesArray *fParams; // object array of parameters in knots
73 TClonesArray *fCovars; // object array of covariance in knots
8625679a 74 Int_t *fIndex; //[fN0] index of point corresponding to knot
deebe992 75 static TLinearFitter* fitterStatic(); // static fitter to save processing time
0dd3a2ac 76 //
0dd3a2ac 77 //
52fdcd41 78 //
79 Int_t fN; // number of knots after compression
80 Double_t fChi2; // chi2 per degree of freedom
8625679a 81 Double_t *fX; //[fN] - xknot value
82 Double_t *fY0; //[fN] - y value at X
83 Double_t *fY1; //[fN] - y derivative value at X
84 Double_t *fChi2I; //[fN] - chi2 on interval
49d97c7e 85 ClassDef(AliSplineFit, 2);
0dd3a2ac 86};
52fdcd41 87#endif