5 '''@file RunTileTBDump.py
6 @brief Script to run Tile Reconstrcution/Monitoring for calibration runs
9 from TileRecEx
import TileInputFiles
10 from AthenaConfiguration.Enums
import Format
16 RunTileTBDump.py --run RUNNUMBER --evtMax 1
17 RunTileTBDump.py --filesInput=FILE1,FILE2 Exec.SkipEvents=100
19 At least one should provide the following arguments or Athena configuration flags (flags have higher priority):
20 Input file(s), e.g.: --run RUNNUMBER | --filesInput=FILE1,FILE2 | Input.Files="['FILE1','FILE2']"
24 if __name__==
'__main__':
27 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
33 parser = argparse.ArgumentParser(parents=parserParents, add_help=
False, epilog=epiLog, formatter_class=argparse.RawTextHelpFormatter)
35 parser.add_argument(
'--preExec', help=
'Code to execute before locking configs')
36 parser.add_argument(
'--postExec', help=
'Code to execute after setup')
37 parser.add_argument(
'--printDetailedConfig', action=
'store_true', help=
'Print detailed Athena configuration')
39 algorithms_group = parser.add_argument_group(
'TileTBDump and/or TileTBStat aglorithms to run')
40 algorithms_group.add_argument(
'--stat', action=
'store_true', help=
'Run TileTBstat algorithm')
41 algorithms_group.add_argument(
'--no-dump', action=
'store_false', dest=
'dump', help=
'Do not run TileTBDump algorithm')
43 parser.add_argument(
'--dump-bs-fragments', action=
'store_true', dest=
'dump_bs_fragments', help=
'Dump fragments from ByteStreamInputSvc')
45 run_period_group = parser.add_argument_group(
'LHC Run period')
46 run_period = run_period_group.add_mutually_exclusive_group()
47 run_period.add_argument(
'--run2', action=
'store_true', help=
'LHC Run2 period')
48 run_period.add_argument(
'--run3', action=
'store_true', help=
'LHC Run3 period')
50 args, _ = parser.parse_known_args()
53 from AthenaCommon.Logging
import log
54 from AthenaCommon
import Constants
55 log.setLevel(Constants.INFO)
58 flags.Input.Files = []
61 flags.fillFromArgs(parser=parser)
66 if not flags.Input.Files
and args.run:
68 if not flags.Input.Files:
69 log.error(
'Input files must be provided! For example: --filesInput=file1,file2,... or --run RUNNUMBER')
72 runNumber = flags.Input.RunNumbers[0]
75 if not any([args.run2, args.run3]):
76 if not flags.Input.isMC:
77 if runNumber >= 411938
or runNumber <= 0
or runNumber == 3:
79 elif runNumber > 232000
or runNumber == 2:
83 if flags.Input.Format
is Format.BS:
84 if args.run3
or flags.Input.isMC:
85 condDbTag =
'OFLCOND-MC23-SDR-RUN3-01' if flags.Input.isMC
else 'CONDBR2-BLKPA-2023-01'
86 detDescrVersion =
'ATLAS-R3S-2021-03-01-00'
88 condDbTag =
'CONDBR2-BLKPA-2018-16'
89 detDescrVersion =
'ATLAS-R2-2016-01-00-01'
91 condDbTag =
'COMCOND-BLKPA-RUN1-06'
92 detDescrVersion =
'ATLAS-R1-2012-03-02-00'
94 flags.IOVDb.GlobalTag = condDbTag
95 flags.GeoModel.AtlasVersion = detDescrVersion
99 flags.fillFromArgs(parser=parser)
101 flags.needFlagsCategory(
'Tile')
104 log.info(
'Executing preExec: %s', args.preExec)
109 log.info(
'=====>>> FINAL CONFIG FLAGS SETTINGS FOLLOW:')
110 flags.dump(pattern=
'Tile.*|Input.*|Exec.*|IOVDb.[D|G].*', evaluate=
True)
113 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
117 if flags.Input.Format
is Format.BS:
119 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
123 if flags.Exec.OutputLevel
is VERBOSE:
124 for alg
in [
'TileDigitsReadAlg',
'TileRawChannelReadAlg']:
125 cfg.getEventAlgo(alg).TileROD_Decoder.VerboseOutput =
True
127 if args.dump_bs_fragments:
128 cfg.getService(
'ByteStreamInputSvc').DumpFlag =
True
131 log.error(
'Input files must be in BS format')
135 dump_once =
True if args.stat
else False
136 from TileTBRec.TileTBDumpConfig
import TileTBDumpCfg
140 from TileTBRec.TileTBStatConfig
import TileTBStatCfg
145 log.info(
'Executing postExec: %s', args.postExec)
148 cfg.printConfig(withDetails=args.printDetailedConfig)
151 sys.exit(0
if sc.isSuccess()
else 1)