def generateFastSimulationList(): FastSimulationList=[] from G4AtlasApps.SimFlags import simFlags from AthenaCommon.DetFlags import DetFlags if DetFlags.bpipe_on(): if 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 simFlags.CavernBG.statusOn and simFlags.CavernBG.get_Value() != 'Read': FastSimulationList += ['NeutronFastSim'] return FastSimulationList
def __init__(self, name="LArG4EMECFastSimSvc"): super(DefaultLArG4FastSimSvc, self).__init__(name) from AthenaCommon.Logging import logging log = logging.getLogger('LArG4EMECFastSimSvc') # set defaults self.EFlagToShowerLib = True self.GFlagToShowerLib = True self.NeutFlagToShowerLib = True self.PionFlagToShowerLib = True self.ContainHigh = True self.ContainCrack = True self.ContainLow = True # get parametrisation level from G4AtlasApps.SimFlags import simFlags # adjust defaults for parametrisation level if simFlags.LArParameterization() >= 2: pass if simFlags.LArParameterization() >= 3: # switch off any EMEC speed up self.EFlagToShowerLib = False self.GFlagToShowerLib = False self.NeutFlagToShowerLib = False self.PionFlagToShowerLib = False
def LArG4FastSimSvcInit(): from AthenaCommon.Logging import logging log = logging.getLogger('LArG4FastSimSvcInit') # get parametrisation level from G4AtlasApps.SimFlags import simFlags if not hasattr(simFlags, 'LArParameterization'): log.warning( "JobProperty LArParameterization is not defined! Can not set up fast simulation!" ) return if simFlags.LArParameterization() == 0: log.warning( "JobProperty LArParameterization is zero! No fast simulation requested!" ) return # get service manager from AthenaCommon.AppMgr import ServiceMgr # add EMB if not hasattr(ServiceMgr, 'LArG4EMBFastSimSvc'): log.info("Adding LArG4EMBFastSimSvc to ServiceMgr") from LArG4FastSimSvc.LArG4FastSimSvcConfig import LArG4EMBFastSimSvc ServiceMgr += LArG4EMBFastSimSvc() # add EMEC if not hasattr(ServiceMgr, 'LArG4EMECFastSimSvc'): log.info("Adding LArG4EMECFastSimSvc to ServiceMgr") from LArG4FastSimSvc.LArG4FastSimSvcConfig import LArG4EMECFastSimSvc ServiceMgr += LArG4EMECFastSimSvc() # add FCAL if not hasattr(ServiceMgr, 'LArG4FCALFastSimSvc'): log.info("Adding LArG4FCALFastSimSvc to ServiceMgr") from LArG4FastSimSvc.LArG4FastSimSvcConfig import LArG4FCALFastSimSvc ServiceMgr += LArG4FCALFastSimSvc() # add FCAL2 if not hasattr(ServiceMgr, 'LArG4FCAL2FastSimSvc'): log.info("Adding LArG4FCAL2FastSimSvc to ServiceMgr") from LArG4FastSimSvc.LArG4FastSimSvcConfig import LArG4FCAL2FastSimSvc ServiceMgr += LArG4FCAL2FastSimSvc() # add Dead Material if not hasattr(ServiceMgr, 'DeadMaterialFastSimSvc'): log.info("Adding DeadMaterialFastSimSvc to ServiceMgr") from LArG4FastSimSvc.LArG4FastSimSvcConfig import DeadMaterialFastSimSvc ServiceMgr += DeadMaterialFastSimSvc() if not hasattr(ServiceMgr, 'LArG4ShowerLibSvc'): log.info("Adding ShowerLibSvc to ServiceMgr") from LArG4ShowerLibSvc.LArG4ShowerLibSvcConf import LArG4ShowerLibSvc ServiceMgr += LArG4ShowerLibSvc()
def getLArFCALSensitiveDetector(name="LArFCALSensitiveDetector", **kwargs): bare_collection_name = "LArHitFCAL" mergeable_collection_suffix = "_G4" merger_input_property = "LArFCALHits" region = "CALO" hits_collection_name = generate_mergeable_collection_name(bare_collection_name, mergeable_collection_suffix, merger_input_property, region) kwargs.setdefault("FCAL1Volumes",["LArMgr::LAr::FCAL::Module1::Gap"]) kwargs.setdefault("FCAL2Volumes",["LArMgr::LAr::FCAL::Module2::Gap"]) kwargs.setdefault("FCAL3Volumes",["LArMgr::LAr::FCAL::Module3::Gap"]) # No effect currently kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) # Hook for fast simulation from G4AtlasApps.SimFlags import simFlags kwargs.setdefault("UseFrozenShowers", simFlags.LArParameterization()>0) return CfgMgr.LArG4__FCALSDTool(name, **kwargs)
def getLArEMBSensitiveDetector(name="LArEMBSensitiveDetector", **kwargs): bare_collection_name = "LArHitEMB" mergeable_collection_suffix = "_G4" merger_input_property = "LArEMBHits" region = "CALO" hits_collection_name = generate_mergeable_collection_name(bare_collection_name, mergeable_collection_suffix, merger_input_property, region) ## Main configuration kwargs.setdefault("StacVolumes",["LArMgr::LAr::EMB::STAC"]) kwargs.setdefault("PresamplerVolumes",["LArMgr::LAr::Barrel::Presampler::Module"]) # No effect currently kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) # Hook for fast simulation from G4AtlasApps.SimFlags import simFlags kwargs.setdefault("UseFrozenShowers", simFlags.LArParameterization()>0) return CfgMgr.LArG4__EMBSDTool(name, **kwargs)
def __init__(self, name="DefaultLArG4FastSimSvc"): super(DefaultLArG4FastSimSvc, self).__init__(name) from AthenaCommon.Logging import logging log = logging.getLogger('LArG4FastSimSvc') # get parametrisation level from G4AtlasApps.SimFlags import simFlags if not hasattr(simFlags, 'LArParameterization'): log.warning( "JobProperty LArParameterization is not defined! Can not set up fast simulation!" ) return if simFlags.LArParameterization() == 0: log.warning( "JobProperty LArParameterization is zero! No fast simulation requested!" ) return
def getLArEMECSensitiveDetector(name="LArEMECSensitiveDetector", **kwargs): bare_collection_name = "LArHitEMEC" mergeable_collection_suffix = "_G4" merger_input_property = "LArEMECHits" region = "CALO" hits_collection_name = generate_mergeable_collection_name(bare_collection_name, mergeable_collection_suffix, merger_input_property, region) from G4AtlasApps.SimFlags import simFlags if simFlags.SimLayout.get_Value() not in ["tb_LArH6_2002","tb_LArH6EC_2002"]: kwargs.setdefault("NegIWVolumes",["LArMgr::LAr::EMEC::Neg::InnerWheel"]) kwargs.setdefault("NegOWVolumes",["LArMgr::LAr::EMEC::Neg::OuterWheel"]) kwargs.setdefault("NegBOBarretteVolumes",["LArMgr::LAr::EMEC::Neg::BackOuterBarrette::Module::Phidiv"]) if simFlags.SimLayout.get_Value()!="tb_LArH6EC_2002": kwargs.setdefault("PosIWVolumes",["LArMgr::LAr::EMEC::Pos::InnerWheel"]) kwargs.setdefault("PosOWVolumes",["LArMgr::LAr::EMEC::Pos::OuterWheel"]) kwargs.setdefault("PosBOBarretteVolumes",["LArMgr::LAr::EMEC::Pos::BackOuterBarrette::Module::Phidiv"]) kwargs.setdefault("PresVolumes", ["LArMgr::LAr::Endcap::Presampler::LiquidArgon"]) # No effect currently kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) # Hook for fast simulation kwargs.setdefault("UseFrozenShowers", simFlags.LArParameterization()>0) return CfgMgr.LArG4__EMECSDTool(name, **kwargs)
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