Beispiel #1
0
def getGeant4Tool(name="ISF_Geant4Tool", **kwargs):
    from G4AtlasApps.SimFlags import simFlags
    kwargs.setdefault('RandomNumberService', simFlags.RandomSvcMT())
    kwargs.setdefault('InputConverter', 'ISF_InputConverter')
    kwargs.setdefault('UserActionSvc','G4UA::ISFUserActionSvc')
    if hasattr(simFlags, 'RecordFlux') and simFlags.RecordFlux.statusOn:
        kwargs.setdefault('RecordFlux',simFlags.RecordFlux())

    # Multi-threading settinggs
    from AthenaCommon.ConcurrencyFlags import jobproperties as concurrencyProps
    if concurrencyProps.ConcurrencyFlags.NumThreads() > 0:
        is_hive = True
    else:
        is_hive = False
    kwargs.setdefault('MultiThreading', is_hive)
    # Set commands for the G4AtlasAlg
    kwargs.setdefault("G4Commands", simFlags.G4Commands.get_Value())
    from ISF_Config.ISF_jobProperties import ISF_Flags
    kwargs.setdefault('PrintTimingInfo'       , ISF_Flags.DoTimeMonitoring() )
    kwargs.setdefault('SenDetMasterTool', 'SensitiveDetectorMasterTool')
    kwargs.setdefault('FastSimMasterTool', 'FastSimulationMasterTool')
    from AthenaCommon import CfgMgr
    # Workaround to keep other simulation flavours working while we migrate everything to be AthenaMT-compatible.
    if ISF_Flags.Simulator.get_Value() in ['FullG4', 'FullG4MT', 'PassBackG4', 'PassBackG4MT', 'G4FastCalo', 'G4FastCaloMT']:
        return CfgMgr.iGeant4__G4TransportTool(name, **kwargs)
    else:
        return CfgMgr.iGeant4__G4LegacyTransportTool(name, **kwargs)
Beispiel #2
0
def getG4TransportTool(name='ISFG4TransportTool', **kwargs):
    from G4AtlasApps.SimFlags import simFlags
    kwargs.setdefault('RandomGenerator', 'athena')
    kwargs.setdefault('RandomNumberService', simFlags.RandomSvc())
    kwargs.setdefault('InputConverter', 'ISF_InputConverter')
    kwargs.setdefault('UserActionSvc', 'G4UA::ISFUserActionSvc')
    if hasattr(simFlags, 'RecordFlux') and simFlags.RecordFlux.statusOn:
        kwargs.setdefault('RecordFlux', simFlags.RecordFlux())

    # Multi-threading settinggs
    from AthenaCommon.ConcurrencyFlags import jobproperties as concurrencyProps
    if concurrencyProps.ConcurrencyFlags.NumThreads() > 0:
        is_hive = True
    else:
        is_hive = False
    kwargs.setdefault('MultiThreading', is_hive)
    # Set commands for the G4AtlasAlg
    kwargs.setdefault("G4Commands", simFlags.G4Commands.get_Value())
    return CfgMgr.iGeant4__G4TransportTool(name, **kwargs)
def generateFastSimulationList():
    FastSimulationList = []
    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.DetFlags import DetFlags
    if DetFlags.bpipe_on():
        if hasattr(
                simFlags, 'ForwardDetectors'
        ) and simFlags.ForwardDetectors.statusOn and simFlags.ForwardDetectors(
        ) == 2:
            FastSimulationList += ['ForwardTransportModel']
        if hasattr(
                simFlags, 'BeamPipeSimMode'
        ) and simFlags.BeamPipeSimMode.statusOn and simFlags.BeamPipeSimMode(
        ) != "Normal":
            FastSimulationList += ['SimpleFastKiller']
    if DetFlags.geometry.LAr_on():
        ## Shower parameterization overrides the calibration hit flag
        if simFlags.LArParameterization.statusOn and simFlags.LArParameterization() > 0 \
                and simFlags.CalibrationRun.statusOn and simFlags.CalibrationRun.get_Value() in ['LAr','LAr+Tile','DeadLAr']:
            print 'getFastSimulationMasterTool FATAL :: You requested both calibration hits and frozen showers / parameterization in the LAr.'
            print '  Such a configuration is not allowed, and would give junk calibration hits where the showers are modified.'
            print '  Please try again with a different value of simFlags.LArParameterization or simFlags.CalibrationRun '
            raise RuntimeError('Configuration not allowed')
        if simFlags.LArParameterization() > 0:
            #FIXME If we're only using Frozen Showers in the FCAL do we really need to set up the EMB and EMEC as well?
            FastSimulationList += [
                'EMBFastShower', 'EMECFastShower', 'FCALFastShower',
                'FCAL2FastShower'
            ]
            if simFlags.LArParameterization.get_Value() > 1:
                FastSimulationList += ['DeadMaterialShower']
        elif simFlags.LArParameterization(
        ) is None or simFlags.LArParameterization() == 0:
            print "getFastSimulationMasterTool INFO No Frozen Showers"
    if DetFlags.Muon_on():
        if hasattr(simFlags, 'CavernBG') and simFlags.CavernBG.statusOn and simFlags.CavernBG.get_Value() != 'Read' and\
           not (hasattr(simFlags, 'RecordFlux') and simFlags.RecordFlux.statusOn and simFlags.RecordFlux()):
            FastSimulationList += ['NeutronFastSim']
    return FastSimulationList
