AliPhysics  63e47e1 (63e47e1)
AliHFVnVsMassFitter.h
Go to the documentation of this file.
1 #ifndef ALIHFVNVSMASSFITTER_H
2 #define ALIHFVNVSMASSFITTER_H
3 
7 #include <TObject.h>
8 #include <Riostream.h>
9 #include <TVirtualPad.h>
10 #include <TH1F.h>
11 #include "Fit/Fitter.h"
12 #include "Fit/Chi2FCN.h"
13 #include "Math/WrappedMultiTF1.h"
14 #include "AliHFInvMassFitter.h"
15 
16 class AliHFVnVsMassFitter : public TObject {
17 
18 public:
20  AliHFVnVsMassFitter(TH1F* hMass, TH1F* hvn, Double_t min, Double_t max, Int_t funcMassBkg, Int_t funcMassSgn, Int_t funcvnBkg);
22 
23  enum ETypeOfBkg{kExpo=0, kLin=1, kPol2=2, kNoBk=3, kPow=4, kPowEx=5, kPoln=6};
24  enum ETypeOfSgn{kGaus=0, k2Gaus=1};
26 
27  Bool_t SimultaneusFit(Bool_t drawFit=kTRUE);
28  void DrawHere(TVirtualPad* c);
29 
30  //setters
36  void SetMassSgnFunc(Int_t functype) {fMassSgnFuncType=functype;}
37  void SetMassBkgFunc(Int_t functype) {fMassBkgFuncType=functype;}
38  void SetVnBkgFunc(Int_t functype) {fVnBkgFuncType=functype;}
45  if(fMassBkgFuncType!=6) AliFatal("fMassBkgFuncType should be set to 6 to use higher order polynomials\n");
46  fPolDegreeBkg=deg;
47  }
49  if(fVnBkgFuncType!=6) AliFatal("fVnBkgFuncType should be set to 6 to use higher order polynomials\n");
50  fPolDegreeVnBkg=deg;
51  }
52  void SetTemplateReflections(const TH1 *h, TString opt, Double_t minRange, Double_t maxRange) {
53  fHistoTemplRflInit=(TH1F*)h->Clone();
60  fRflOpt=opt;
61  fMinRefl=minRange;
62  fMaxRefl=maxRange;
63  fReflections=kTRUE;
64  }
66  void SetFixReflOverS(Double_t rovers){
67  SetInitialReflOverS(rovers);
68  fFixRflOverSig=kTRUE;
69  }
72  fVnRflLimited=kTRUE;
73  fVnRflMin=min;
74  fVnRflMax=max;
75  }
77  fSecondPeak=kTRUE; fSecMass=mass; fSecWidth=width;
78  fFixSecMass=fixm; fFixSecWidth=fixw;
79  fDoSecondPeakVn=doVn;
80  }
81  void SetHarmonic(Int_t harmonic=2) {fHarmonic=harmonic;}
82 
83  //getters
84  Double_t GetVn() const {return fVn;}
86  Double_t GetMean() const {return fMean;}
88  Double_t GetSigma() const {return fSigma;}
90  Double_t GetRawYield() const {return fRawYield;}
92  Double_t GetChiSquare() const {return fChiSquare;}
93  Int_t GetNDF() const {return fNDF;}
95  Double_t GetFitProbability() const {return fProb;}
98  if(fHistoTemplRfl) {return (TH1F*)fHistoTemplRfl->Clone();}
99  else if(fHistoTemplRflInit) {return (TH1F*)fHistoTemplRflInit->Clone();}
100  else {return 0;}
101  }
102  void Signal(Double_t nOfSigma,Double_t &signal,Double_t &errsignal) const;
103  void Signal(Double_t min,Double_t max,Double_t &signal,Double_t &errsignal) const;
104  void Background(Double_t nOfSigma, Double_t &background,Double_t &errbackground) const;
105  void Background(Double_t min, Double_t max, Double_t &background,Double_t &errbackground) const;
106  void Significance(Double_t nOfSigma, Double_t &significance,Double_t &errsignificance) const;
107  void Significance(Double_t min, Double_t max, Double_t &significance,Double_t &errsignificance) const;
109  if(fMassTotFunc) return fMassTotFunc;
110  else return 0x0;
111  }
113  if(fVnTotFunc) return fVnTotFunc;
114  else return 0x0;
115  }
116 
117  //struct for global chi2 (for simultaneus fit)
119  AliHFGlobalChi2(ROOT::Math::IMultiGenFunction & f1,ROOT::Math::IMultiGenFunction & f2) : fChi2_1(&f1), fChi2_2(&f2) {}
120 
121  double operator() (const double *par) const {
122  return (*fChi2_1)(par) + (*fChi2_2)(par);
123  }
124  const ROOT::Math::IMultiGenFunction * fChi2_1;
125  const ROOT::Math::IMultiGenFunction * fChi2_2;
126  };
127 
128 private:
129 
132  Double_t GetExpoPDF(Double_t x, Double_t slope, Bool_t isnorm=kTRUE);
133  Double_t GetPolPDF(Double_t x, Double_t *pars, Int_t order, Bool_t isnorm=kTRUE);
136  Double_t GetHigherPolFuncPDF(Double_t x, Double_t *pars, Int_t Ndeg, Bool_t isnorm=kTRUE);
138  Double_t MassBkg(Double_t *m, Double_t *pars);
142  Double_t vnBkgFunc(Double_t *m, Double_t *pars);
143  Double_t MassFunc(Double_t *m, Double_t *pars);
144  Double_t vnFunc(Double_t *m, Double_t *pars);
145 
148  Bool_t MassPrefit();
149  Bool_t VnSBPrefit();
150  void DrawFit();
151  void SetParNames();
152 
154  TH1F* fMassHisto;
164  TF1* fVnBkgFunc;
165  TF1* fVnTotFunc;
230 
232  ClassDef(AliHFVnVsMassFitter,4);
234 };
235 #endif //ALIHFVNVSMASSFITTER
void SetReflVnParLimits(Double_t min, Double_t max)
Double_t GetChiSquare() const
Int_t fVnRflOpt
internal variable for fit with reflections
Int_t fFrac2GausFixed
flag to fix second peak width in case of k2Gaus
Int_t fPolDegreeVnBkg
degree of polynomial expansion for back fit (option 6 for back)
Double_t MassSecondPeak(Double_t *m, Double_t *par)
double operator()(const double *par) const
Double_t GetExpoPDF(Double_t x, Double_t slope, Bool_t isnorm=kTRUE)
Int_t fNParsVnBkg
number of parameters in mass bkg fit function
Bool_t fFixSecWidth
flag to fix the position of the 2nd peak
double Double_t
Definition: External.C:58
AliHFGlobalChi2(ROOT::Math::IMultiGenFunction &f1, ROOT::Math::IMultiGenFunction &f2)
Int_t fNParsVnSecPeak
number of parameters in vn sgn fit function (1)
Int_t fNParsRfl
flag use/not use reflections
Bool_t fReflections
degree of polynomial expansion for vn back fit (option 6 for back)
Double_t MassRfl(Double_t *m, Double_t *par)
Bool_t SimultaneusFit(Bool_t drawFit=kTRUE)
Double_t GetPowerFuncPDF(Double_t x, Double_t *pars)
Bool_t fMeanFixedFromMassFit
initialization for fraction of second gaussian in case of k2Gaus
Double_t fMean
uncertainty on mass peak width from simultaneus fit
void SetFixReflOverS(Double_t rovers)
TH1F * fHistoTemplRfl
switch for fix refl/signal
Double_t fMassParticle
flag to fix fraction of second gaussian in case of k2Gaus
Bool_t fFixSecMass
width of the 2nd peak
Int_t fNParsSec
fit function for second peak
Bool_t fSecondPeak
maximum vn of reflections
Double_t fSigma2GausInit
initialization for peak position
Double_t GetHigherPolFuncPDF(Double_t x, Double_t *pars, Int_t Ndeg, Bool_t isnorm=kTRUE)
Bool_t fSigmaFixedFromMassFit
flag to fix peak position from mass prefit
Double_t mass
void Signal(Double_t nOfSigma, Double_t &signal, Double_t &errsignal) const
Double_t fSecMass
number of parameters in second peak fit function
TF1 * fMassTotFunc
mass signal fit function (final, after simultaneus fit)
Double_t vnBkgFunc(Double_t *m, Double_t *pars)
Double_t GetVnUncertainty() const
Double_t fRflOverSig
fit parameters in reflection fit function
Double_t fMassMax
upper mass limit
AliHFInvMassFitter class for the fit of invariant mass distribution of charm hadrons.
TCanvas * c
Definition: TestFitELoss.C:172
void IncludeSecondGausPeak(Double_t mass, Bool_t fixm, Double_t width, Bool_t fixw, Bool_t doVn)
Double_t GetMean() const
Double_t GetMeanUncertainty() const
Double_t GetRawYield() const
Int_t fSigma2GausFixed
flag to fix peak position
void SetParticlePdgMass(Double_t mass)
Int_t fMeanFixed
flag to fix peak width
void SetTemplateReflections(const TH1 *h, TString opt, Double_t minRange, Double_t maxRange)
Double_t fVn
lower mass limit
Int_t fMassSgnFuncType
vn vs. mass histogram to fit
void DefineNumberOfParameters()
private methods
void SetNSigmaForVnSB(Int_t nsigma=4)
Double_t fChiSquare
uncertainty raw yield from simultaneus fit
void SetVnBkgFunc(Int_t functype)
void SetReflVnOption(Int_t opt)
Double_t GetSigmaUncertainty() const
Bool_t fSigma2GausFixedFromMassFit
flag to fix peak width from mass prefit
Double_t fRawYieldUncertainty
raw yield from simultaneus fit
Double_t GetPowerExpoPDF(Double_t x, Double_t *pars)
const ROOT::Math::IMultiGenFunction * fChi2_2
Int_t fNSigmaForSB
simultaneus fit probability
Double_t * sigma
TF1 * fMassBkgFunc
mass fit function (1st step, from prefit)
Double_t fMaxRefl
minimum for refelction histo
void SetMassSgnFunc(Int_t functype)
Double_t vnFunc(Double_t *m, Double_t *pars)
Double_t fVnUncertainty
vn of the signal from fit
Double_t fProb
simultaneus fit number of degree of freedom
Double_t MassSignal(Double_t *m, Double_t *pars)
Bool_t fFrac2GausFixedFromMassFit
flag to fix second peak width from mass prefit in case of k2Gaus
int Int_t
Definition: External.C:63
TF1 * fMassSecPeakFunc
switch off/on second peak (for D+->KKpi in Ds)
TF1 * fVnBkgFunc
vn bkg fit function (1st step from SB prefit)
Int_t fPolDegreeBkg
flag to fix fraction of second gaussian in case of k2Gaus
Double_t fSecWidth
position of the 2nd peak
void SetInitialFrac2Gaus(Double_t frac, Int_t opt)
Bool_t fVnRflLimited
option for reflection vn type
TF1 * fVnTotFunc
vn bkg fit function (final, after simultaneus fit)
void SetPolDegreeForVnBackgroundFit(Int_t deg)
Int_t fHarmonic
vn uncertainty of second peak from fit
Double_t fSigmaInit
number of sigma for sidebands region (vn bkg prefit)
Int_t fNParsMassBkg
number of parameters in mass signal fit function
Double_t GetFitProbability() const
Double_t MassBkgRfl(Double_t *m, Double_t *par)
Double_t GetReducedChiSquare() const
Double_t fMeanUncertainty
mass peak position from simultaneus fit
void SetPolDegreeForBackgroundFit(Int_t deg)
void SetHarmonic(Int_t harmonic=2)
Double_t GetPolPDF(Double_t x, Double_t *pars, Int_t order, Bool_t isnorm=kTRUE)
Double_t nsigma
Double_t GetRawYieldUncertainty() const
Double_t fSigma
uncertainty on vn of the signal from simultaneus fit
TF1 * fVnBkgFuncSb
mass fit function (final, after simultaneus fit)
Double_t fMeanInit
initialization for peak width
void SetInitialGaussianSigma2Gaus(Double_t sigma, Int_t opt)
TH1F * fMassHisto
data members
void DrawHere(TVirtualPad *c)
void SetInitialGaussianSigma(Double_t sigma, Int_t opt)
TH1F * fHistoTemplRflInit
histogram with reflection template
Double_t GetGausPDF(Double_t x, Double_t mean, Double_t sigma)
fit functions
Int_t fNDF
simultaneus fit chi square
Bool_t fDoSecondPeakVn
vn of second peak from fit
TF1 * fMassRflFunc
initial histogram with reflection template
Double_t MassFunc(Double_t *m, Double_t *pars)
void Background(Double_t nOfSigma, Double_t &background, Double_t &errbackground) const
AliHFInvMassFitter * fMassFitter
vn fit function (final, after simultaneus fit)
TF1 * fMassBkgRflFunc
fit function for reflections
Double_t GetSigma() const
Int_t fNParsVnRfl
number of parameters in vn sec peak fit function (1 if included, 0 otherwise)
TF1 * fMassFuncFromPrefit
type of vn bkg fit function
TH1F * fVnVsMassHisto
mass histogram to fit
Int_t fNParsMassSgn
mass of selected particle
Int_t fNParsVnSgn
number of parameters in vn bkg fit function
Double_t fSigmaUncertainty
mass peak width from simultaneus fit
Double_t fFrac2GausInit
initialization for second peak width in case of k2Gaus
Double_t fRawYield
uncertainty on mass peak position from simultaneus fit
Double_t fVnRflMax
minimum vn of reflections
Int_t fSigmaFixed
number of parameters in vn refl fit function (1 if included, 0 otherwise)
void SetMassBkgFunc(Int_t functype)
Double_t fMinRefl
refelction option
Int_t fVnBkgFuncType
type of mass bkg fit function
void Significance(Double_t nOfSigma, Double_t &significance, Double_t &errsignificance) const
Double_t GetParticlePdgMass() const
Int_t fMassBkgFuncType
type of mass signal fit function
Double_t fVnRflMin
flag to limit or not the vn of reflections
TF1 * fMassSgnFunc
mass bkg fit function (final, after simultaneus fit)
Double_t GetVn() const
bool Bool_t
Definition: External.C:53
const ROOT::Math::IMultiGenFunction * fChi2_1
Double_t fRawYieldHelp
switch for smoothing of reflection template
Bool_t fFixRflOverSig
reflection/signal
TString fRflOpt
mass bkg fit function plus reflections (final, after simultaneus fit)
Double_t fMassMin
mass fitter for mass prefit
Double_t MassBkg(Double_t *m, Double_t *pars)
Double_t fVnSecPeakUncertainty
flag to introduce second peak vn in the vn vs. mass fit
void SetInitialReflOverS(Double_t rovers)
Bool_t fSmoothRfl
maximum for refelction histo
Definition: External.C:196
void SetInitialGaussianMean(Double_t mean, Int_t opt)
Double_t fVnSecPeak
flag to fix the width of the 2nd peak