17ROOT.gStyle.SetOptStat(0)
18ROOT.PyConfig.IgnoreCommandLineOptions =
True
19ROOT.gROOT.SetBatch(
True)
26obsvar = ROOT.RooRealVar(observablename,
"p_{T}^{V}", 10, 600)
31kSM = ROOT.RooRealVar(
"kSM",
"sm modifier", 1.0)
32cHq3 = ROOT.RooRealVar(
"cHq3",
"EFT modifier", 0.0, 1.0)
33cHq3.setAttribute(
"NewPhysics",
True)
37infilename = ROOT.gROOT.GetTutorialDir().Data() +
"/roofit/input_histos_rf_lagrangianmorph.root"
39samplelist = [
"SM_NPsq0",
"cHq3_NPsq1",
"cHq3_NPsq2"]
44config = ROOT.RooLagrangianMorphFunc.Config()
45config.fileName = infilename
46config.observableName = observablename
47config.folderNames = samplelist
48config.couplings.add(cHq3)
49config.couplings.add(kSM)
55morphfunc = ROOT.RooLagrangianMorphFunc(
"morphfunc",
"morphed dist. of pTV", config)
59morphfunc.setParameter(
"cHq3", 0.01)
60morph_hist_0p01 = morphfunc.createTH1(
"morph_cHq3=0.01")
61morphfunc.setParameter(
"cHq3", 0.25)
62morph_hist_0p25 = morphfunc.createTH1(
"morph_cHq3=0.25")
63morphfunc.setParameter(
"cHq3", 0.5)
64morph_hist_0p5 = morphfunc.createTH1(
"morph_cHq3=0.5")
65morph_datahist_0p01 = ROOT.RooDataHist(
"morph_dh_cHq3=0.01",
"", [obsvar], morph_hist_0p01)
66morph_datahist_0p25 = ROOT.RooDataHist(
"morph_dh_cHq3=0.25",
"", [obsvar], morph_hist_0p25)
67morph_datahist_0p5 = ROOT.RooDataHist(
"morph_dh_cHq3=0.5",
"", [obsvar], morph_hist_0p5)
72input_hists = {sample: ROOT.TFile.Open(infilename).Get(sample).FindObject(observablename)
for sample
in samplelist}
74 sample: ROOT.RooDataHist(
"dh_" + sample,
"dh_" + sample, [obsvar], input_hists[sample])
for sample
in samplelist
80frame0 = obsvar.frame(Title=
"Input templates for p_{T}^{V}")
81for sample, color
in zip(samplelist,
"krb"):
82 input_datahists[sample].plotOn(frame0, Name=sample, LineColor=color, MarkerColor=color, MarkerSize=1)
87frame1 = obsvar.frame(Title=
"Morphed templates for selected values")
93morph_datahist_0p01.plotOn(frame1, Name=
"morph_dh_cHq3=0.01", LineColor=
"kGreen", **plot_args)
94morph_datahist_0p25.plotOn(frame1, Name=
"morph_dh_cHq3=0.25", LineColor=
"kGreen+1", **plot_args)
95morph_datahist_0p5.plotOn(frame1, Name=
"morph_dh_cHq3=0.5", LineColor=
"kGreen+2", **plot_args)
100model = ROOT.RooWrapperPdf(
"wrap_pdf",
"wrap_pdf", morphfunc)
101data = model.generate({cHq3, obsvar}, 1000000)
102hh_data = ROOT.RooAbsData.createHistogram(data,
"x,y", obsvar, Binning=20, YVar=dict(var=cHq3, Binning=50))
103hh_data.SetTitle(
"Morphing prediction")
108c1 = ROOT.TCanvas(
"fig3",
"fig3", 1200, 400)
112ROOT.gPad.SetLeftMargin(0.15)
113ROOT.gPad.SetRightMargin(0.05)
116leg1 = ROOT.TLegend(0.55, 0.65, 0.94, 0.87)
117leg1.SetTextSize(0.04)
118leg1.SetFillColor(ROOT.kWhite)
119leg1.SetLineColor(ROOT.kWhite)
120leg1.AddEntry(
"SM_NPsq0",
"SM",
"LP")
121leg1.AddEntry(0,
"",
"")
122leg1.AddEntry(
"cHq3_NPsq1",
"c_{Hq^{(3)}}=1.0 at #Lambda^{-2}",
"LP")
123leg1.AddEntry(0,
"",
"")
124leg1.AddEntry(
"cHq3_NPsq2",
"c_{Hq^{(3)}}=1.0 at #Lambda^{-4}",
"LP")
128ROOT.gPad.SetLeftMargin(0.15)
129ROOT.gPad.SetRightMargin(0.05)
133leg2 = ROOT.TLegend(0.62, 0.65, 0.94, 0.87)
134leg2.SetTextSize(0.04)
135leg2.SetFillColor(ROOT.kWhite)
136leg2.SetLineColor(ROOT.kWhite)
138leg2.AddEntry(
"morph_dh_cHq3=0.01",
"c_{Hq^{(3)}}=0.01",
"L")
139leg2.AddEntry(0,
"",
"")
140leg2.AddEntry(
"morph_dh_cHq3=0.025",
"c_{Hq^{(3)}}=0.025",
"L")
141leg2.AddEntry(0,
"",
"")
142leg2.AddEntry(
"morph_dh_cHq3=0.5",
"c_{Hq^{(3)}}=0.5",
"L")
143leg2.AddEntry(0,
"",
"")
147ROOT.gPad.SetLeftMargin(0.12)
148ROOT.gPad.SetRightMargin(0.18)
149ROOT.gStyle.SetNumberContours(255)
150ROOT.gStyle.SetPalette(ROOT.kGreyScale)
151ROOT.gStyle.SetOptStat(0)
152ROOT.TColor.InvertPalette()
154hh_data.GetYaxis().SetTitle(
"c_{Hq^{(3)}}")
155hh_data.GetYaxis().SetRangeUser(0, 0.5)
156hh_data.GetZaxis().SetTitleOffset(1.8)
158c1.SaveAs(
"rf711_lagrangianmorph.png")