ATLAS Offline Software
Functions | Variables
python.ISF_Skeleton Namespace Reference

Functions

def fromRunArgs (runArgs)
 

Variables

 jobPropertiesDisallowed
 

Function Documentation

◆ fromRunArgs()

def python.ISF_Skeleton.fromRunArgs (   runArgs)

Definition at line 13 of file ISF_Skeleton.py.

13 def fromRunArgs(runArgs):
14  from AthenaCommon.Logging import logging
15  log = logging.getLogger('Sim_tf')
16  log.info('****************** STARTING Simulation *****************')
17 
18  log.info('**** Transformation run arguments')
19  log.info(str(runArgs))
20 
21  log.info('**** Setting-up configuration flags')
22  from AthenaConfiguration.AllConfigFlags import initConfigFlags
23  from AthenaConfiguration.Enums import BeamType
24  from SimulationConfig.SimEnums import CalibrationRun, CavernBackground, SimulationFlavour
25  flags = initConfigFlags()
26 
27  commonRunArgsToFlags(runArgs, flags)
28 
29  # Set ProductionStep
30  from AthenaConfiguration.Enums import ProductionStep
31  flags.Common.ProductionStep = ProductionStep.Simulation
32 
33  # Set the simulator
34  if hasattr(runArgs, 'simulator'):
35  flags.Sim.ISF.Simulator = SimulationFlavour(runArgs.simulator)
36 
37  # This is ISF
38  flags.Sim.ISFRun = True
39 
40  # Generate detector list
41  from SimuJobTransforms.SimulationHelpers import getDetectorsFromRunArgs
42  detectors = getDetectorsFromRunArgs(flags, runArgs)
43 
44  # Beam Type
45  if hasattr(runArgs,'beamType'):
46  if runArgs.beamType == 'cosmics':
47  flags.Beam.Type = BeamType.Cosmics
48  flags.Sim.CavernBackground = CavernBackground.Off
49 
50  # Setup input: Three possible cases:
51  # 1) inputEVNTFile (normal)
52  # 2) inputEVNT_TRFile (TrackRecords from pre-simulated events,
53  # used with TrackRecordGenerator)
54  # 3) no input file (on-the-fly generation - typically ParticleGun
55  # or CosmicGenerator)
56  if hasattr(runArgs, 'inputEVNTFile'):
57  flags.Input.Files = runArgs.inputEVNTFile
58  elif hasattr(runArgs, 'inputEVNT_TRFile'):
59  flags.Input.Files = runArgs.inputEVNT_TRFile
60  # Three common cases here:
61  # 2a) Cosmics simulation
62  # 2b) Stopped particle simulation
63  # 2c) Cavern background simulation
64  if flags.Beam.Type is BeamType.Cosmics:
65  flags.Sim.ReadTR = True
66  flags.Sim.CosmicFilterVolumeNames = ['Muon']
67  detectors.add('Cavern') # simulate the cavern with a cosmic TR file
68  elif hasattr(runArgs,"trackRecordType") and runArgs.trackRecordType=="stopped":
69  flags.Sim.ReadTR = True
70  log.error('Stopped Particle simulation is not supported yet')
71  else:
72  detectors.add('Cavern') # simulate the cavern
73  flags.Sim.CavernBackground = CavernBackground.Read
74  else:
75  # Common cases
76  # 3a) ParticleGun
77  # 3b) CosmicGenerator
78  flags.Input.Files = []
79  flags.Input.isMC = True
80  log.info('No inputEVNTFile provided. Assuming that you are running a generator on the fly.')
81  if flags.Beam.Type is BeamType.Cosmics:
82  flags.Sim.CosmicFilterVolumeNames = [getattr(runArgs, "CosmicFilterVolume", "InnerDetector")]
83  flags.Sim.CosmicFilterVolumeNames += [getattr(runArgs, "CosmicFilterVolume2", "NONE")]
84  flags.Sim.CosmicPtSlice = getattr(runArgs, "CosmicPtSlice", 'NONE')
85  detectors.add('Cavern') # simulate the cavern when generating cosmics on-the-fly
86  log.debug('No inputEVNTFile provided. OK, as performing cosmics simulation.')
87 
88  if hasattr(runArgs, 'outputHITSFile'):
89  if runArgs.outputHITSFile == 'None':
90  flags.Output.HITSFileName = ''
91  else:
92  flags.Output.HITSFileName = runArgs.outputHITSFile
93  if hasattr(runArgs, "outputEVNT_TRFile"):
94  # Three common cases
95  # 1b) Write TrackRecords for Cavern background
96  # 1c) Write TrackRecords for Stopped particles
97  # 3b) CosmicGenerator
98  flags.Output.EVNT_TRFileName = runArgs.outputEVNT_TRFile
99  if hasattr(runArgs,"trackRecordType") and runArgs.trackRecordType=="stopped":
100  # Case 1c)
101  log.error('Stopped Particle simulation not supported yet!')
102  elif flags.Beam.Type is BeamType.Cosmics:
103  # Case 3b)
104  pass
105  else:
106  #Case 1b) Cavern Background
107  detectors.add('Cavern') # simulate the cavern
108  flags.Sim.CalibrationRun = CalibrationRun.Off
109  flags.Sim.CavernBackground = CavernBackground.Write
110  if not (hasattr(runArgs, 'outputHITSFile') or hasattr(runArgs, "outputEVNT_TRFile")):
111  log.warning('No outputHITSFile or outputEVNT_TRFile defined')
112 
113  # Setup detector flags
114  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
115  setupDetectorFlags(flags, detectors, toggle_geometry=True)
116 
117  # Setup perfmon flags from runargs
118  from PerfMonComps.PerfMonConfigHelpers import setPerfmonFlagsFromRunArgs
119  setPerfmonFlagsFromRunArgs(flags, runArgs)
120 
121  # Pre-include
122  processPreInclude(runArgs, flags)
123 
124  # Special Configuration preInclude
126 
127  # Pre-exec
128  processPreExec(runArgs, flags)
129 
130  # Common simulation runtime arguments
131  from SimulationConfig.SimConfigFlags import simulationRunArgsToFlags
132  simulationRunArgsToFlags(runArgs, flags)
133 
134  # To respect --athenaopts
135  flags.fillFromArgs()
136 
137  # Lock flags
138  flags.lock()
139 
140  cfg = CommonSimulationCfg(flags, log)
141 
142  # Special Configuration postInclude
143  specialConfigPostInclude(flags, cfg)
144 
145  # Post-include
146  processPostInclude(runArgs, flags, cfg)
147 
148  # Post-exec
149  processPostExec(runArgs, flags, cfg)
150 
151  from AthenaConfiguration.Utils import setupLoggingLevels
152  setupLoggingLevels(flags, cfg)
153 
154  # Write AMI tag into in-file metadata
155  from PyUtils.AMITagHelperConfig import AMITagCfg
156  cfg.merge(AMITagCfg(flags, runArgs))
157 
158  import time
159  tic = time.time()
160  # Run the final accumulator
161  sc = cfg.run()
162  log.info("Run ISF simulation in " + str(time.time()-tic) + " seconds")
163 
164  sys.exit(not sc.isSuccess())

