22x = ROOT.RooRealVar(
"x",
"x", -10, 10)
23y = ROOT.RooRealVar(
"y",
"y", -10, 10)
26ax = ROOT.RooRealVar(
"ax",
"ay", 0.6, 0, 1)
27bx = ROOT.RooRealVar(
"bx",
"by", 5)
28cx = ROOT.RooRealVar(
"cx",
"cy", -1, -10, 10)
30ay = ROOT.RooRealVar(
"ay",
"ay", 0.2, 0, 1)
31by = ROOT.RooRealVar(
"by",
"by", 5)
32cy = ROOT.RooRealVar(
"cy",
"cy", -1, -10, 10)
34effFunc = ROOT.RooFormulaVar(
36 "((1-ax)+ax*cos((x-cx)/bx))*((1-ay)+ay*cos((y-cy)/by))",
48cut = ROOT.RooCategory(
"cut",
"cutr")
49cut.defineType(
"accept", 1)
50cut.defineType(
"reject", 0)
56effPdf = ROOT.RooEfficiency(
"effPdf",
"effPdf", effFunc, cut,
"accept")
63shapePdfX = ROOT.RooPolynomial(
64 "shapePdfX",
"shapePdfX", x, ROOT.RooArgList(
66 0
if flat
else -0.095)))
67shapePdfY = ROOT.RooPolynomial(
68 "shapePdfY",
"shapePdfY", y, ROOT.RooArgList(
70 0
if flat
else +0.095)))
71shapePdf = ROOT.RooProdPdf(
77model = ROOT.RooProdPdf(
80 ROOT.RooArgSet(shapePdf),
81 ROOT.RooFit.Conditional(
82 ROOT.RooArgSet(effPdf),
86data = model.generate(ROOT.RooArgSet(x, y, cut), 10000)
92effPdf.fitTo(data, ROOT.RooFit.ConditionalObservables(ROOT.RooArgSet(x, y)))
98hh_data_all = ROOT.RooAbsData.createHistogram(
99 data,
"hh_data_all", x, ROOT.RooFit.Binning(8), ROOT.RooFit.YVar(
100 y, ROOT.RooFit.Binning(8)))
101hh_data_sel = ROOT.RooAbsData.createHistogram(
102 data,
"hh_data_sel", x, ROOT.RooFit.Binning(8), ROOT.RooFit.YVar(
103 y, ROOT.RooFit.Binning(8)), ROOT.RooFit.Cut(
"cut==cut::accept"))
104hh_eff = effFunc.createHistogram(
105 "hh_eff", x, ROOT.RooFit.Binning(
106 50), ROOT.RooFit.YVar(y, ROOT.RooFit.Binning(50)))
109hh_data_all.SetMinimum(0)
110hh_data_sel.SetMinimum(0)
112hh_eff.SetLineColor(ROOT.kBlue)
115ca = ROOT.TCanvas(
"rf702_efficiency_2D",
"rf702_efficiency_2D", 1200, 400)
118ROOT.gPad.SetLeftMargin(0.15)
119hh_data_all.GetZaxis().SetTitleOffset(1.8)
120hh_data_all.Draw(
"lego")
122ROOT.gPad.SetLeftMargin(0.15)
123hh_data_sel.GetZaxis().SetTitleOffset(1.8)
124hh_data_sel.Draw(
"lego")
126ROOT.gPad.SetLeftMargin(0.15)
127hh_eff.GetZaxis().SetTitleOffset(1.8)
130ca.SaveAs(
"rf702_efficiency_2D.png")