3 from __future__
import print_function
7 from Validation.RecoTrack.plotting.validation
import SimpleValidation, SimpleSample
8 import Validation.RecoTrack.plotting.trackingPlots
as trackingPlots
9 import Validation.RecoVertex.plotting.vertexPlots
as vertexPlots
10 import Validation.RecoTrack.plotting.plotting
as plotting
24 return quality
in [
"",
"highPurity",
"ByOriginalAlgo",
"highPurityByOriginalAlgo"]
27 sample = SimpleSample(opts.subdirprefix, opts.html_sample, [(f, f.replace(
".root",
""))
for f
in opts.files])
31 drawArgs[
"ratio"] =
False 33 drawArgs[
"separate"] =
True 35 drawArgs[
"saveFormat"] =
".png" 37 plotting.verbose =
True 39 val = SimpleValidation([sample], opts.outputDir)
40 htmlReport = val.createHtmlReport(validationName=opts.html_validation_name)
42 limitProcessing =
LimitTrackAlgo(opts.limit_tracking_algo, includePtCut=opts.ptcut)
44 "limitSubFoldersOnlyTo": {
46 "allTPEffic": limitProcessing,
47 "fromPV": limitProcessing,
48 "fromPVAllTP": limitProcessing,
49 "tpPtLess09": limitProcessing,
50 "seeding": limitProcessing,
51 "building": limitProcessing,
52 "bhadron": limitProcessing,
56 ignore =
lambda a,q:
False 57 kwargs_tracking[
"limitSubFoldersOnlyTo"] = {
61 "fromPVAllTP": ignore,
62 "tpPtLess09": limitRelVal,
64 "bhadron": limitRelVal,
67 trk = [trackingPlots.plotter]
68 other = [trackingPlots.timePlotter, vertexPlots.plotter, trackingPlots.plotterHLT]
70 trk.append(trackingPlots.plotterExt)
71 other.extend([vertexPlots.plotterExt, trackingPlots.plotterHLTExt])
72 val.doPlots(trk, plotterDrawArgs=drawArgs, **kwargs_tracking)
73 val.doPlots(other, plotterDrawArgs=drawArgs)
76 print(
"Plots created into directory '%s'." % opts.outputDir)
79 print(
"Plots and HTML report created into directory '%s'. You can just move it to some www area and access the pages via web browser" % opts.outputDir)
81 if __name__ ==
"__main__":
82 parser = argparse.ArgumentParser(description=
"Create standard set of tracking validation plots from one or more DQM files.\nNote that for timing plots you have to include FastTimerService (typically it gets included via DQM/VALIDATION), and set\nprocess.FastTimerService.enableDQMbyPath = True")
83 parser.add_argument(
"files", metavar=
"file", type=str, nargs=
"+",
84 help=
"DQM file to plot the validation plots from")
85 parser.add_argument(
"-o",
"--outputDir", type=str, default=
"plots",
86 help=
"Plot output directory (default: 'plots')")
87 parser.add_argument(
"--subdirprefix", type=str, default=
"plots",
88 help=
"Prefix for subdirectories inside outputDir (default: 'plots')")
89 parser.add_argument(
"--no-ratio", action=
"store_true",
90 help=
"Disable ratio pads")
91 parser.add_argument(
"--separate", action=
"store_true",
92 help=
"Save all plots separately instead of grouping them")
93 parser.add_argument(
"--png", action=
"store_true",
94 help=
"Save plots in PNG instead of PDF")
95 parser.add_argument(
"--limit-tracking-algo", type=str, default=
None,
96 help=
"Comma separated list of tracking algos to limit to. (default: all algos; conflicts with --limit-relval)")
97 parser.add_argument(
"--limit-relval", action=
"store_true",
98 help=
"Limit set of plots to those in release validation (almost). (default: all plots in the DQM files; conflicts with --limit-tracking-algo)")
99 parser.add_argument(
"--ptcut", action=
"store_true",
100 help=
"Include plots with pT > 0.9 GeV cut (with --limit-relval, does not have any effect)")
101 parser.add_argument(
"--extended", action=
"store_true",
102 help=
"Include extended set of plots (e.g. bunch of distributions; default off)")
103 parser.add_argument(
"--no-html", action=
"store_true",
104 help=
"Disable HTML page genration")
105 parser.add_argument(
"--html-sample", default=
"Sample",
106 help=
"Sample name for HTML page generation (default 'Sample')")
107 parser.add_argument(
"--html-validation-name", default=
"",
108 help=
"Validation name for HTML page generation (enters to <title> element) (default '')")
109 parser.add_argument(
"--verbose", action=
"store_true",
112 group = parser.add_argument_group(
"deprecated arguments (they have no effect and will be removed in the future):")
113 group.add_argument(
"--ignoreMissing", action=
"store_true",
114 help=
"Ignore missing histograms and directories (deprecated, is this is already the default mode)")
115 group.add_argument(
"--ratio", action=
"store_true",
116 help=
"Create ratio pads (deprecated, as it is already the default")
117 group.add_argument(
"--html", action=
"store_true",
118 help=
"Generate HTML pages (deprecated, as it is already the default")
120 opts = parser.parse_args()
122 if not os.path.exists(f):
123 parser.error(
"DQM file %s does not exist" % f)
125 if opts.ignoreMissing:
126 print(
"--ignoreMissing is now the only operation mode, so you can stop using this parameter")
129 print(
"--ratio is now the default, so you can stop using this parameter")
132 print(
"--html is now the default, so you can stop using this parameter")
134 if opts.limit_tracking_algo
is not None:
135 if opts.limit_relval:
136 parser.error(
"--limit-tracking-algo and --limit-relval conflict with each other")
137 opts.limit_tracking_algo = opts.limit_tracking_algo.split(
",")
139 if opts.limit_relval
and opts.ptcut:
140 print(
"With --limit-relval enabled, --ptcut option does not have any effect")
def __init__(self, algos, includePtCut)
def limitRelVal(algo, quality)
def __call__(self, algo, quality)
S & print(S &os, JobReport::InputFile const &f)