AliPhysics  ef3b16e (ef3b16e)
AliHFMassFitterVAR.h
Go to the documentation of this file.
1 #ifndef ALIHFMASSFITTERVAR_H
2 #define ALIHFMASSFITTERVAR_H
3 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
5 
6 /* $Id$ */
7 
16 
17 #include <TNamed.h>
18 #include <TString.h>
19 #include "AliHFMassFitter.h"
20 class TF1;
21 class TNtuple;
22 class TFile;
23 class TList;
24 class TH1F;
25 class TVirtualPad;
26 class TPaveText;
27 
29 
30  public:
32  AliHFMassFitterVAR(const TH1F* histoToFit, Double_t minvalue, Double_t maxvalue, Int_t rebin=1,Int_t fittypeb=0,Int_t fittypes=0);
33  virtual ~AliHFMassFitterVAR();
34 
37 
39 /* void SetHisto(const TH1F *histoToFit); */
40 /* void SetRangeFit(Double_t minvalue, Double_t maxvalue){fminMass=minvalue; fmaxMass=maxvalue; CheckRangeFit();} */
41 /* void SetMinRangeFit(Double_t minvalue){fminMass=minvalue;printf("CheckRangeFit after SetMaxRangeFit is also set\n");} */
42 /* void SetMaxRangeFit(Double_t maxvalue){fmaxMass=maxvalue;printf("CheckRangeFit after SetMinRangeFit is also set\n");} */
43 /* void SetBinN(Int_t newbinN){fNbin=newbinN;} */
44 /* void SetType(Int_t fittypeb, Int_t fittypes); */
45 /* void SetReflectionSigmaFactor(Int_t constant) {ffactor=constant;} */
46 /* void SetInitialGaussianMean(Double_t mean) {fMass=mean;} // change the default value of the mean */
47 /* void SetInitialGaussianSigma(Double_t sigma) {fSigmaSgn=sigma;} // change the default value of the sigma */
48 /* void SetSideBands(Bool_t onlysidebands=kTRUE) {fSideBands=onlysidebands;} // consider only side bands */
49 /* void SetFixParam(Bool_t *fixpar){fFixPar=fixpar;} */
50 /* void SetDefaultFixParam(); */
51 /* Bool_t SetFixThisParam(Int_t thispar,Bool_t fixpar); */
52 
53 /* //getters */
54 /* TH1F* GetHistoClone() const; //return the histogram */
55 /* void GetRangeFit(Double_t &minvalue, Double_t &maxvalue) const {minvalue=fminMass; maxvalue=fmaxMass;} */
56 /* Double_t GetMinRangeFit()const {return fminMass;} */
57 /* Double_t GetMaxRangeFit()const {return fmaxMass;} */
58 /* Int_t GetBinN() const {return fNbin;} */
59 /* void GetFitPars(Float_t* pars) const; */
60 /* Int_t GetNFinalPars() const {return fNFinalPars;} */
61 /* void GetTypeOfFit(Bool_t &background, Int_t &typeb) const {background = fWithBkg; typeb = ftypeOfFit4Bkg;} */
62 /* Int_t GetReflectionSigmaFactor() const {return ffactor;} */
63 /* Double_t GetMean() const {return fMass;} */
64 /* Double_t GetMeanUncertainty() const {return fMassErr;} */
65 /* Double_t GetSigma()const {return fSigmaSgn;} */
66 /* Double_t GetSigmaUncertainty()const { return fSigmaSgnErr;} */
67 /* Double_t GetRawYield()const {return fRawYield;} */
68 /* Double_t GetRawYieldError()const {return fRawYieldErr;} */
69 /* Double_t GetChiSquare() const; */
70 /* Double_t GetReducedChiSquare() const; */
71 /* void GetSideBandsBounds(Int_t& lb, Int_t& hb) const; */
72 /* Bool_t* GetFixParam()const {return fFixPar;} */
73 /* Bool_t GetFixThisParam(Int_t thispar)const; */
74 /* TVirtualPad* GetPad(Double_t nsigma=3,Int_t writeFitInfo=1)const; */
75 
76 /* void PrintParTitles() const; */
77 
78 /* void InitNtuParam(TString ntuname="ntupar"); // initialize TNtuple to store the parameters */
79 /* void FillNtuParam(); //Fill the TNtuple with the current parameters */
80 /* TNtuple* GetNtuParam() const {return fntuParam;} // return the TNtuple */
81 /* TNtuple* NtuParamOneShot(TString ntuname="ntupar"); // the three functions above all together */
82 /* void WriteHisto(TString path="./") const; // write the histogram */
83 /* void WriteNtuple(TString path="./") const; // write the TNtuple */
84  void WriteCanvas(TString userIDstring="",TString path="./",Double_t nsigma=3,Int_t writeFitInfo=1,Bool_t draw=kFALSE) const; //write the canvas in a root file
85  void DrawHere(TVirtualPad* pd,Double_t nsigma=3,Int_t writeFitInfo=1);
86 /* void DrawFit(Double_t nsigma=3) const; */
87 /* void Reset(); */
88 
89  void IntS(Float_t *valuewitherror) const;
90  Double_t IntTot() const {return fhistoInvMass->Integral("width");}
91  void Signal(Double_t nOfSigma,Double_t &signal,Double_t &errsignal) const;
92  void Signal(Double_t min,Double_t max,Double_t &signal,Double_t &errsignal) const;
93  void Background(Double_t nOfSigma,Double_t &background,Double_t &errbackground) const;
94  void Background(Double_t min,Double_t max,Double_t &background,Double_t &errbackground) const;
95  void Significance(Double_t nOfSigma,Double_t &significance,Double_t &errsignificance) const;
96  void Significance(Double_t min,Double_t max,Double_t &significance,Double_t &errsignificance) const;
98  TH1F* SetTemplateReflections(const TH1F *h,TString option="templ",Double_t minRange=1.72,Double_t maxRange=2.05);
99  void SetFixReflOverS(Double_t val,Bool_t fixpar=kTRUE){fReflInit=val;
100  if(ftypeOfFit4Sgn!=2)Printf("Set or Fixing Refl/Signal but fit with template not foreseen");
101  fFixParReflExternalValue[0]=fixpar;
102  fparReflFixExt[0]=val;
103  }
104  void SetFixGaussianMean(Double_t mean=1.865,Bool_t fixpar=kTRUE){fFixParSignExternalValue[1]=fixpar; fparSignFixExt[1]=mean;}
106  void SetBackHighPolDegree(Int_t deg);
108  Bool_t PrepareHighPolFit(TF1 *fback);
116  Bool_t MassFitter(Bool_t draw=kTRUE);
118  TH1F* GetOverBackgroundResidualsAndPulls(Double_t minrange=0,Double_t maxrange=-1,TH1 *hPulls=0x0,TH1 *hResidualTrend=0x0,TH1 *hPullsTrend=0x0);
119  TH1F* GetAllRangeResidualsAndPulls(Double_t minrange=0,Double_t maxrange=-1,TH1 *hPulls=0x0,TH1 *hResidualTrend=0x0,TH1 *hPullsTrend=0x0);
120  TPaveText* GetYieldBox(Double_t nsigma=3.);
121  TPaveText* GetFitParametersBox(Double_t nsigma=3.,Int_t mode=0);
122 
123 /* void RebinMass(Int_t bingroup=1); */
124 /* TF1* GetBackgroundFullRangeFunc(){ */
125 /* return fhistoInvMass->GetFunction("funcbkgFullRange"); */
126 /* } */
127 /* TF1* GetBackgroundRecalcFunc(){ */
128 /* return fhistoInvMass->GetFunction("funcbkgRecalc"); */
129 /* } */
130 /* TF1* GetMassFunc(){ */
131 /* return fhistoInvMass->GetFunction("funcmass"); */
132 /* } */
133 
134 
135  private:
136 
137  void PlotFitVAR(TVirtualPad* pd,Double_t nsigma=3,Int_t writeFitInfo=1);
138 
139  void ComputeParSize();
140  void ComputeNFinalPars();
143  void AddFunctionsToHisto();
147  TH1F *fhTemplRefl;
166 /* TH1F* fhistoInvMass; // histogram to fit */
167 /* Double_t fminMass; // lower mass limit */
168 /* Double_t fmaxMass; // upper mass limit */
169 /* Int_t fminBinMass; // bin corresponding to fminMass */
170 /* Int_t fmaxBinMass; // bin corresponding to fmaxMass */
171 /* Int_t fNbin; // number of bins */
172 /* Int_t fParsSize; // size of fFitPars array */
173 /* Int_t fNFinalPars; // number of parameters of the final function */
174 /* Float_t* fFitPars; //[fParsSize] array of fit parameters */
175 /* Bool_t fWithBkg; // signal+background (kTRUE) or signal only (kFALSE) */
176 /* Int_t ftypeOfFit4Bkg; // 0 = exponential; 1 = linear; 2 = pol2 */
177 /* Int_t ftypeOfFit4Sgn; // 0 = gaus; 1 = gaus+gaus broadened */
178 /* Int_t ffactor; // number to multiply to the sigma of the signal to obtain the reflected gaussian */
179 /* TNtuple* fntuParam; // contains fit parameters */
180 /* Double_t fMass; // signal gaussian mean value */
181 /* Double_t fMassErr; // err signal gaussian mean value */
182 /* Double_t fSigmaSgn; // signal gaussian sigma */
183 /* Double_t fSigmaSgnErr; // err signal gaussian sigma */
184 /* Double_t fRawYield; // signal gaussian integral */
185 /* Double_t fRawYieldErr; // err on signal gaussian integral */
186 /* Bool_t fSideBands; // kTRUE = only side bands considered */
187 /* Bool_t* fFixPar; //[fNFinalPars] for each par if kTRUE it is fixed in fit */
188 /* Int_t fSideBandl; // left side band limit (bin number) */
189 /* Int_t fSideBandr; // right side band limit (bin number) */
190 /* Int_t fcounter; // internal counter */
191 /* TList* fContourGraph; // TList of TGraph containing contour plots */
192 
194  ClassDef(AliHFMassFitterVAR,2);
195 };
197 
198 #endif
199 
200 
void Significance(Double_t nOfSigma, Double_t &significance, Double_t &errsignificance) const
backgournd in (min, max) with error
Double_t fReflInit
smoothing refl template
void Background(Double_t nOfSigma, Double_t &background, Double_t &errbackground) const
signal in (min, max) with error
Double_t FitFunction4BkgAndReflDraw(Double_t *x, Double_t *par)
TPaveText * GetYieldBox(Double_t nsigma=3.)
void SetFixReflOverS(Double_t val, Bool_t fixpar=kTRUE)
TPaveText * GetFitParametersBox(Double_t nsigma=3., Int_t mode=0)
TString * fSignParNames
template of reflection contribution
Double_t * fparReflFixExt
external values to fix back parameters
double Double_t
Definition: External.C:58
void PlotFitVAR(TVirtualPad *pd, Double_t nsigma=3, Int_t writeFitInfo=1)
Int_t fNparBack
number of signal parameters
Bool_t * fFixParReflExternalValue
fix signal parameter from ext value
Bool_t RefitWithBkgOnly(Bool_t draw=kTRUE)
void WriteCanvas(TString userIDstring="", TString path="./", Double_t nsigma=3, Int_t writeFitInfo=1, Bool_t draw=kFALSE) const
setters
Bool_t * fFixParBack
fix signal parameter from ext value
void Signal(Double_t nOfSigma, Double_t &signal, Double_t &errsignal) const
return total integral of the histogram
Double_t FitFunction4Sgn(Double_t *x, Double_t *par)
Double_t mass
void DrawHere(TVirtualPad *pd, Double_t nsigma=3, Int_t writeFitInfo=1)
void SetBackHighPolDegree(Int_t deg)
void SetParticlePdgMass(Double_t mass)
Int_t ftypeOfFit4Sgn
0 = exponential; 1 = linear; 2 = pol2
Int_t fNparRefl
number of bkg parameters
Bool_t * fFixParBackExternalValue
fix signal parameter from ext value
Double_t GetReflOverSignal(Double_t &err) const
significance in (min, max) with error
Bool_t MassFitter(Bool_t draw=kTRUE)
Bool_t * fFixParRefl
fix signal parameter from ext value
TString * fReflParNames
back parameter names
Double_t * sigma
AliHFMassFitterVAR for the fit of invariant mass distribution of charmed mesons.
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Double_t fRawYieldHelp
external values to fix refl parameters
Int_t fpolbackdegreeTay
internal variable used when fitting with reflections
Double_t nsigma
TH1F * SetTemplateReflections(const TH1F *h, TString option="templ", Double_t minRange=1.72, Double_t maxRange=2.05)
Int_t mode
Definition: anaM.C:41
Double_t BackFitFuncPolHelper(Double_t *x, Double_t *par)
TString * fBackParNames
signal parameter names
Double_t FitFunction4Bkg(Double_t *x, Double_t *par)
void IntS(Float_t *valuewitherror) const
Double_t fMassParticle
help variable
Bool_t draw[nPtBins]
void SetFixGaussianSigma(Double_t sigma=0.012, Bool_t fixpar=kTRUE)
Double_t FitFunction4Refl(Double_t *x, Double_t *par)
AliHFMassFitterVAR & operator=(const AliHFMassFitterVAR &mfit)
Double_t * fparBackFixExt
external values to fix signal parameters
Bool_t fSmoothRefl
refl parameter names
Int_t rebin
Double_t IntTot() const
integral of signal given my the fit with error
TH1F * GetOverBackgroundResidualsAndPulls(Double_t minrange=0, Double_t maxrange=-1, TH1 *hPulls=0x0, TH1 *hResidualTrend=0x0, TH1 *hPullsTrend=0x0)
Bool_t * fFixParSign
initial value of Refl/Signal
Int_t fpolbackdegreeTayHelp
degree of polynomial expansion for back fit (option 6 for back)
bool Bool_t
Definition: External.C:53
Bool_t * fFixParSignExternalValue
fix signal parameter from ext value
TH1F * GetAllRangeResidualsAndPulls(Double_t minrange=0, Double_t maxrange=-1, TH1 *hPulls=0x0, TH1 *hResidualTrend=0x0, TH1 *hPullsTrend=0x0)
Double_t FitFunction4MassDistr(Double_t *x, Double_t *par)
significance in (min, max) with error
void SetFixGaussianMean(Double_t mean=1.865, Bool_t fixpar=kTRUE)
AliHFMassFitter for the fit of invariant mass distribution of charmed mesons.
Definition: External.C:196
TH1F * fhTemplRefl
number of reflection parameters
Double_t * fparSignFixExt
fix signal parameter from ext value
Bool_t PrepareHighPolFit(TF1 *fback)