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 calorimeters
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 calorimeters """
0019 
0020 
0021 def add_calorimeter_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_calorimeter_defaults.clients:
0026         return
0027 
0028     add_calorimeter_defaults.clients.append(md)
0029 
0030     logger = logging.getLogger(__name__)
0031     logger.info("Define calorimeter types:")
0032 
0033     logger.info("-> adding sensitive types")
0034     md.add_sensitive(Shape.RECTANGLE, type_id=0)
0035     md.add_sensitive(Shape.TRAPEZOID, type_id=1)
0036 
0037     logger.info("-> adding portal types")
0038     md.add_portal(Shape.CONCENTRIC_CYLINDER, type_id=2)
0039     md.add_portal(Shape.RING, type_id=3)
0040 
0041     # Acceleration Struct for portals and passives
0042     md.add_accel_struct(Accelerator.BRUTE_FORCE, "portal", is_default=True)
0043     md.add_accel_struct(Accelerator.BRUTE_FORCE, "passive")
0044 
0045     if use_mat_maps:
0046         logger.info("-> requested material map types")
0047         md.add_material(Material.CYLINDER_MAP3D)
0048     if use_homogeneous_mat:
0049         logger.info("-> requested homogeneous material types")
0050         md.add_material(Material.RAW)
0051 
0052     # Add acceleration structures (e.g. Frustum navigation) in the future...
0053 
0054     logger.info("Done")
0055 
0056 
0057 add_calorimeter_defaults.clients = []