CbmRoot
PairAnalysisSignalFunc.h
Go to the documentation of this file.
1 #ifndef PAIRANALYSISFUNCTION_H
2 #define PAIRANALYSISFUNCTION_H
3 
4 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. */
5 
6 //#############################################################
7 //# #
8 //# Class PairAnalysisFunction #
9 //# #
10 //# Authors: #
11 //# Julian Book, Uni Ffm / Julian.Book@cern.ch #
12 //# #
13 //#############################################################
14 
15 #include <TH1F.h>
16 #include <TString.h>
17 #include <TVectorT.h>
18 
19 class PairAnalysisFunction : public TNamed {
20 public:
22  PairAnalysisFunction(const char* name, const char* title);
25 
27 
28  // virtual void Fit(Option_t *opt);
29 
30  // Setter
31  void SetUseIntegral(Bool_t flag = kTRUE) { fUseIntegral = flag; };
32  void SetFitOption(const char* opt) {
33  fFitOpt = opt;
34  fFitOpt.ToLower();
35  if (!fFitOpt.Contains("s")) fFitOpt += "s";
36  }
37 
38  void SetFunction(TF1* const combined,
39  TF1* const sig = 0,
40  TF1* const back = 0,
41  Int_t parM = 1,
42  Int_t parMres = 2);
43  void SetDefaults(Int_t type);
44 
45  void CombineFunc(TF1* const peak = 0, TF1* const bgnd = 0);
46 
47  // predefined peak functions
48  Double_t PeakFunMC(const Double_t* x,
49  const Double_t* par); // peak function from a mc histo
50  Double_t PeakFunCB(const Double_t* x,
51  const Double_t* par); // crystal ball function
52  Double_t PeakFunGaus(const Double_t* x, const Double_t* par); // gaussian
53 
54  // Getter
55  TF1* GetSignalFunction() const { return fFuncSignal; }
56  TF1* GetBackgroundFunction() const { return fFuncBackground; }
57  TF1* GetCombinedFunction() const { return fFuncSigBack; }
58 
59  Int_t GetDof() const { return fDof; }
60  Double_t GetChi2Dof() const { return fChi2Dof; }
61 
62  virtual void Draw(const Option_t* option = "");
63  virtual void Print(Option_t* option = "") const;
64 
65 
66 protected:
67  Double_t
68  PeakBgndFun(const Double_t* x,
69  const Double_t* par); // combine any bgrd and any peak function
70 
71  TF1* fFuncSignal = NULL; // Function for the signal description
72  TF1* fFuncBackground = NULL; // Function for the background description
73  TF1* fFuncSigBack = NULL; // Combined function signal plus background
74 
75  Int_t fParMass =
76  1; // the index of the parameter corresponding to the resonance mass
77  Int_t fParMassWidth =
78  2; // the index of the parameter corresponding to the resonance mass width
79 
80  TString fFitOpt = "SMNQE"; // fit option used
81  Bool_t fUseIntegral =
82  kFALSE; // use the integral of the fitted functions to extract signal and background
83 
84  Int_t fDof = 0; // degrees of freedom
85  Double_t fChi2Dof = 0; // chi2/dof of the fitted inv mass spectra
86 
87  Int_t fNparPeak = 0; // number of parameters for peak function
88  Int_t fNparBgnd = 0; // number of parameters for background function
89 
90  ClassDef(PairAnalysisFunction,
91  1) // Signal extraction using a combined bgrd+signal fit
92 };
93 
94 #endif
PairAnalysisFunction::operator=
PairAnalysisFunction & operator=(const PairAnalysisFunction &c)
PairAnalysisFunction
Definition: PairAnalysisFunction.h:22
PairAnalysisFunction::PairAnalysisFunction
PairAnalysisFunction(const PairAnalysisFunction &c)
PairAnalysisFunction::fFitOpt
TString fFitOpt
Definition: PairAnalysisFunction.h:116
PairAnalysisFunction::PairAnalysisFunction
PairAnalysisFunction(const char *name, const char *title)
PairAnalysisFunction::SetUseIntegral
void SetUseIntegral(Bool_t flag=kTRUE)
Definition: PairAnalysisSignalFunc.h:31
PairAnalysisFunction::fDof
Int_t fDof
Definition: PairAnalysisFunction.h:120
PairAnalysisFunction::CombineFunc
void CombineFunc(TF1 *const peak=0, TF1 *const bgnd=0)
PairAnalysisFunction::~PairAnalysisFunction
virtual ~PairAnalysisFunction()
PairAnalysisFunction::Print
virtual void Print(Option_t *option="") const
Definition: PairAnalysisSignalFunc.cxx:264
PairAnalysisFunction::fChi2Dof
Double_t fChi2Dof
Definition: PairAnalysisFunction.h:121
PairAnalysisFunction::SetDefaults
void SetDefaults(Int_t type)
PairAnalysisFunction::fParMass
Int_t fParMass
Definition: PairAnalysisFunction.h:111
PairAnalysisFunction::SetFunction
void SetFunction(TF1 *const combined, TF1 *const sig=0, TF1 *const back=0, Int_t parM=1, Int_t parMres=2)
PairAnalysisFunction::fFuncBackground
TF1 * fFuncBackground
Definition: PairAnalysisFunction.h:103
PairAnalysisFunction::fFuncSigBack
TF1 * fFuncSigBack
Definition: PairAnalysisFunction.h:104
PairAnalysisFunction::PairAnalysisFunction
PairAnalysisFunction()
PairAnalysisFunction::fFuncSignal
TF1 * fFuncSignal
Definition: PairAnalysisFunction.h:102
PairAnalysisFunction::SetFitOption
void SetFitOption(const char *opt)
Definition: PairAnalysisSignalFunc.h:32
PairAnalysisFunction::PeakFunGaus
Double_t PeakFunGaus(const Double_t *x, const Double_t *par)
Definition: PairAnalysisSignalFunc.cxx:130
PairAnalysisFunction::fUseIntegral
Bool_t fUseIntegral
Definition: PairAnalysisFunction.h:117
PairAnalysisFunction::fNparPeak
Int_t fNparPeak
Definition: PairAnalysisFunction.h:123
PairAnalysisFunction::PeakBgndFun
Double_t PeakBgndFun(const Double_t *x, const Double_t *par)
PairAnalysisFunction::GetChi2Dof
Double_t GetChi2Dof() const
Definition: PairAnalysisSignalFunc.h:60
PairAnalysisFunction::PeakFunMC
Double_t PeakFunMC(const Double_t *x, const Double_t *par)
PairAnalysisFunction::GetCombinedFunction
TF1 * GetCombinedFunction() const
Definition: PairAnalysisSignalFunc.h:57
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
PairAnalysisFunction::Draw
virtual void Draw(const Option_t *option="")
PairAnalysisFunction::fParMassWidth
Int_t fParMassWidth
Definition: PairAnalysisFunction.h:113
PairAnalysisFunction::GetBackgroundFunction
TF1 * GetBackgroundFunction() const
Definition: PairAnalysisSignalFunc.h:56
PairAnalysisFunction::GetDof
Int_t GetDof() const
Definition: PairAnalysisSignalFunc.h:59
PairAnalysisFunction::fNparBgnd
Int_t fNparBgnd
Definition: PairAnalysisFunction.h:124
PairAnalysisFunction::PeakFunCB
Double_t PeakFunCB(const Double_t *x, const Double_t *par)
PairAnalysisFunction::GetSignalFunction
TF1 * GetSignalFunction() const
Definition: PairAnalysisSignalFunc.h:55