23ROOT.ROOT.EnableImplicitMT()
26path =
"root://eospublic.cern.ch//eos/opendata/atlas/OutreachDatasets/2020-01-22"
28df[
"data"] =
ROOT.RDataFrame(
"mini", (os.path.join(path,
"GamGam/Data/data_{}.GamGam.root".format(x))
for x
in (
"A",
"B",
"C",
"D")))
29df[
"ggH"] =
ROOT.RDataFrame(
"mini", os.path.join(path,
"GamGam/MC/mc_343981.ggH125_gamgam.GamGam.root"))
30df[
"VBF"] =
ROOT.RDataFrame(
"mini", os.path.join(path,
"GamGam/MC/mc_345041.VBFH125_gamgam.GamGam.root"))
31processes = list(df.keys())
34for p
in [
"ggH",
"VBF"]:
35 df[p] = df[p].Define(
"weight",
36 "scaleFactor_PHOTON * scaleFactor_PhotonTRIGGER * scaleFactor_PILEUP * mcWeight");
37df[
"data"] = df[
"data"].Define(
"weight",
"1.0")
42 df[p] = df[p].
Filter(
"trigP")
45 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))")\
46 .
Filter(
"Sum(goodphotons) == 2")
49 df[p] = df[p].
Filter(
"Sum(photon_ptcone30[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")\
50 .
Filter(
"Sum(photon_etcone20[goodphotons] / photon_pt[goodphotons] < 0.065) == 2")
53ROOT.gInterpreter.Declare(
55using Vec_t = const ROOT::VecOps::RVec<float>;
56float ComputeInvariantMass(Vec_t& pt, Vec_t& eta, Vec_t& phi, Vec_t& e) {
57 ROOT::Math::PtEtaPhiEVector p1(pt[0], eta[0], phi[0], e[0]);
58 ROOT::Math::PtEtaPhiEVector p2(pt[1], eta[1], phi[1], e[1]);
59 return (p1 + p2).mass() / 1000.0;
63# Define a new column with the invariant mass and perform final event selection
67 df[p] = df[p].Define(
"m_yy",
"ComputeInvariantMass(photon_pt[goodphotons], photon_eta[goodphotons], photon_phi[goodphotons], photon_E[goodphotons])")
70 df[p] = df[p].
Filter(
"photon_pt[goodphotons][0] / 1000.0 / m_yy > 0.35")\
71 .
Filter(
"photon_pt[goodphotons][1] / 1000.0 / m_yy > 0.25")\
72 .
Filter(
"m_yy > 105 && m_yy < 160")
75 hists[p] = df[p].Histo1D(
76 ROOT.RDF.TH1DModel(p,
"Diphoton invariant mass; m_{#gamma#gamma} [GeV];Events", 30, 105, 160),
80ggh = hists[
"ggH"].GetValue()
81vbf = hists[
"VBF"].GetValue()
82data = hists[
"data"].GetValue()
87ROOT.gROOT.SetStyle(
"ATLAS")
90c = ROOT.TCanvas(
"c",
"", 700, 750)
92upper_pad = ROOT.TPad(
"upper_pad",
"", 0, 0.35, 1, 1)
93lower_pad = ROOT.TPad(
"lower_pad",
"", 0, 0, 1, 0.35)
94for p
in [upper_pad, lower_pad]:
96 p.SetRightMargin(0.05)
99upper_pad.SetBottomMargin(0)
100lower_pad.SetTopMargin(0)
101lower_pad.SetBottomMargin(0.3)
108fit = ROOT.TF1(
"fit",
"([0]+[1]*x+[2]*x^2+[3]*x^3)+[4]*exp(-0.5*((x-[5])/[6])^2)", 105, 160)
109fit.FixParameter(5, 125.0)
110fit.FixParameter(4, 119.1)
111fit.FixParameter(6, 2.39)
115data.Fit(
"fit",
"",
"E SAME", 105, 160)
119bkg = ROOT.TF1(
"bkg",
"([0]+[1]*x+[2]*x^2+[3]*x^3)", 105, 160)
121 bkg.SetParameter(i, fit.GetParameter(i))
128data.SetMarkerStyle(20)
129data.SetMarkerSize(1.2)
131data.SetLineColor(ROOT.kBlack)
135data.GetYaxis().SetLabelSize(0.045)
136data.GetYaxis().SetTitleSize(0.05)
143ggh.Scale(lumi * 0.102 / 55922617.6297)
144vbf.Scale(lumi * 0.008518764 / 3441426.13711)
147higgs.Draw(
"HIST SAME")
152ratiobkg = ROOT.TF1(
"zero",
"0", 105, 160)
153ratiobkg.SetLineColor(4)
154ratiobkg.SetLineStyle(2)
155ratiobkg.SetLineWidth(2)
156ratiobkg.SetMinimum(-125)
157ratiobkg.SetMaximum(250)
158ratiobkg.GetXaxis().SetLabelSize(0.08)
159ratiobkg.GetXaxis().SetTitleSize(0.12)
160ratiobkg.GetXaxis().SetTitleOffset(1.0)
161ratiobkg.GetYaxis().SetLabelSize(0.08)
162ratiobkg.GetYaxis().SetTitleSize(0.09)
163ratiobkg.GetYaxis().SetTitle(
"Data - Bkg.")
164ratiobkg.GetYaxis().CenterTitle()
165ratiobkg.GetYaxis().SetTitleOffset(0.7)
166ratiobkg.GetYaxis().SetNdivisions(503,
False)
167ratiobkg.GetYaxis().ChangeLabel(-1, -1, 0)
168ratiobkg.GetXaxis().SetTitle(
"m_{#gamma#gamma} [GeV]")
171ratiosig = ROOT.TH1F(
"ratiosig",
"ratiosig", 5500, 105, 160)
173ratiosig.SetLineColor(2)
174ratiosig.SetLineStyle(1)
175ratiosig.SetLineWidth(2)
179ratiodata = data.Clone()
180ratiodata.Add(bkg, -1)
181ratiodata.Draw(
"E SAME")
182for i
in range(1, data.GetNbinsX()):
183 ratiodata.SetBinError(i, data.GetBinError(i))
187legend = ROOT.TLegend(0.55, 0.55, 0.89, 0.85)
188legend.SetTextFont(42)
189legend.SetFillStyle(0)
190legend.SetBorderSize(0)
191legend.SetTextSize(0.05)
192legend.SetTextAlign(32)
193legend.AddEntry(data,
"Data" ,
"lep")
194legend.AddEntry(bkg,
"Background",
"l")
195legend.AddEntry(fit,
"Signal + Bkg.",
"l")
196legend.AddEntry(higgs,
"Signal",
"l")
203text.SetTextSize(0.05)
204text.DrawLatex(0.18, 0.84,
"ATLAS")
206text.DrawLatex(0.18 + 0.13, 0.84,
"Open Data")
207text.SetTextSize(0.04)
208text.DrawLatex(0.18, 0.78,
"#sqrt{s} = 13 TeV, 10 fb^{-1}");
211c.SaveAs(
"HiggsToTwoPhotons.pdf");
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
RVec< T > Filter(const RVec< T > &v, F &&f)
Create a new collection with the elements passing the filter expressed by the predicate.
A struct which stores the parameters of a TH1D.