def _do_external(self): """Place to handle the external services: GeoModel, IOVDb, frozen showers, etc """ AtlasG4Eng.G4Eng.log.verbose( 'AtlasSimSkeleton._do_external :: starting') from AthenaCommon.AppMgr import ToolSvc, ServiceMgr from Geo2G4.Geo2G4Conf import Geo2G4Svc geo2G4Svc = Geo2G4Svc() theApp.CreateSvc += ["Geo2G4Svc"] ServiceMgr += geo2G4Svc ## Enable top transforms for the ATLAS geometry geo2G4Svc.GetTopTransform = True ## Configure access to the BeamCondSvc if necessary. Assuming ## it should be on always as BeamEffectTransformation is ## currently always switched on, else something like this will ## be required here. from G4AtlasApps.SimFlags import simFlags include("InDetBeamSpotService/BeamCondSvc.py") ## GeoModel stuff ## TODO: Tidy imports etc. from GeoModelSvc.GeoModelSvcConf import GeoModelSvc from AthenaCommon.GlobalFlags import jobproperties from AtlasGeoModel import SetGeometryVersion ## Forward Region Twiss files - needed before geometry setup! if simFlags.ForwardDetectors.statusOn: if DetFlags.geometry.FwdRegion_on(): from AthenaCommon.CfgGetter import getPublicTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += getPublicTool("ForwardRegionProperties") from AtlasGeoModel import GeoModelInit from AtlasGeoModel import SimEnvelopes from GeoModelSvc.GeoModelSvcConf import GeoModelSvc gms = GeoModelSvc() ## Cosmics GeoModel tweaks if jobproperties.Beam.beamType() == 'cosmics' or \ (simFlags.CavernBG.statusOn and not 'Signal' in simFlags.CavernBG.get_Value() ): from CavernInfraGeoModel.CavernInfraGeoModelConf import CavernInfraDetectorTool gms.DetectorTools += [CavernInfraDetectorTool()] ## Protects GeoModelSvc in the simulation from the AlignCallbacks gms.AlignCallbacks = False ## Muon GeoModel tweaks if DetFlags.Muon_on(): ## Turn off caching in the muon system from MuonGeoModel.MuonGeoModelConf import MuonDetectorTool MuonDetectorTool = MuonDetectorTool() MuonDetectorTool.FillCacheInitTime = 0 # default is 1 ## Additional material in the muon system from AGDD2GeoSvc.AGDD2GeoSvcConf import AGDDtoGeoSvc AGDD2Geo = AGDDtoGeoSvc() from AthenaCommon import CfgGetter if not "MuonAGDDTool/MuonSpectrometer" in AGDD2Geo.Builders: ToolSvc += CfgGetter.getPublicTool("MuonSpectrometer", checkType=True) AGDD2Geo.Builders += ["MuonAGDDTool/MuonSpectrometer"] from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()): if not "NSWAGDDTool/NewSmallWheel" in AGDD2Geo.Builders: ToolSvc += CfgGetter.getPublicTool("NewSmallWheel", checkType=True) AGDD2Geo.Builders += ["NSWAGDDTool/NewSmallWheel"] theApp.CreateSvc += ["AGDDtoGeoSvc"] ServiceMgr += AGDD2Geo ## Add configured GeoModelSvc to service manager ServiceMgr += gms ## Run the geometry envelope setup earlier than GeoSD self._do_GeoEnv() #TODO remove AtlasG4Eng.G4Eng.log.verbose('AtlasSimSkeleton._do_external :: done')
from MuonCondTool.MuonCondToolConf import MuonAlignmentDbTool MuonAlignmentDbTool = MuonAlignmentDbTool("MGM_AlignmentDbTool") MuonAlignmentDbTool.ParlineFolders = [ "/MUONALIGN/MDT/BARREL", "/MUONALIGN/MDT/ENDCAP/SIDEA", "/MUONALIGN/MDT/ENDCAP/SIDEC", "/MUONALIGN/TGC/SIDEA", "/MUONALIGN/TGC/SIDEC" ] ToolSvc += MuonAlignmentDbTool MGM_AlignmentDbTool = ToolSvc.MGM_AlignmentDbTool MGM_AlignmentDbTool.OutputLevel = DEBUG #***************************************************** HERE setup MuonDetectorManager from MuonGeoModel.MuonGeoModelConf import MuonDetectorTool MuonDetectorTool = MuonDetectorTool() # memory management MuonDetectorTool.FillCacheInitTime = 0 # default is 0 #MuonDetectorTool.DumpMemoryBreakDown = True # default is false # selection of active stations MuonDetectorTool.StationSelection = 0 # default is 0 #MuonDetectorTool.SelectedStations = [ "X" ] # irrelevant if stationselection is 0 - this will switch off all stations MuonDetectorTool.SelectedStations = ["EIL", "T", "CSS", "BMS" ] # irrelevant if stationselection is 0 MuonDetectorTool.SelectedStations = ["BOL" ] # irrelevant if stationselection is 0 MuonDetectorTool.SelectedStJzz = [1, -1] MuonDetectorTool.SelectedStJff = [3] # alignment control MuonDetectorTool.ControlAlines = GeneralControlAlines # default is 111111 MuonDetectorTool.DumpAlines = False if useAlign: MuonDetectorTool.UseConditionDb = 1
GeoModelSvc = GeoModelSvc() #GeoModelSvc.MuonVersionOverride = "MuonSpectrometer-R.01.01.Initial.Light" printfunc(GeoModelSvc) #***************************************************** HERE setup MuonDetectorManager from MuonGeoModel.MuonGeoModelConf import MuonDetectorTool MuonDetectorTool = MuonDetectorTool() MuonDetectorTool.StationSelection = 0 MuonDetectorTool.SelectedStations = ["BOG"] MuonDetectorTool.SelectedStJzz = [3] MuonDetectorTool.SelectedStJff = [6] MuonDetectorTool.ControlAlines = GeneralControlAlines MuonDetectorTool.ForceSwitchOnOff_BUILDINERTMATERIALS = 1000 # avoid building the dead matter MuonDetectorTool.FillCacheInitTime = 1 MuonDetectorTool.DumpMemoryBreakDown = True printfunc(MuonDetectorTool) #***************************************************** HERE setup MuonGMCheck from MuonGeoModelTest.MuonGeoModelTestConf import MuonGMCheck MuonGMCheck = MuonGMCheck() MuonGMCheck.EventLoopMode = GMCheckLoop MuonGMCheck.check_mdt = 1 MuonGMCheck.check_rpc = 1 MuonGMCheck.check_tgc = 1 MuonGMCheck.check_csc = 1 #MuonGMCheck.check_surfaces = 1 printfunc(MuonGMCheck)