]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STAT/TStatToolkit.h
List panel improved. Faulty macros commented in alieve_online_new. Typo in CMakelibMO...
[u/mrichter/AliRoot.git] / STAT / TStatToolkit.h
CommitLineData
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
16class TH1F;
3d7cc0b4 17class TH1;
32d8f622 18class TH2;
21f3a443 19class TH3;
20class TString;
21class TTree;
3d7cc0b4 22class TGraph;
23class TGraph2D;
377a7d60 24class TCanvas;
25class TMultiGraph;
1a8f4649 26class TGraphErrors;
8e63b06b 27class TObjString;
28class TCut;
29class TTreeSRedirector;
30
377a7d60 31
21f3a443 32class TStatToolkit : public TObject
33{
34 public:
35 TStatToolkit();
36 virtual ~TStatToolkit();
37 //
38 //
39 //
40 static void EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh);
41 static void EvaluateUniExternal(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh, Float_t externalfactor=1);
42 static Int_t Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);
43 //
44 // HISTOGRAMS TOOLS
45 //
3d7cc0b4 46 static void TruncatedMean(const TH1 * his, TVectorD *param, Float_t down=0, Float_t up=1.0, Bool_t verbose=kFALSE);
8fae6121
MK
47 static void MedianFilter(TH1 * his1D, Int_t nmedian);
48 static Bool_t LTMHisto(TH1 * his, TVectorD &param , Float_t fraction=1);
49 //
32d8f622 50 static void LTM(TH1 * his, TVectorD *param=0 , Float_t fraction=1, Bool_t verbose=kFALSE);
94a43b22 51 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 52 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 53 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 54
55 static TGraph2D * MakeStat2D(TH3 * his, Int_t delta0, Int_t delta1, Int_t type);
32d8f622 56 static TGraphErrors * MakeStat1D(TH2 * his, Int_t deltaBin, Double_t fraction, Int_t returnType, Int_t markerStyle, Int_t markerColor);
df0a2a0a 57 //
58 // Graph tools
59 //
377a7d60 60 static TGraph * MakeGraphSparse(TTree * tree, const char * expr="Entry", const char * cut="1", Int_t mstyle=25, Int_t mcolor=1, Float_t msize=-1, Float_t offset=0.0);
1a8f4649 61 static TGraphErrors * MakeGraphErrors(TTree * tree, const char * expr="Entry", const char * cut="1", Int_t mstyle=25, Int_t mcolor=1, Float_t msize=-1, Float_t offset=0.0);
62
21f3a443 63 //
64 // Fitting function
65 //
88b1c775 66 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 67 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 68 //
69 //Linear fitter helper function
70 //
cb1d20de 71 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 72 static Int_t GetFitIndex(const TString fString, const TString subString);
73 static TString FilterFit(const TString &input, const TString filter, TVectorD &vec, TMatrixD &covar);
7c9cf6e4 74 static void Update1D(Double_t delta, Double_t sigma, Int_t s1, TMatrixD &param, TMatrixD &covar);
3d7cc0b4 75 static void Constrain1D(const TString &input, const TString filter, TVectorD &param, TMatrixD & covar, Double_t mean, Double_t sigma);
ae45c94d 76 static TString MakeFitString(const TString &input, const TVectorD &param, const TMatrixD & covar, Bool_t verbose=kFALSE);
377a7d60 77 //
fc03fa55 78 // TTree function for the trending
377a7d60 79 //
80 static Int_t MakeStatAlias(TTree * tree, const char * expr, const char * cut, const char * alias);
81 static Int_t SetStatusAlias(TTree * tree, const char * expr, const char * cut, const char * alias);
fc03fa55 82 static TMultiGraph* MakeStatusMultGr(TTree * tree, const char * expr, const char * cut, const char * alias, Int_t igr=0);
377a7d60 83 static void AddStatusPad(TCanvas* c1, Float_t padratio, Float_t bottommargin);
84 static void DrawStatusGraphs(TObjArray* oaMultGr);
fc03fa55 85 static TTree* WriteStatusToTree(TObject* oStatusGr);
86 static TMultiGraph* MakeStatusLines(TTree * tree, const char * expr, const char * cut, const char * alias);
8e63b06b 87 static void MakeSummaryTree(TTree* treeIn, TTreeSRedirector *pcstream, TObjString& sumID, TCut &selection);
21f3a443 88 //
376089b6 89 // TTree function for robust draw
90 //
5d6816d1 91 static TH1* DrawHistogram(TTree * tree, const char* drawCommand, const char* cuts = "1", const char* hname = "histo", const char* htitle = "histo", Int_t nsigma = 4, Float_t fraction = 0.75);
376089b6 92 //
21f3a443 93 // TestFunctions:
94 //
95 static void TestGausFit(Int_t nhistos=5000);
5d1391ec 96 static void CheckTreeAliases(TTree * tree, Int_t ncheck);
21f3a443 97 ClassDef(TStatToolkit,0) // Various mathematical tools for physics analysis - which are not included in ROOT TMath
98
99};
100#endif