From 7915bd33e868e8e935f14795215ea50ad4bc4a5b Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Fri, 12 Aug 2011 13:58:52 -0400 Subject: G4Generator and sim.py can now generate boosted pi0 decays. The ROOT data structure has been extended to allow storage of the individual gamma rays as subtracks. --- fileio/root.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'fileio') diff --git a/fileio/root.py b/fileio/root.py index 0b80745..004484f 100644 --- a/fileio/root.py +++ b/fileio/root.py @@ -20,7 +20,7 @@ class RootWriter(object): self.ev.mc.gen_dir.SetXYZ(*direction) self.ev.mc.gen_total_e = total_e - def write_event(self, event_id, hits, photon_start=None, photon_stop=None): + def write_event(self, event_id, hits, photon_start=None, photon_stop=None, subtracks=None): self.ev.event_id = event_id if photon_start is not None: photons = photon_start @@ -40,6 +40,15 @@ class RootWriter(object): photons['wavelength'], photons['t0'], photons['histories'], photons['last_hit_triangles']) + self.ev.mc.subtrack.resize(0) + if subtracks is not None: + self.ev.mc.subtrack.resize(len(subtracks)) + for i, subtrack in enumerate(subtracks): + self.ev.mc.subtrack[i].name = subtrack['name'] + self.ev.mc.subtrack[i].pos.SetXYZ(*subtrack['pos']) + self.ev.mc.subtrack[i].dir.SetXYZ(*subtrack['dir']) + self.ev.mc.subtrack[i].total_energy = subtrack['total_e'] + ROOT.fill_hits(self.ev, len(hits['t']), hits['t'], hits['q'], hits['history']) self.T.Fill() -- cgit