6 from Validation.RecoTrack.plotting.validation
import SimpleValidation, SimpleSample
7 import Validation.RecoTrack.plotting.trackingPlots
as trackingPlots
8 import Validation.RecoVertex.plotting.vertexPlots
as vertexPlots
9 import Validation.RecoTrack.plotting.plotting
as plotting
13 labels = [f.replace(
".root",
"")
for f
in files]
17 drawArgs[
"ratio"] =
True
19 drawArgs[
"separate"] =
True
21 drawArgs[
"saveFormat"] =
".png"
23 plotting.verbose =
True
25 val = SimpleValidation(files, labels, opts.outputDir)
28 htmlReport = val.createHtmlReport(validationName=opts.html_validation_name)
29 htmlReport.beginSample(SimpleSample(opts.html_prefix, opts.html_sample))
30 kwargs[
"htmlReport"] = htmlReport
31 val.doPlots(trackingPlots.plotter, subdirprefix=opts.subdirprefix, plotterDrawArgs=drawArgs, **kwargs)
32 val.doPlots(trackingPlots.timePlotter, subdirprefix=opts.subdirprefix, plotterDrawArgs=drawArgs, **kwargs)
33 val.doPlots(vertexPlots.plotter, subdirprefix=opts.subdirprefix, plotterDrawArgs=drawArgs, **kwargs)
37 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
39 print "Plots created into directory '%s'." % opts.outputDir
41 if __name__ ==
"__main__":
42 parser =
argparse.ArgumentParser(description=
"Create standard set of tracking validation plots from one or more DQM files.")
43 parser.add_argument(
"files", metavar=
"file", type=str, nargs=
"+",
44 help=
"DQM file to plot the validation plots from")
45 parser.add_argument(
"-o",
"--outputDir", type=str, default=
"plots",
46 help=
"Plot output directory (default: 'plots')")
47 parser.add_argument(
"--subdirprefix", type=str, default=
"plots",
48 help=
"Prefix for subdirectories inside outputDir (default: 'plots')")
49 parser.add_argument(
"--ignoreMissing", action=
"store_true",
50 help=
"Ignore missing histograms and directories")
51 parser.add_argument(
"--ratio", action=
"store_true",
52 help=
"Create ratio pads")
53 parser.add_argument(
"--separate", action=
"store_true",
54 help=
"Save all plots separately instead of grouping them")
55 parser.add_argument(
"--png", action=
"store_true",
56 help=
"Save plots in PNG instead of PDF")
57 parser.add_argument(
"--html", action=
"store_true",
58 help=
"Generate HTML pages")
59 parser.add_argument(
"--html-prefix", default=
"plots",
60 help=
"Prefix for HTML page generation (default 'plots')")
61 parser.add_argument(
"--html-sample", default=
"Sample",
62 help=
"Sample name for HTML page generation (default 'Sample')")
63 parser.add_argument(
"--html-validation-name", default=
"",
64 help=
"Validation name for HTML page generation (enters to <title> element) (default '')")
65 parser.add_argument(
"--verbose", action=
"store_true",
68 opts = parser.parse_args()
70 if not os.path.exists(f):
71 parser.error(
"DQM file %s does not exist" % f)
73 if opts.ignoreMissing:
74 print "--ignoreMissing is now the only operation mode, so you can stop using this parameter"