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 flags.IOVDb.UseCREST = False
45
46
47 processPreInclude(runArgs, flags)
48
49
50 processPreExec(runArgs, flags)
51
52
53 flags.fillFromArgs()
54
55
56 flags.lock()
57
58 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
59 cfg = MainServicesCfg(flags)
60
61 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
62 cfg.merge(PoolReadCfg(flags))
63
64
65
66 if ('EventInfo' not in flags.Input.Collections and
67 'McEventInfo' in flags.Input.Collections):
68 from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
69 cfg.merge(EventInfoCnvAlgCfg(flags, disableBeamSpot = True))
70
71 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
72 cfg.merge(OutputStreamCfg(flags, "EVNT", disableEventTag = True, takeItemsFromInput = True, extendProvenanceRecord = False))
73
74
75 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
76
77 cfg.merge(
78 SetupMetaDataForStreamCfg(
79 flags,
80 "EVNT",
81 disableEventTag=True,
82 createMetadata=[MetadataCategory.IOVMetaData],
83 )
84 )
85
86
87 processPostInclude(runArgs, flags, cfg)
88
89
90 processPostExec(runArgs, flags, cfg)
91
92
93 from PyUtils.AMITagHelperConfig import AMITagCfg
94 cfg.merge(AMITagCfg(flags, runArgs))
95
96
97 from AthenaConfiguration.AutoConfigFlags import GetFileMD
98 hepmc_version = GetFileMD(flags.Input.Files).
get(
"hepmc_version",
None)
99 if hepmc_version is not None:
100 if hepmc_version == "2":
101 hepmc_version = "HepMC2"
102 elif hepmc_version == "3":
103 hepmc_version = "HepMC3"
104 log.info("Input file was produced with %s", hepmc_version)
105 from EventInfoMgt.TagInfoMgrConfig import TagInfoMgrCfg
106 cfg.merge(TagInfoMgrCfg(flags, tagValuePairs={"hepmc_version": hepmc_version}))
107
108 import time
109 tic = time.time()
110
111 sc = cfg.run()
112 log.info("Ran EVNTMerge_tf in " + str(time.time()-tic) + " seconds")
113
114 sys.exit(not sc.isSuccess())
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)