5 from AthenaConfiguration.AutoConfigFlags
import GetFileMD
6 from AthenaConfiguration.Enums
import ProductionStep
7 from PyJobTransforms.CommonRunArgsToFlags
import commonRunArgsToFlags
8 from PyJobTransforms.TransformUtils
import processPreExec, processPreInclude, processPostExec, processPostInclude
9 from SimuJobTransforms.CommonSimulationSteering
import specialConfigPreInclude, specialConfigPostInclude
12 from AthenaCommon
import JobProperties
13 JobProperties.jobPropertiesDisallowed =
True
17 hasRDO_BKGInput = hasattr(runArgs,
'inputRDO_BKGFile')
18 hasBS_SKIMInput = hasattr(runArgs,
'inputBS_SKIMFile')
19 hasEVNT_Input = hasattr(runArgs,
'inputEVNTFile')
21 if flags.Common.ProductionStep == ProductionStep.Overlay
and not hasattr(runArgs,
'inputHITSFile'):
22 raise RuntimeError(
'No input HITS file defined')
24 if hasRDO_BKGInput
and hasBS_SKIMInput:
25 raise RuntimeError(
'Both RDO_BKG and BS_SKIM are defined')
26 if not hasRDO_BKGInput
and not hasBS_SKIMInput:
27 raise RuntimeError(
'Define one of RDO_BKG and BS_SKIM file types')
29 if hasattr(runArgs,
'skipSecondaryEvents'):
30 flags.Overlay.SkipSecondaryEvents = runArgs.skipSecondaryEvents
33 log.info(
'Running MC+MC overlay')
34 flags.Overlay.DataOverlay =
False
35 flags.Input.isMC =
True
36 flags.Input.Files = runArgs.inputRDO_BKGFile
37 if flags.Common.ProductionStep == ProductionStep.Overlay:
38 flags.Input.SecondaryFiles = runArgs.inputHITSFile
39 elif flags.Common.ProductionStep == ProductionStep.FastChain:
41 raise RuntimeError(
'No input EVNT file defined')
43 flags.Input.SecondaryFiles = runArgs.inputEVNTFile
45 raise RuntimeError(
'No secondaryFiles are defined')
48 flags.Input.MCChannelNumber =
GetFileMD(flags.Input.SecondaryFiles, allowEmpty=
False).
get(
"mc_channel_number", 0)
51 if hasattr(runArgs,
'runNumber'):
52 if flags.Input.MCChannelNumber != runArgs.runNumber:
53 log.warning(
'Got different MC channel number (%d) from runNumber than from metadata (%d)', runArgs.runNumber, flags.Input.MCChannelNumber)
54 flags.Input.MCChannelNumber = runArgs.runNumber
56 log.info(
'MC channel number: %d', flags.Input.MCChannelNumber)
58 log.info(
'Running MC+data overlay')
59 flags.Overlay.DataOverlay =
True
60 flags.Input.isMC =
False
61 flags.Input.Files = runArgs.inputHITSFile
62 flags.Input.SecondaryFiles = runArgs.inputBS_SKIMFile
66 from AthenaCommon.Logging
import logging
67 logOverlay = logging.getLogger(
'Overlay')
68 logOverlay.info(
'****************** STARTING OVERLAY *****************')
70 logOverlay.info(
'**** Transformation run arguments')
71 logOverlay.info(
str(runArgs))
73 logOverlay.info(
'**** Setting-up configuration flags')
74 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
79 flags.Common.ProductionStep = ProductionStep.Overlay
85 if hasattr(runArgs,
'outputRDOFile'):
86 if runArgs.outputRDOFile ==
'None':
87 flags.Output.RDOFileName =
''
89 flags.Output.RDOFileName = runArgs.outputRDOFile
91 raise RuntimeError(
'No output RDO file defined')
93 if hasattr(runArgs,
'outputRDO_SGNLFile'):
94 flags.Output.RDO_SGNLFileName = runArgs.outputRDO_SGNLFile
97 if hasattr(runArgs,
'detectors'):
98 detectors = runArgs.detectors
103 from DigitizationConfig.DigitizationConfigFlags
import digitizationRunArgsToFlags
107 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
111 if hasattr(runArgs,
'triggerConfig')
and runArgs.triggerConfig ==
'NONE':
112 flags.Detector.EnableL1Calo =
False
115 from PerfMonComps.PerfMonConfigHelpers
import setPerfmonFlagsFromRunArgs
132 from OverlayConfiguration.OverlayMetadata
import overlayMetadataCheck
140 from OverlayConfiguration.OverlaySteering
import OverlayMainCfg
144 from DigitizationConfig.DigitizationSteering
import DigitizationMessageSvcCfg
157 from PyUtils.AMITagHelperConfig
import AMITagCfg
162 sys.exit(
not sc.isSuccess())