12def fromRunArgs(runArgs):
13
14 from AthenaCommon.Logging import logging
15 log = logging.getLogger('AODtoHIST')
16 log.info('****************** STARTING AOD->HIST MAKING *****************')
17
18 log.info('**** Transformation run arguments')
19 log.info(str(runArgs))
20
21 import time
22 timeStart = time.time()
23
24
25 from AthenaConfiguration.AllConfigFlags import initConfigFlags
26 flags = initConfigFlags()
27 from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
28 commonRunArgsToFlags(runArgs, flags)
29 from RecJobTransforms.RecoConfigFlags import recoRunArgsToFlags
30 recoRunArgsToFlags(runArgs, flags)
31
32
33 if hasattr(runArgs, 'inputAODFile'):
34 flags.Input.Files = runArgs.inputAODFile
35
36
37 if hasattr(runArgs, 'outputHIST_AODFile'):
38 flags.Output.HISTFileName = runArgs.outputHIST_AODFile
39 log.info("---------- Configured HIST_AOD output")
40 if hasattr(runArgs, 'outputHISTFile'):
41 flags.Output.HISTFileName = runArgs.outputHISTFile
42 log.info("---------- Configured HIST output")
43
44
45
46
47 if hasattr(runArgs, 'detectors'):
48 detectors = runArgs.detectors
49 else:
50 detectors = None
51
52 from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
53 setupDetectorFlags(flags, detectors, use_metadata=True, toggle_geometry=True, keep_beampipe=True)
54
55 processPreInclude(runArgs, flags)
56 processPreExec(runArgs, flags)
57
58
59 flags.fillFromArgs()
60 flags.lock()
61
62
63 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
64 cfg = MainServicesCfg(flags)
65
66 cfg.flagPerfmonDomain('IO')
67 from AthenaConfiguration.Enums import Format
68 if flags.Input.Format is Format.BS:
69 from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
70 cfg.merge(ByteStreamReadCfg(flags))
71 log.info("---------- Configured BS reading")
72 else:
73 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
74 cfg.merge(PoolReadCfg(flags))
75
76 if "EventInfo" not in flags.Input.Collections:
77 from xAODEventInfoCnv.xAODEventInfoCnvConfig import (
78 EventInfoCnvAlgCfg)
79 cfg.merge(EventInfoCnvAlgCfg(flags))
80 log.info("---------- Configured POOL reading")
81
82 from AthenaMonitoring.AthenaMonitoringCfg import AthenaMonitoringCfg, AthenaMonitoringPostprocessingCfg
83 cfg.merge(AthenaMonitoringCfg(flags))
84 cfg.merge(AthenaMonitoringPostprocessingCfg(flags))
85
86 processPostInclude(runArgs, flags, cfg)
87 processPostExec(runArgs, flags, cfg)
88
89
90 sc = cfg.run()
91 timeFinal = time.time()
92 log.info("Run AODtoHIST_Skeleton in %d seconds", timeFinal - timeStart)
93
94 sys.exit(not sc.isSuccess())