AliPhysics  ec7afe5 (ec7afe5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Go to the documentation of this file.
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"
16 class AliHFVnVsMassFitter : public TObject {
18 public:
20  AliHFVnVsMassFitter(TH1F* hMass, TH1F* hvn, Double_t min, Double_t max, Int_t funcMassBkg, Int_t funcMassSgn, Int_t funcvnBkg);
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  Bool_t SimultaneusFit(Bool_t drawFit=kTRUE);
27  void DrawHere(TVirtualPad* c);
29  //setters
33  void SetMassSgnFunc(Int_t functype) {fMassSgnFuncType=functype;}
34  void SetMassBkgFunc(Int_t functype) {fMassBkgFuncType=functype;}
35  void SetVnBkgFunc(Int_t functype) {fVnBkgFuncType=functype;}
40  if(fMassBkgFuncType!=6) AliFatal("fMassBkgFuncType should be set to 6 to use higher order polynomials\n");
41  fPolDegreeBkg=deg;
42  }
43  void SetTemplateReflections(const TH1 *h, TString opt, Double_t minRange, Double_t maxRange) {
44  fHistoTemplRflInit=(TH1F*)h->Clone();
51  fRflOpt=opt;
52  fMinRefl=minRange;
53  fMaxRefl=maxRange;
54  fReflections=kTRUE;
55  }
57  void SetFixReflOverS(Double_t rovers){
58  SetInitialReflOverS(rovers);
59  fFixRflOverSig=kTRUE;
60  }
62  fSecondPeak=kTRUE; fSecMass=mass; fSecWidth=width;
63  fFixSecMass=fixm; fFixSecWidth=fixw;
64  fDoSecondPeakVn=doVn;
65  }
66  void SetHarmonic(Int_t harmonic=2) {fHarmonic=harmonic;}
68  //getters
69  Double_t GetVn() const {return fVn;}
71  Double_t GetMean() const {return fMean;}
73  Double_t GetSigma() const {return fSigma;}
75  Double_t GetRawYield() const {return fRawYield;}
77  Double_t GetChiSquare() const {return fChiSquare;}
78  Int_t GetNDF() const {return fNDF;}
80  Double_t GetFitProbability() const {return fProb;}
83  if(fHistoTemplRfl) {return (TH1F*)fHistoTemplRfl->Clone();}
84  else if(fHistoTemplRflInit) {return (TH1F*)fHistoTemplRflInit->Clone();}
85  else {return 0;}
86  }
87  void Signal(Double_t nOfSigma,Double_t &signal,Double_t &errsignal) const;
88  void Signal(Double_t min,Double_t max,Double_t &signal,Double_t &errsignal) const;
89  void Background(Double_t nOfSigma, Double_t &background,Double_t &errbackground) const;
90  void Background(Double_t min, Double_t max, Double_t &background,Double_t &errbackground) const;
91  void Significance(Double_t nOfSigma, Double_t &significance,Double_t &errsignificance) const;
92  void Significance(Double_t min, Double_t max, Double_t &significance,Double_t &errsignificance) const;
94  if(fMassTotFunc) return fMassTotFunc;
95  else return 0x0;
96  }
98  if(fVnTotFunc) return fVnTotFunc;
99  else return 0x0;
100  }
102  //struct for global chi2 (for simultaneus fit)
104  AliHFGlobalChi2(ROOT::Math::IMultiGenFunction & f1,ROOT::Math::IMultiGenFunction & f2) : fChi2_1(&f1), fChi2_2(&f2) {}
106  double operator() (const double *par) const {
107  return (*fChi2_1)(par) + (*fChi2_2)(par);
108  }
109  const ROOT::Math::IMultiGenFunction * fChi2_1;
110  const ROOT::Math::IMultiGenFunction * fChi2_2;
111  };
113 private:
118  Double_t GetPolPDF(Double_t x, Double_t *pars, Int_t order, Bool_t isnorm=kTRUE);
123  Double_t MassBkg(Double_t *m, Double_t *pars);
127  Double_t vnBkgFunc(Double_t *m, Double_t *pars);
128  Double_t MassFunc(Double_t *m, Double_t *pars);
129  Double_t vnFunc(Double_t *m, Double_t *pars);
133  Bool_t MassPrefit();
134  Bool_t VnSBPrefit();
135  void DrawFit();
136  void SetParNames();
139  TH1F* fMassHisto;
149  TF1* fVnBkgFunc;
150  TF1* fVnTotFunc;
203  ClassDef(AliHFVnVsMassFitter,1);
205 };
Double_t GetChiSquare() const
Double_t MassSecondPeak(Double_t *m, Double_t *par)
double operator()(const double *par) const
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 fNParsRfl
flag use/not use reflections
Bool_t fReflections
degree of polynomial expansion for 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
flag to fix peak width from mass prefit
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 peak position from mass prefit
Bool_t fFixSecMass
width of the 2nd peak
Int_t fNParsSec
fit function for second peak
Bool_t fSecondPeak
internal variable for fit with reflections
Bool_t fSigmaFixedFromMassFit
initialization for peak position
Double_t GetHigherPolFuncPDF(Double_t x, Double_t *pars)
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
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)
Double_t GetSigmaUncertainty() const
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)
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)
Double_t GetExpoPDF(Double_t x, Double_t slope)
Int_t fPolDegreeBkg
flag to fix peak position
Double_t fSecWidth
position of the 2nd peak
TF1 * fVnTotFunc
vn bkg fit function (final, after simultaneus fit)
Int_t fHarmonic
vn uncertainty of second peak from fit
Double_t fSigmaInit
number of sigma for sidebands region (vn bkg prefit)
void SetInitialGaussianMean(Double_t mean)
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
TH1F * fMassHisto
data members
void DrawHere(TVirtualPad *c)
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
void SetInitialGaussianSigma(Double_t sigma)
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
TF1 * fMassFuncFromPrefit
type of vn bkg fit function
TH1F * fVnVsMassHisto
mass histogram to fit
Int_t fNParsMassSgn
mass of selected particle
Double_t fSigmaUncertainty
mass peak width from simultaneus fit
Double_t fRawYield
uncertainty on mass peak position from simultaneus fit
Int_t fSigmaFixed
number of parameters in vn bkg fit function
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
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
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
Double_t fVnSecPeak
flag to fix the width of the 2nd peak