diff options
Diffstat (limited to 'fileio/root.py')
-rw-r--r-- | fileio/root.py | 11 |
1 files changed, 10 insertions, 1 deletions
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() |