CbmRoot
PairAnalysisFunction.h
Go to the documentation of this file.
1 #ifndef PAIRANALYSISFUNCTION_H
2 #define PAIRANALYSISFUNCTION_H
3 
4 //#############################################################
5 //# #
6 //# Class PairAnalysisFunction #
7 //# #
8 //# Authors: #
9 //# Julian Book, Uni Ffm / Julian.Book@cern.ch #
10 //# #
11 //#############################################################
12 
13 #include <TDatabasePDG.h>
14 #include <TF1.h>
15 #include <TH1F.h>
16 #include <TMath.h>
17 #include <TNamed.h>
18 #include <TParticlePDG.h>
19 #include <TString.h>
20 #include <TVectorT.h>
21 
22 class PairAnalysisFunction : public TNamed {
23 
24 public:
26 
28  PairAnalysisFunction(const char* name, const char* title);
30  /* PairAnalysisFunction &operator=(const PairAnalysisFunction &c); */
31 
32  virtual ~PairAnalysisFunction();
33 
34  // virtual void Fit(Option_t *opt);
35 
36  // Setter
37  void SetParticleOfInterest(Int_t pdgcode) {
38  fPOIpdg = pdgcode;
39  fPOI = TDatabasePDG::Instance()->GetParticle(fPOIpdg);
40  }
41  void SetFitRange(Double_t min, Double_t max) {
42  fFitMin = min;
43  fFitMax = max;
44  }
45  void SetUseIntegral(Bool_t flag = kTRUE) { fUseIntegral = flag; }
46  void SetFitOption(const char* opt) {
47  fFitOpt = opt;
48  fFitOpt.ToLower();
49  if (!fFitOpt.Contains("s")) fFitOpt += "s";
50  }
51 
52  void SetMCSignalShape(TH1F* hist) { fgHistSimPM = hist; }
53  void SetFunctions(TF1* const combined,
54  TF1* const sig = 0,
55  TF1* const back = 0,
56  Int_t parM = 1,
57  Int_t parMres = 2);
58  void SetDefault(EFunction predefinedFunc);
59  void SetDefaults(Int_t type);
60 
61  void CombineFunc(TF1* const peak = 0, TF1* const bgnd = 0);
62 
63  // predefined peak functions
64  Double_t PeakFunMC(const Double_t* x,
65  const Double_t* par); // peak function from a mc histo
66  Double_t PeakFunCB(const Double_t* x,
67  const Double_t* par); // crystal ball function
68  Double_t PeakFunGauss(const Double_t* x, const Double_t* par); // gaussian
69  Double_t PeakFunPowGaussPow(const Double_t* x,
70  const Double_t* par); // pow gaussian pow
71  Double_t PeakFunExpGaussExp(const Double_t* x,
72  const Double_t* par); // exp gaussian exp
73 
74  // TODO: predefined other functions (tsallis, boltzman, levi, powerlaw)
75  TF1* GetBoltzmann();
76  TF1* GetPtExp();
77  TF1* GetHagedorn();
78  TF1* GetLevi();
79 
80  // Getter
81  TF1* GetSignalFunction() const { return fFuncSignal; }
82  TF1* GetBackgroundFunction() const { return fFuncBackground; }
83  TF1* GetCombinedFunction() const { return fFuncSigBack; }
84 
85  Int_t GetParticleOfInterest() const { return fPOIpdg; }
86  Int_t GetDof() const { return fDof; }
87  Double_t GetChi2Dof() const { return fChi2Dof; }
88  Double_t GetFitMin() const { return fFitMin; }
89  Double_t GetFitMax() const { return fFitMax; }
90 
91  //virtual void Draw(const Option_t* option = "");
92  // virtual void Print(Option_t *option="") const;
93 
94 
95 protected:
96  static TH1F* fgHistSimPM; // simulated peak shape
97 
98  Double_t
99  PeakBgndFun(const Double_t* x,
100  const Double_t* par); // combine any bgrd and any peak function
101 
102  TF1* fFuncSignal = NULL; // Function for the signal description
103  TF1* fFuncBackground = NULL; // Function for the background description
104  TF1* fFuncSigBack = NULL; // Combined function signal plus background
105 
106  Double_t fFitMin = 0.; // fit range lowest inv. mass
107  Double_t fFitMax = 0.; // fit range highest inv. mass
108 
109  TParticlePDG* fPOI = NULL; // MC particle of interest
110  Int_t fPOIpdg = 443; // pdg code particle of interest
111  Int_t fParMass =
112  1; // the index of the parameter corresponding to the resonance mass
114  2; // the index of the parameter corresponding to the resonance mass width
115 
116  TString fFitOpt = "SMNQE"; // fit option used
117  Bool_t fUseIntegral =
118  kFALSE; // use the integral of the fitted functions to extract signal and background
119 
120  Int_t fDof = 0; // degrees of freedom
121  Double_t fChi2Dof = 0.; // chi2/dof of the fitted inv mass spectra
122 
123  Int_t fNparPeak = 0; // number of parameters for peak function
124  Int_t fNparBgnd = 0; // number of parameters for background function
125 
126 
127  // PairAnalysisFunction(const PairAnalysisFunction &c);
129 
130  ClassDef(PairAnalysisFunction,
131  1) // Combine functions for e.g. signal extractions
132 };
133 
134 #endif
PairAnalysisFunction::operator=
PairAnalysisFunction & operator=(const PairAnalysisFunction &c)
PairAnalysisFunction
Definition: PairAnalysisFunction.h:22
PairAnalysisFunction::fFitOpt
TString fFitOpt
Definition: PairAnalysisFunction.h:116
PairAnalysisFunction::EFunction
EFunction
Definition: PairAnalysisFunction.h:25
PairAnalysisFunction::SetUseIntegral
void SetUseIntegral(Bool_t flag=kTRUE)
Definition: PairAnalysisFunction.h:45
PairAnalysisFunction::fDof
Int_t fDof
Definition: PairAnalysisFunction.h:120
PairAnalysisFunction::SetFitRange
void SetFitRange(Double_t min, Double_t max)
Definition: PairAnalysisFunction.h:41
PairAnalysisFunction::GetPtExp
TF1 * GetPtExp()
Definition: PairAnalysisFunction.cxx:375
PairAnalysisFunction::CombineFunc
void CombineFunc(TF1 *const peak=0, TF1 *const bgnd=0)
Definition: PairAnalysisFunction.cxx:314
PairAnalysisFunction::GetFitMin
Double_t GetFitMin() const
Definition: PairAnalysisFunction.h:88
PairAnalysisFunction::GetFitMax
Double_t GetFitMax() const
Definition: PairAnalysisFunction.h:89
PairAnalysisFunction::SetFunctions
void SetFunctions(TF1 *const combined, TF1 *const sig=0, TF1 *const back=0, Int_t parM=1, Int_t parMres=2)
Definition: PairAnalysisFunction.cxx:216
PairAnalysisFunction::fFitMax
Double_t fFitMax
Definition: PairAnalysisFunction.h:107
PairAnalysisFunction::fPOIpdg
Int_t fPOIpdg
Definition: PairAnalysisFunction.h:110
PairAnalysisFunction::GetBoltzmann
TF1 * GetBoltzmann()
Definition: PairAnalysisFunction.cxx:361
PairAnalysisFunction::fChi2Dof
Double_t fChi2Dof
Definition: PairAnalysisFunction.h:121
PairAnalysisFunction::kBoltzmann
@ kBoltzmann
Definition: PairAnalysisFunction.h:25
PairAnalysisFunction::SetDefaults
void SetDefaults(Int_t type)
Definition: PairAnalysisFunction.cxx:254
PairAnalysisFunction::fParMass
Int_t fParMass
Definition: PairAnalysisFunction.h:111
PairAnalysisFunction::fFitMin
Double_t fFitMin
Definition: PairAnalysisFunction.h:106
min
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:33
PairAnalysisFunction::fFuncBackground
TF1 * fFuncBackground
Definition: PairAnalysisFunction.h:103
PairAnalysisFunction::fFuncSigBack
TF1 * fFuncSigBack
Definition: PairAnalysisFunction.h:104
PairAnalysisFunction::PairAnalysisFunction
PairAnalysisFunction()
PairAnalysisFunction::SetDefault
void SetDefault(EFunction predefinedFunc)
Definition: PairAnalysisFunction.cxx:240
PairAnalysisFunction::PeakFunGauss
Double_t PeakFunGauss(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:202
PairAnalysisFunction::fFuncSignal
TF1 * fFuncSignal
Definition: PairAnalysisFunction.h:102
PairAnalysisFunction::SetFitOption
void SetFitOption(const char *opt)
Definition: PairAnalysisFunction.h:46
PairAnalysisFunction::GetParticleOfInterest
Int_t GetParticleOfInterest() const
Definition: PairAnalysisFunction.h:85
PairAnalysisFunction::fUseIntegral
Bool_t fUseIntegral
Definition: PairAnalysisFunction.h:117
PairAnalysisFunction::kPtExp
@ kPtExp
Definition: PairAnalysisFunction.h:25
PairAnalysisFunction::SetMCSignalShape
void SetMCSignalShape(TH1F *hist)
Definition: PairAnalysisFunction.h:52
PairAnalysisFunction::fPOI
TParticlePDG * fPOI
Definition: PairAnalysisFunction.h:109
PairAnalysisFunction::fNparPeak
Int_t fNparPeak
Definition: PairAnalysisFunction.h:123
PairAnalysisFunction::kHagedorn
@ kHagedorn
Definition: PairAnalysisFunction.h:25
PairAnalysisFunction::PeakBgndFun
Double_t PeakBgndFun(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:339
PairAnalysisFunction::GetChi2Dof
Double_t GetChi2Dof() const
Definition: PairAnalysisFunction.h:87
PairAnalysisFunction::PeakFunMC
Double_t PeakFunMC(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:99
PairAnalysisFunction::fgHistSimPM
static TH1F * fgHistSimPM
Definition: PairAnalysisFunction.h:96
PairAnalysisFunction::GetCombinedFunction
TF1 * GetCombinedFunction() const
Definition: PairAnalysisFunction.h:83
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
PairAnalysisFunction::kLevi
@ kLevi
Definition: PairAnalysisFunction.h:25
PairAnalysisFunction::SetParticleOfInterest
void SetParticleOfInterest(Int_t pdgcode)
Definition: PairAnalysisFunction.h:37
PairAnalysisFunction::GetHagedorn
TF1 * GetHagedorn()
Definition: PairAnalysisFunction.cxx:385
PairAnalysisFunction::fParMassWidth
Int_t fParMassWidth
Definition: PairAnalysisFunction.h:113
PairAnalysisFunction::~PairAnalysisFunction
virtual ~PairAnalysisFunction()
Definition: PairAnalysisFunction.cxx:88
max
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:36
PairAnalysisFunction::PeakFunPowGaussPow
Double_t PeakFunPowGaussPow(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:148
PairAnalysisFunction::GetBackgroundFunction
TF1 * GetBackgroundFunction() const
Definition: PairAnalysisFunction.h:82
PairAnalysisFunction::GetDof
Int_t GetDof() const
Definition: PairAnalysisFunction.h:86
PairAnalysisFunction::fNparBgnd
Int_t fNparBgnd
Definition: PairAnalysisFunction.h:124
PairAnalysisFunction::PeakFunCB
Double_t PeakFunCB(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:121
PairAnalysisFunction::PeakFunExpGaussExp
Double_t PeakFunExpGaussExp(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:177
PairAnalysisFunction::GetLevi
TF1 * GetLevi()
Definition: PairAnalysisFunction.cxx:398
PairAnalysisFunction::GetSignalFunction
TF1 * GetSignalFunction() const
Definition: PairAnalysisFunction.h:81