Variable Documentation

◆ jobPropertiesDisallowed

python.ISF_Skeleton.jobPropertiesDisallowed

Definition at line 10 of file ISF_Skeleton.py.

python.TransformUtils.processPreExec
def processPreExec(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:41
python.TransformUtils.processPostExec
def processPostExec(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:50
python.CommonSimulationSteering.CommonSimulationCfg
def CommonSimulationCfg(flags, log)
Definition: CommonSimulationSteering.py:35
python.TransformUtils.processPostInclude
def processPostInclude(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:69
python.TransformUtils.processPreInclude
def processPreInclude(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:62
python.Utils.setupLoggingLevels
def setupLoggingLevels(flags, ca)
Definition: Control/AthenaConfiguration/python/Utils.py:46
python.CommonSimulationSteering.specialConfigPostInclude
def specialConfigPostInclude(flags, cfg)
Definition: CommonSimulationSteering.py:29
python.PerfMonConfigHelpers.setPerfmonFlagsFromRunArgs
def setPerfmonFlagsFromRunArgs(flags, runArgs)
Definition: PerfMonConfigHelpers.py:3
python.CommonRunArgsToFlags.commonRunArgsToFlags
def commonRunArgsToFlags(runArgs, configFlags)
Definition: CommonRunArgsToFlags.py:12
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:289
python.SimConfigFlags.simulationRunArgsToFlags
def simulationRunArgsToFlags(runArgs, flags)
Definition: SimConfigFlags.py:267
python.CommonSimulationSteering.specialConfigPreInclude
def specialConfigPreInclude(flags)
Definition: CommonSimulationSteering.py:23
python.AMITagHelperConfig.AMITagCfg
def AMITagCfg(flags, runArgs=None, fixBroken=False)
Definition: AMITagHelperConfig.py:77
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
str
Definition: BTagTrackIpAccessor.cxx:11
python.SimulationHelpers.getDetectorsFromRunArgs
def getDetectorsFromRunArgs(flags, runArgs)
Definition: SimulationHelpers.py:5
python.ISF_Skeleton.fromRunArgs
def fromRunArgs(runArgs)
Definition: ISF_Skeleton.py:13