3 from __future__
import print_function
7 from Validation.RecoTrack.plotting.validation
import SimpleValidation, SimpleSample
8 import Validation.HGCalValidation.hgcalPlots
as hgcalPlots
9 import Validation.RecoTrack.plotting.plotting
as plotting
12 sample = SimpleSample(opts.subdirprefix, opts.html_sample, [(f, f.replace(
".root",
""))
for f
in opts.files])
16 drawArgs[
"ratio"] =
False 18 drawArgs[
"separate"] =
True 20 drawArgs[
"saveFormat"] =
".png" 22 plotting.verbose =
True 24 val = SimpleValidation([sample], opts.outputDir)
25 htmlReport = val.createHtmlReport(validationName=opts.html_validation_name)
27 hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
28 val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)
31 print(
"Plots created into directory '%s'." % opts.outputDir)
34 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)
36 if __name__ ==
"__main__":
37 parser = argparse.ArgumentParser(description=
"Create set of HGCal validation plots from one or more DQM files.")
38 parser.add_argument(
"files", metavar=
"file", type=str, nargs=
"+",
39 help=
"DQM file to plot the validation plots from")
40 parser.add_argument(
"-o",
"--outputDir", type=str, default=
"plots",
41 help=
"Plot output directory (default: 'plots')")
42 parser.add_argument(
"--subdirprefix", type=str, default=
"plots",
43 help=
"Prefix for subdirectories inside outputDir (default: 'plots')")
44 parser.add_argument(
"--no-ratio", action=
"store_true",
45 help=
"Disable ratio pads")
46 parser.add_argument(
"--separate", action=
"store_true",
47 help=
"Save all plots separately instead of grouping them")
48 parser.add_argument(
"--png", action=
"store_true",
49 help=
"Save plots in PNG instead of PDF")
50 parser.add_argument(
"--no-html", action=
"store_true",
51 help=
"Disable HTML page generation")
52 parser.add_argument(
"--html-sample", default=
"Sample",
53 help=
"Sample name for HTML page generation (default 'Sample')")
54 parser.add_argument(
"--html-validation-name", default=
"",
55 help=
"Validation name for HTML page generation (enters to <title> element) (default '')")
56 parser.add_argument(
"--verbose", action=
"store_true",
58 opts = parser.parse_args()
61 if not os.path.exists(f):
62 parser.error(
"DQM file %s does not exist" % f)
S & print(S &os, JobReport::InputFile const &f)