Beispiel #1
0
def CavernGeometryCfg(flags):
    from AtlasGeoModel.GeoModelConfig import GeoModelCfg
    acc = GeoModelCfg(flags)
    geoModelSvc = acc.getPrimary()
    if (flags.Detector.Simulate
            and flags.Beam.Type == "cosmics") or flags.Detector.SimulateCavern:
        from CavernInfraGeoModel.CavernInfraGeoModelConf import CavernInfraDetectorTool
        geoModelSvc.DetectorTools += [CavernInfraDetectorTool()]
    return acc
Beispiel #2
0
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
    if hasattr(simFlags, 'SimulateNewSmallWheel'):
        if simFlags.SimulateNewSmallWheel():
            MuonDetectorTool.StationSelection = 2
            MuonDetectorTool.SelectedStations = ["EIL1"]
            MuonDetectorTool.SelectedStations += ["EIL2"]
            MuonDetectorTool.SelectedStations += ["EIL6"]
            MuonDetectorTool.SelectedStations += ["EIL7"]
Beispiel #3
0
    GeoModelSvc.MuonVersionOverride = vp1MuonLayout

# --- GeoModel
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit

from AthenaCommon.AppMgr import ServiceMgr as svcMgr

if vp1GeoModelStats:
    print "printing GeoModel stats to file (Svc.StatisticsToFile=TRUE)..."
    svcMgr.GeoModelSvc.StatisticsToFile = True

if vp1Cavern:
    print "vp1.py - Initializing the visualization of the Cavern Infrastructure..."
    from CavernInfraGeoModel.CavernInfraGeoModelConf import CavernInfraDetectorTool
    svcMgr.GeoModelSvc.DetectorTools += [CavernInfraDetectorTool()]

if vp1ToyDetector:
    print "vp1.py - Initializing the visualization of the GeoModelExamples 'ToyDetector'..."
    from GeoModelExamples.GeoModelExamplesConf import ToyDetectorTool
    svcMgr.GeoModelSvc.DetectorTools += [ToyDetectorTool()]

# --- AGDD2Geo
# Switch it on if
#  - Muon is ON
#  - Major geometry version is greater than 10
if (vp1Muon):

    from AtlasGeoModel import Agdd2Geo

    if len(vp1MuonAGDDFiles) > 0:
Beispiel #4
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')