CbmRoot
Loading...
Searching...
No Matches
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
19class PairAnalysisFunction : public TNamed {
20public:
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 {
34 fFitOpt = opt;
35 fFitOpt.ToLower();
36 if (!fFitOpt.Contains("s")) fFitOpt += "s";
37 }
38
39 void SetFunction(TF1* const combined, TF1* const sig = 0, TF1* const back = 0, Int_t parM = 1, Int_t parMres = 2);
40 void SetDefaults(Int_t type);
41
42 void CombineFunc(TF1* const peak = 0, TF1* const bgnd = 0);
43
44 // predefined peak functions
45 Double_t PeakFunMC(const Double_t* x,
46 const Double_t* par); // peak function from a mc histo
47 Double_t PeakFunCB(const Double_t* x,
48 const Double_t* par); // crystal ball function
49 Double_t PeakFunGaus(const Double_t* x, const Double_t* par); // gaussian
50
51 // Getter
52 TF1* GetSignalFunction() const { return fFuncSignal; }
53 TF1* GetBackgroundFunction() const { return fFuncBackground; }
54 TF1* GetCombinedFunction() const { return fFuncSigBack; }
55
56 Int_t GetDof() const { return fDof; }
57 Double_t GetChi2Dof() const { return fChi2Dof; }
58
59 virtual void Draw(const Option_t* option = "");
60 virtual void Print(Option_t* option = "") const;
61
62
63protected:
64 Double_t PeakBgndFun(const Double_t* x,
65 const Double_t* par); // combine any bgrd and any peak function
66
67 TF1* fFuncSignal = NULL; // Function for the signal description
68 TF1* fFuncBackground = NULL; // Function for the background description
69 TF1* fFuncSigBack = NULL; // Combined function signal plus background
70
71 Int_t fParMass = 1; // the index of the parameter corresponding to the resonance mass
72 Int_t fParMassWidth = 2; // the index of the parameter corresponding to the resonance mass width
73
74 TString fFitOpt = "SMNQE"; // fit option used
75 Bool_t fUseIntegral = kFALSE; // use the integral of the fitted functions to extract signal and background
76
77 Int_t fDof = 0; // degrees of freedom
78 Double_t fChi2Dof = 0; // chi2/dof of the fitted inv mass spectra
79
80 Int_t fNparPeak = 0; // number of parameters for peak function
81 Int_t fNparBgnd = 0; // number of parameters for background function
82
83 ClassDef(PairAnalysisFunction,
84 1) // Signal extraction using a combined bgrd+signal fit
85};
86
87#endif
PairAnalysisFunction(const PairAnalysisFunction &c)
Double_t PeakBgndFun(const Double_t *x, const Double_t *par)
Double_t PeakFunMC(const Double_t *x, const Double_t *par)
void CombineFunc(TF1 *const peak=0, TF1 *const bgnd=0)
virtual void Draw(const Option_t *option="")
Double_t PeakFunCB(const Double_t *x, const Double_t *par)
Double_t PeakFunGaus(const Double_t *x, const Double_t *par)
virtual ~PairAnalysisFunction()
void SetDefaults(Int_t type)
virtual void Print(Option_t *option="") const
void SetFunction(TF1 *const combined, TF1 *const sig=0, TF1 *const back=0, Int_t parM=1, Int_t parMres=2)
PairAnalysisFunction(const char *name, const char *title)
void SetFitOption(const char *opt)
void SetUseIntegral(Bool_t flag=kTRUE)
PairAnalysisFunction & operator=(const PairAnalysisFunction &c)