24x = ROOT.RooRealVar(
"x",
"x", -10, 10)
25y = ROOT.RooRealVar(
"y",
"y", -10, 10)
28ax = ROOT.RooRealVar(
"ax",
"ay", 0.6, 0, 1)
29bx = ROOT.RooRealVar(
"bx",
"by", 5)
30cx = ROOT.RooRealVar(
"cx",
"cy", -1, -10, 10)
32ay = ROOT.RooRealVar(
"ay",
"ay", 0.2, 0, 1)
33by = ROOT.RooRealVar(
"by",
"by", 5)
34cy = ROOT.RooRealVar(
"cy",
"cy", -1, -10, 10)
36effFunc = ROOT.RooFormulaVar(
37 "effFunc",
"((1-ax)+ax*cos((x-cx)/bx))*((1-ay)+ay*cos((y-cy)/by))", [ax, bx, cx, x, ay, by, cy, y]
41cut = ROOT.RooCategory(
"cut",
"cutr", {
"accept": 1,
"reject": 0})
47effPdf = ROOT.RooEfficiency(
"effPdf",
"effPdf", effFunc, cut,
"accept")
54shapePdfX = ROOT.RooPolynomial(
"shapePdfX",
"shapePdfX", x, [0
if flat
else -0.095])
55shapePdfY = ROOT.RooPolynomial(
"shapePdfY",
"shapePdfY", y, [0
if flat
else +0.095])
56shapePdf = ROOT.RooProdPdf(
"shapePdf",
"shapePdf", [shapePdfX, shapePdfY])
57model = ROOT.RooProdPdf(
"model",
"model", {shapePdf}, Conditional=({effPdf}, {cut}))
60data = model.generate({x, y, cut}, 10000)
66effPdf.fitTo(data, ConditionalObservables={x, y}, PrintLevel=-1)
72hh_data_all = data.createHistogram(
"hh_data_all", x, Binning=8, YVar=dict(var=y, Binning=8))
73hh_data_sel = data.createHistogram(
"hh_data_sel", x, Binning=8, YVar=dict(var=y, Binning=8), Cut=
"cut==cut::accept")
74hh_eff = effFunc.createHistogram(
"hh_eff", x, Binning=50, YVar=dict(var=y, Binning=50))
77hh_data_all.SetMinimum(0)
78hh_data_sel.SetMinimum(0)
80hh_eff.SetLineColor(ROOT.kBlue)
83ca = ROOT.TCanvas(
"rf702_efficiency_2D",
"rf702_efficiency_2D", 1200, 400)
86ROOT.gPad.SetLeftMargin(0.15)
87hh_data_all.GetZaxis().SetTitleOffset(1.8)
88hh_data_all.Draw(
"lego")
90ROOT.gPad.SetLeftMargin(0.15)
91hh_data_sel.GetZaxis().SetTitleOffset(1.8)
92hh_data_sel.Draw(
"lego")
94ROOT.gPad.SetLeftMargin(0.15)
95hh_eff.GetZaxis().SetTitleOffset(1.8)
98ca.SaveAs(
"rf702_efficiency_2D.png")