]>
Commit | Line | Data |
---|---|---|
fabf4d8e | 1 | #ifndef ALIHFMASSFITTER_H |
2 | #define ALIHFMASSFITTER_H | |
3 | /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | ///////////////////////////////////////////////////////////// | |
7 | // | |
8 | // AliHFMassFitter for the fit of invariant mass distribution | |
9 | // of charmed mesons | |
10 | // | |
11 | // Author: C.Bianchin, chiara.bianchin@pd.infn.it | |
12 | ///////////////////////////////////////////////////////////// | |
13 | ||
14 | #include <TNamed.h> | |
15 | #include <Riostream.h> | |
16 | #include <TH1F.h> | |
17 | #include <TF1.h> | |
18 | #include <TMath.h> | |
19 | #include <TNtuple.h> | |
20 | #include <TFile.h> | |
21 | #include <TString.h> | |
56cbeefb | 22 | #include <TList.h> |
fabf4d8e | 23 | |
24 | ||
25 | class AliHFMassFitter : public TNamed { | |
26 | ||
27 | public: | |
28 | AliHFMassFitter(); | |
29 | AliHFMassFitter(TH1F* histoToFit, Double_t minvalue, Double_t maxvalue, Int_t rebin=1,Int_t fittypeb=0,Int_t fittypes=0); | |
2f328d65 | 30 | virtual ~AliHFMassFitter(); |
fabf4d8e | 31 | |
74179930 | 32 | AliHFMassFitter(const AliHFMassFitter &mfit); |
33 | AliHFMassFitter& operator=(const AliHFMassFitter &mfit); | |
fabf4d8e | 34 | |
35 | //setters | |
56cbeefb | 36 | void SetHisto(TH1F *histoToFit); |
2f328d65 | 37 | void SetRangeFit(Double_t minvalue, Double_t maxvalue){fminMass=minvalue; fmaxMass=maxvalue;} |
38 | void SetMinRangeFit(Double_t minvalue){fminMass=minvalue;} | |
39 | void SetMaxRangeFit(Double_t maxvalue){fmaxMass=maxvalue;} | |
40 | void SetBinN(Int_t newbinN){fNbin=newbinN;} | |
41 | void SetType(Int_t fittypeb, Int_t fittypes); | |
fabf4d8e | 42 | void SetReflectionSigmaFactor(Int_t constant) {ffactor=constant;} |
43 | void SetInitialGaussianMean(Double_t mean) {fMass=mean;} | |
44 | void SetInitialGaussianSigma(Double_t sigma) {fSigmaSgn=sigma;} | |
45 | void SetSideBands(Bool_t onlysidebands=kTRUE) {fSideBands=onlysidebands;} | |
46 | ||
47 | //getters | |
56cbeefb | 48 | TH1F* GetHistoClone() const; |
2f328d65 | 49 | Double_t GetMinRangeFit()const {return fminMass;} |
50 | Double_t GetMaxRangeFit()const {return fmaxMass;} | |
51 | Int_t GetBinN() const {return fNbin;} | |
fabf4d8e | 52 | void GetFitPars(Float_t*) const; |
56cbeefb | 53 | void GetTypeOfFit(Bool_t &background, Int_t &typeb) const {background = fWithBkg; typeb = ftypeOfFit4Bkg;} |
fabf4d8e | 54 | Int_t GetReflectionSigmaFactor() const {return ffactor;} |
0566386c | 55 | Double_t GetMean() const {return fMass;} |
56 | Double_t GetSigma()const {return fSigmaSgn;} | |
34c79b83 | 57 | Double_t GetChiSquare() const; |
b7d4bc49 | 58 | Double_t GetReducedChiSquare() const; |
59 | void GetSideBandsBounds(Int_t&, Int_t&) const; | |
fabf4d8e | 60 | |
61 | void InitNtuParam(char *ntuname="ntupar"); | |
62 | void FillNtuParam(); | |
63 | TNtuple* GetNtuParam() const {return fntuParam;} | |
64 | TNtuple* NtuParamOneShot(char *ntuname="ntupar"); | |
65 | ||
56cbeefb | 66 | void WriteHisto(TString path="./"); |
67 | void WriteNtuple(TString path="./") const; | |
68 | void Reset(); | |
69 | ||
fabf4d8e | 70 | void Signal(Double_t nOfSigma,Double_t &signal,Double_t &errsignal) const; |
71 | void Background(Double_t nOfSigma,Double_t &background,Double_t &errbackground) const; | |
72 | void Significance(Double_t nOfSigma,Double_t &significance,Double_t &errsignificance) const; | |
73 | ||
74 | Double_t FitFunction4MassDistr (Double_t*, Double_t*); | |
75 | Double_t FitFunction4Sgn (Double_t*, Double_t*); | |
76 | Double_t FitFunction4Bkg (Double_t*, Double_t*); | |
34c79b83 | 77 | Bool_t MassFitter(Bool_t draw=kTRUE); |
fabf4d8e | 78 | void RebinMass(Int_t binground=1); |
79 | ||
80 | ||
81 | private: | |
82 | ||
2f328d65 | 83 | void ComputeParSize(); |
b7d4bc49 | 84 | Bool_t SideBandsBounds(); |
2f328d65 | 85 | |
74179930 | 86 | TH1F *fhistoInvMass; // histogram to fit |
fabf4d8e | 87 | Double_t fminMass; // lower mass limit |
88 | Double_t fmaxMass; // upper mass limit | |
89 | Int_t fNbin; // number of bins | |
2f328d65 | 90 | Int_t fParsSize; // size of fFitPars array |
91 | Float_t *fFitPars; //[fParsSize] array of fit parameters | |
fabf4d8e | 92 | Bool_t fWithBkg; // signal+background (kTRUE) or signal only (kFALSE) |
93 | Int_t ftypeOfFit4Bkg; // 0 = exponential; 1 = linear; 2 = pol2 | |
94 | Int_t ftypeOfFit4Sgn; // 0 = gaus; 1 = gaus+gaus broadened | |
95 | Int_t ffactor; // number to multiply to the sigma of the signal to obtain the reflected gaussian | |
96 | TNtuple *fntuParam; // contains fit parameters | |
97 | Double_t fMass; // signal gaussian mean value | |
98 | Double_t fSigmaSgn; // signal gaussian sigma | |
99 | Bool_t fSideBands; // kTRUE = only side bands considered | |
b7d4bc49 | 100 | Int_t fSideBandl; // left side band limit (bin number) |
101 | Int_t fSideBandr; // right side band limit (bin number) | |
56cbeefb | 102 | Int_t fcounter; // internal counter |
fabf4d8e | 103 | |
b7d4bc49 | 104 | ClassDef(AliHFMassFitter,2); // class for invariant mass fit |
fabf4d8e | 105 | }; |
106 | ||
107 | #endif | |
108 | ||
74179930 | 109 |