Warning, file /epic/scripts/material_map/epic.py was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 from pathlib import Path
0010
0011 import acts
0012 import acts.examples.dd4hep
0013
0014 from acts import (
0015 Vector4,
0016 MaterialMapJsonConverter
0017 )
0018
0019 import json
0020
0021 def getDetector(
0022 xmlFile,
0023 jsonFile="",
0024 logLevel=acts.logging.WARNING,
0025 ):
0026 customLogLevel = acts.examples.defaultLogging(logLevel=logLevel)
0027 logger = acts.logging.getLogger("epic.getDetector")
0028
0029 matDeco = None
0030 if len(jsonFile)>0:
0031 file = Path(jsonFile)
0032 logger.info("Adding material from %s", file.absolute())
0033 matDeco = acts.IMaterialDecorator.fromFile(
0034 file,
0035 level=customLogLevel(maxLevel=acts.logging.INFO),
0036 )
0037
0038 dd4hepConfig = acts.examples.dd4hep.DD4hepDetector.Config(
0039 xmlFileNames=[xmlFile],
0040 logLevel=logLevel,
0041 dd4hepLogLevel=customLogLevel(),
0042 )
0043 detector = acts.examples.dd4hep.DD4hepDetector(dd4hepConfig)
0044
0045 return detector