6 '''@file DQTestingDriver.py
10 @brief Driver script to run DQ with new-style configuration on an ESD/AOD
13 if __name__==
'__main__':
15 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
16 from AthenaConfiguration.ComponentFactory
import CompFactory
17 from AthenaConfiguration.Enums
import Format
19 parser = flags.getArgumentParser()
20 parser.add_argument(
'--preExec', help=
'Code to execute before locking configs')
21 parser.add_argument(
'--postExec', help=
'Code to execute after setup')
22 parser.add_argument(
'--dqOffByDefault', action=
'store_true',
23 help=
'Set all DQ steering flags to False, user must then switch them on again explicitly')
25 parser.add_argument(
'--inputFiles',
26 help=
'Comma-separated list of input files (alias for --filesInput)')
28 parser.add_argument(
'--maxEvents', type=int,
29 help=
'Maximum number of events to process (alias for --evtMax)')
30 parser.add_argument(
'--printDetailedConfig', action=
'store_true',
31 help=
'Print detailed Athena configuration')
34 parser.set_defaults(threads=1)
35 args, _ = parser.parse_known_args()
38 flags.Input.Files = [
'/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/AthenaMonitoring/q431/21.0/f946/myESD.pool.root']
39 flags.Output.HISTFileName =
'ExampleMonitorOutput.root'
40 if args.dqOffByDefault:
41 from AthenaMonitoring.DQConfigFlags
import allSteeringFlagsOff
43 flags.fillFromArgs(parser=parser)
46 from AthenaCommon.Logging
import log
47 from AthenaCommon
import Constants
49 log.setLevel(getattr(Constants, args.loglevel))
53 if args.inputFiles
is not None:
54 flags.Input.Files = args.inputFiles.split(
',')
56 if args.maxEvents
is not None:
57 flags.Exec.MaxEvents = args.maxEvents
59 if flags.Input.Format
is Format.BS:
60 if flags.DQ.Environment
not in (
'tier0',
'tier0Raw',
'online'):
61 log.warning(
'Reading RAW file, but DQ.Environment set to %s',
63 log.warning(
'Will proceed but best guess is this is an error')
64 log.info(
'Will schedule reconstruction, as best we know')
66 if flags.DQ.Environment
in (
'tier0',
'tier0Raw',
'online'):
67 log.warning(
'Reading POOL file, but DQ.Environment set to %s',
69 log.warning(
'Will proceed but best guess is this is an error')
73 from AthenaMonitoring.DQConfigFlags
import allSteeringFlagsOff
74 log.info(
'Executing preExec: %s', args.preExec)
77 if hasattr(flags,
"DQ")
and hasattr(flags.DQ,
"Steering")
and hasattr(flags,
"Detector"):
78 if hasattr(flags.DQ.Steering,
"InDet"):
79 if ((flags.DQ.Steering.InDet,
"doAlignMon")
and flags.DQ.Steering.InDet.doAlignMon)
or \
80 ((flags.DQ.Steering.InDet,
"doGlobalMon")
and flags.DQ.Steering.InDet.doGlobalMon)
or \
81 ((flags.DQ.Steering.InDet,
"doPerfMon")
and flags.DQ.Steering.InDet.doPerfMon):
82 flags.Detector.GeometryID =
True
85 flags.Detector.GeometryPixel =
True
86 flags.Detector.GeometrySCT =
True
87 flags.Detector.GeometryTRT =
True
89 log.info(
'FINAL CONFIG FLAGS SETTINGS FOLLOW')
90 if args.loglevel
is None or getattr(Constants, args.loglevel) <= Constants.INFO:
95 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
98 if flags.Input.Format
is Format.BS:
100 from CaloRec.CaloRecoConfig
import CaloRecoCfg
103 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
107 from AthenaMonitoring.AthenaMonitoringCfg
import AthenaMonitoringCfg
112 if flags.Concurrency.NumThreads > 0:
113 from AthenaConfiguration.ComponentAccumulator
import ConfigurationError
114 for condalg, alg
in [(
"PixelDetectorElementCondAlg",
"ForceIDConditionsAlg")]:
116 cfg.getCondAlgo(condalg)
117 except ConfigurationError:
120 beginseq = cfg.getSequence(
"AthBeginSeq")
121 beginseq.Members.append(CompFactory.getComp(alg)())
125 log.info(
'Executing postExec: %s', args.postExec)
128 cfg.printConfig(withDetails=args.printDetailedConfig)
131 sys.exit(0
if sc.isSuccess()
else 1)