Centrality Framework
Loading...
Searching...
No Matches
Fitter.hpp
1
7
8#ifndef GlauberFitter_H
9#define GlauberFitter_H 1
10
11#include "TH1F.h"
12#include "TH2F.h"
13#include "TNamed.h"
14#include "TString.h"
15#include "TTree.h"
16
17#include <vector>
18// #include "TMinuit.h"
19
20namespace Glauber {
21class Fitter {
22
23 public:
25 Fitter() = default;
26 ;
27 explicit Fitter(std::unique_ptr<TTree> tree);
29 virtual ~Fitter() = default;
30 ;
31
32 void Init(int nEntries);
33 void SetGlauberFitHisto(double f, double mu, double k, Int_t n = 10000, Bool_t Norm2Data = true);
34 void NormalizeGlauberFit();
35 // void DrawHistos(Bool_t isSim = true, Bool_t isData = true, Bool_t isGlauber = false, Bool_t isNBD = false) {};
36
37 double FitGlauber(double* par, double f0, Int_t k0, Int_t k1, Int_t nEvents);
38 void FindMuGoldenSection(double* mu,
39 double* chi2,
40 double mu_min,
41 double mu_max,
42 double f,
43 double k,
44 Int_t nEvents = 10000,
45 Int_t nIter = 5);
46
47 double GetChi2() const;
48
49 double NBD(double n, double mu, double k) const;
50 void SetNBDhist(double mu, double k);
51 double Nancestors(double f) const;
52 double NancestorsMax(double f) const;
53
54 std::unique_ptr<TH2F> GetModelHisto(const TString& name, const double par[3], Int_t nEvents);
55
56 //
57 // Setters
58 //
59 void SetInputHisto(const TH1F& h) { fDataHisto = h; }
60 void SetFitMinBin(Int_t min) { fFitMinBin = min; }
61 void SetFitMaxBin(Int_t min) { fFitMaxBin = min; }
62 void SetNormMinBin(Int_t min) { fNormMinBin = min; }
63 void SetBinSize(Int_t size) { fBinSize = size; }
64 void SetOutDirName(const TString& name) { fOutDirName = name; }
65 void SetMode(const TString& mode) { fMode = mode; }
66
67 //
68 // Getters
69 //
70 TH1F GetGlauberFitHisto() const { return fGlauberFitHisto; }
71 TH1F GetDataHisto() const { return fDataHisto; }
72 TH1F GetNBDHisto() const { return fNbdHisto; }
73 TH1F GetNpartHisto() const { return fNpartHisto; }
74 TH1F GetNcollHisto() const { return fNcollHisto; }
75 TH1F GetBestFiHisto() const { return fBestFitHisto; }
76
77 private:
79 TH1F fNpartHisto;
80 TH1F fNcollHisto;
81 TH1F fDataHisto;
82 TH1F fNbdHisto;
83 TH1F fGlauberFitHisto;
84 TH1F fBestFitHisto;
85
86 /* MC data */
87 std::unique_ptr<TTree> fSimTree{nullptr};
88
89 float fNpart{-1.};
90 float fNcoll{-1.};
91
92 double fMaxValue{-1.};
93
94 Int_t fNbins{-1};
95 Int_t fBinSize{-1};
96
97 Int_t fFitMinBin{-1};
98 Int_t fFitMaxBin{-1};
99
100 Int_t fNormMinBin{-1};
101
102 TString fMode{"Default"};
103
104 TString fOutDirName{""};
105 ClassDef(Fitter, 2);
106};
107}// namespace Glauber
108
109#endif
virtual ~Fitter()=default
std::unique_ptr< TH2F > GetModelHisto(const TString &name, const double par[3], Int_t nEvents)
Definition Fitter.cpp:342
void FindMuGoldenSection(double *mu, double *chi2, double mu_min, double mu_max, double f, double k, Int_t nEvents=10000, Int_t nIter=5)
Definition Fitter.cpp:150
double GetChi2() const
Definition Fitter.cpp:270
void SetNBDhist(double mu, double k)
Definition Fitter.cpp:293
double FitGlauber(double *par, double f0, Int_t k0, Int_t k1, Int_t nEvents)
Definition Fitter.cpp:208
double NBD(double n, double mu, double k) const
Definition Fitter.cpp:314
Fitter()=default