26x = ROOT.RooRealVar(
"x",
"", 1, 0, 50)
27mu = ROOT.RooRealVar(
"mu",
"", 2.5, 0, 15)
28b = ROOT.RooConstVar(
"b",
"", 3.0)
29mean = ROOT.RooAddition(
"mean",
"", [mu, b])
30pois = ROOT.RooPoisson(
"pois",
"", x, mean)
34data = pois.generate({x}, 1)
37dataCanvas = ROOT.TCanvas(
"dataCanvas")
43w = ROOT.RooWorkspace()
44modelConfig = ROOT.RooStats.ModelConfig(
"poissonProblem", w)
45modelConfig.SetPdf(pois)
46modelConfig.SetParametersOfInterest(parameters)
47modelConfig.SetObservables({x})
51fc = ROOT.RooStats.FeldmanCousins(data, modelConfig)
53fc.UseAdaptiveSampling(
True)
54fc.FluctuateNumDataEntries(
False)
58interval = fc.GetInterval()
61intervalCanvas = ROOT.TCanvas(
"intervalCanvas")
63print(
"is this point in the interval? ", interval.IsInInterval(parameters))
64print(
"interval is [{}, {}]".
format(interval.LowerLimit(mu), interval.UpperLimit(mu)))
72parameterScan = fc.GetPointsToScan()
73hist = parameterScan.createHistogram(
"mu", ROOT.RooFit.Binning(30))
78for i
in range(parameterScan.numEntries()):
80 tmpPoint = parameterScan.get(i).
clone(
"temp")
82 mark = ROOT.TMarker(tmpPoint.getRealValue(
"mu"), 1, 25)
83 if interval.IsInInterval(tmpPoint):
84 mark.SetMarkerColor(ROOT.kBlue)
86 mark.SetMarkerColor(ROOT.kRed)
94dataCanvas.SaveAs(
"rs401c_FeldmanCousins_data.png")
95intervalCanvas.SaveAs(
"rs401c_FeldmanCousins_hist.png")
TObject * clone(const char *newname) const override
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