25ROOT.ROOT.EnableImplicitMT()
28path =
"root://eospublic.cern.ch//eos/opendata/atlas/OutreachDatasets/2020-01-22"
30df[
"data"] =
ROOT.RDataFrame(
"mini", (os.path.join(path,
"GamGam/Data/data_{}.GamGam.root".format(x))
for x
in (
"A",
"B",
"C",
"D")))
31df[
"ggH"] =
ROOT.RDataFrame(
"mini", os.path.join(path,
"GamGam/MC/mc_343981.ggH125_gamgam.GamGam.root"))
32df[
"VBF"] =
ROOT.RDataFrame(
"mini", os.path.join(path,
"GamGam/MC/mc_345041.VBFH125_gamgam.GamGam.root"))
33processes = list(df.keys())
36for p
in [
"ggH",
"VBF"]:
37 df[p] = df[p].Define(
"weight",
38 "scaleFactor_PHOTON * scaleFactor_PhotonTRIGGER * scaleFactor_PILEUP * mcWeight");
39df[
"data"] = df[
"data"].Define(
"weight",
"1.0")
44 df[p] = df[p].Filter(
"trigP")
47 df[p] = df[p].Define(
"goodphotons",
"photon_isTightID && (photon_pt > 25000) && (abs(photon_eta) < 2.37) && ((abs(photon_eta) < 1.37) || (abs(photon_eta) > 1.52))")\
48 .Filter(
"Sum(goodphotons) == 2")
51 df[p] = df[p].Filter(
"Sum(photon_ptcone30[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")\
52 .Filter(
"Sum(photon_etcone20[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")
55ROOT.gInterpreter.Declare(
57using Vec_t = const ROOT::VecOps::RVec<float>;
58float ComputeInvariantMass(Vec_t& pt, Vec_t& eta, Vec_t& phi, Vec_t& e) {
59 ROOT::Math::PtEtaPhiEVector p1(pt[0], eta[0], phi[0], e[0]);
60 ROOT::Math::PtEtaPhiEVector p2(pt[1], eta[1], phi[1], e[1]);
61 return (p1 + p2).mass() / 1000.0;
69 df[p] = df[p].Define(
"m_yy",
"ComputeInvariantMass(photon_pt[goodphotons], photon_eta[goodphotons], photon_phi[goodphotons], photon_E[goodphotons])")
72 df[p] = df[p].Filter(
"photon_pt[goodphotons][0] / 1000.0 / m_yy > 0.35")\
73 .Filter(
"photon_pt[goodphotons][1] / 1000.0 / m_yy > 0.25")\
74 .Filter(
"m_yy > 105 && m_yy < 160")
77 hists[p] = df[p].Histo1D(
78 ROOT.RDF.TH1DModel(p,
"Diphoton invariant mass; m_{#gamma#gamma} [GeV];Events", 30, 105, 160),
89ggh = hists[
"ggH"].GetValue()
90vbf = hists[
"VBF"].GetValue()
91data = hists[
"data"].GetValue()
96ROOT.gROOT.SetStyle(
"ATLAS")
99c = ROOT.TCanvas(
"c",
"", 700, 750)
101upper_pad = ROOT.TPad(
"upper_pad",
"", 0, 0.35, 1, 1)
102lower_pad = ROOT.TPad(
"lower_pad",
"", 0, 0, 1, 0.35)
103for p
in [upper_pad, lower_pad]:
104 p.SetLeftMargin(0.14)
105 p.SetRightMargin(0.05)
108upper_pad.SetBottomMargin(0)
109lower_pad.SetTopMargin(0)
110lower_pad.SetBottomMargin(0.3)
117fit = ROOT.TF1(
"fit",
"([0]+[1]*x+[2]*x^2+[3]*x^3)+[4]*exp(-0.5*((x-[5])/[6])^2)", 105, 160)
118fit.FixParameter(5, 125.0)
119fit.FixParameter(4, 119.1)
120fit.FixParameter(6, 2.39)
124data.Fit(
"fit",
"",
"E SAME", 105, 160)
128bkg = ROOT.TF1(
"bkg",
"([0]+[1]*x+[2]*x^2+[3]*x^3)", 105, 160)
130 bkg.SetParameter(i, fit.GetParameter(i))
137data.SetMarkerStyle(20)
138data.SetMarkerSize(1.2)
140data.SetLineColor(ROOT.kBlack)
144data.GetYaxis().SetLabelSize(0.045)
145data.GetYaxis().SetTitleSize(0.05)
152ggh.Scale(lumi * 0.102 / 55922617.6297)
153vbf.Scale(lumi * 0.008518764 / 3441426.13711)
156higgs.Draw(
"HIST SAME")
161ratiobkg = ROOT.TF1(
"zero",
"0", 105, 160)
162ratiobkg.SetLineColor(4)
163ratiobkg.SetLineStyle(2)
164ratiobkg.SetLineWidth(2)
165ratiobkg.SetMinimum(-125)
166ratiobkg.SetMaximum(250)
167ratiobkg.GetXaxis().SetLabelSize(0.08)
168ratiobkg.GetXaxis().SetTitleSize(0.12)
169ratiobkg.GetXaxis().SetTitleOffset(1.0)
170ratiobkg.GetYaxis().SetLabelSize(0.08)
171ratiobkg.GetYaxis().SetTitleSize(0.09)
172ratiobkg.GetYaxis().SetTitle(
"Data - Bkg.")
173ratiobkg.GetYaxis().CenterTitle()
174ratiobkg.GetYaxis().SetTitleOffset(0.7)
175ratiobkg.GetYaxis().SetNdivisions(503,
False)
176ratiobkg.GetYaxis().ChangeLabel(-1, -1, 0)
177ratiobkg.GetXaxis().SetTitle(
"m_{#gamma#gamma} [GeV]")
180ratiosig = ROOT.TH1F(
"ratiosig",
"ratiosig", 5500, 105, 160)
182ratiosig.SetLineColor(2)
183ratiosig.SetLineStyle(1)
184ratiosig.SetLineWidth(2)
188ratiodata = data.Clone()
189ratiodata.Add(bkg, -1)
190ratiodata.Draw(
"E SAME")
191for i
in range(1, data.GetNbinsX()):
192 ratiodata.SetBinError(i, data.GetBinError(i))
196legend = ROOT.TLegend(0.55, 0.55, 0.89, 0.85)
197legend.SetTextFont(42)
198legend.SetFillStyle(0)
199legend.SetBorderSize(0)
200legend.SetTextSize(0.05)
201legend.SetTextAlign(32)
202legend.AddEntry(data,
"Data" ,
"lep")
203legend.AddEntry(bkg,
"Background",
"l")
204legend.AddEntry(fit,
"Signal + Bkg.",
"l")
205legend.AddEntry(higgs,
"Signal",
"l")
212text.SetTextSize(0.05)
213text.DrawLatex(0.18, 0.84,
"ATLAS")
215text.DrawLatex(0.18 + 0.13, 0.84,
"Open Data")
216text.SetTextSize(0.04)
217text.DrawLatex(0.18, 0.78,
"#sqrt{s} = 13 TeV, 10 fb^{-1}")
220c.SaveAs(
"df104_HiggsToTwoPhotons.png")
221print(
"Saved figure to df104_HiggsToTwoPhotons.png")
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
void RunGraphs(std::vector< RResultHandle > handles)
Trigger the event loop of multiple RDataFrames concurrently.
A struct which stores the parameters of a TH1D.