Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-22 07:49:51

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 
0013 
0014 def detector_Shelf(description, det):
0015 
0016   plane = det.find('planes')
0017   mat = det.find('material')
0018   # pos   = det.find('position')
0019   # rot   = det.find('rotation')
0020   book = det.find('books')
0021 
0022   # ---Construct the ensamble plane+books volume-------------------------------------------------------------
0023   e_vol = Volume(description, 'ensemble',  # noqa: F821
0024                  Box(description, 'box', plane.x, plane.y + book.y, plane.z),   # noqa: F821
0025                      description.material('Air'))
0026   e_vol.setVisAttributes(description, 'InvisibleWithDaughters')
0027 
0028   # ---Construct the plane and place it----------------------------------------------------------------------
0029   p_vol = Volume(description, 'plane',  # noqa: F821
0030                  Box(description, 'plane', plane.x, plane.y, plane.z),  # noqa: F821
0031                      description.material(mat.name))
0032   p_vol.setVisAttributes(description, plane.vis)
0033   e_vol.placeVolume(p_vol, Position(0, -book.y, 0))  # noqa: F821
0034 
0035   # ---Construct a book and place it number of times---------------------------------------------------------
0036   b_vol = Volume(description, 'book',  # noqa: F821
0037                  Box(description, 'book', book.x, book.y, book.z),  # noqa: F821
0038                      description.material('Carbon'))
0039   b_vol.setVisAttributes(description, book.vis)
0040   x, y, z = plane.x - book.x, plane.y, -plane.z + book.z
0041   for _n in range(book.number):
0042     e_vol.placeVolume(b_vol, Position(x, y, z))  # noqa: F821
0043     z += 2 * book.z + book.getF('dz')
0044 
0045   # --Construct the overal envelope and Detector element-----------------------------------------------------
0046   g_x, g_y, g_z = plane.x, plane.number * plane.getF('dy'), plane.z
0047   g_vol = Volume(description, det.name,  # noqa: F821
0048                  Box(description, 'box', g_x, g_y, g_z), description.material('Air'))  # noqa: F821
0049   g_vol.setVisAttributes(description, 'InvisibleWithDaughters')
0050   de = DetElement(description, det.name, det.type, det.id)  # noqa: F821
0051   phv = description.worldVolume().placeVolume(g_vol, Position(g_x, g_y, g_z))  # noqa: F821
0052   phv.addPhysVolID('id', det.id)
0053   de.addPlacement(phv)
0054   x, y, z = 0, book.y + plane.y - 2 * plane.getF('dy'), 0
0055   for _n in range(plane.number):
0056     g_vol.placeVolume(e_vol, Position(x, y, z))  # noqa: F821
0057     y += plane.getF('dy')
0058   # ---Return detector element---------------------------------------------------------------------------------
0059   return de