5 versionRegex = re.compile(
r'\(v\.(.*)\)$')
7 ignoredGenerators = [
"Pythia8B",
"Powheg"]
11 from pathlib
import Path
12 from PathResolver
import PathResolver
15 with filePath.open()
as f:
16 header = f.readline().strip().
split(
",")
17 generators = header[2:]
19 line = line.strip().
split(
",")
20 item = {generator: version
for generator, version
in zip(generators, line[2:])}
21 item[
'version'] = line[0]
27 for generator
in generators:
28 env_variable = f
"{generator.upper()}VER"
29 output[generator] =
getenv(env_variable,
None)
34 metadataStringSplit = metadataString.split(
"+")
35 for s
in metadataStringSplit:
36 match = versionRegex.search(s)
38 s = s.replace(match.group(0),
"")
39 output[s] = match.group(1)
46 for generator, version
in generatorsDictionary.items():
47 if version
is not None:
48 list.append(f
"{generator}(v.{version})")
50 list.append(generator)
54 return "+".
join(generatorsVersionedList)
58 from AthenaCommon.Logging
import logging
59 log = logging.getLogger(
"GeneratorsInfo")
60 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
62 generatorsData = flags.Input.GeneratorsInfo
63 log.info(f
"Generators data: {generatorsData}")
65 missingVersion =
False
66 for k, v
in generatorsData.items():
67 if v
is None and k
not in ignoredGenerators:
70 if not missingVersion:
73 log.info(
"At least one MC generator is missing version information. Attempting to fix...")
75 from PyUtils.AMITagHelperConfig
import inputAMITags
78 if tags
and tags[0].startswith(
"e"):
82 if tag
not in releaseDataDict:
83 log.warning(f
"Could not find release data for tag {tag}.")
86 releaseData = releaseDataDict[tag]
87 for k, v
in generatorsData.items():
88 if v
is None and k
not in ignoredGenerators
and k
in releaseData:
89 log.info(f
"Setting version for {k} to {releaseData[k]}.")
90 generatorsData[k] = releaseData[k]
94 from EventInfoMgt.TagInfoMgrConfig
import TagInfoMgrCfg