20x = ROOT.RooRealVar(
"x",
"x", 0, 10)
21a = ROOT.RooArgusBG(
"a",
"argus(x)", x, 10.0, -1.0)
24data = a.generate({x}, 10000)
33xRegion = ROOT.RooThresholdCategory(
"xRegion",
"region of x", x,
"Background")
42xRegion.addThreshold(4.23,
"Background")
43xRegion.addThreshold(5.23,
"SideBand")
44xRegion.addThreshold(8.23,
"Signal")
45xRegion.addThreshold(9.23,
"SideBand")
52data.addColumn(xRegion)
55xframe = x.frame(Title=
"Demo of threshold and binning mapping functions")
59data.plotOn(xframe, Cut=
"xRegion==xRegion::SideBand", MarkerColor=
"r", LineColor=
"r")
69x.setBins(10,
"coarse")
70xBins = ROOT.RooBinningCategory(
"xBins",
"coarse bins in x", x,
"coarse")
77xbtable = data.table(xBins)
82xb = data.addColumn(xBins)
85xb.setRange(
"alt",
"x_coarse_bin1,x_coarse_bin3,x_coarse_bin5,x_coarse_bin7,x_coarse_bin9")
89dataSel = data.reduce(CutRange=
"alt", EventRange=(0, 5000))
90dataSel.plotOn(xframe, MarkerColor=
"g", LineColor=
"g")
92c = ROOT.TCanvas(
"rf405_realtocatfuncs",
"rf405_realtocatfuncs", 600, 600)
93xframe.SetMinimum(0.01)
94ROOT.gPad.SetLeftMargin(0.15)
95xframe.GetYaxis().SetTitleOffset(1.4)
98c.SaveAs(
"rf405_realtocatfuncs.png")