124 p = argparse.ArgumentParser()
125 p.add_argument(
"geant")
126 p.add_argument(
"mapped")
127 p.add_argument(
"--events",
"-n", type=int)
128 p.add_argument(
"outdir")
130 args = p.parse_args()
133 ROOT.gROOT.SetBatch()
135 ROOT.gROOT.LoadMacro(
"../AtlasStyle.C")
139 ROOT.gROOT.LoadMacro(os.path.join(os.path.dirname(__file__),
"plot_helper.C"))
140 geom_graph = ROOT.fill_geometry_hist_rz(
"excells_charged.root", 5000)
142 c = ROOT.TCanvas(
"c",
"c", 800, 600)
144 geom_graph.Draw(
"ap")
145 c.SaveAs(os.path.join(args.outdir,
"geom_graph.png"))
147 geant_file = ROOT.TFile.Open(args.geant)
148 geant_tree = geant_file.Get(
"MaterialTracks")
150 mapped_file = ROOT.TFile.Open(args.mapped)
151 mapped_tree = mapped_file.Get(
"MaterialTracks")
190 vol_6_lay_idxs =
range(2, 12+2, 2)
191 vol_7_lay_idxs =
range(2, 8+2, 2)
192 vol_11_lay_idxs =
range(2, 18+2, 2)
193 vol_12_lay_idxs =
range(2, 8+2, 2)
195 for i, l
in enumerate(vol_6_lay_idxs):
196 vol_lay_col_map[(6, l)] = colors[i%len(colors)]
198 for l1, l2
in zip(vol_6_lay_idxs, reversed(vol_6_lay_idxs)):
199 vol_lay_col_map[(8, l1)] = vol_lay_col_map[(6, l2)]
201 for i, l
in enumerate(vol_11_lay_idxs):
202 vol_lay_col_map[(11, l)] = colors[i%len(colors)]
204 for l1, l2
in zip(vol_11_lay_idxs, reversed(vol_11_lay_idxs)):
205 vol_lay_col_map[(13, l1)] = vol_lay_col_map[(11, l2)]
207 for i, l
in enumerate(vol_7_lay_idxs):
208 vol_lay_col_map[(7, l)] = colors[i%len(colors)]
209 for i, l
in enumerate(vol_12_lay_idxs):
210 vol_lay_col_map[(12, l)] = colors[i%len(colors)]
229 return tuple(
int(h[i:i+2], 16)
for i
in (0, 2 ,4))
232 layers_geant =
do_step(c, geant_tree, os.path.join(args.outdir,
"geant"), args.events, geom_graph)
233 layers_mapped =
do_step(c, mapped_tree, os.path.join(args.outdir,
"mapped"), args.events, geom_graph)
236 c_all = ROOT.TCanvas(
"c_all",
"c_all", 1000, 600)
238 keys_geant =
set(layers_geant.keys())
239 keys_mapped =
set(layers_mapped.keys())
240 keys = keys_geant & keys_mapped
242 for idx, key
in enumerate(keys):
246 h2_geant = layers_geant[key]
247 h2_mapped = layers_mapped[key]
250 for bx
in range(h.GetNbinsX()):
251 for by
in range(h.GetNbinsY()):
252 bc = h.GetBinContent(bx, by)
254 h.SetBinContent(bx, by, val)
267 color_a = vol_lay_col_map[(geo_id.vol_id, geo_id.lay_id)]
280 color_b = ROOT.TColor.GetColorTransparent(color_a, 0.6)
288 h2_geant.SetLineColor(color_a)
289 h2_mapped.SetLineColor(color_a)
290 h2_mapped.SetLineStyle(2)
291 h2_mapped.SetFillColor(color_a)
293 for h
in (h2_geant, h2_mapped):
300 h2_mapped.Draw(opt+
" sames")
306 h2_mapped.Draw(opt+
" sames")
313 lay_str =
"vol_{:03d}_lay_{:03d}_app_{:03d}.pdf".
format(geo_id.vol_id, geo_id.lay_id, geo_id.app_id)
314 path = os.path.join(args.outdir,
"assoc",
"{}.pdf".
format(lay_str))
315 mkdir(os.path.dirname(path))
318 path = os.path.join(args.outdir,
"assoc.pdf")
319 mkdir(os.path.dirname(path))