23x = ROOT.RooRealVar(
"x",
"x", 0, 10)
24a = ROOT.RooArgusBG(
"a",
"argus(x)", x, ROOT.RooFit.RooConst(
25 10), ROOT.RooFit.RooConst(-1))
28data = a.generate(ROOT.RooArgSet(x), 10000)
37xRegion = ROOT.RooThresholdCategory(
38 "xRegion",
"region of x", x,
"Background")
47xRegion.addThreshold(4.23,
"Background")
48xRegion.addThreshold(5.23,
"SideBand")
49xRegion.addThreshold(8.23,
"Signal")
50xRegion.addThreshold(9.23,
"SideBand")
57data.addColumn(xRegion)
60xframe = x.frame(ROOT.RooFit.Title(
61 "Demo of threshold and binning mapping functions"))
65data.plotOn(xframe, ROOT.RooFit.Cut(
"xRegion==xRegion::SideBand"),
66 ROOT.RooFit.MarkerColor(ROOT.kRed), ROOT.RooFit.LineColor(ROOT.kRed))
76x.setBins(10,
"coarse")
77xBins = ROOT.RooBinningCategory(
"xBins",
"coarse bins in x", x,
"coarse")
84xbtable = data.table(xBins)
89xb = data.addColumn(xBins)
93 "alt",
"x_coarse_bin1,x_coarse_bin3,x_coarse_bin5,x_coarse_bin7,x_coarse_bin9")
97dataSel = data.reduce(ROOT.RooFit.CutRange(
98 "alt"), ROOT.RooFit.EventRange(0, 5000))
99dataSel.plotOn(xframe, ROOT.RooFit.MarkerColor(ROOT.kGreen),
100 ROOT.RooFit.LineColor(ROOT.kGreen))
102c = ROOT.TCanvas(
"rf405_realtocatfuncs",
"rf405_realtocatfuncs", 600, 600)
103xframe.SetMinimum(0.01)
104ROOT.gPad.SetLeftMargin(0.15)
105xframe.GetYaxis().SetTitleOffset(1.4)
108c.SaveAs(
"rf405_realtocatfuncs.png")