]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STAT/TStatToolkit.h
Coverity - memory leak
[u/mrichter/AliRoot.git] / STAT / TStatToolkit.h
1 #ifndef TSTATTOOLKIT_H
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
6
7  
8 #include "TObject.h"
9 #include "TVectorD.h"
10 #include "TMatrixD.h"
11 #include "TGraph2D.h"
12 #include "TGraph.h"
13
14 class TH1F;
15 class TH3;
16 class TString;
17 class TTree;
18  
19 class TStatToolkit : public TObject
20 {
21  public:
22   TStatToolkit();
23   virtual ~TStatToolkit();
24   //
25   //
26   //
27   static void    EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh);
28   static void    EvaluateUniExternal(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh, Float_t externalfactor=1);
29   static Int_t  Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);    
30   //
31   // HISTOGRAMS TOOLS
32   //
33   static  void TruncatedMean(TH1F * his, TVectorD *param, Float_t down=0, Float_t up=1.0, Bool_t verbose=kFALSE);
34   static void LTM(TH1F * his, TVectorD *param=0 , Float_t fraction=1,  Bool_t verbose=kFALSE);
35   static Double_t  FitGaus(TH1F* his, TVectorD *param=0, TMatrixD *matrix=0, Float_t xmin=0, Float_t xmax=0,  Bool_t verbose=kFALSE);
36   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);
37   static Float_t  GetCOG(Short_t *arr, Int_t nBins, Float_t xMin, Float_t xMax, Float_t *rms=0, Float_t *sum=0);
38
39   static TGraph2D *  MakeStat2D(TH3 * his, Int_t delta0, Int_t delta1, Int_t type);
40   static TGraph *  MakeStat1D(TH3 * his, Int_t delta1, Int_t type);
41
42   //
43   // Fitting function
44   //
45   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);
46   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);
47   //
48   //Linear fitter helper function
49   //
50   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);
51   static Int_t GetFitIndex(TString fString, TString subString);
52  static TString FilterFit(TString &input, TString filter, TVectorD &vec, TMatrixD &covar);
53  static void Update1D(Double_t delta, Double_t sigma, Int_t s1, TMatrixD &param, TMatrixD &covar);
54   static void   Constrain1D(TString &input, TString filter, TVectorD &param, TMatrixD & covar, Double_t mean, Double_t sigma);
55   static TString  MakeFitString(TString &input, TVectorD &param, TMatrixD & covar);
56
57   //
58   // TestFunctions:
59   //
60  static  void TestGausFit(Int_t nhistos=5000);
61
62  ClassDef(TStatToolkit,0) // Various mathematical tools for physics analysis - which are not included in ROOT TMath
63  
64 };
65 #endif