]>
Commit | Line | Data |
---|---|---|
38a7a276 | 1 | #ifndef TSTATTOOLKIT_H |
21f3a443 | 2 | #define TSTATTOOLKIT_H |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
3d7cc0b4 | 6 | // |
7 | // some utilities which do net exist in the standard ROOT | |
8 | // | |
21f3a443 | 9 | |
10 | #include "TObject.h" | |
11 | #include "TVectorD.h" | |
12 | #include "TMatrixD.h" | |
3d7cc0b4 | 13 | //#include "TGraph2D.h" |
14 | //#include "TGraph.h" | |
21f3a443 | 15 | |
16 | class TH1F; | |
3d7cc0b4 | 17 | class TH1; |
21f3a443 | 18 | class TH3; |
19 | class TString; | |
20 | class TTree; | |
3d7cc0b4 | 21 | class TGraph; |
22 | class TGraph2D; | |
21f3a443 | 23 | |
24 | class TStatToolkit : public TObject | |
25 | { | |
26 | public: | |
27 | TStatToolkit(); | |
28 | virtual ~TStatToolkit(); | |
29 | // | |
30 | // | |
31 | // | |
32 | static void EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh); | |
33 | static void EvaluateUniExternal(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh, Float_t externalfactor=1); | |
34 | static Int_t Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down); | |
35 | // | |
36 | // HISTOGRAMS TOOLS | |
37 | // | |
3d7cc0b4 | 38 | static void TruncatedMean(const TH1 * his, TVectorD *param, Float_t down=0, Float_t up=1.0, Bool_t verbose=kFALSE); |
21f3a443 | 39 | static void LTM(TH1F * his, TVectorD *param=0 , Float_t fraction=1, Bool_t verbose=kFALSE); |
94a43b22 | 40 | static Double_t FitGaus(TH1* his, TVectorD *param=0, TMatrixD *matrix=0, Float_t xmin=0, Float_t xmax=0, Bool_t verbose=kFALSE); |
21f3a443 | 41 | static Double_t FitGaus(Float_t *arr, Int_t nBins, Float_t xMin, Float_t xMax, TVectorD *param=0, TMatrixD *matrix=0, Bool_t verbose=kFALSE); |
3d7cc0b4 | 42 | static Float_t GetCOG(const Short_t *arr, Int_t nBins, Float_t xMin, Float_t xMax, Float_t *rms=0, Float_t *sum=0); |
21f3a443 | 43 | |
44 | static TGraph2D * MakeStat2D(TH3 * his, Int_t delta0, Int_t delta1, Int_t type); | |
45 | static TGraph * MakeStat1D(TH3 * his, Int_t delta1, Int_t type); | |
df0a2a0a | 46 | // |
47 | // Graph tools | |
48 | // | |
49 | static TGraph * MakeGraphSparse(TTree * tree, const char * expr="Entry", const char * cut="1"); | |
21f3a443 | 50 | // |
51 | // Fitting function | |
52 | // | |
88b1c775 | 53 | static TString* FitPlane(TTree * tree, const char* drawCommand, const char* formula, const char* cuts, Double_t & chi2, Int_t &npoints, TVectorD &fitParam, TMatrixD &covMatrix, Float_t frac=-1, Int_t start=0, Int_t stop=10000000, Bool_t fix0=kFALSE); |
cb1d20de | 54 | static TString* FitPlaneFixed(TTree * tree, const char* drawCommand, const char* formula, const char* cuts, Double_t & chi2, Int_t &npoints, TVectorD &fitParam, TMatrixD &covMatrix, Float_t frac=-1, Int_t start=0, Int_t stop=10000000); |
7c9cf6e4 | 55 | // |
56 | //Linear fitter helper function | |
57 | // | |
cb1d20de | 58 | static TString* FitPlaneConstrain(TTree * tree, const char* drawCommand, const char* formula, const char* cuts, Double_t & chi2, Int_t &npoints, TVectorD &fitParam, TMatrixD &covMatrix, Float_t frac=-1, Int_t start=0, Int_t stop=10000000, Double_t constrain=-1); |
3d7cc0b4 | 59 | static Int_t GetFitIndex(const TString fString, const TString subString); |
60 | static TString FilterFit(const TString &input, const TString filter, TVectorD &vec, TMatrixD &covar); | |
7c9cf6e4 | 61 | static void Update1D(Double_t delta, Double_t sigma, Int_t s1, TMatrixD ¶m, TMatrixD &covar); |
3d7cc0b4 | 62 | static void Constrain1D(const TString &input, const TString filter, TVectorD ¶m, TMatrixD & covar, Double_t mean, Double_t sigma); |
ae45c94d | 63 | static TString MakeFitString(const TString &input, const TVectorD ¶m, const TMatrixD & covar, Bool_t verbose=kFALSE); |
21f3a443 | 64 | |
65 | // | |
66 | // TestFunctions: | |
67 | // | |
68 | static void TestGausFit(Int_t nhistos=5000); | |
7c9cf6e4 | 69 | |
21f3a443 | 70 | ClassDef(TStatToolkit,0) // Various mathematical tools for physics analysis - which are not included in ROOT TMath |
71 | ||
72 | }; | |
73 | #endif |