1 // ----------------------------------------------------------------------
4 // This class provides some tools which can be useful in the analsis
5 // of spectra, to fit or transform histograms. See the comments of the
6 // individual methods for details
8 // Author: M. Floris (CERN)
9 // ----------------------------------------------------------------------
14 #if !defined(__CINT__) || defined(__MAKECINT__)
27 class AliBWTools : public TObject {
34 static TH1 * GetOneOverPtdNdPt(TH1 * hPt) ;
35 static TH1 * GetdNdmtFromdNdpt(TH1 * hpt, Double_t mass);
36 static TH1 * GetdNdPtFromOneOverPt(TH1 * h1Pt) ;
38 static TGraphErrors * ConcatenateGraphs(TGraphErrors * g1,TGraphErrors * g2);
39 static TH1F * GetHistoFromGraph(TGraphErrors * g, TH1F* hTemplate) ;
40 static TGraphErrors * GetGraphFromHisto(TH1F * h, Bool_t binWidth = kTRUE) ;
41 static TH1F * CombineHistos(TH1 * h1, TH1 * h2, TH1* htemplate, Float_t renorm1=1.);
42 static void GetFromHistoGraphDifferentX(TH1F * h, TF1 * f, TGraphErrors ** gBarycentre, TGraphErrors ** gXlw);
43 static Float_t GetMean(TH1F * h, Float_t min, Float_t max) ;
45 static void GetMean(TF1 * func, Float_t &mean, Float_t &error, Float_t min=0, Float_t max=100);
46 static void GetMeanSquare(TF1 * func, Float_t &mean, Float_t &error, Float_t min=0, Float_t max=100) ;
48 static Bool_t Fit (TH1 * h, TF1* f, Float_t min, Float_t max) ;
50 static Int_t GetLowestNotEmptyBin(TH1*h);
51 static Int_t GetHighestNotEmptyBin(TH1*h);
52 static Float_t GetLowestNotEmptyBinEdge(TH1*h) { return h->GetBinLowEdge(GetLowestNotEmptyBin(h));}
53 static Float_t GetHighestNotEmptyBinEdge(TH1*h) { return h->GetBinLowEdge(GetHighestNotEmptyBin(h)+1);}
55 static void GetResiduals(TGraphErrors * gdata, TF1 * func, TH1F ** hres, TGraphErrors ** gres) ;
56 static void GetResiduals(TH1F* hdata, TF1 * func, TH1F ** hres, TH1F ** hresVsBin) ;
58 static void GetYield(TH1* h, TF1 * f, Double_t &yield, Double_t &yieldError, Float_t min = 0,
59 Float_t max = 100, Double_t *partialYields=0, Double_t *partialYieldsErrors=0);
61 static TGraphErrors * DivideGraphByFunc (TGraphErrors * g, TF1 * f, Bool_t invert = kFALSE);
62 static TGraphErrors * DivideGraphByHisto(TGraphErrors * g, TH1 * h, Bool_t invert = kFALSE);
63 static TH1F * DivideHistoByFunc (TH1F * h, TF1 * f, Bool_t invert = kFALSE);
67 static void GetMoment(TString name, TString var, TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max) ;
68 static Double_t GetNormalizedFunc(double * x, double* p);
70 static TF1 * fFuncForNormalized; // Function used in GetNormalizedFunc
72 AliBWTools(const AliBWTools&); // not implemented
73 AliBWTools& operator=(const AliBWTools&); // not implemented
75 ClassDef(AliBWTools,1);