21x = ROOT.RooRealVar(
"x",
"The observable", 1, 30)
22tau = ROOT.RooRealVar(
"tau",
"The exponent", -0.1337, -10.0, -0.1)
23exp = ROOT.RooExponential(
"exp",
"A falling exponential function", x, tau)
26x.setRange(
"full", 1, 30)
27x.setRange(
"left", 1, 10)
28x.setRange(
"right", 20, 30)
31data = exp.generate(x, 1000)
32blindedData = data.reduce(CutRange=
"left,right")
41canvas = ROOT.TCanvas(
"canvas",
"canvas", 800, 600)
51print(
"Now plotting with unique normalisation for each slice.\n")
53plotFrame = x.frame(Title=
"Wrong: Each slice normalised over its plotting range")
56blindedData.plotOn(plotFrame)
57exp.plotOn(plotFrame, LineColor=
"r", Range=
"full")
58exp.plotOn(plotFrame, LineColor=
"b", Range=
"left")
59exp.plotOn(plotFrame, LineColor=
"g", Range=
"right")
70print(
"\n\nNow plotting with correct norm ranges:\n")
72plotFrameWithNormRange = x.frame(Title=
"Right: All slices have common normalisation")
75blindedData.plotOn(plotFrameWithNormRange)
76exp.plotOn(plotFrameWithNormRange, LineColor=
"b", Range=
"left", NormRange=
"left,right")
77exp.plotOn(plotFrameWithNormRange, LineColor=
"g", Range=
"right", NormRange=
"left,right")
78exp.plotOn(plotFrameWithNormRange, LineColor=
"r", Range=
"full", NormRange=
"left,right", LineStyle=10)
80plotFrameWithNormRange.Draw()
84canvas.SaveAs(
"rf212_plottingInRanges_blinding.png")