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