diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-08 11:03:07 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-08 11:03:07 -0400 |
commit | f6109fc8939c55a9ef8244806d00b3ee07ee1b13 (patch) | |
tree | 0a3d84cc5fb29412743999b3d28654442389422f /solids/pmts.py | |
parent | 3a8a4c4dd095ff25a1dbe70e387e166f43a5644b (diff) | |
download | chroma-f6109fc8939c55a9ef8244806d00b3ee07ee1b13.tar.gz chroma-f6109fc8939c55a9ef8244806d00b3ee07ee1b13.tar.bz2 chroma-f6109fc8939c55a9ef8244806d00b3ee07ee1b13.zip |
add a simple event viewer. view events by running ./camera.py <detector_name> -i <name_of_io_file>.
Diffstat (limited to 'solids/pmts.py')
-rw-r--r-- | solids/pmts.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/solids/pmts.py b/solids/pmts.py index 22d9d67..a30d007 100644 --- a/solids/pmts.py +++ b/solids/pmts.py @@ -27,7 +27,24 @@ def build_light_collector(pmt, a, b, d, rmin, rmax, npoints=10): lc_mesh = rotate_extrude(lc_radii, lc_profile + lc_offset, pmt.theta) - return Solid(lc_mesh, pmt.outer_material, pmt.outer_material, color=0xff0000, surface=shiny_surface) + return Solid(lc_mesh, pmt.outer_material, pmt.outer_material, surface=shiny_surface) + +def build_pmt_shell(filename, outer_material=water, theta=np.pi/8): + profile = read_csv(filename) + + # slice profile in half + profile = profile[profile[:,0] < 0] + profile[:,0] = -profile[:,0] + # order profile from base to face + profile = profile[np.argsort(profile[:,1])] + # set x coordinate to 0.0 for first and last profile along the profile + # so that the mesh is closed + profile[0,0] = 0.0 + profile[-1,0] = 0.0 + # convert mm -> m + profile /= 1000.0 + + return Solid(rotate_extrude(profile[:,0], profile[:,1], theta), glass, outer_material, color=0xeeffffff) def build_pmt(filename, glass_thickness, outer_material=water, theta=np.pi/8): profile = read_csv(filename) @@ -72,6 +89,5 @@ def build_light_collector_from_file(filename, outer_material, theta=np.pi/24): profile /= 1000.0 mesh = rotate_extrude(profile[:,0], profile[:,1], theta) - solid = Solid(mesh, outer_material, outer_material, color=0xFF0000, - surface=shiny_surface) + solid = Solid(mesh, outer_material, outer_material, surface=shiny_surface) return solid |