summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchroma/benchmark.py16
-rw-r--r--chroma/demo/__init__.py58
-rw-r--r--chroma/demo/detector.py136
-rw-r--r--chroma/demo/optics.py127
-rw-r--r--chroma/demo/pmt.py16
-rw-r--r--chroma/demo/sno_cone.txt21
-rw-r--r--chroma/demo/sno_pmt.txt121
-rw-r--r--chroma/demo/sno_pmt_reduced.txt47
-rw-r--r--test/test_generator_photon.py6
-rw-r--r--test/test_pdf.py8
-rw-r--r--test/test_rayleigh.py6
11 files changed, 545 insertions, 17 deletions
diff --git a/chroma/benchmark.py b/chroma/benchmark.py
index a45ff90..b9fb2e7 100755
--- a/chroma/benchmark.py
+++ b/chroma/benchmark.py
@@ -14,8 +14,10 @@ from chroma import generator
from chroma import tools
from chroma import optics
from chroma.transform import normalize
+from chroma.demo.optics import water
+
# Generator processes need to fork BEFORE the GPU context is setup
-g4generator = generator.photon.G4ParallelGenerator(4, optics.water_wcsim)
+g4generator = generator.photon.G4ParallelGenerator(4, water)
def intersect(gpu_geometry, number=100, nphotons=500000, nthreads_per_block=64,
max_blocks=1024):
@@ -224,7 +226,7 @@ def pdf_eval(gpu_geometry, max_pmt_id, npdfs=10, nevents=25, nreps=16, ndaq=128,
if __name__ == '__main__':
- from chroma import detectors
+ from chroma import demo
import gc
# Default to run all tests
@@ -232,11 +234,11 @@ if __name__ == '__main__':
if len(sys.argv) > 1:
tests = sys.argv[1:] # unless test names given on command line
- lbne = detectors.lbne()
- lbne.build(bits=11)
+ detector = demo.detector()
+ detector.build(bits=11)
context = gpu.create_cuda_context()
- gpu_geometry = gpu.GPUGeometry(lbne)
+ gpu_geometry = gpu.GPUGeometry(detector)
if 'ray' in tests:
print '%s ray intersections/sec.' % \
@@ -256,11 +258,11 @@ if __name__ == '__main__':
if 'pdf' in tests:
print '%s 100 MeV events histogrammed/s' % \
- tools.ufloat_to_str(pdf(gpu_geometry, max(lbne.pmtids)))
+ tools.ufloat_to_str(pdf(gpu_geometry, max(detector.pmtids)))
gc.collect()
if 'pdf_eval' in tests:
print '%s 100 MeV events/s accumulated in PDF evaluation data structure (100 GEANT4 x 16 Chroma x 128 DAQ)' % \
- tools.ufloat_to_str(pdf_eval(gpu_geometry, max(lbne.pmtids)))
+ tools.ufloat_to_str(pdf_eval(gpu_geometry, max(detector.pmtids)))
context.pop()
diff --git a/chroma/demo/__init__.py b/chroma/demo/__init__.py
new file mode 100644
index 0000000..af90fca
--- /dev/null
+++ b/chroma/demo/__init__.py
@@ -0,0 +1,58 @@
+import os
+from math import sin, cos, sqrt
+
+import numpy as np
+import numpy.linalg
+
+from chroma.make import sphere
+from chroma.stl import mesh_from_stl
+from chroma.geometry import *
+from chroma.transform import rotate, make_rotation_matrix
+
+from chroma.demo.pmt import build_8inch_pmt_with_lc
+from chroma.demo.optics import water
+
+dir = os.path.split(os.path.realpath(__file__))[0]
+
+def spherical_spiral(radius, spacing):
+ '''Returns iterator generating points on a spiral wrapping the
+ surface of a sphere. Points should be approximately equidistiant
+ along the spiral.'''
+ dl = spacing / radius
+ t = 0.0
+ a = np.pi / dl
+
+ while t < np.pi:
+ yield np.array([sin(t) * sin(a*t), sin(t) * cos(a*t), cos(t)])*radius
+ dt = spacing / sqrt(1 + a**2 * sin(t) ** 2)
+ t += dt
+
+def detector(pmt_radius=30.0, sphere_radius=30.5, spiral_step=0.14):
+ pmt = build_8inch_pmt_with_lc()
+ geo = Geometry(water)
+
+ geo.add_solid(Solid(sphere(sphere_radius,nsteps=200),
+ water, water,
+ color=0xBBFFFFFF))
+
+ geo.pmtids = []
+
+
+ for position in spherical_spiral(pmt_radius, spiral_step):
+ direction = -position/numpy.linalg.norm(position)
+
+ # Orient PMT that starts facing Y axis
+ y_axis = np.array((0.0,1.0,0.0))
+ axis = np.cross(direction, y_axis)
+ angle = np.arccos(np.dot(y_axis, direction))
+ rotation = make_rotation_matrix(angle, axis)
+
+ # Place PMT (note that position is front face of PMT)
+ chroma_id = geo.add_solid(pmt, rotation, position)
+ geo.pmtids.append(chroma_id)
+
+ print 'Demo detector: %d PMTs' % len(geo.pmtids)
+ return geo
+
+def tiny():
+ return detector(1.0, 1.5, 0.4)
diff --git a/chroma/demo/detector.py b/chroma/demo/detector.py
new file mode 100644
index 0000000..03a474e
--- /dev/null
+++ b/chroma/demo/detector.py
@@ -0,0 +1,136 @@
+import os
+import math
+
+import numpy as np
+import numpy.linalg
+import h5py
+
+from chroma.make import rotate_extrude
+from chroma.stl import mesh_from_stl
+from chroma.geometry import *
+from chroma.transform import rotate, make_rotation_matrix
+
+from chroma_sno.pmt import build_8inch_pmt_with_lc
+from chroma_sno.optics import water, acrylic_sno, glass
+
+def sno_vessel(sphere_radius, neck_radius, neck_top, nsteps=40):
+ '''Compute the 2D coordinates of the profile of one side of a
+ SNO-style acrylic vessel. The center of the sphere is at (0,0), with
+ the neck extending along the positive y direction.
+
+ sphere_radius: Radius of spherical part of profile
+ neck_radius: Radius of neck part
+ neck_top: y coordinate of top of neck
+ nsteps: number of points around the circumference of the sphere
+
+ Returns: Tuple of x and y coordinate numpy arrays.
+ '''
+ if neck_radius >= sphere_radius:
+ raise ValueError('neck_radius must be less than sphere_radius')
+
+ intersect_height = (sphere_radius**2 - neck_radius**2)**0.5
+ max_angle = math.atan2(intersect_height, neck_radius)
+
+ if neck_top < intersect_height:
+ raise ValueError('neck_top must be greater than the y-value where the sphere and cylinder intersect')
+
+ # Start with point at bottom
+ angles = np.linspace(-math.pi/2, max_angle, nsteps)
+ x = list(np.cos(angles) * sphere_radius)
+ y = list(np.sin(angles) * sphere_radius)
+ x[0] = 0.0 # Round-off error might make cos(-pi/2) not exactly zero
+
+ # Neck intersection point
+ x.append(neck_radius)
+ y.append(intersect_height)
+
+ # Top of neck
+ x.append(neck_radius)
+ y.append(neck_top)
+
+ # Top of neck on axis
+ x.append(0.0)
+ y.append(neck_top)
+
+ return x, y
+
+##### SNO Parts
+
+nsteps = 40
+av_outside_profile = sno_vessel(sphere_radius=6.0604, neck_radius=0.79375,
+ neck_top=10.50, nsteps=nsteps)
+# For simplicity, cap the top of the AV with acrylic
+av_inside_profile = sno_vessel(sphere_radius=6.0053, neck_radius=0.72898,
+ neck_top=10.00, nsteps=nsteps)
+
+av_outside_mesh = rotate_extrude(av_outside_profile[0], av_outside_profile[1],
+ nsteps)
+av_outside_mesh.vertices = rotate(av_outside_mesh.vertices, np.pi/2, (-1,0,0))
+
+av_inside_mesh = rotate_extrude(av_inside_profile[0], av_inside_profile[1],
+ nsteps)
+av_inside_mesh.vertices = rotate(av_inside_mesh.vertices, np.pi/2, (-1,0,0))
+
+dir = os.path.split(os.path.realpath(__file__))[0]
+
+def build_sno(real_av=False):
+ pmtinfo = h5py.File(dir+'/sno_pmt_info.hdf5')
+
+ pmt = build_8inch_pmt_with_lc()
+
+
+ if real_av:
+ geo = Geometry(water)
+ real_av_mesh = mesh_from_stl(dir+'/sno_av_ascii.stl.bz2')
+ real_av_mesh.vertices *= 0.0254 # inch -> meter
+ geo.add_solid(Solid(real_av_mesh, glass, water, color=0xBBAAAAFF))
+ else:
+ geo = Geometry(water)
+ geo.add_solid(Solid(av_outside_mesh, acrylic_sno, water,
+ color=0xBBFFFFFF))
+ geo.add_solid(Solid(av_inside_mesh, water, acrylic_sno,
+ color=0xBB0000FF))
+ geo.pmtids = []
+
+ snoman_id_dict = {}
+
+ pmt_offset = 122.0 - 2 * 0.01# max bucket height - 2 * facegap (mm)
+
+ for position, direction, idnum, pmt_type in zip(pmtinfo['pos'], pmtinfo['dir'],
+ pmtinfo['snoman_id'],
+ pmtinfo['pmt_type']):
+
+ # PMT type codes:
+ # 1 = normal; 2 = OWL; 3 = Low Gain; 4 = BUTT; 5 = Neck
+ # 6 = Calib channel; 10 = spare; 11 = invalid
+ if pmt_type != 1: # All the other PMTs have nonsense directions
+ continue
+
+
+ # Flip and renormalize
+ direction *= -1.0/numpy.linalg.norm(direction)
+
+ # Orient PMT that starts facing Y axis
+ y_axis = np.array((0.0,1.0,0.0))
+ axis = np.cross(direction, y_axis)
+ angle = np.arccos(np.dot(y_axis, direction))
+ rotation = make_rotation_matrix(angle, axis)
+
+ # Values in database are for front face of concentrator.
+ # need to shift so position is for equator of PMT
+ if pmt_type == 1:
+ displacement = position - direction * pmt_offset
+ displacement /= 1000.0 # mm -> m
+ chroma_id = geo.add_solid(pmt, rotation, displacement)
+ snoman_id_dict[chroma_id] = idnum
+ geo.pmtids.append(chroma_id)
+
+ # Convert dict to numpy array for fast array remapping later
+ chroma_ids = np.array(snoman_id_dict.keys())
+ snoman_ids = np.array(snoman_id_dict.values())
+ snoman_id_map = np.zeros(max(chroma_ids)+1) - 1 # Fill with -1 everywhere
+ snoman_id_map[chroma_ids] = snoman_ids
+
+ geo.snoman_id_map = snoman_id_map
+
+ return geo
diff --git a/chroma/demo/optics.py b/chroma/demo/optics.py
new file mode 100644
index 0000000..2fd34d0
--- /dev/null
+++ b/chroma/demo/optics.py
@@ -0,0 +1,127 @@
+import numpy as np
+from chroma.geometry import Material, Surface
+
+vacuum = Material('vacuum')
+vacuum.set('refractive_index', 1.0)
+vacuum.set('absorption_length', 1e6)
+vacuum.set('scattering_length', 1e6)
+
+lambertian_surface = Surface('lambertian_surface')
+lambertian_surface.set('reflect_diffuse', 1)
+
+black_surface = Surface('black_surface')
+black_surface.set('absorb', 1)
+
+shiny_surface = Surface('shiny_surface')
+shiny_surface.set('reflect_specular', 1)
+
+glossy_surface = Surface('glossy_surface')
+glossy_surface.set('reflect_diffuse', 0.5)
+glossy_surface.set('reflect_specular', 0.5)
+
+red_absorb_surface = Surface('red_absorb')
+red_absorb_surface.set('absorb', [0.0, 0.0, 1.0], [465, 545, 685])
+red_absorb_surface.set('reflect_diffuse', [1.0, 1.0, 0.0], [465, 545, 685])
+
+# r7081hqe photocathode material surface
+# source: hamamatsu supplied datasheet for r7081hqe pmt serial number zd0062
+r7081hqe_photocathode = Surface('r7081hqe_photocathode')
+r7081hqe_photocathode.detect = \
+ np.array([(260.0, 0.00),
+ (270.0, 0.04), (280.0, 0.07), (290.0, 0.77), (300.0, 4.57),
+ (310.0, 11.80), (320.0, 17.70), (330.0, 23.50), (340.0, 27.54),
+ (350.0, 30.52), (360.0, 31.60), (370.0, 31.90), (380.0, 32.20),
+ (390.0, 32.00), (400.0, 31.80), (410.0, 30.80), (420.0, 30.16),
+ (430.0, 29.24), (440.0, 28.31), (450.0, 27.41), (460.0, 26.25),
+ (470.0, 24.90), (480.0, 23.05), (490.0, 21.58), (500.0, 19.94),
+ (510.0, 18.48), (520.0, 17.01), (530.0, 15.34), (540.0, 12.93),
+ (550.0, 10.17), (560.0, 7.86), (570.0, 6.23), (580.0, 5.07),
+ (590.0, 4.03), (600.0, 3.18), (610.0, 2.38), (620.0, 1.72),
+ (630.0, 0.95), (640.0, 0.71), (650.0, 0.44), (660.0, 0.25),
+ (670.0, 0.14), (680.0, 0.07), (690.0, 0.03), (700.0, 0.02),
+ (710.0, 0.00)])
+# convert percent -> fraction
+r7081hqe_photocathode.detect[:,1] /= 100.0
+# roughly the same amount of detected photons are absorbed without detection
+r7081hqe_photocathode.absorb = r7081hqe_photocathode.detect
+# remaining photons are diffusely reflected
+r7081hqe_photocathode.set('reflect_diffuse', 1.0 - r7081hqe_photocathode.detect[:,1] - r7081hqe_photocathode.absorb[:,1], wavelengths=r7081hqe_photocathode.detect[:,0])
+
+# glass data comes from 'glass_sno' material in SNO+ optics database
+glass = Material('glass')
+glass.set('refractive_index', 1.49)
+glass.absorption_length = \
+ np.array([(200, 0.1e-6), (300, 0.1e-6), (330, 1.0), (500, 2.0), (600, 1.0), (770, 0.5), (800, 0.1e-6)])
+glass.set('scattering_length', 1e6)
+
+# From WCSim
+water = Material('water')
+water.density = 1.0 # g/cm^3
+water.composition = { 'H' : 0.1119, 'O' : 0.8881 } # fraction by mass
+hc_over_GeV = 1.2398424468024265e-06 # h_Planck * c_light / GeV / nanometer
+wcsim_wavelengths = hc_over_GeV / np.array([ 1.56962e-09, 1.58974e-09, 1.61039e-09, 1.63157e-09,
+ 1.65333e-09, 1.67567e-09, 1.69863e-09, 1.72222e-09,
+ 1.74647e-09, 1.77142e-09,1.7971e-09, 1.82352e-09,
+ 1.85074e-09, 1.87878e-09, 1.90769e-09, 1.93749e-09,
+ 1.96825e-09, 1.99999e-09, 2.03278e-09, 2.06666e-09,
+ 2.10169e-09, 2.13793e-09, 2.17543e-09, 2.21428e-09,
+ 2.25454e-09, 2.29629e-09, 2.33962e-09, 2.38461e-09,
+ 2.43137e-09, 2.47999e-09, 2.53061e-09, 2.58333e-09,
+ 2.63829e-09, 2.69565e-09, 2.75555e-09, 2.81817e-09,
+ 2.88371e-09, 2.95237e-09, 3.02438e-09, 3.09999e-09,
+ 3.17948e-09, 3.26315e-09, 3.35134e-09, 3.44444e-09,
+ 3.54285e-09, 3.64705e-09, 3.75757e-09, 3.87499e-09,
+ 3.99999e-09, 4.13332e-09, 4.27585e-09, 4.42856e-09,
+ 4.59258e-09, 4.76922e-09, 4.95999e-09, 5.16665e-09,
+ 5.39129e-09, 5.63635e-09, 5.90475e-09, 6.19998e-09 ])[::-1] #reversed
+
+water.set('refractive_index',
+ wavelengths=wcsim_wavelengths,
+ value=np.array([1.32885, 1.32906, 1.32927, 1.32948, 1.3297, 1.32992, 1.33014,
+ 1.33037, 1.3306, 1.33084, 1.33109, 1.33134, 1.3316, 1.33186, 1.33213,
+ 1.33241, 1.3327, 1.33299, 1.33329, 1.33361, 1.33393, 1.33427, 1.33462,
+ 1.33498, 1.33536, 1.33576, 1.33617, 1.3366, 1.33705, 1.33753, 1.33803,
+ 1.33855, 1.33911, 1.3397, 1.34033, 1.341, 1.34172, 1.34248, 1.34331,
+ 1.34419, 1.34515, 1.3462, 1.34733, 1.34858, 1.34994, 1.35145, 1.35312,
+ 1.35498, 1.35707, 1.35943, 1.36211, 1.36518, 1.36872, 1.37287, 1.37776,
+ 1.38362, 1.39074, 1.39956, 1.41075, 1.42535])[::-1] #reversed
+)
+water.set('absorption_length',
+ wavelengths=wcsim_wavelengths,
+ value=np.array([22.8154, 28.6144, 35.9923, 45.4086, 57.4650,
+ 72.9526, 75, 81.2317, 120.901, 160.243,
+ 193.797, 215.045, 227.786, 243.893, 294.113,
+ 321.735, 342.931, 362.967, 378.212, 449.602,
+ 740.143, 1116.06, 1438.78, 1615.48, 1769.86,
+ 2109.67, 2304.13, 2444.97, 3076.83, 4901.5,
+ 6666.57, 7873.95, 9433.81, 10214.5, 10845.8,
+ 15746.9, 20201.8, 22025.8, 21142.2, 15083.9,
+ 11751, 8795.34, 8741.23, 7102.37, 6060.68,
+ 4498.56, 3039.56, 2232.2, 1938, 1811.58,
+ 1610.32, 1338.7, 1095.3, 977.525, 965.258,
+ 1082.86, 876.434, 633.723, 389.87, 142.011])[::-1] / 100.0 # reversed, cm->m
+ )
+
+water.set('scattering_length',
+ wavelengths=wcsim_wavelengths,
+ value=np.array([167024.4, 158726.7, 150742,
+ 143062.5, 135680.2, 128587.4,
+ 121776.3, 115239.5, 108969.5,
+ 102958.8, 97200.35, 91686.86,
+ 86411.33, 81366.79, 76546.42,
+ 71943.46, 67551.29, 63363.36,
+ 59373.25, 55574.61, 51961.24,
+ 48527.00, 45265.87, 42171.94,
+ 39239.39, 36462.50, 33835.68,
+ 31353.41, 29010.30, 26801.03,
+ 24720.42, 22763.36, 20924.88,
+ 19200.07, 17584.16, 16072.45,
+ 14660.38, 13343.46, 12117.33,
+ 10977.70, 9920.416, 8941.407,
+ 8036.711, 7202.470, 6434.927,
+ 5730.429, 5085.425, 4496.467,
+ 3960.210, 3473.413, 3032.937,
+ 2635.746, 2278.907, 1959.588,
+ 1675.064, 1422.710, 1200.004,
+ 1004.528, 833.9666, 686.1063])[::-1] / 100.0 * 0.625 # reversed, cm -> m, * magic tuning constant
+ )
diff --git a/chroma/demo/pmt.py b/chroma/demo/pmt.py
new file mode 100644
index 0000000..8256d98
--- /dev/null
+++ b/chroma/demo/pmt.py
@@ -0,0 +1,16 @@
+from os.path import dirname
+
+from chroma.pmt import build_pmt, build_light_collector_from_file
+
+from chroma_sno.optics import water
+
+
+def build_8inch_pmt(outer_material=water, nsteps=24):
+ return build_pmt(dirname(__file__) + '/sno_pmt.txt', 0.003,
+ outer_material, nsteps)
+
+def build_8inch_pmt_with_lc(outer_material=water, nsteps=24):
+ pmt = build_8inch_pmt(outer_material, nsteps)
+ lc = build_light_collector_from_file(dirname(__file__) + '/sno_cone.txt',
+ outer_material, nsteps)
+ return pmt + lc
diff --git a/chroma/demo/sno_cone.txt b/chroma/demo/sno_cone.txt
new file mode 100644
index 0000000..5b56792
--- /dev/null
+++ b/chroma/demo/sno_cone.txt
@@ -0,0 +1,21 @@
+#DataThief /Users/stan/Downloads/./sno_pmt.png Tuesday 26-Jul-2011 3:33:52 PM
+-133.6402, 130.0879
+-133.673, 123.0691
+-133.7058, 116.0503
+-133.0342, 109.7357
+-132.3659, 102.7194
+#-131.6944, 96.4048
+-130.3251, 89.3909
+#-128.2481, 83.7831
+#-126.8788, 76.7691
+-124.8018, 71.1613
+-122.7282, 64.8516
+-119.9503, 59.2462
+-117.1756, 52.9388
+-114.3976, 47.3335
+-111.6197, 41.7281
+-108.1407, 36.1251
+-104.6617, 30.5222
+-100.4816, 24.9216
+-97.5145, 22.2998
+
diff --git a/chroma/demo/sno_pmt.txt b/chroma/demo/sno_pmt.txt
new file mode 100644
index 0000000..9553505
--- /dev/null
+++ b/chroma/demo/sno_pmt.txt
@@ -0,0 +1,121 @@
+#DataThief /Users/stan/Downloads/./sno_pmt.png Tuesday 26-Jul-2011 3:31:47 PM
+-1.2088, -183.8939
+5.8016, -183.8698
+12.812, -183.8456
+19.8225, -183.8215
+26.8329, -183.7974
+33.8433, -183.7732
+38.0659, -180.2494
+38.0889, -175.3362
+36.7163, -169.0241
+36.749, -162.0053
+36.7818, -154.9865
+36.8145, -147.9677
+36.8473, -140.9489
+36.8801, -133.9301
+37.6139, -126.9089
+38.3477, -119.8877
+36.975, -113.5756
+35.6025, -107.2635
+35.6352, -100.2447
+34.9668, -93.2283
+34.2953, -86.9138
+35.7269, -80.592
+39.2616, -74.263
+43.4908, -69.3354
+48.4178, -65.1072
+54.0359, -62.9823
+60.3584, -60.1531
+62.491, -53.8289
+67.418, -49.6008
+72.3449, -45.3726
+77.2719, -41.1444
+82.9032, -36.212
+89.9136, -36.1878
+91.3418, -30.568
+94.8667, -26.3446
+97.7004, -20.0181
+99.8296, -14.3958
+101.2646, -7.3721
+101.9984, -0.3509
+101.3203, 4.5598
+100.652, 11.5762
+98.5783, 17.8859
+96.5013, 23.4937
+93.7267, 29.801
+90.2477, 35.404
+86.0644, 40.3026
+81.18, 45.1989
+76.2924, 49.3933
+71.4015, 52.8858
+65.8094, 56.376
+60.2176, 59.866
+54.6223, 62.6543
+48.326, 65.4401
+42.7275, 67.5264
+36.428, 69.6104
+30.1252, 70.9924
+23.8223, 72.3745
+16.8185, 73.7541
+10.5124, 74.4343
+3.5051, 75.1121
+-3.5051, 75.0879
+-10.5156, 75.0638
+-16.8316, 73.6383
+-23.8453, 72.9123
+-30.1612, 71.4868
+-36.4804, 69.3595
+-42.7995, 67.2322
+-48.4178, 65.1072
+-54.7403, 62.278
+-60.3617, 59.4512
+-65.983, 56.6244
+-71.6111, 52.3938
+-76.5348, 48.8675
+-82.1628, 44.6369
+-87.093, 39.7069
+-90.6212, 34.7816
+-94.1526, 29.1546
+-97.5145, 22.2998
+-99.1123, 17.9076
+-101.2449, 11.5834
+-101.9787, 4.5622
+-102.0115, -2.4566
+-101.3399, -8.7711
+-100.6716, -15.7875
+-98.5979, -22.0972
+-95.8167, -27.0007
+-93.0421, -33.308
+-88.8587, -38.2067
+-83.9744, -43.1029
+-79.09, -47.9992
+-74.1991, -51.4917
+-69.3082, -54.9843
+-63.7162, -58.4744
+-58.1243, -61.9645
+-52.5257, -64.0508
+-46.9338, -67.5409
+-42.0527, -73.1391
+-39.2715, -78.0426
+-36.4968, -84.3498
+-35.8252, -90.6644
+-37.2601, -97.688
+-37.2894, -104.0049
+-36.6213, -111.0213
+-40.1527, -116.6484
+-40.1822, -122.9654
+-40.2149, -129.9842
+-38.8423, -136.2963
+-38.8751, -143.3151
+-38.9078, -150.3338
+-38.9405, -157.3527
+-38.9734, -164.3715
+-39.0061, -171.3902
+-41.8365, -177.015
+-41.1649, -183.3295
+-34.8588, -184.0097
+#-27.8484, -183.9855
+#-20.838, -183.9614
+#-13.8276, -183.9373
+#-6.8171, -183.9132
+#-3.3119, -183.9011
diff --git a/chroma/demo/sno_pmt_reduced.txt b/chroma/demo/sno_pmt_reduced.txt
new file mode 100644
index 0000000..eceaadf
--- /dev/null
+++ b/chroma/demo/sno_pmt_reduced.txt
@@ -0,0 +1,47 @@
+#DataThief /Users/stan/Downloads/./sno_pmt.png Wednesday 27-Jul-2011 11:20:44 AM
+#-0.7993, -96.1588
+#13.2215, -96.1106
+#27.2424, -96.0623
+#34.2823, -89.7213
+#37.8465, -77.0754
+#46.3081, -66.5182
+#57.551, -60.8646
+65.305, -51.7136
+75.8632, -42.553
+87.1094, -36.1975
+92.7603, -27.0538
+99.1188, -16.5038
+101.2842, -3.1609
+100.6389, 8.7687
+97.1926, 21.3905
+91.64, 33.3031
+83.2766, 43.8024
+73.498, 51.4893
+62.3141, 58.4695
+51.1237, 64.046
+39.2288, 68.9181
+26.6265, 72.3841
+13.3165, 74.4439
+-0.701, 75.0976
+-14.7219, 75.0493
+-27.3537, 72.1984
+-39.9889, 68.6456
+-51.9295, 63.6914
+-63.8767, 57.3335
+-75.1262, 50.2761
+-84.9801, 41.8197
+-93.4417, 31.2626
+-99.0992, 20.7151
+-101.9656, 7.3697
+-101.3268, -5.9636
+-99.2859, -19.2921
+-94.431, -30.5053
+-86.0677, -41.0045
+-76.2957, -50.0952
+-65.8128, -57.0778
+-54.6256, -63.3562
+#-43.445, -71.0383
+#-37.8858, -81.5472
+#-35.8449, -94.8757
+#-22.5316, -96.2336
+#-8.5108, -96.1854
diff --git a/test/test_generator_photon.py b/test/test_generator_photon.py
index 13501fe..6952da9 100644
--- a/test/test_generator_photon.py
+++ b/test/test_generator_photon.py
@@ -3,19 +3,19 @@ import itertools
from chroma import generator
from chroma.generator.vertex import constant_particle_gun
-from chroma import optics
+from chroma.demo.optics import water
class TestG4ParallelGenerator(unittest.TestCase):
def test_center(self):
'''Generate Cherenkov light at the center of the world volume'''
- gen = generator.photon.G4ParallelGenerator(1, optics.water_wcsim)
+ gen = generator.photon.G4ParallelGenerator(1, water)
vertex = itertools.islice(constant_particle_gun('e-', (0,0,0), (1,0,0), 100), 10)
for event in gen.generate_events(vertex):
self.assertGreater(len(event.photons_beg.pos), 0)
def test_off_center(self):
'''Generate Cherenkov light at (1 m, 0 m, 0 m)'''
- gen = generator.photon.G4ParallelGenerator(1, optics.water_wcsim)
+ gen = generator.photon.G4ParallelGenerator(1, water)
vertex = itertools.islice(constant_particle_gun('e-', (1,0,0), (1,0,0), 100), 10)
for event in gen.generate_events(vertex):
self.assertGreater(len(event.photons_beg.pos), 0)
diff --git a/test/test_pdf.py b/test/test_pdf.py
index 571cbd4..2eafd67 100644
--- a/test/test_pdf.py
+++ b/test/test_pdf.py
@@ -2,23 +2,23 @@ import unittest
import numpy as np
import itertools
-import chroma.detectors
+import chroma.demo
from chroma.generator.photon import G4ParallelGenerator
from chroma.generator.vertex import constant_particle_gun
-from chroma.optics import water_wcsim
+from chroma.demo.optics import water
from chroma import gpu
from chroma.sim import Simulation
class TestPDF(unittest.TestCase):
def setUp(self):
- self.detector = chroma.detectors.microlbne()
+ self.detector = chroma.demo.tiny()
self.detector.build()
self.vertex_gen = constant_particle_gun('e-', (0,0,0), (1,0,0), 10)
def testGPUPDF(self):
'''Create a hit count and (q,t) PDF for 10 MeV events in MicroLBNE'''
- g4generator = G4ParallelGenerator(1, water_wcsim)
+ g4generator = G4ParallelGenerator(1, water)
context = gpu.create_cuda_context()
diff --git a/test/test_rayleigh.py b/test/test_rayleigh.py
index 02ccb41..cfb0441 100644
--- a/test/test_rayleigh.py
+++ b/test/test_rayleigh.py
@@ -4,7 +4,7 @@ import numpy as np
from chroma.geometry import Solid, Geometry
from chroma.make import box
from chroma.sim import Simulation
-from chroma.optics import water_wcsim
+from chroma.demo.optics import water
from chroma.event import Photons
import histogram
from histogram.root import rootify
@@ -13,8 +13,8 @@ ROOT.gROOT.SetBatch(1)
class TestRayleigh(unittest.TestCase):
def setUp(self):
- self.cube = Geometry(water_wcsim)
- self.cube.add_solid(Solid(box(100,100,100), water_wcsim, water_wcsim))
+ self.cube = Geometry(water)
+ self.cube.add_solid(Solid(box(100,100,100), water, water))
self.cube.pmtids = [0]
self.cube.build(use_cache=False)
self.sim = Simulation(self.cube, geant4_processes=0)