|
ATLAS Offline Software
|
◆ checkBlackList()
def python.GENtoEVGEN_Skeleton.checkBlackList |
( |
|
cache, |
|
|
|
generatorName, |
|
|
|
checkType |
|
) |
| |
Definition at line 120 of file GENtoEVGEN_Skeleton.py.
122 fileName =
"BlackList_caches.txt" if checkType ==
"black" else "PurpleList_generators.txt"
123 with open(f
"/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/common/{fileName}")
as bfile:
124 for line
in bfile.readlines():
128 badCache=line.split(
',')[1].strip()
130 badGens=line.split(
',')[2].strip()
132 used_gens =
','.
join(generatorName)
134 if cache==badCache
and re.search(badGens,used_gens)
is not None:
135 if badGens==
"": badGens=
"all generators"
136 isError=f
"{cache} is {checkType}-listed for {badGens}"
◆ fromRunArgs()
def python.GENtoEVGEN_Skeleton.fromRunArgs |
( |
|
runArgs | ) |
|
Definition at line 142 of file GENtoEVGEN_Skeleton.py.
145 evgenLog.info(
"using release [%(project name)s-%(release)s] [%(platform)s] [%(nightly name)s/%(nightly release)s] -- built on [%(date)s]", d)
146 athenaRel = d[
"release"]
148 evgenLog.info(
"****************** STARTING EVENT GENERATION *****************")
150 evgenLog.info(
"**** Transformation run arguments")
151 evgenLog.info(runArgs)
153 evgenLog.info(
"**** Setting-up configuration flags")
155 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
158 from AthenaConfiguration.Enums
import ProductionStep
159 flags.Common.ProductionStep = ProductionStep.Generation
162 from PyJobTransforms.CommonRunArgsToFlags
import commonRunArgsToFlags
166 from GeneratorConfig.GeneratorConfigFlags
import generatorRunArgsToFlags
176 from GeneratorConfig.GenConfigHelpers
import gen_sortkey, gen_lhef
177 generatorNames =
sorted(sample.generators, key=gen_sortkey)
182 if blError
is not None:
183 raise RuntimeError(blError)
184 if plError
is not None:
185 evgenLog.warning(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
186 evgenLog.warning(f
"!!! WARNING {plError} !!!")
187 evgenLog.warning(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
190 flags.Exec.FirstEvent = runArgs.firstEvent
191 flags.Exec.MaxEvents = runArgs.maxEvents
if runArgs.maxEvents != -1
else flags.Generator.nEventsPerJob
193 flags.Input.Files = []
194 flags.Input.RunNumbers = [flags.Generator.DSID]
195 flags.Input.TimeStamps = [0]
197 flags.Output.EVNTFileName = runArgs.outputEVNTFile
199 flags.Beam.Energy = runArgs.ecmEnergy / 2 * GeV
201 flags.PerfMon.doFastMonMT =
True
202 flags.PerfMon.doFullMonMT =
True
213 evgenLog.info(
"**** Configuration flags")
217 flags.dump(
"Generator.*")
220 evgenLog.info(
".transform = Gen_tf")
221 evgenLog.info(
".platform = " +
str(os.environ[
"BINARY_TAG"]))
224 evgenLog.info(
"**** Configuring event generation")
227 from AthenaConfiguration.MainServicesConfig
import MainEvgenServicesCfg
231 from xAODEventInfoCnv.xAODEventInfoCnvConfig
import EventInfoCnvAlgCfg
233 sequenceName=EvgenSequence.Generator.value)
236 cfg.merge(sample.setupProcess(flags))
241 from EvgenProdTools.EvgenProdToolsConfig
import FixHepMCCfg
245 from GeneratorConfig.GenConfigHelpers
import gens_testhepmc
247 from EvgenProdTools.EvgenProdToolsConfig
import TestHepMCCfg
251 from EvgenProdTools.EvgenProdToolsConfig
import CopyEventWeightCfg
254 from EvgenProdTools.EvgenProdToolsConfig
import FillFilterValuesCfg
258 from EvgenProdTools.EvgenProdToolsConfig
import CountHepMCCfg
260 RequestedOutput = sample.nEventsPerJob
if runArgs.maxEvents == -1
261 else runArgs.maxEvents))
262 evgenLog.info(
"Requested output events = %s",
str(cfg.getEventAlgo(
"CountHepMC").RequestedOutput))
265 if hasattr(runArgs,
"printEvts")
and runArgs.printEvts > 0:
266 from TruthIO.TruthIOConfig
import PrintMCCfg
268 LastEvent=runArgs.printEvts))
271 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
272 cfg.merge(
PerfMonMTSvcCfg(flags), sequenceName=EvgenSequence.Post.value)
275 from EvgenProdTools.EvgenProdToolsConfig
import SimTimeEstimateCfg
281 from GeneratorConfig.Versioning
import generatorsGetInitialVersionedDictionary, generatorsVersionedStringList
287 from EventInfoMgt.TagInfoMgrConfig
import TagInfoMgrCfg
289 "project_name":
"IS_SIMULATION",
290 f
"AtlasRelease_{runArgs.trfSubstepName}": flags.Input.Release
or "n/a",
291 "beam_energy":
str(
int(flags.Beam.Energy)),
292 "beam_type": flags.Beam.Type.value,
293 "generators":
'+'.
join(generatorList),
294 "hepmc_version": f
"HepMC{os.environ['HEPMCVER']}",
295 "keywords":
", ".
join(sample.keywords).lower(),
296 "lhefGenerator":
'+'.
join(
filter(gen_lhef, generatorNames)),
297 "mc_channel_number":
str(flags.Generator.DSID),
299 if hasattr(sample,
"process"): metadata.update({
"evgenProcess": sample.process})
300 if hasattr(sample,
"tune"): metadata.update({
"evgenTune": sample.tune})
301 if hasattr(sample,
"specialConfig"): metadata.update({
"specialConfiguration": sample.specialConfig})
302 if hasattr(sample,
"hardPDF"): metadata.update({
"hardPDF": sample.hardPDF})
303 if hasattr(sample,
"softPDF"): metadata.update({
"softPDF": sample.softPDF})
304 if hasattr(sample,
"randomSeed"): metadata.update({
"randomSeed":
str(runArgs.randomSeed)})
308 evgenLog.info(
"HepMC version %s", os.environ[
"HEPMCVER"])
311 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
315 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
325 from PyUtils.AMITagHelperConfig
import AMITagCfg
329 cfg.printConfig(prefix=
"Gen_tf", printSequenceTreeOnly=
not runArgs.VERBOSE)
332 sys.exit(
not cfg.run().isSuccess())
◆ setupSample()
def python.GENtoEVGEN_Skeleton.setupSample |
( |
|
runArgs, |
|
|
|
flags |
|
) |
| |
Definition at line 25 of file GENtoEVGEN_Skeleton.py.
27 if len(runArgs.jobConfig) != 1:
28 raise RuntimeError(
"You must supply one and only one jobConfig file argument")
30 evgenLog.info(
"Using JOBOPTSEARCHPATH (as seen in skeleton) = {}".
format(os.environ[
"JOBOPTSEARCHPATH"]))
32 FIRST_DIR = (os.environ[
"JOBOPTSEARCHPATH"]).
split(
":")[0]
35 jofiles = [f
for f
in os.listdir(FIRST_DIR)
if (f.startswith(
"mc")
and f.endswith(
".py"))]
37 raise RuntimeError(
"You must supply one and only one jobOption file in DSID directory")
41 from GeneratorConfig.GenConfigHelpers
import checkJOConsistency, checkNEventsPerJob, checkKeywords, checkCategories
49 spec = importlib.util.spec_from_file_location(
51 location=os.path.join(FIRST_DIR,jofile),
53 jo = importlib.util.module_from_spec(spec)
54 spec.loader.exec_module(jo)
55 evgenLog.info(
"including file %s", jofile)
58 sample = jo.Sample(flags)
61 sample.setupFlags(flags)
67 dsid = os.path.basename(runArgs.jobConfig[0])
68 if dsid.startswith(
"Test"):
69 dsid = dsid.split(
"Test")[-1]
73 flags.Generator.DSID =
int(dsid)
76 if not sample.nEventsPerJob:
77 evgenLog.info(
"#############################################################")
78 evgenLog.info(
" !!!! no sample.nEventsPerJob set !!! The default 10000 used. !!! ")
79 evgenLog.info(
"#############################################################")
82 evgenLog.info(
" nEventsPerJob = " +
str(sample.nEventsPerJob))
83 flags.Generator.nEventsPerJob = sample.nEventsPerJob
86 for var, value
in vars(sample).
items():
88 raise RuntimeError(
"self.{} should be set in Sample(EvgenConfig)".
format(var))
90 if var ==
"generators":
91 from GeneratorConfig.Versioning
import generatorsGetInitialVersionedDictionary, generatorsVersionedStringList
92 from GeneratorConfig.GenConfigHelpers
import gen_sortkey
93 gennames =
sorted(sample.generators, key=gen_sortkey)
96 evgenLog.info(
"MetaData: generatorName = {}".
format(gennamesvers))
98 evgenLog.info(
"MetaData: {} = {}".
format(var, value))
101 if len(sample.generators) > len(
set(sample.generators)):
102 raise RuntimeError(
"Duplicate entries in generators: invalid configuration, please check your JO")
103 from GeneratorConfig.GenConfigHelpers
import gen_require_steering
105 if hasattr(runArgs,
"outputEVNTFile")
and not hasattr(runArgs,
"outputEVNT_PreFile"):
106 raise RuntimeError(
"'EvtGen' found in job options name, please set '--steering=afterburn'")
109 if hasattr(sample,
"keywords"):
113 if hasattr(sample,
"categories"):
◆ evgenLog
python.GENtoEVGEN_Skeleton.evgenLog = logging.getLogger("Gen_tf") |
◆ jobPropertiesDisallowed
python.GENtoEVGEN_Skeleton.jobPropertiesDisallowed |
def checkBlackList(cache, generatorName, checkType)
def gens_testhepmc(gennames)
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
def PrintMCCfg(flags, name="PrintMC", **kwargs)
def setupSample(runArgs, flags)
def generatorRunArgsToFlags(runArgs, flags)
def checkJOConsistency(jofile)
def PerfMonMTSvcCfg(flags, **kwargs)
A minimal new-style configuration for PerfMonMTSvc.
def TagInfoMgrCfg(flags, tagValuePairs={})
def MainEvgenServicesCfg(flags, LoopMgr="AthenaEventLoopMgr", withSequences=True)
def checkNEventsPerJob(sample)
def gen_require_steering(gennames)
def commonRunArgsToFlags(runArgs, configFlags)
def generatorsGetInitialVersionedDictionary(generators)
def checkKeywords(sample, evgenLog, officialJO)
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
std::string join(const std::vector< std::string > &v, const char c=',')
def generatorsVersionedStringList(generatorsDictionary)
def AMITagCfg(flags, runArgs=None, fixBroken=False)
def checkCategories(sample, evgenLog, officialJO)
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)