Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:44

0001 # ==========================================================================
0002 #  AIDA Detector description implementation
0003 # --------------------------------------------------------------------------
0004 # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 # All rights reserved.
0006 #
0007 # For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 # For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
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   # pos   = det.find('position')
0020   # rot   = det.find('rotation')
0021   book = det.find('books')
0022 
0023   # ---Construct the ensamble plane+books volume-------------------------------------------------------------
0024   e_vol = Volume(description, 'ensemble',  # noqa: F821
0025                  Box(description, 'box', plane.x, plane.y + book.y, plane.z),   # noqa: F821
0026                      description.material('Air'))
0027   e_vol.setVisAttributes(description, 'InvisibleWithDaughters')
0028 
0029   # ---Construct the plane and place it----------------------------------------------------------------------
0030   p_vol = Volume(description, 'plane',  # noqa: F821
0031                  Box(description, 'plane', plane.x, plane.y, plane.z),  # noqa: F821
0032                      description.material(mat.name))
0033   p_vol.setVisAttributes(description, plane.vis)
0034   e_vol.placeVolume(p_vol, Position(0, -book.y, 0))  # noqa: F821
0035 
0036   # ---Construct a book and place it number of times---------------------------------------------------------
0037   b_vol = Volume(description, 'book',  # noqa: F821
0038                  Box(description, 'book', book.x, book.y, book.z),  # noqa: F821
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))  # noqa: F821
0044     z += 2 * book.z + book.getF('dz')
0045 
0046   # --Construct the overal envelope and Detector element-----------------------------------------------------
0047   g_x, g_y, g_z = plane.x, plane.number * plane.getF('dy'), plane.z
0048   g_vol = Volume(description, det.name,  # noqa: F821
0049                  Box(description, 'box', g_x, g_y, g_z), description.material('Air'))  # noqa: F821
0050   g_vol.setVisAttributes(description, 'InvisibleWithDaughters')
0051   de = DetElement(description, det.name, det.type, det.id)  # noqa: F821
0052   phv = description.worldVolume().placeVolume(g_vol, Position(g_x, g_y, g_z))  # noqa: F821
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))  # noqa: F821
0058     y += plane.getF('dy')
0059   # ---Return detector element---------------------------------------------------------------------------------
0060   return de