4#ifndef __bayesian_estimator_H
5#define __bayesian_estimator_H
8#include "impact_parameter_distribution.h"
16#include <KVValueRange.h>
40 double operator()(
double X,
double mean,
double reduced_variance)
66 double operator()(
double X,
double mean,
double reduced_variance)
92 double operator()(
double X,
double mean,
double reduced_variance)
217 <
class FittingFunction,
class FluctuationKernel>
354 if (den > 0)
return num / den;
617 Warning(
"update_fit_params",
"no histogram set with FitHisto(TH1*)");
622 Warning(
"update_fit_params",
"no fit function found in histogram");
644 f->SetLineColor(color);
645 f->SetMarkerColor(color);
648 return f->GetMaximum();
672 int first_bin(0), last_bin(0);
673 for (
int i = 1; i <= incl->
GetNbinsX(); ++i) {
676 if (
sel->GetBinContent(i) > 0) {
677 if (!first_bin) first_bin = i;
694 double cb_mean(0), cb_sqrmean(0), sum_pcb(0);
696 for (
int i = 0; i < 500; ++i) {
697 double cb = i / 499.;
700 cb_mean += p_cb * cb;
701 cb_sqrmean += p_cb * cb * cb;
704 f->SetPoint(i, cb, p_cb);
708 cb_sqrmean /= sum_pcb;
711 sigma_cb =
TMath::Sqrt(cb_sqrmean - cb_mean * cb_mean);
714 f->SetLineColor(color);
715 f->SetMarkerColor(color);
718 if (
TString(opt) ==
"same")
f->Draw(
"l");
743 for (
int i = 0; i < 500; ++i) {
746 if (sig > maxS) maxS = sig;
747 f->SetPoint(i,
b, sig);
749 f->SetLineColor(color);
750 f->SetMarkerColor(color);
753 if (
TString(opt) ==
"same")
f->Draw(
"l");
779 for (
int i = 0; i < npts; ++i) {
782 f->SetPoint(i,
b, sig);
813 int first_bin(0), last_bin(0);
814 for (
int i = 1; i <= incl->
GetNbinsX(); ++i) {
817 if (
sel->GetBinContent(i) > 0) {
818 if (!first_bin) first_bin = i;
833 double bmean(0), bsqrmean(0), sigtot(0);
835 for (
int i = 0; i < 500; ++i) {
839 bsqrmean += sig *
b *
b;
841 f->SetPoint(i,
b, sig);
843 f->SetLineColor(color);
844 f->SetMarkerColor(color);
847 mean = bmean / sigtot;
850 if (
TString(opt) ==
"same")
f->Draw(
"l");
877 int first_bin(0), last_bin(0);
878 for (
int i = 1; i <= incl->
GetNbinsX(); ++i) {
881 if (
sel->GetBinContent(i) > 0) {
882 if (!first_bin) first_bin = i;
897 double bmean(0), bsqrmean(0), sigtot(0);
899 for (
int i = 0; i < 500; ++i) {
903 bsqrmean += sig *
b *
b;
905 f->SetPoint(i,
b, sig);
907 f->SetLineColor(color);
908 f->SetMarkerColor(color);
911 mean = bmean / sigtot;
914 if (
TString(opt) ==
"same")
f->Draw(
"l");
941 int first_bin(0), last_bin(0);
942 for (
int i = 1; i <= incl->
GetNbinsX(); ++i) {
945 if (
sel->GetBinContent(i) > 0) {
946 if (!first_bin) first_bin = i;
996 f->SetLineColor(color);
1063 b_range.
Min(), b_range.
Max(), X_range.
Min(), X_range.
Max(), 0);
#define ClassDef(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Base class for KaliVeda framework.
Fluctuation kernel using binomial distribution for use with bayesian_estimator.
double operator()(double X, double mean, double reduced_variance)
Fluctuation kernel using negative binomial distribution for use with bayesian_estimator.
double operator()(double X, double mean, double reduced_variance)
Impact parameter distribution reconstruction from experimental data.
double P_X_cb_for_integral(double *x, double *par)
impact_parameter_distribution fIPDist
void DrawBDistForSelection(TH1 *sel, TH1 *incl, double &mean, double &sigma, Option_t *opt="", Color_t color=kRed, const TString &title="")
void DrawCbDistForSelection(TH1 *sel, TH1 *incl, double &mean_cb, double &sigma_cb, Option_t *opt="", Color_t color=kRed, const TString &title="")
void RenormaliseHisto(TH1 *h)
double mean_X_vs_b(double *x, double *par)
TF1 p_X_X_integrator_with_selection
virtual ~bayesian_estimator()
void GetMeanAndSigmaBDistForXSelection(double X1, double X2, double &mean, double &sigma)
double P_X_cb(double X, double cb)
double DrawBDistForXSelection(KVValueRange< double > Xrange, Option_t *opt="", Color_t color=kRed, const TString &title="")
TF1 Cb_dist_for_arb_X_select
void GetMeanAndSigmaBDistForSelection(TH1 *sel, TH1 *incl, double &mean, double &sigma)
bayesian_estimator(Bool_t integer_variable=false)
double cb_dist_for_X_selection(double *x, double *p)
void SetIPDistParams(double sigmaR, double deltab)
FluctuationKernel theKernel
void SetIPDistFromHisto(TH1 *ip_histo)
TF1 & GetB_dist_for_X_select()
double b_dist_for_arb_X_selection_from_histo(double *x, double *p)
double P_X_cb_for_TF2_obs_vs_b(double *x, double *)
TGraph * GraphBDistForXSelection(KVValueRange< double > Xrange, int npts=500)
double P_X_from_fit(double *x, double *par)
FittingFunction theFitter
double b_dist_for_arb_X_selection(double *x, double *p)
double DrawCbDistForXSelection(double X1, double X2, Option_t *opt="", Color_t color=kRed, const TString &title="")
void FitHisto(TH1 *h=nullptr)
bayesian_estimator(const FittingFunction &previous_fit, Bool_t integer_variable=false)
impact_parameter_distribution & GetIPDist()
double b_dist_for_X_selection(double *x, double *p)
TF2 * GetJointProbabilityDistribution(KVValueRange< double > b_range, KVValueRange< double > X_range)
TGraph * GraphMeanXvsb(int npts=500)
double cb_integrated_P_X(double *x, double *p)
TF1 mean_X_vs_cb_function
std::vector< double > sel_rapp
TF1 * GetFittedP_X(double norm=1.0)
double P_X_cb_for_X_integral(double *x, double *par)
void DrawNormalisedMeanXvsb(const TString &title, Color_t color, Option_t *opt)
void Print(Option_t *="") const
double cb_dist_for_arb_X_selection(double *x, double *p)
double mean_X_vs_cb(double *x, double *par)
void DrawBDistForSelectionFromIPHisto(TH1 *sel, TH1 *incl, double &mean, double &sigma, Option_t *opt="", Color_t color=kRed, const TString &title="")
double P_X_cb_for_X_integral_with_selection(double *x, double *par)
void DrawMeanXvsCb(const TString &title="", Color_t color=-1, Option_t *opt="")
TF1 B_dist_for_arb_X_select
TGraph * GraphP_XForGivenB(double b, KVValueRange< double > Xrange, int npts=500)
TF1 B_dist_for_arb_X_select_from_histo
void DrawFittedP_X(double norm=1.0, Option_t *opt="", Color_t color=kRed, const TString &title="")
Fluctuation kernel using gamma distribution for use with bayesian_estimator.
double operator()(double X, double mean, double reduced_variance)
Class implementing parametrizable impact parameter distributions.
Double_t GetDifferentialCrossSection(double b) const
Double_t GetDifferentialCrossSectionFromHisto(double bb)
TH1 * GetCentralityFromHisto()
const TF1 & GetCentrality()
void SetDeltaB_WithConstantCrossSection(Double_t deltab, Double_t sigmaR=0)
Range of values specified by minimum, maximum.
ValueType ValueIofN(Int_t i, Int_t n) const
virtual void SetLineColor(Color_t lcolor)
virtual Double_t GetBinLowEdge(Int_t bin) const
virtual Double_t GetBinUpEdge(Int_t bin) const
virtual Double_t Mean(Double_t a, Double_t b, const Double_t *params=nullptr, Double_t epsilon=0.000001)
virtual TH1 * GetHistogram() const
virtual void SetRange(Double_t xmin, Double_t xmax)
virtual Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
void SetTitle(const char *title="") override
void Draw(Option_t *option="") override
virtual Double_t Variance(Double_t a, Double_t b, const Double_t *params=nullptr, Double_t epsilon=0.000001)
virtual TF1 * DrawCopy(Option_t *option="") const
virtual void SetParameters(const Double_t *params)
virtual void SetParNames(const char *name0="p0", const char *name1="p1", const char *name2="p2", const char *name3="p3", const char *name4="p4", const char *name5="p5", const char *name6="p6", const char *name7="p7", const char *name8="p8", const char *name9="p9", const char *name10="p10")
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual void SetParameter(const TString &name, Double_t value)
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
TObject * FindObject(const char *name) const override
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
virtual Int_t GetNbinsX() const
virtual Double_t GetBinLowEdge(Int_t bin) const
virtual Double_t Integral(Int_t binx1, Int_t binx2, Option_t *option="") const
virtual Double_t GetBinContent(Int_t bin) const
virtual void Scale(Double_t c1=1, Option_t *option="")
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
virtual void Warning(const char *method, const char *msgfmt,...) const
double binomial_pdf(unsigned int k, double p, unsigned int n)
double negative_binomial_pdf(unsigned int k, double p, double n)
double gamma_pdf(double x, double alpha, double theta, double x0=0)
fit(model, train_loader, val_loader, num_epochs, batch_size, optimizer, criterion, save_best, scheduler)
Double_t Sqrt(Double_t x)