]>
Commit | Line | Data |
---|---|---|
4c0d7bc7 | 1 | // ---------------------------------------------------------------------- |
2 | // AliBWTools | |
3 | // | |
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 | |
7 | // | |
8 | // Author: M. Floris (CERN) | |
9 | // ---------------------------------------------------------------------- | |
10 | ||
11 | #ifndef ALIBWTOOLS_H | |
12 | #define ALIBWTOOLS_H | |
13 | ||
14 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
15 | ||
16 | #include "TObject.h" | |
17 | #include "TH1.h" | |
18 | ||
19 | class TF1; | |
20 | class TH1D; | |
21 | class TH1F; | |
22 | class TGraphErrors; | |
23 | #endif | |
24 | ||
25 | ||
26 | ||
27 | class AliBWTools : public TObject { | |
28 | ||
29 | public: | |
30 | ||
31 | AliBWTools(); | |
32 | ~AliBWTools(); | |
33 | ||
34 | static TH1 * GetOneOverPtdNdPt(TH1 * hPt) ; | |
35 | static TH1 * GetdNdmtFromdNdpt(TH1 * hpt, Double_t mass); | |
36 | static TH1 * GetdNdPtFromOneOverPt(TH1 * h1Pt) ; | |
37 | ||
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.); | |
ee08b77d | 42 | static TH1F * Combine3HistosWithErrors(TH1 * h1, TH1 * h2, TH1* h3, |
43 | TH1 * he1, TH1 * he2, TH1 * he3, | |
44 | TH1* htemplate, Int_t statFrom = 0, | |
45 | Float_t renorm1=1., Float_t renorm2=1., Float_t renorm3=1.); | |
4c0d7bc7 | 46 | static void GetFromHistoGraphDifferentX(TH1F * h, TF1 * f, TGraphErrors ** gBarycentre, TGraphErrors ** gXlw); |
47 | static Float_t GetMean(TH1F * h, Float_t min, Float_t max) ; | |
48 | ||
49 | static void GetMean(TF1 * func, Float_t &mean, Float_t &error, Float_t min=0, Float_t max=100); | |
50 | static void GetMeanSquare(TF1 * func, Float_t &mean, Float_t &error, Float_t min=0, Float_t max=100) ; | |
51 | ||
52 | static Bool_t Fit (TH1 * h, TF1* f, Float_t min, Float_t max) ; | |
53 | ||
54 | static Int_t GetLowestNotEmptyBin(TH1*h); | |
55 | static Int_t GetHighestNotEmptyBin(TH1*h); | |
56 | static Float_t GetLowestNotEmptyBinEdge(TH1*h) { return h->GetBinLowEdge(GetLowestNotEmptyBin(h));} | |
57 | static Float_t GetHighestNotEmptyBinEdge(TH1*h) { return h->GetBinLowEdge(GetHighestNotEmptyBin(h)+1);} | |
58 | ||
59 | static void GetResiduals(TGraphErrors * gdata, TF1 * func, TH1F ** hres, TGraphErrors ** gres) ; | |
60 | static void GetResiduals(TH1F* hdata, TF1 * func, TH1F ** hres, TH1F ** hresVsBin) ; | |
61 | ||
62 | static void GetYield(TH1* h, TF1 * f, Double_t &yield, Double_t &yieldError, Float_t min = 0, | |
63 | Float_t max = 100, Double_t *partialYields=0, Double_t *partialYieldsErrors=0); | |
64 | ||
65 | static TGraphErrors * DivideGraphByFunc (TGraphErrors * g, TF1 * f, Bool_t invert = kFALSE); | |
66 | static TGraphErrors * DivideGraphByHisto(TGraphErrors * g, TH1 * h, Bool_t invert = kFALSE); | |
67 | static TH1F * DivideHistoByFunc (TH1F * h, TF1 * f, Bool_t invert = kFALSE); | |
68 | ||
ee08b77d | 69 | static void WeightedMean(Int_t npoints, const Double_t *x, const Double_t *xerr, Double_t &mean, Double_t &meanerr); |
70 | ||
71 | ||
4c0d7bc7 | 72 | private: |
73 | ||
74 | static void GetMoment(TString name, TString var, TF1 * func, Float_t &mean, Float_t &error, Float_t min, Float_t max) ; | |
75 | static Double_t GetNormalizedFunc(double * x, double* p); | |
76 | ||
c3c47c65 | 77 | static TF1 * fgFuncForNormalized; // Function used in GetNormalizedFunc |
4c0d7bc7 | 78 | |
79 | AliBWTools(const AliBWTools&); // not implemented | |
80 | AliBWTools& operator=(const AliBWTools&); // not implemented | |
81 | ||
82 | ClassDef(AliBWTools,1); | |
83 | ||
84 | }; | |
85 | ||
86 | #endif |