Beispiel #4
0
def getATLAS_RegionCreatorList():
    regionCreatorList = []
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    isUpgrade = commonGeoFlags.Run() == "RUN4" or (
        commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC())
    isRUN2 = (commonGeoFlags.Run() in [
        "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL())

    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.DetFlags import DetFlags
    if simFlags.SimulateCavern.get_Value():
        regionCreatorList += [
            'SX1PhysicsRegionTool', 'BedrockPhysicsRegionTool',
            'CavernShaftsConcretePhysicsRegionTool'
        ]
        #regionCreatorList += ['CavernShaftsAirPhysicsRegionTool'] # Not used currently
    if DetFlags.ID_on():
        if DetFlags.pixel_on():
            regionCreatorList += ['PixelPhysicsRegionTool']
        if DetFlags.SCT_on():
            regionCreatorList += ['SCTPhysicsRegionTool']
        if DetFlags.TRT_on() and not isUpgrade:
            regionCreatorList += ['TRTPhysicsRegionTool']
            if isRUN2:
                regionCreatorList += ['TRT_ArPhysicsRegionTool'
                                      ]  #'TRT_KrPhysicsRegionTool'
        # FIXME dislike the ordering here, but try to maintain the same ordering as in the old configuration.
        if DetFlags.bpipe_on():
            if simFlags.BeamPipeSimMode.statusOn and simFlags.BeamPipeSimMode(
            ) != "Normal":
                regionCreatorList += ['BeampipeFwdCutPhysicsRegionTool']
            if simFlags.ForwardDetectors.statusOn and simFlags.ForwardDetectors(
            ) == 2:
                regionCreatorList += ['FWDBeamLinePhysicsRegionTool']
    if DetFlags.Calo_on():
        if DetFlags.geometry.LAr_on():
            ## Shower parameterization overrides the calibration hit flag
            if simFlags.LArParameterization.statusOn and simFlags.LArParameterization() > 0 \
                    and simFlags.CalibrationRun.statusOn and simFlags.CalibrationRun.get_Value() in ['LAr','LAr+Tile','DeadLAr']:
                print(
                    'You requested both calibration hits and frozen showers / parameterization in the LAr.'
                )
                print(
                    '  Such a configuration is not allowed, and would give junk calibration hits where the showers are modified.'
                )
                print(
                    '  Please try again with a different value of either simFlags.LArParameterization ('
                    + str(simFlags.LArParameterization()) +
                    ') or simFlags.CalibrationRun (' +
                    str(simFlags.CalibrationRun.get_Value()) + ')')
                raise RuntimeError('Configuration not allowed')
            if simFlags.LArParameterization() > 0:
                regionCreatorList += [
                    'EMBPhysicsRegionTool', 'EMECPhysicsRegionTool',
                    'HECPhysicsRegionTool', 'FCALPhysicsRegionTool'
                ]
                # FIXME 'EMBPhysicsRegionTool' used for parametrization also - do we need a second instance??
                regionCreatorList += [
                    'EMECParaPhysicsRegionTool', 'FCALParaPhysicsRegionTool',
                    'FCAL2ParaPhysicsRegionTool'
                ]
                if simFlags.LArParameterization.get_Value() > 1:
                    regionCreatorList += [
                        'PreSampLArPhysicsRegionTool',
                        'DeadMaterialPhysicsRegionTool'
                    ]
            elif simFlags.LArParameterization(
            ) is None or simFlags.LArParameterization() == 0:
                regionCreatorList += [
                    'EMBPhysicsRegionTool', 'EMECPhysicsRegionTool',
                    'HECPhysicsRegionTool', 'FCALPhysicsRegionTool'
                ]
    ## FIXME _initPR never called for FwdRegion??
    #if simFlags.ForwardDetectors.statusOn:
    #    if DetFlags.geometry.FwdRegion_on():
    #        regionCreatorList += ['FwdRegionPhysicsRegionTool']
    if DetFlags.Muon_on():
        regionCreatorList += [
            'DriftWallPhysicsRegionTool', 'DriftWall1PhysicsRegionTool',
            'DriftWall2PhysicsRegionTool'
        ]
        if simFlags.CavernBG.statusOn and simFlags.CavernBG.get_Value(
        ) != 'Read' and not (simFlags.RecordFlux.statusOn
                             and simFlags.RecordFlux()):
            regionCreatorList += ['MuonSystemFastPhysicsRegionTool']
    return regionCreatorList