12def fromRunArgs(runArgs):
13 from AthenaCommon.Logging import logging
14 log = logging.getLogger("EVNTMerge")
15 log.info("****************** STARTING EVNT MERGING *****************")
16
17 log.info("**** Transformation run arguments")
18 log.info(str(runArgs))
19
20 log.info("**** Setting-up configuration flags")
21 from AthenaConfiguration.AllConfigFlags import initConfigFlags
22 flags = initConfigFlags()
23
24 from AthenaConfiguration.Enums import ProductionStep, MetadataCategory
25 flags.Common.ProductionStep = ProductionStep.Generation
26
27 commonRunArgsToFlags(runArgs, flags)
28
29 if hasattr(runArgs, "inputEVNTFile"):
30 flags.Input.Files = runArgs.inputEVNTFile
31 else:
32 raise RuntimeError("No input EVNT file defined")
33
34 if hasattr(runArgs, "outputEVNT_MRGFile"):
35 if runArgs.outputEVNT_MRGFile == "None":
36 flags.Output.EVNTFileName = ""
37
38 else:
39 flags.Output.EVNTFileName = runArgs.outputEVNT_MRGFile
40 else:
41 raise RuntimeError("No outputEVNT_MRGFile defined")
42
43
44 processPreInclude(runArgs, flags)
45
46
47 processPreExec(runArgs, flags)
48
49
50 flags.fillFromArgs()
51
52
53 flags.lock()
54
55 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
56 cfg = MainServicesCfg(flags)
57
58 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
59 cfg.merge(PoolReadCfg(flags))
60
61 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
62 cfg.merge(OutputStreamCfg(flags, "EVNT", disableEventTag = True, takeItemsFromInput = True, extendProvenanceRecord = False))
63
64
65 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
66
67 cfg.merge(
68 SetupMetaDataForStreamCfg(
69 flags,
70 "EVNT",
71 disableEventTag=True,
72 createMetadata=[MetadataCategory.IOVMetaData],
73 )
74 )
75
76
77 processPostInclude(runArgs, flags, cfg)
78
79
80 processPostExec(runArgs, flags, cfg)
81
82
83 from PyUtils.AMITagHelperConfig import AMITagCfg
84 cfg.merge(AMITagCfg(flags, runArgs))
85
86
87 from AthenaConfiguration.AutoConfigFlags import GetFileMD
88 hepmc_version = GetFileMD(flags.Input.Files).
get(
"hepmc_version",
None)
89 if hepmc_version is not None:
90 if hepmc_version == "2":
91 hepmc_version = "HepMC2"
92 elif hepmc_version == "3":
93 hepmc_version = "HepMC3"
94 log.info("Input file was produced with %s", hepmc_version)
95 from EventInfoMgt.TagInfoMgrConfig import TagInfoMgrCfg
96 cfg.merge(TagInfoMgrCfg(flags, tagValuePairs={"hepmc_version": hepmc_version}))
97
98 import time
99 tic = time.time()
100
101 sc = cfg.run()
102 log.info("Ran EVNTMerge_tf in " + str(time.time()-tic) + " seconds")
103
104 sys.exit(not sc.isSuccess())
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)