Back to home page

EIC code displayed by LXR

 
 

    


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

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 import detray
0010 
0011 from detray.detectors import metadata, metadata_generator
0012 from detray.detectors import Shape
0013 from detray.detectors import add_silicon_tracker_defaults
0014 
0015 import argparse
0016 import logging
0017 import sys
0018 
0019 # --------------------------------------------------------------------------
0020 # Generate the Open Data Detector metadata type
0021 # --------------------------------------------------------------------------
0022 
0023 """ Add all types needed to describe the ACTS Open Data Detector (ODD) """
0024 
0025 
0026 def add_odd_types(md: metadata):
0027     logger = logging.getLogger(__name__)
0028     logger.info("Define types required by the ACTS Open Data Detector (ODD):")
0029 
0030     # Add default types for silicon trackers (cylindrical detector shape)
0031     add_silicon_tracker_defaults(
0032         metadata=md, use_homogeneous_mat=True, use_mat_maps=True, add_trapezoid=True
0033     )
0034 
0035     # Add passive material surfaces (intersectable for cosmics)
0036     # md.add_passive(Shape.CYLINDER2D)
0037     # md.add_passive(Shape.RING)
0038 
0039     logger.info("Done")
0040 
0041 
0042 def __main__():
0043     # Commandline options
0044     parser = argparse.ArgumentParser(prog=sys.argv[0])
0045     detray.detectors.add_logging_options(parser)
0046     detray.detectors.add_io_options(parser)
0047 
0048     args = parser.parse_args()
0049     detray.detectors.parse_logging_options(args)
0050     detray.detectors.parse_io_options(args)
0051 
0052     md = metadata("odd")
0053 
0054     add_odd_types(md)
0055 
0056     # Dump the metadata to header file
0057     if args.output:
0058         metadata_generator(md, args.output)
0059     else:
0060         metadata_generator(md)
0061 
0062 
0063 if __name__ == "__main__":
0064     __main__()