File indexing completed on 2025-01-30 09:17:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 from __future__ import absolute_import, unicode_literals
0013
0014
0015 def detector_Shelf(description, det):
0016
0017 plane = det.find('planes')
0018 mat = det.find('material')
0019
0020
0021 book = det.find('books')
0022
0023
0024 e_vol = Volume(description, 'ensemble',
0025 Box(description, 'box', plane.x, plane.y + book.y, plane.z),
0026 description.material('Air'))
0027 e_vol.setVisAttributes(description, 'InvisibleWithDaughters')
0028
0029
0030 p_vol = Volume(description, 'plane',
0031 Box(description, 'plane', plane.x, plane.y, plane.z),
0032 description.material(mat.name))
0033 p_vol.setVisAttributes(description, plane.vis)
0034 e_vol.placeVolume(p_vol, Position(0, -book.y, 0))
0035
0036
0037 b_vol = Volume(description, 'book',
0038 Box(description, 'book', book.x, book.y, book.z),
0039 description.material('Carbon'))
0040 b_vol.setVisAttributes(description, book.vis)
0041 x, y, z = plane.x - book.x, plane.y, -plane.z + book.z
0042 for _n in range(book.number):
0043 e_vol.placeVolume(b_vol, Position(x, y, z))
0044 z += 2 * book.z + book.getF('dz')
0045
0046
0047 g_x, g_y, g_z = plane.x, plane.number * plane.getF('dy'), plane.z
0048 g_vol = Volume(description, det.name,
0049 Box(description, 'box', g_x, g_y, g_z), description.material('Air'))
0050 g_vol.setVisAttributes(description, 'InvisibleWithDaughters')
0051 de = DetElement(description, det.name, det.type, det.id)
0052 phv = description.worldVolume().placeVolume(g_vol, Position(g_x, g_y, g_z))
0053 phv.addPhysVolID('id', det.id)
0054 de.addPlacement(phv)
0055 x, y, z = 0, book.y + plane.y - 2 * plane.getF('dy'), 0
0056 for _n in range(plane.number):
0057 g_vol.placeVolume(e_vol, Position(x, y, z))
0058 y += plane.getF('dy')
0059
0060 return de