File indexing completed on 2026-10-04 08:09:16
0001
0002
0003 """Build the GeoModel muon mockup and its ACTS tracking geometry."""
0004
0005 import acts
0006 from acts import geomodel as gm
0007 from acts.examples import geomodel as gm_ex
0008
0009
0010 def buildMuonMockup(
0011 gContext: acts.GeometryContext | None = None,
0012 input: str = "",
0013 mockupDetector: str = "Muon",
0014 stationNames: list[str] | None = None,
0015 logLevel=acts.logging.INFO,
0016 ):
0017 """Build and return the detector, tracking geometry, field, and mappings."""
0018
0019 if gContext is None:
0020 gContext = acts.GeometryContext.dangerouslyDefaultConstruct()
0021 unit_constants = acts.UnitConstants
0022
0023 builderConfig = gm_ex.GeoModelMuonMockupBuilder.Config()
0024
0025 if input:
0026 geomTree = gm.readFromDb(input)
0027 builderConfig.stationNames = stationNames or [
0028 "BIL",
0029 "BML",
0030 "BOL",
0031 "EAI",
0032 "EAM",
0033 "EAO",
0034 "ECI",
0035 "ECM",
0036 "ECO",
0037 ]
0038 elif mockupDetector == "Muon":
0039 mockupConfig = gm_ex.GeoMuonMockupExperiment.Config()
0040 mockupConfig.dumpTree = True
0041 mockupConfig.dbName = "ActsGeoMS.db"
0042 mockupConfig.nSectors = 12
0043 mockupConfig.nEtaStations = 8
0044 mockupConfig.buildEndcaps = True
0045 mockupConfig.buildBarrel = True
0046 mockupBuilder = gm_ex.GeoMuonMockupExperiment(
0047 mockupConfig, "GeoMockUpMS", logLevel
0048 )
0049 builderConfig.stationNames = stationNames or [
0050 "BI",
0051 "BM",
0052 "BO",
0053 "EAI",
0054 "EAM",
0055 "EAO",
0056 "ECI",
0057 "ECM",
0058 "ECO",
0059 ]
0060 geomTree = mockupBuilder.constructMS()
0061 else:
0062 raise RuntimeError(f"{mockupDetector} not implemented yet")
0063
0064 factoryConfig = gm.GeoModelDetectorObjectFactory.Config()
0065 factoryConfig.nameList = [
0066 "RpcGasGap",
0067 "MDTDriftGas",
0068 "TgcGasGap",
0069 "SmallWheelGasGap",
0070 ]
0071 factoryConfig.convertSubVolumes = True
0072 factoryConfig.convertBox = ["MDT", "RPC", "SmallWheel", "TGC"]
0073
0074 factoryOptions = gm.GeoModelDetectorObjectFactory.Options()
0075 factoryOptions.queries = ["Muon"]
0076 factoryCache = gm.GeoModelDetectorObjectFactory.Cache()
0077 factory = gm.GeoModelDetectorObjectFactory(factoryConfig, logLevel)
0078 factory.construct(factoryCache, gContext, geomTree, factoryOptions)
0079 builderConfig.volumeBoxFPVs = factoryCache.boundingBoxes
0080
0081 gmDetectorCfg = gm_ex.GeoModelDetector.Config()
0082 gmDetectorCfg.geoModelTree = geomTree
0083 gmDetector = gm_ex.GeoModelDetector(gmDetectorCfg)
0084
0085 trackingGeometryBuilder = gm_ex.GeoModelMuonMockupBuilder(
0086 builderConfig, "GeoModelMuonMockupBuilder", acts.logging.INFO
0087 )
0088
0089 trackingGeometry = gmDetector.buildTrackingGeometry(
0090 gContext, trackingGeometryBuilder
0091 )
0092 return gmDetector, trackingGeometry, factoryConfig.nameList, factoryCache