def getVertexPositionFromFile(name="VertexPositionFromFile", **kwargs): from G4AtlasApps.SimFlags import simFlags vtxPosFile = "vtx-pos.txt" if simFlags.VertexOverrideFile.statusOn: vtxPosFile = str(simFlags.VertexOverrideFile()) kwargs.setdefault("VertexPositionsFile", vtxPosFile) runAndEventNosFile = "run-evt-nums.txt" if simFlags.VertexOverrideEventFile.statusOn: runAndEventNosFile = str(simFlags.VertexOverrideEventFile()) if hasattr(simFlags, 'IsEventOverlayInputSim') and simFlags.IsEventOverlayInputSim(): from OverlayCommonAlgs.OverlayFlags import overlayFlags runAndEventNosFile = (overlayFlags.EventIDTextFile()) kwargs.setdefault("RunAndEventNumbersFile", runAndEventNosFile) return CfgMgr.Simulation__VertexPositionFromFile(name, **kwargs)
def configureFlagsBase(): from AthenaCommon.DetFlags import DetFlags if not DetFlags.any_on(): # If you configure some of the DetFlags then you're # responsible for configuring all of them. DetFlags.all_setOn() DetFlags.Truth_setOn() # FIXME redundant? DetFlags.LVL1_setOff() # LVL1 is not part of G4 sim DetFlags.Forward_setOff() # Forward dets are off by default DetFlags.geometry.DBM_setOff() DetFlags.geometry.sTGC_setOff() DetFlags.geometry.Micromegas_setOff() ## Configure tasks DetFlags.digitize.all_setOff() DetFlags.makeRIO.all_setOff() from G4AtlasApps.SimFlags import simFlags if not (hasattr(simFlags, 'IsEventOverlayInputSim') and simFlags.IsEventOverlayInputSim()): # Unless this is an Overlay input simulation job switch off # the overlay DetFlags. DetFlags.overlay.all_setOff() DetFlags.pileup.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.writeRDOPool.all_setOff() DetFlags.writeRIOPool.all_setOff() if "G4" in ISF_Flags.Simulator(): # Short-cut: if G4 is in the simulator name, then it's a pretty # safe assumption that the configuration uses Geant4. ISF_Flags.UsingGeant4 = True return
## Tidy up DBM DetFlags: temporary measure DetFlags.DBM_setOff() ## Tidy up NSW DetFlags: temporary measure DetFlags.sTGC_setOff() DetFlags.Micromegas_setOff() if hasattr(simFlags, 'SimulateNewSmallWheel'): if simFlags.SimulateNewSmallWheel(): DetFlags.sTGC_setOn() DetFlags.Micromegas_setOn() ## Switch off tasks DetFlags.pileup.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.digitize.all_setOff() if not simFlags.IsEventOverlayInputSim(): DetFlags.overlay.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.makeRIO.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.writeRDOPool.all_setOff() ## Global flags needed by externals from AthenaCommon.GlobalFlags import globalflags globalflags.DataSource = 'geant4' if jobproperties.Beam.beamType() == 'cosmics':
def _do_jobproperties(self): """ Place to handle JobProperties. """ ## Import extra flags if it hasn't already been done from G4AtlasApps.SimFlags import simFlags if "atlas_flags" not in simFlags.extra_flags: simFlags.load_atlas_flags() if jobproperties.Beam.beamType( ) == "cosmics" and "cosmics_flags" not in simFlags.extra_flags: simFlags.load_cosmics_flags() AtlasG4Eng.G4Eng.log.verbose( 'AtlasSimSkeleton._do_jobproperties :: starting') ## Tidy up DBM DetFlags: temporary measure DetFlags.DBM_setOff() from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff() if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff() if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_setOff() ## Switch off tasks DetFlags.pileup.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.digitize.all_setOff() if not simFlags.IsEventOverlayInputSim(): DetFlags.overlay.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.makeRIO.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.writeRDOPool.all_setOff() ## Global flags needed by externals from AthenaCommon.GlobalFlags import globalflags globalflags.DataSource = 'geant4' if jobproperties.Beam.beamType() == 'cosmics': globalflags.DetGeo = 'commis' else: globalflags.DetGeo = 'atlas' ## At this point we can set the global job properties flag globalflags.DetDescrVersion = simFlags.SimLayout.get_Value() # Switch off GeoModel Release in the case of parameterization if simFlags.LArParameterization.get_Value( ) > 0 and simFlags.ReleaseGeoModel(): AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: Running parameterization - switching off GeoModel release!' ) simFlags.ReleaseGeoModel = False ## Translate conditions tag into IOVDbSvc global tag: must be done before job properties are locked!!! from AthenaCommon.AppMgr import ServiceMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc ServiceMgr += IOVDbSvc() if not hasattr( globalflags, "ConditionsTag") or not globalflags.ConditionsTag.get_Value(): msg = "AtlasSimSkeleton._do_jobproperties :: conditions tag has not been set and is no longer guessed by SimAtlasKernel. " msg += "You must set the globaltags.ConditionsTag flag in your job options." AtlasG4Eng.G4Eng.log.error(msg) raise SystemExit( "AtlasSimSkeleton._do_jobproperties :: Global ConditionsTag not set" ) if not hasattr(ServiceMgr.IOVDbSvc, 'GlobalTag') or not ServiceMgr.IOVDbSvc.GlobalTag: ServiceMgr.IOVDbSvc.GlobalTag = globalflags.ConditionsTag.get_Value( ) ## Enable floating point exception handling ## FIXME! This seems to cause the jobs to crash in the FpeControlSvc, so commenting this out for now... #from AthenaCommon.AthenaCommonFlags import athenaCommonFlags #athenaCommonFlags.RuntimeStrictness = 'abort' #AtlasG4Eng.G4Eng.log.debug('AtlasSimSkeleton._do_jobproperties :: Enabled floating point exceptions') if not simFlags.ISFRun: from G4AtlasApps.G4Atlas_Metadata import checkForSpecialConfigurationMetadata checkForSpecialConfigurationMetadata() ## Print flags if AtlasG4Eng.G4Eng.log.getEffectiveLevel() < 40: AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: printing detector flags DetFlags' ) DetFlags.Print() AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: printing simulation flags simFlags' ) jobproperties.print_JobProperties('tree&value') # Lock the job properties if not running ISF. if not simFlags.ISFRun: jobproperties.lock_JobProperties() AtlasG4Eng.G4Eng.log.verbose( 'AtlasSimSkeleton._do_jobproperties :: done')