File indexing completed on 2026-09-26 08:10:16
0001
0002
0003
0004
0005
0006
0007
0008
0009 from pathlib import Path
0010
0011 import acts
0012 import acts.examples.dd4hep
0013
0014 def getDetector(
0015 xmlFile,
0016 matFile="",
0017 logLevel=acts.logging.WARNING,
0018 ):
0019 customLogLevel = acts.examples.defaultLogging(logLevel=logLevel)
0020 logger = acts.getDefaultLogger("epic.getDetector", logLevel)
0021
0022 matDeco = None
0023 if len(matFile) > 0:
0024 file = Path(matFile)
0025 if file.exists():
0026 logger.info("Adding material from %s", file.absolute())
0027 matDeco = acts.IMaterialDecorator.fromFile(
0028 file,
0029 level=customLogLevel(maxLevel=acts.logging.WARNING),
0030 )
0031 else:
0032 logger.warning("Material map %s not found.", matFile)
0033
0034 dd4hepConfig = acts.examples.dd4hep.DD4hepDetector.Config(
0035 xmlFileNames=[xmlFile],
0036 logLevel=logLevel,
0037 dd4hepLogLevel=customLogLevel(),
0038 materialDecorator=matDeco,
0039 )
0040 detector = acts.examples.dd4hep.DD4hepDetector(dd4hepConfig)
0041
0042 return detector