5 import python_tools
as pt
11 parser = argparse.ArgumentParser()
12 parser.add_argument(
'--infile', type=str, help=
'input file path')
13 parser.add_argument(
'--outdir', type=str, help=
'output directory')
15 args = parser.parse_args()
16 infilename = args.infile
18 if "mc" in infilename:
20 run_folder = "run_"+run_number
22 run_number = infilename.replace('/eos/atlas/atlascerngroupdisk/perf-lumi/Zcounting/Run3/MergedOutputs/HighMu/data22_13p6TeV/mc16e_cf/tree_', '')
23 run_number = run_number.replace('.root', '')
24 run_folder = "run_"+run_number
26 pattern = re.compile(
r"tree_(\d+)\.root")
27 match = pattern.search(infilename)
29 run_number = match.group(1)
32 run_folder =
"run_"+run_number
38 plotter_GeV(
"m_Z_mass_opsmu",
"Z#rightarrow#mu#mu (op. sign) Mass",
"m_{#mu#mu} [GeV]", 66, 116,
"Entries/GeV")
39 plotter_GeV(
"m_leadingmu_pt",
"Leading #mu p_{T}",
"p^{#mu}_{T} [GeV]", 27, 200,
"Entries/GeV")
40 plotter_GeV(
"m_subleadingmu_pt",
"Subleading #mu p_{T}",
"p^{#mu}_{T} [GeV]", 27, 200,
"Entries/GeV")
41 plotter(
"m_leadingmu_eta",
"Leading #mu #eta",
"#eta^{#mu}", -2.5, 2.5,
"Entries")
42 plotter(
"m_subleadingmu_eta",
"Subleading #mu #eta",
"#eta^{#mu}", -2.5, 2.5,
"Entries")
43 plotter(
"m_leadingmu_phi",
"Leading #mu #phi",
"#phi^{#mu}", -3.4, 3.4,
"Entries")
44 plotter(
"m_subleadingmu_phi",
"Subleading #mu #phi",
"#phi^{#mu}",-3.4, 3.4,
"Entries")
46 plotter_GeV(
"m_Z_mass_opsele",
"Z#rightarrow ee (op. sign) Mass",
"m_{ee} [GeV]", 66, 116,
"Entries/GeV")
47 plotter_GeV(
"m_leadingele_pt",
"Leading e p_{T}",
"p^{e}_{T} [GeV]", 27, 200,
"Entries/GeV")
48 plotter_GeV(
"m_subleadingele_pt",
"Subleading e p_{T}",
"p^{e}_{T} [GeV]", 27, 200,
"Entries/GeV")
49 plotter(
"m_leadingele_eta",
"Leading e #eta",
"#eta^{e}", -2.5, 2.5,
"Entries")
50 plotter(
"m_subleadingele_eta",
"Subleading e #eta",
"#eta^{e}", -2.5, 2.5,
"Entries")
51 plotter(
"m_leadingele_phi",
"Leading e #phi",
"#phi^{e}", -3.4, 3.4,
"Entries")
52 plotter(
"m_subleadingele_phi",
"Subleading e #phi",
"#phi^{e}",-3.4, 3.4,
"Entries")
57 pad1 = R.TPad(
"pad1",
"pad1", 0, 0, 1, 1)
59 rfile = R.TFile(infilename)
63 hist1 = rfile.Get(run_folder+
"/GLOBAL/DQTGlobalWZFinder/" + histname)
64 hist2 = R.TH1F(histname, title, len(bins)-1, bins)
65 for i
in range(0, hist1.GetNbinsX()):
66 hist2.SetBinContent(i, hist1.GetBinContent(i))
69 hist2.GetXaxis().SetTitle(xlabel)
70 hist2.GetXaxis().SetRangeUser(xmin, xmax)
71 hist2.GetYaxis().SetTitle(ylabel)
75 hist2.GetXaxis().SetMoreLogLabels()
77 pt.drawAtlasLabel(0.2, 0.56,
"Internal")
78 pt.drawText(0.2, 0.50,
"Data 2022")
79 pt.drawText(0.2, 0.44,
"#sqrt{s} = 13.6 TeV")
80 pt.drawText(0.2, 0.38,
"run "+run_number)
82 pt.drawText(0.2, 0.32,
"p^{#mu}_{T} > 27 GeV")
83 pt.drawText(0.2, 0.26,
"|#eta^{#mu}| < 2.4")
84 pt.drawText(0.2, 0.20,
"66 < m_{#mu#mu} < 116 GeV")
86 pt.drawText(0.2, 0.32,
"p^{e}_{T} > 27 GeV")
87 pt.drawText(0.2, 0.26,
"|#eta^{e}| < 1.37 or 1.52 < |#eta^{e}| < 2.4")
88 pt.drawText(0.2, 0.20,
"66 < m_{ee} < 116 GeV")
91 hist2.GetYaxis().SetRangeUser(0, hist2.GetMaximum()*1.2)
92 pt.drawAtlasLabel(0.2, 0.86,
"Internal")
93 pt.drawText(0.2, 0.80,
"Data 2022")
94 pt.drawText(0.2, 0.74,
"#sqrt{s} = 13.6 TeV")
95 pt.drawText(0.2, 0.68,
"run "+run_number)
97 pt.drawText(0.6, 0.86,
"p^{#mu}_{T} > 27 GeV")
98 pt.drawText(0.6, 0.80,
"|#eta^{#mu}| < 2.4")
99 pt.drawText(0.6, 0.74,
"66 < m_{#mu#mu} < 116 GeV")
101 pt.drawText(0.6, 0.86,
"p^{e}_{T} > 27 GeV")
102 pt.drawText(0.6, 0.80,
"|#eta^{e}| < 1.37 OR")
103 pt.drawText(0.6, 0.74,
"1.52 < |#eta^{e}| < 2.4")
104 pt.drawText(0.6, 0.68,
"66 < m_{ee} < 116 GeV")
106 c1.SaveAs(os.path.join(args.outdir, histname +
".pdf"))
108 def plotter(histname, title, xlabel, xmin, xmax, ylabel):
111 pad1 = R.TPad(
"pad1",
"pad1", 0, 0, 1, 1)
113 rfile = R.TFile(infilename)
117 hist = rfile.Get(run_folder+
"/GLOBAL/DQTGlobalWZFinder/" + histname)
121 hist.GetXaxis().SetTitle(xlabel)
122 hist.GetXaxis().SetRangeUser(xmin, xmax)
123 hist.GetYaxis().SetRangeUser(0, hist.GetMaximum()*1.7)
124 hist.GetYaxis().SetTitle(ylabel)
126 pt.drawAtlasLabel(0.2, 0.86,
"Internal")
127 pt.drawText(0.2, 0.80,
"Data 2022")
128 pt.drawText(0.2, 0.74,
"#sqrt{s} = 13.6 TeV")
129 pt.drawText(0.2, 0.68,
"run "+run_number)
131 pt.drawText(0.6, 0.86,
"p^{#mu}_{T} > 27 GeV")
132 pt.drawText(0.6, 0.80,
"|#eta^{#mu}| < 2.4")
133 pt.drawText(0.6, 0.74,
"66 < m_{#mu#mu} < 116 GeV")
135 pt.drawText(0.6, 0.86,
"p^{e}_{T} > 27 GeV")
136 pt.drawText(0.6, 0.80,
"|#eta^{e}| < 1.37 OR")
137 pt.drawText(0.6, 0.74,
"1.52 < |#eta^{e}| < 2.4")
138 pt.drawText(0.6, 0.68,
"66 < m_{ee} < 116 GeV")
140 c1.SaveAs(os.path.join(args.outdir, histname +
".pdf"))
146 nzbins =
int(zCutHigh - zCutLow)
148 if "mass" in histname:
149 bins = np.linspace(zCutLow, zCutHigh, nzbins+1)
150 elif "pt" in histname:
151 bins = np.linspace(0, 200, 201)
152 elif "eta" in histname:
153 bins = np.linspace(-2.5, 2.5, 50)
154 elif "phi" in histname:
155 bins = np.linspace(-3.4, 3.4, 34)
157 bins = np.linspace(0, 100, 101)
161 if __name__ ==
"__main__":
163 R.gROOT.SetBatch(R.kTRUE)