AliPhysics  8195daa (8195daa)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliHFInvMassFitter.h
Go to the documentation of this file.
1 #ifndef ALIHFINVMASSFITTER_H
2 #define ALIHFINVMASSFITTER_H
3 
4 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice */
6 
7 
16 
17 
18 #include <TNamed.h>
19 
20 class TF1;
21 class TH1F;
22 
23 class AliHFInvMassFitter : public TNamed {
24  public:
25 
26  enum ETypeOfBkg{ kExpo=0, kLin=1, kPol2=2, kNoBk=3, kPow=4, kPowEx=5};
27  enum ETypeOfSgn{ kGaus=0, k2Gaus=1 };
29  AliHFInvMassFitter(const TH1F* histoToFit, Double_t minvalue, Double_t maxvalue, Int_t fittypeb=kExpo, Int_t fittypes=kGaus);
31 
32  void SetRangeFit(Double_t minvalue, Double_t maxvalue){
33  fMinMass=minvalue; fMaxMass=maxvalue;
34  }
35 
39  void SetFitOption(TString opt){fFitOption=opt.Data();};
43  if(fTypeOfFit4Bkg!=6) AliFatal("fTypeOfFit4Bkg should be set to 6 to use higher order polynomials\n");
44  fPolDegreeBkg=deg;
46  }
51  fFixedMean=kTRUE;
52  }
55  fFixedSigma=kTRUE;
56  }
58  fFixedRawYield=yield;
59  }
62  }
63  TH1F* SetTemplateReflections(const TH1 *h, TString opt,Double_t minRange,Double_t maxRange);
65  void SetFixReflOverS(Double_t rovers){
66  SetInitialReflOverS(rovers);
67  fFixRflOverSig=kTRUE;
68  }
70  fSecondPeak=kTRUE; fSecMass=mass; fSecWidth=width;
71  fFixSecMass=fixm; fFixSecWidth=fixw;
72  }
73  Double_t GetRawYield()const {return fRawYield;}
75  Double_t GetMean() const {return fMass;}
77  Double_t GetSigma()const {return fSigmaSgn;}
81  TF1* GetMassFunc(){return fTotFunc;}
83  if(fTotFunc) return fTotFunc->GetChisquare();
84  else return -1;
85  }
87  if(fTotFunc) return fTotFunc->GetChisquare()/fTotFunc->GetNDF();
88  else return -1;
89  }
91  if(fTotFunc) return fTotFunc->GetProb();
92  else return -1;
93  }
94 
102  virtual void Signal(Double_t nOfSigma,Double_t &signal,Double_t &errsignal) const;
103  virtual 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 DrawHere(TVirtualPad* c);
107  void Significance(Double_t nOfSigma, Double_t &significance,Double_t &errsignificance) const;
108  void Significance(Double_t min, Double_t max, Double_t &significance,Double_t &errsignificance) const;
109  void PrintFunctions();
110  private:
111  AliHFInvMassFitter(const AliHFInvMassFitter &source);
113 
114  void SetNumberOfParams();
116  TF1* CreateBackgroundFitFunction(TString fname, Double_t integral);
117  TF1* CreateSignalFitFunction(TString fname, Double_t integral);
118  TF1* CreateSecondPeakFunction(TString fname, Double_t integral);
119  TF1* CreateReflectionFunction(TString fname);
121  TF1* CreateTotalFitFunction(TString fname);
122  Bool_t PrepareHighPolFit(TF1 *fback);
124 
125  void DrawFit();
126 
149  TF1* fSigFunc;
150  TF1* fBkgFuncSb;
151  TF1* fBkgFunc;
160  TF1* fRflFunc;
161  TF1* fBkRFunc;
168  TF1* fSecFunc;
169  TF1* fTotFunc;
170 
172  ClassDef(AliHFInvMassFitter,3);
173 };
175 
176 #endif
Int_t fTypeOfFit4Sgn
pdg value of particle mass
Double_t GetMeanUncertainty() const
Double_t fSigmaSgnErr
signal gaussian sigma
Bool_t fFixSecWidth
flag to fix the position of the 2nd peak
Double_t GetChiSquare() const
Double_t GetFitProbability() const
Double_t fRawYieldHelp
switch for smoothing of reflection template
double Double_t
Definition: External.C:58
void SetFixReflOverS(Double_t rovers)
Double_t fRawYield
L, LW or Chi2.
void IncludeSecondGausPeak(Double_t mass, Bool_t fixm, Double_t width, Bool_t fixw)
TF1 * CreateReflectionFunction(TString fname)
Int_t fCurPolDegreeBkg
degree of polynomial expansion for back fit (option 6 for back)
Bool_t PrepareHighPolFit(TF1 *fback)
Bool_t fOnlySideBands
fit parameters in background fit function
virtual void Signal(Double_t nOfSigma, Double_t &signal, Double_t &errsignal) const
Double_t FitFunction4SecPeak(Double_t *x, Double_t *par)
Double_t fMass
signal fit func
TF1 * CreateTotalFitFunction(TString fname)
Double_t mass
Double_t fRawYieldErr
signal gaussian integral
Int_t fNParsBkg
fit parameters in signal fit function
AliHFInvMassFitter class for the fit of invariant mass distribution of charm hadrons.
void SetFitOption(TString opt)
Int_t fNParsRfl
flag use/not use reflections
TCanvas * c
Definition: TestFitELoss.C:172
TF1 * CreateSecondPeakFunction(TString fname, Double_t integral)
TF1 * fTotFunc
fit function for second peak
Double_t fFixedRawYield
switch for fix Sigma of gaussian
Double_t GetSigma() const
Double_t FitFunction4Bkg(Double_t *x, Double_t *par)
Double_t fSigmaSgn
unc on signal gaussian mean value
void SetPolDegreeForBackgroundFit(Int_t deg)
Double_t fSecMass
fit parameters in 2nd peak fit function
Double_t GetParticlePdgMass()
void SetFixGaussianSigma(Double_t sigma)
Bool_t fFixSecMass
width of the 2nd peak
TF1 * fSecFunc
flag to fix the width of the 2nd peak
Double_t * sigma
void SetFixGaussianMean(Double_t mean)
int Int_t
Definition: External.C:63
Double_t fSecWidth
position of the 2nd peak
Double_t GetMean() const
TString fFitOption
number of sigmas to veto the signal peak
TF1 * fBkRFunc
fit function for reflections
Int_t fNParsSec
switch off/on second peak (for D+->KKpi in Ds)
TF1 * CreateSignalFitFunction(TString fname, Double_t integral)
Bool_t fFixedMean
unc on signal gaussian sigma
Double_t GetReducedChiSquare() const
Double_t fMassParticle
help variable
void SetFixSignalYield(Double_t yield)
Double_t FitFunction4Refl(Double_t *x, Double_t *par)
void SetParticlePdgMass(Double_t mass)
TH1F * SetTemplateReflections(const TH1 *h, TString opt, Double_t minRange, Double_t maxRange)
Int_t fTypeOfFit4Bkg
upper mass limit
TH1F * fHistoTemplRfl
switch for fix refl/signal
TF1 * fBkgFunc
background fit function (1st step, side bands only)
Double_t fMassErr
signal gaussian mean value
Double_t fRflOverSig
fit parameters in reflection fit function
Double_t fMinMass
histogram to fit
Bool_t fFixRflOverSig
reflection/signal
Double_t FitFunction4Mass(Double_t *x, Double_t *par)
Double_t GetSigmaUncertainty() const
void Significance(Double_t nOfSigma, Double_t &significance, Double_t &errsignificance) const
Double_t BackFitFuncPolHelper(Double_t *x, Double_t *par)
Bool_t MassFitter(Bool_t draw=kTRUE)
Bool_t draw[nPtBins]
void SetInitialReflOverS(Double_t rovers)
Double_t fMaxMass
lower mass limit
TF1 * CreateBackgroundFitFunction(TString fname, Double_t integral)
TF1 * fRflFunc
internal variable for fit with reflections
Double_t GetRawYieldError() const
Double_t fNSigma4SideBands
kTRUE = only side bands considered
void Background(Double_t nOfSigma, Double_t &background, Double_t &errbackground) const
void SetInitialGaussianSigma(Double_t sigma)
void SetInitialGaussianMean(Double_t mean)
void SetRangeFit(Double_t minvalue, Double_t maxvalue)
Double_t FitFunction4Sgn(Double_t *x, Double_t *par)
Int_t fPolDegreeBkg
background fit func
void SetUseLikelihoodWithWeightsFit()
bool Bool_t
Definition: External.C:53
TF1 * fBkgFuncRefit
background fit function (1st step, extended in peak region)
Double_t CheckForSignal(Double_t mean, Double_t sigma)
TF1 * fSigFunc
err on signal gaussian integral
TF1 * fBkgFuncSb
Signal fit function.
TF1 * GetBackgroundFullRangeFunc()
void SetNSigma4SideBands(Double_t ns=4.)
Bool_t fSecondPeak
fit function for reflections
AliHFInvMassFitter & operator=(const AliHFInvMassFitter &source)
void DrawHere(TVirtualPad *c)
Bool_t fSmoothRfl
histogram with reflection template
TF1 * CreateBackgroundPlusReflectionFunction(TString fname)
Definition: External.C:196
Double_t FitFunction4BkgAndRefl(Double_t *x, Double_t *par)
Int_t fNParsSig
initialization for wa yield
Double_t GetRawYield() const
Bool_t fReflections
background fit function (2nd step)
Bool_t fFixedSigma
switch for fix mean of gaussian