19 from argparse
import ArgumentParser
20 parser = ArgumentParser()
21 parser.add_argument(
'--file', default=
'TrigCostRoot_Results.root', help=
'Input ROOT file to generate output from')
22 parser.add_argument(
'--userDetails', help=
'User supplied metadata string giving any extra details about this run.')
23 parser.add_argument(
'--oksMetadata', action=
'store_true', help=
'Retrieve additional metadata from OKS for Cost CPU studies')
24 parser.add_argument(
'--jira', help=
'Related jira ticket number')
25 parser.add_argument(
'--trpDetails', type=bool, default=
False, help=
'Include details read from TRP like pileup and deadtime in the metadata - to be used for P1 data')
26 parser.add_argument(
'--amiTag', help=
'AMI tag used for data reprocessing')
27 parser.add_argument(
'--partition', default=
'ATLAS', help=
'Used partition (needed to read OKS details)')
28 parser.add_argument(
'--underflowThreshold', default=0.5, help=
'Threshold of underflow percent value to save warning in metadata tree.')
29 parser.add_argument(
'--overflowThreshold', default=0.1, help=
'Threshold of underflow percent value to save warning in metadata tree.')
30 parser.add_argument(
'--dumpAlgorithmSummary', action=
'store_true', help=
'Print algorithm\'s mean time of execution to the log file')
31 parser.add_argument(
'--onlyMetadata', type=bool, default=
False, help=
'Only save metadata (csv tables will not be produced)')
32 parser.add_argument(
'--maxRanges', type=int, default=5, help=
"Maximum number of ranges to process. Use -1 to process all.")
33 parser.add_argument(
'--skipRanges', type=int, default=-1, help=
"Skip n first ranges. Use -1 to process all.")
34 parser.add_argument(
'--loglevel', type=int, default=3, help=
'Verbosity level: 1 - VERBOSE, 2 - DEBUG, 3 - INFO')
35 args = parser.parse_args()
36 log.level = args.loglevel
38 inputFile = ROOT.TFile(args.file,
'READ')
42 "amiTag" : args.amiTag,
43 "userDetails" : args.userDetails,
44 "readOKSDetails": args.oksMetadata,
45 "partition": args.partition
48 if inputFile.IsOpen():
50 saveMetadata(inputFile, metadata, [], args.trpDetails, args.loglevel, args.maxRanges)
52 warningMsg =
exploreTree(inputFile, args.dumpAlgorithmSummary, args.underflowThreshold, args.overflowThreshold, args.maxRanges, args.skipRanges)
54 log.error(
"Postprocessing script failed!")
56 saveMetadata(inputFile, metadata, warningMsg, args.trpDetails, args.loglevel, args.maxRanges)
58 log.error(
"File %s not found", args.file)
61 ROOT.gROOT.GetListOfFiles().Remove(inputFile)