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 wire chamber 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 wirechamber-like detectors """
0019 
0020 
0021 def add_wire_chamber_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_wire_chamber_defaults.clients:
0026         return
0027 
0028     add_wire_chamber_defaults.clients.append(md)
0029 
0030     logger = logging.getLogger(__name__)
0031     logger.info("Define wire chamber types:")
0032 
0033     # Sensitive shapes
0034     logger.info("-> adding sensitive types")
0035     md.add_sensitive(Shape.DRIFT_CELL, type_id=0)
0036     md.add_sensitive(Shape.STRAW_TUBE, type_id=1)
0037 
0038     # Cylindrical volume portals (barrel and endcap)
0039     logger.info("-> adding portal types")
0040     md.add_portal(Shape.CONCENTRIC_CYLINDER, type_id=2)
0041     md.add_portal(Shape.RING, type_id=3)
0042 
0043     # Acceleration struct for portals and passives
0044     md.add_accel_struct(Accelerator.BRUTE_FORCE, "portal", is_default=True)
0045     md.add_accel_struct(Accelerator.BRUTE_FORCE, "passive")
0046 
0047     # Surface acceleration structure for the wires
0048     md.add_accel_struct(Accelerator.CONCENTRIC_CYLINDER_GRID2D, "sensitive")
0049 
0050     if use_mat_maps:
0051         logger.info("-> requested material map types")
0052         # Map the material for the support structures
0053         md.add_material(Material.CONCENTIRC_CYLINDER_MAP2D)
0054         md.add_material(Material.DISC_MAP2D)
0055         # Experimental: map the all of the material above into 3D bins
0056         # md.add_material(Material.CYLINDER3D)
0057 
0058     if use_homogeneous_mat:
0059         logger.info("-> requested homogeneous material types")
0060         # Model the gas content
0061         md.add_material(Material.RAW)
0062 
0063     # Sensitive material
0064     md.add_material(Material.ROD)
0065 
0066     # Volume accelerator for layered cylindrical detectors
0067     logger.info("-> adding detector volume acceleration structure")
0068     md.add_accel_struct(Accelerator.CYLINDER_GRID3D, "volume", is_default=True)
0069 
0070     logger.info("Done")
0071 
0072 
0073 add_wire_chamber_defaults.clients = []