Exemplo n.º 1
0
        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
    if hasattr(simFlags, 'SimulateNewSmallWheel'):
        if simFlags.SimulateNewSmallWheel():
            MuonDetectorTool.StationSelection = 2
            MuonDetectorTool.SelectedStations = ["EIL1"]
            MuonDetectorTool.SelectedStations += ["EIL2"]
            MuonDetectorTool.SelectedStations += ["EIL6"]
            MuonDetectorTool.SelectedStations += ["EIL7"]
            MuonDetectorTool.SelectedStations += ["EIS*"]
            MuonDetectorTool.SelectedStations += ["EIL10"]
Exemplo n.º 2
0
    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')