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