ATLAS Offline Software
Functions | Variables
dump_layer Namespace Reference

Functions

def main (path, particle)
 

Variables

 output_file = ROOT.TFile.Open("average_layers.root", "recreate")
 
def result
 

Function Documentation

◆ main()

def dump_layer.main (   path,
  particle 
)

Definition at line 19 of file dump_layer.py.

19 def main(path, particle):
20  files = glob(path)
21  chain = ROOT.TChain("egamma")
22  for f in files:
23  chain.Add(f)
24  print("entries:", chain.GetEntries())
25 
26  selection = {"unconv": "(ph_Rconv >= 800 || ph_Rconv <= 0)",
27  "conv": "(ph_Rconv < 800 && ph_Rconv > 0)",
28  "electron": "1"}[particle]
29 
30  prefix = {"unconv": "ph", "conv": "ph", "electron": "el"}[particle]
31 
32  layers = "rawcl_Es0", "rawcl_Es1", "rawcl_Es2", "rawcl_Es3"
33  layers = [prefix + "_" + v for v in layers]
34  title = ["ratio_Es0_true_E",
35  "ratio_Es1_true_E",
36  "ratio_Es2_true_E",
37  "ratio_Es3_true_E"]
38  aetaCalo = "abs(" + prefix + "_" + "cl_etaCalo" + ")"
39  truth_E = prefix + "_truth_E"
40  ratio_layers = ["%s / %s" % (layer, truth_E) for layer in layers]
41  truth_eta = prefix + "_truth_eta"
42  truth_pt = "(%s / cosh(%s))" % (truth_E, truth_eta)
43  matched = ("abs(({0}_rawcl_Es0 + "
44  "{0}_rawcl_Es1 + {0}_rawcl_Es2 + "
45  "{0}_rawcl_Es3)/{0}_truth_E - 1)<1").format(prefix)
46  vars_to_plot = ratio_layers
47  selection += " && " + "(" + matched + ")"
48 
49  pt_binning = [0, 5E3, 10E3, 15E3, 20E3,
50  30E3, 35E3, 40E3, 45E3, 50E3, 55E3, 60E3, 65E3,
51  70E3, 75E3, 80E3, 85E3, 90E3,
52  100E3, 110E3, 120E3, 130E3,
53  140E3, 160E3, 180E3, 200E3, 220E3,
54  250E3, 300E3, 350E3, 400E3, 450E3, 500E3, 550E3, 600E3,
55  700E3, 800E3, 900E3, 1000E3,
56  1200E3, 1400E3, 1600E3, 1800E3, 2000E3,
57  2500E3]
58  aeta_binning = [0, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6,
59  0.7, 0.75, 0.8, 0.85, 0.9, 1.0,
60  1.1, 1.2, 1.3, 1.425, 1.550, 1.6,
61  1.65, 1.7, 1.75, 1.8, 1.9, 2.0, 2.1,
62  2.2, 2.3, 2.35, 2.4, 2.5]
63  pt_binning = array('d', pt_binning)
64  aeta_binning = array('d', aeta_binning)
65  if particle == "conv":
66  vars_to_plot.append("ph_Rconv")
67  title.append("ph_Rconv")
68  vars_to_plot.append("ph_zconv")
69  title.append("ph_zconv")
70 
71  print("plotting counting")
72  histo_name = "histo_count_%s" % particle
73  histo_count = ROOT.TH2F(histo_name, "count %s" % particle, len(
74  pt_binning) - 1, pt_binning, len(aeta_binning) - 1, aeta_binning)
75  chain.Draw(aetaCalo + ":" + truth_pt + ">>" + histo_name, selection)
76 
77  result = []
78  for t, v in zip(title, vars_to_plot):
79  print("plotting", v)
80  histo_name = "histo_%s_%s" % (particle, t)
81  if "zconv" in v:
82  sel = selection + " && abs(ph_zconv) < 5000"
83  else:
84  sel = selection
85  histo = ROOT.TProfile2D(histo_name, t, len(
86  pt_binning) - 1, pt_binning, len(aeta_binning) - 1, aeta_binning)
87  arg = v + ":" + aetaCalo + ":" + truth_pt + ">>" + histo_name
88  chain.Draw(arg, sel, "profcolz")
89  histo.GetXaxis().SetTitle("true pT [MeV]")
90  histo.GetYaxis().SetTitle("etaCalo")
91  result.append(histo)
92  result.append(histo_count)
93  return result
94 
95 

Variable Documentation

◆ output_file

dump_layer.output_file = ROOT.TFile.Open("average_layers.root", "recreate")

Definition at line 97 of file dump_layer.py.

◆ result

def dump_layer.result
Initial value:
1 = main(
2  "/storage_tmp/atlas/MVA2015/inputs_MC15/"
3  "photon_grid_v5/data-output/*/*.root",
4  "unconv")

Definition at line 98 of file dump_layer.py.

vtune_athena.format
format
Definition: vtune_athena.py:14
array
dump_layer.main
def main(path, particle)
Definition: dump_layer.py:19
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70