summaryrefslogtreecommitdiff
path: root/detectors/lbne.py
blob: 04751e6bd0bea834eaab7c239926281654533efd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
import sys
import numpy as np

dir = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(dir + '/..')

import models
from geometry import *
from materials import *
from solids import *
from transform import rotate, make_rotation_matrix
from itertools import product
import make

class LBNE(Geometry):
    def __init__(self, radius, height, nstrings, pmts_per_string, endcap_spacing):
        super(LBNE, self).__init__()

        # outer cylinder
        cylinder_mesh = \
            make.cylinder(radius, height+height/(pmts_per_string-1))
        cylinder_solid = Solid(cylinder_mesh, lightwater_sno, vacuum, black_surface, 0x0000ff)
        self.add_solid(cylinder_solid)

        self.pmtids = []

        # construct the barrel
        for i in range(pmts_per_string):
            for j in range(nstrings):
                rotation = make_rotation_matrix(j*2*np.pi/nstrings, (0,0,1))
                displacement = rotate((0,-radius,-height/2+i*height/(pmts_per_string-1)), j*2*np.pi/nstrings, (0,0,1))
                self.pmtids.append(self.add_solid(r7081, rotation, displacement))

        # construct the top endcap
        for x, y in np.array(tuple(product(\
                    np.arange(-radius+0.075, radius, endcap_spacing),
                    np.arange(-radius+0.075, radius, endcap_spacing)))):
            if np.sqrt(x**2 + y**2) <= radius:
                rotation = make_rotation_matrix(+np.pi/2, (1,0,0))
                displacement = (x,y,+height/2+height/(pmts_per_string-1)/2)
                self.pmtids.append(self.add_solid(r7081, rotation, displacement))

        # construct the bottom endcap
        for x, y in np.array(tuple(product(\
                    np.arange(-radius+0.075, radius, endcap_spacing),
                    np.arange(-radius+0.075, radius, endcap_spacing)))):
            if np.sqrt(x**2 + y**2) <= radius:
                rotation = make_rotation_matrix(-np.pi/2, (1,0,0))
                displacement = (x,y,-height/2-height/(pmts_per_string-1)/2)
                self.pmtids.append(self.add_solid(r7081, rotation, displacement))