14 from AthenaCommon.Logging
import logging
15 log = logging.getLogger(
'Sim_tf')
16 log.info(
'****************** STARTING Simulation *****************')
18 log.info(
'**** Transformation run arguments')
19 log.info(
str(runArgs))
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
30 from AthenaConfiguration.Enums
import ProductionStep
31 flags.Common.ProductionStep = ProductionStep.Simulation
34 if hasattr(runArgs,
'simulator'):
35 flags.Sim.ISF.Simulator = SimulationFlavour(runArgs.simulator)
38 flags.Sim.ISFRun =
True
41 from SimuJobTransforms.SimulationHelpers
import getDetectorsFromRunArgs
45 if hasattr(runArgs,
'beamType'):
46 if runArgs.beamType ==
'cosmics':
47 flags.Beam.Type = BeamType.Cosmics
48 flags.Sim.CavernBackground = CavernBackground.Off
56 if hasattr(runArgs,
'inputEVNTFile'):
57 flags.Input.Files = runArgs.inputEVNTFile
58 elif hasattr(runArgs,
'inputEVNT_TRFile'):
59 flags.Input.Files = runArgs.inputEVNT_TRFile
64 if flags.Beam.Type
is BeamType.Cosmics:
65 flags.Sim.ReadTR =
True
66 flags.Sim.CosmicFilterVolumeNames = [
'Muon']
67 detectors.add(
'Cavern')
68 elif hasattr(runArgs,
"trackRecordType")
and runArgs.trackRecordType==
"stopped":
69 flags.Sim.ReadTR =
True
70 log.error(
'Stopped Particle simulation is not supported yet')
72 detectors.add(
'Cavern')
73 flags.Sim.CavernBackground = CavernBackground.Read
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')
86 log.debug(
'No inputEVNTFile provided. OK, as performing cosmics simulation.')
88 if hasattr(runArgs,
'outputHITSFile'):
89 if runArgs.outputHITSFile ==
'None':
90 flags.Output.HITSFileName =
''
92 flags.Output.HITSFileName = runArgs.outputHITSFile
93 if hasattr(runArgs,
"outputEVNT_TRFile"):
98 flags.Output.EVNT_TRFileName = runArgs.outputEVNT_TRFile
99 if hasattr(runArgs,
"trackRecordType")
and runArgs.trackRecordType==
"stopped":
101 log.error(
'Stopped Particle simulation not supported yet!')
102 elif flags.Beam.Type
is BeamType.Cosmics:
107 detectors.add(
'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')
114 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
118 from PerfMonComps.PerfMonConfigHelpers
import setPerfmonFlagsFromRunArgs
131 from SimulationConfig.SimConfigFlags
import simulationRunArgsToFlags
151 from AthenaConfiguration.Utils
import setupLoggingLevels
155 from PyUtils.AMITagHelperConfig
import AMITagCfg
162 log.info(
"Run ISF simulation in " +
str(time.time()-tic) +
" seconds")
164 sys.exit(
not sc.isSuccess())