23x = ROOT.RooRealVar(
"x",
"The observable", 1, 30)
24tau = ROOT.RooRealVar(
"tau",
"The exponent", -0.1337, -10.0, -0.1)
25expo = ROOT.RooExponential(
"expo",
"A falling exponential function", x, tau)
28x.setRange(
"full", 1, 30)
29x.setRange(
"left", 1, 10)
30x.setRange(
"right", 20, 30)
33data = expo.generate(x, 1000)
34blindedData = data.reduce(CutRange=
"left,right")
41expo.fitTo(blindedData, Range=
"left,right", PrintLevel=-1)
47expo.removeStringAttribute(
"fitrange")
51canvas = ROOT.TCanvas(
"canvas",
"canvas", 800, 600)
61print(
"Now plotting with unique normalisation for each slice.\n")
63plotFrame = x.frame(Title=
"Wrong: Each slice normalised over its plotting range")
66blindedData.plotOn(plotFrame)
67expo.plotOn(plotFrame, LineColor=
"r", Range=
"full")
68expo.plotOn(plotFrame, LineColor=
"b", Range=
"left")
69expo.plotOn(plotFrame, LineColor=
"g", Range=
"right")
80print(
"\n\nNow plotting with correct norm ranges:\n")
82plotFrameWithNormRange = x.frame(Title=
"Right: All slices have common normalisation")
85blindedData.plotOn(plotFrameWithNormRange)
86expo.plotOn(plotFrameWithNormRange, LineColor=
"b", Range=
"left", NormRange=
"left,right")
87expo.plotOn(plotFrameWithNormRange, LineColor=
"g", Range=
"right", NormRange=
"left,right")
88expo.plotOn(plotFrameWithNormRange, LineColor=
"r", Range=
"full", NormRange=
"left,right", LineStyle=10)
90plotFrameWithNormRange.Draw()
94canvas.SaveAs(
"rf212_plottingInRanges_blinding.png")