18w = ROOT.RooWorkspace(
"w")
19w.factory(
"SUM::pdf(s[0.001,15]*Uniform(x[0,1]),b[1,0,2]*Uniform(x))")
20w.factory(
"Gaussian::prior_b(b,1,1)")
21model = w.factory(
"PROD::model(pdf,prior_b)")
22nuisanceParameters = ROOT.RooArgSet(w[
"b"])
25priorPOI = w.factory(
"Uniform::priorPOI(s)")
26priorPOI2 = w.factory(
"GenericPdf::priorPOI2('1/sqrt(@0)',s)")
30data = ROOT.RooDataSet(
"data",
"", {w[
"x"], w[
"n"]}, WeightVar=
"n")
31data.add({w[
"x"]}, w[
"n"].getVal())
34ROOT.RooMsgService.instance().setGlobalKillBelow(ROOT.RooFit.FATAL)
38 nuisPar = nuisanceParameters
43print(
"\nBayesian Result using a Flat prior ")
44bcalc = ROOT.RooStats.BayesianCalculator(data, model, {POI}, priorPOI, nuisPar)
45bcalc.SetTestSize(size)
46interval = bcalc.GetInterval()
47cl = bcalc.ConfidenceLevel()
49 "{}% CL central interval: [ {} - {} ] or {}% CL limits\n".
format(
50 cl, interval.LowerLimit(), interval.UpperLimit(), cl + (1.0 - cl) / 2
53plot = bcalc.GetPosteriorPlot()
54c1 = ROOT.TCanvas(
"c1",
"Bayesian Calculator Result")
60print(
"\nBayesian Result using a 1/sqrt(s) prior ")
61bcalc2 = ROOT.RooStats.BayesianCalculator(data, model, {POI}, priorPOI2, nuisPar)
62bcalc2.SetTestSize(size)
63interval2 = bcalc2.GetInterval()
64cl = bcalc2.ConfidenceLevel()
66 "{}% CL central interval: [ {} - {} ] or {}% CL limits\n".
format(
67 cl, interval2.LowerLimit(), interval2.UpperLimit(), cl + (1.0 - cl) / 2
70plot2 = bcalc2.GetPosteriorPlot()
79c1.SaveAs(
"rs701_BayesianCalculator.png")
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 Atom_t Atom_t Time_t format