Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:10

0001 # This file is part of the ACTS project.
0002 #
0003 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 # --------------------------------------------------------------------------
0010 # Function that will add types commonly needed for telescope detectors
0011 # --------------------------------------------------------------------------
0012 
0013 from ..impl import metadata
0014 from ..impl import Shape, Material, Accelerator
0015 
0016 import logging
0017 
0018 """ Types that are typically needed for telescope detectors """
0019 
0020 
0021 def add_telescope_detector_defaults(
0022     md: metadata, use_mat_maps=False, use_homogeneous_mat=False
0023 ):
0024     # Don't run more than once on given metadata (prevents spurious log entries)
0025     if md in add_telescope_detector_defaults.clients:
0026         return
0027 
0028     add_telescope_detector_defaults.clients.append(md)
0029 
0030     logger = logging.getLogger(__name__)
0031     logger.info("Define telescope detector types:")
0032 
0033     # Sensitive and portal shapes
0034     md.add_sensitive(Shape.RECTANGLE, type_id=0)
0035     md.add_portal(Shape.RECTANGLE, type_id=1)
0036 
0037     # Acceleration struct for portals and passives
0038     md.add_accel_struct(Accelerator.BRUTE_FORCE, "portal", is_default=True)
0039     md.add_accel_struct(Accelerator.BRUTE_FORCE, "passive")
0040     md.add_accel_struct(Accelerator.BRUTE_FORCE, "sensitive")
0041 
0042     # Map the material for the support structures onto the portals
0043     if use_mat_maps:
0044         logger.info("-> requested material map types")
0045         md.add_material(Material.RECTANGLE_MAP2D)
0046 
0047     # Sensitive material
0048     if use_homogeneous_mat:
0049         logger.info("-> requested homogeneous material types")
0050         md.add_material(Material.SLAB)
0051 
0052     # Acceleration struct for telescope detector volumes
0053     logger.info("-> adding detector volume acceleration structure")
0054     md.add_accel_struct(Accelerator.BRUTE_FORCE, "volume", is_default=True)
0055 
0056     logger.info("Done")
0057 
0058 
0059 add_telescope_detector_defaults.clients = []