Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-26 09:23:12

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 from detray_metadata import metadata
0010 from detray_metadata import Type, Algebra, Shape, Material, Accelerator
0011 from detray_metadata import (
0012     add_silicon_tracker_defaults,
0013     add_calorimeter_defaults,
0014     add_telescope_detector_defaults,
0015     add_wire_chamber_defaults,
0016 )
0017 
0018 from .itk_detector import configure as configure_itk
0019 from .odd_detector import configure as configure_odd
0020 
0021 import logging
0022 
0023 
0024 def configure(md: metadata):
0025     logger = logging.getLogger(__name__)
0026 
0027     # Collect the types required for a detector that can hold all detector types
0028 
0029     # Specify a particular algebra plugin (otherwise left as template param.)
0030     # md.set_algebra_plugin(Algebra.ARRAY, Type.SINGLE)
0031 
0032     # Make sure all of the defaults are added
0033     add_telescope_detector_defaults(md, use_mat_maps=True, use_homogeneous_mat=True)
0034     add_wire_chamber_defaults(md, use_mat_maps=True, use_homogeneous_mat=True)
0035     add_calorimeter_defaults(md, use_mat_maps=True, use_homogeneous_mat=True)
0036     add_silicon_tracker_defaults(
0037         md, use_mat_maps=True, use_homogeneous_mat=True, add_trapezoid=True
0038     )
0039 
0040     # Make sure all detectors can be represented by this metadata
0041     configure_odd(md)
0042     configure_itk(md)
0043 
0044     # Extra passive surface shapes (cylinder with two intersection solutions)
0045     md.add_passive(Shape.CYLINDER2D)
0046     md.add_passive(Shape.RING)
0047 
0048     # Add an acceleration struct and material map for generic 2D cylinders
0049     md.add_accel_struct(Accelerator.CYLINDER_GRID2D)
0050     md.add_material(Material.CYLINDER_MAP2D)
0051 
0052     #
0053     # Add some special types (e.g. for detector R&D)
0054 
0055     # Special surface types
0056     # md.add_sensitive(Shape.UNMASKED)
0057 
0058     # Add more material types for testing
0059     md.add_material(Material.ANNULUS_MAP2D)
0060     md.add_material(Material.TRAPEZOID_MAP2D)
0061     md.add_material(Material.CUBOID_MAP3D)
0062     md.add_material(Material.CYLINDER_MAP2D)
0063 
0064     # Make sure a default acceleration struct is chosen that can be used in all
0065     # detector types
0066     logger.info(
0067         "Overwrite default acceleration structures to use most generic types as defaults"
0068     )
0069     md.set_default_accel_struct(Accelerator.BRUTE_FORCE, "portal")
0070     md.set_default_accel_struct(Accelerator.CYLINDER_GRID3D, "volume")