summaryrefslogtreecommitdiff
path: root/event.py
diff options
context:
space:
mode:
Diffstat (limited to 'event.py')
-rw-r--r--event.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/event.py b/event.py
new file mode 100644
index 0000000..bf7c007
--- /dev/null
+++ b/event.py
@@ -0,0 +1,51 @@
+import numpy as np
+
+class Photons(object):
+ def __init__(self, positions, directions, polarizations, times, wavelengths,
+ last_hit_triangles=None, histories=None):
+ self.positions = positions
+ self.directions = directions
+ self.polarizations = polarizations
+ self.times = times
+ self.wavelengths = wavelengths
+ self.last_hit_triangles = last_hit_triangles
+ self.histories = histories
+
+def concatenate_photons(photons):
+ '''Merge a list of Photons objects into one long list of photons'''
+ return Photons(positions=np.concatenate([p.positions for p in photons]),
+ directions=np.concatenate([p.directions for p in photons]),
+ polarizations=np.concatenate([p.polarizations for p in photons]),
+ times=np.concatenate([p.times for p in photons]),
+ wavelengths=np.concatenate([p.wavelengths for p in photons]))
+
+class Channels(object):
+ def __init__(self, hit, t, q, histories=None):
+ self.hit = hit
+ self.t = t
+ self.q = q
+ self.histories=histories
+
+ def hit_channels(self):
+ return self.hit.nonzero(), self.t[self.hit], self.q[self.hit]
+
+class Subtrack(object):
+ def __init__(self, particle_name, position, direction, start_time, total_energy):
+ self.particle_name = particle_name
+ self.position = position
+ self.direction = direction
+ self.start_time = start_time
+ self.total_energy = total_energy
+
+class Event(object):
+ def __init__(self, event_id, particle_name=None, gen_position=None, gen_direction=None, gen_total_energy=None, ):
+ self.event_id = event_id
+ self.particle_name = particle_name
+ self.gen_position = gen_position
+ self.gen_direction = gen_direction
+ self.gen_total_energy = gen_total_energy
+
+ self.subtracks = []
+ self.photon_start = None
+ self.photon_stop = None
+ self.channels = None