ATLAS Offline Software
Functions | Variables
plotting.plot_kinematics Namespace Reference

Functions

def main ()
 
def plotter_GeV (histname, title, xlabel, xmin, xmax, ylabel)
 
def plotter (histname, title, xlabel, xmin, xmax, ylabel)
 
def get_bins (histname)
 

Variables

 parser = argparse.ArgumentParser()
 
 type
 
 str
 
 help
 
 args = parser.parse_args()
 
 infilename = args.infile
 
 pattern = re.compile(r"tree_(\d+)\.root")
 
 match = pattern.search(infilename)
 
 run_number = match.group(1)
 
string run_folder = "run_"+run_number
 

Function Documentation

◆ get_bins()

def plotting.plot_kinematics.get_bins (   histname)

Definition at line 142 of file plot_kinematics.py.

142 def get_bins(histname):
143 
144  zCutLow = 66
145  zCutHigh = 116
146  nzbins = int(zCutHigh - zCutLow)
147 
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)
156  else:
157  bins = np.linspace(0, 100, 101)
158 
159  return bins
160 

◆ main()

def plotting.plot_kinematics.main ( )

Definition at line 36 of file plot_kinematics.py.

36 def main():
37 
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")
45 
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")
53 

◆ plotter()

def plotting.plot_kinematics.plotter (   histname,
  title,
  xlabel,
  xmin,
  xmax,
  ylabel 
)

Definition at line 108 of file plot_kinematics.py.

108 def plotter(histname, title, xlabel, xmin, xmax, ylabel):
109 
110  c1 = R.TCanvas()
111  pad1 = R.TPad("pad1", "pad1", 0, 0, 1, 1)
112  pad1.SetRightMargin
113  rfile = R.TFile(infilename)
114 
115  get_bins(histname)
116 
117  hist = rfile.Get(run_folder+"/GLOBAL/DQTGlobalWZFinder/" + histname)
118 
119  hist.Draw("HIST")
120 
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)
125 
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)
130  if "mu" in histname:
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")
134  else:
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")
139 
140  c1.SaveAs(os.path.join(args.outdir, histname + ".pdf"))
141 

◆ plotter_GeV()

def plotting.plot_kinematics.plotter_GeV (   histname,
  title,
  xlabel,
  xmin,
  xmax,
  ylabel 
)

Definition at line 54 of file plot_kinematics.py.

54 def plotter_GeV(histname, title, xlabel, xmin, xmax, ylabel):
55 
56  c1 = R.TCanvas()
57  pad1 = R.TPad("pad1", "pad1", 0, 0, 1, 1)
58  pad1.SetRightMargin
59  rfile = R.TFile(infilename)
60 
61  bins = get_bins(histname)
62 
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))
67  hist2.Draw("E0")
68 
69  hist2.GetXaxis().SetTitle(xlabel)
70  hist2.GetXaxis().SetRangeUser(xmin, xmax)
71  hist2.GetYaxis().SetTitle(ylabel)
72 
73  if "pt" in histname:
74  R.gPad.SetLogx()
75  hist2.GetXaxis().SetMoreLogLabels()
76  R.gPad.SetLogy()
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)
81  if "mu" in histname:
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")
85  else:
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")
89 
90  else:
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)
96  if "mu" in histname:
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")
100  else:
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")
105 
106  c1.SaveAs(os.path.join(args.outdir, histname + ".pdf"))
107 

Variable Documentation

◆ args

plotting.plot_kinematics.args = parser.parse_args()

Definition at line 15 of file plot_kinematics.py.

◆ help

plotting.plot_kinematics.help

Definition at line 12 of file plot_kinematics.py.

◆ infilename

plotting.plot_kinematics.infilename = args.infile

Definition at line 16 of file plot_kinematics.py.

◆ match

plotting.plot_kinematics.match = pattern.search(infilename)

Definition at line 27 of file plot_kinematics.py.

◆ parser

plotting.plot_kinematics.parser = argparse.ArgumentParser()

Definition at line 11 of file plot_kinematics.py.

◆ pattern

plotting.plot_kinematics.pattern = re.compile(r"tree_(\d+)\.root")

Definition at line 26 of file plot_kinematics.py.

◆ run_folder

string plotting.plot_kinematics.run_folder = "run_"+run_number

Definition at line 32 of file plot_kinematics.py.

◆ run_number

string plotting.plot_kinematics.run_number = match.group(1)

Definition at line 29 of file plot_kinematics.py.

◆ str

plotting.plot_kinematics.str

Definition at line 12 of file plot_kinematics.py.

◆ type

plotting.plot_kinematics.type

Definition at line 12 of file plot_kinematics.py.

CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
plotting.plot_kinematics.get_bins
def get_bins(histname)
Definition: plot_kinematics.py:142
plotting.plot_kinematics.main
def main()
Definition: plot_kinematics.py:36
plotting.plot_kinematics.plotter_GeV
def plotter_GeV(histname, title, xlabel, xmin, xmax, ylabel)
Definition: plot_kinematics.py:54
plotting.plot_kinematics.plotter
def plotter(histname, title, xlabel, xmin, xmax, ylabel)
Definition: plot_kinematics.py:108