summaryrefslogtreecommitdiff
path: root/detectors/lbne.py
diff options
context:
space:
mode:
Diffstat (limited to 'detectors/lbne.py')
-rw-r--r--detectors/lbne.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/detectors/lbne.py b/detectors/lbne.py
new file mode 100644
index 0000000..7940f43
--- /dev/null
+++ b/detectors/lbne.py
@@ -0,0 +1,40 @@
+import os
+import numpy as np
+import pickle
+from chroma import *
+
+models_directory = os.path.split(os.path.realpath(__file__))[0] + '/../models'
+
+strings = 100
+pmts_per_string = 100
+radius = 50.0
+height = 100.0
+
+def build_lbne(bits=4):
+ lbne = geometry.Geometry()
+
+ sphere_mesh = stl.read_stl(models_directory + '/sphere.stl')
+
+ solids = []
+ for i in range(pmts_per_string):
+ for j in range(strings):
+ sphere = np.copy(sphere_mesh)
+ sphere += (radius,0,i*(height/pmts_per_string))
+ sphere = transform.rotate(sphere, j*2*np.pi/strings, (0,0,1))
+ lbne.add_solid(geometry.Solid(sphere, materials.vacuum, materials.h2o))
+
+ lbne.build(bits)
+
+ return lbne
+
+def cache_lbne(filename):
+ lbne = build_lbne(bits=8)
+ f = open(filename, 'wb')
+ pickle.dump(lbne, f)
+ f.close()
+
+def load_lbne(filename):
+ f = open(filename, 'rb')
+ lbne = pickle.load(filename)
+ f.close()
+ return lbne