13 from AthenaCommon.Logging
import logging
14 log = logging.getLogger(
"EVNTMerge")
15 log.info(
"****************** STARTING EVNT MERGING *****************")
17 log.info(
"**** Transformation run arguments")
18 log.info(
str(runArgs))
20 log.info(
"**** Setting-up configuration flags")
21 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
24 from AthenaConfiguration.Enums
import ProductionStep, MetadataCategory
25 flags.Common.ProductionStep = ProductionStep.Generation
29 if hasattr(runArgs,
"inputEVNTFile"):
30 flags.Input.Files = runArgs.inputEVNTFile
32 raise RuntimeError(
"No input EVNT file defined")
34 if hasattr(runArgs,
"outputEVNT_MRGFile"):
35 if runArgs.outputEVNT_MRGFile ==
"None":
36 flags.Output.EVNTFileName =
""
39 flags.Output.EVNTFileName = runArgs.outputEVNT_MRGFile
41 raise RuntimeError(
"No outputEVNT_MRGFile defined")
55 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
58 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
61 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
62 cfg.merge(
OutputStreamCfg(flags,
"EVNT", disableEventTag =
True, takeItemsFromInput =
True, extendProvenanceRecord =
False))
65 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
70 MetadataCategory.IOVMetaData,
81 from PyUtils.AMITagHelperConfig
import AMITagCfg
85 from AthenaConfiguration.AutoConfigFlags
import GetFileMD
86 hepmc_version =
GetFileMD(flags.Input.Files).
get(
"hepmc_version",
None)
87 if hepmc_version
is not None:
88 if hepmc_version ==
"2":
89 hepmc_version =
"HepMC2"
90 elif hepmc_version ==
"3":
91 hepmc_version =
"HepMC3"
92 log.info(
"Input file was produced with %s", hepmc_version)
93 from EventInfoMgt.TagInfoMgrConfig
import TagInfoMgrCfg
94 cfg.merge(
TagInfoMgrCfg(flags, tagValuePairs={
"hepmc_version": hepmc_version}))
100 log.info(
"Ran EVNTMerge_tf in " +
str(time.time()-tic) +
" seconds")
102 sys.exit(
not sc.isSuccess())