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
23 return quality
in [
"",
"highPurity"]
26 sample = SimpleSample(opts.subdirprefix, opts.html_sample, [(f, f.replace(
".root",
""))
for f
in opts.files])
30 drawArgs[
"ratio"] =
False 32 drawArgs[
"separate"] =
True 34 drawArgs[
"saveFormat"] =
".png" 36 plotting.verbose =
True 38 val = SimpleValidation([sample], opts.outputDir)
39 htmlReport = val.createHtmlReport(validationName=opts.html_validation_name)
41 limitProcessing =
LimitTrackAlgo(opts.limit_tracking_algo, includePtCut=opts.ptcut)
43 "limitSubFoldersOnlyTo": {
45 "allTPEffic": limitProcessing,
46 "fromPV": limitProcessing,
47 "fromPVAllTP": limitProcessing,
48 "seeding": limitProcessing,
49 "building": limitProcessing,
53 ignore =
lambda a,q:
False 54 kwargs_tracking[
"limitSubFoldersOnlyTo"] = {
58 "fromPVAllTP": ignore,
63 trk = [trackingPlots.plotter]
64 other = [trackingPlots.timePlotter, vertexPlots.plotter]
66 trk.append(trackingPlots.plotterExt)
67 other.append(vertexPlots.plotterExt)
68 val.doPlots(trk, plotterDrawArgs=drawArgs, **kwargs_tracking)
69 val.doPlots(other, plotterDrawArgs=drawArgs)
72 print "Plots created into directory '%s'." % opts.outputDir
75 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
77 if __name__ ==
"__main__":
78 parser =
argparse.ArgumentParser(description=
"Create standard set of tracking validation plots from one or more DQM files.")
79 parser.add_argument(
"files", metavar=
"file", type=str, nargs=
"+",
80 help=
"DQM file to plot the validation plots from")
81 parser.add_argument(
"-o",
"--outputDir", type=str, default=
"plots",
82 help=
"Plot output directory (default: 'plots')")
83 parser.add_argument(
"--subdirprefix", type=str, default=
"plots",
84 help=
"Prefix for subdirectories inside outputDir (default: 'plots')")
85 parser.add_argument(
"--no-ratio", action=
"store_true",
86 help=
"Disable ratio pads")
87 parser.add_argument(
"--separate", action=
"store_true",
88 help=
"Save all plots separately instead of grouping them")
89 parser.add_argument(
"--png", action=
"store_true",
90 help=
"Save plots in PNG instead of PDF")
91 parser.add_argument(
"--limit-tracking-algo", type=str, default=
None,
92 help=
"Comma separated list of tracking algos to limit to. (default: all algos; conflicts with --limit-relval)")
93 parser.add_argument(
"--limit-relval", action=
"store_true",
94 help=
"Limit set of plots to those in release validation (almost). (default: all plots in the DQM files; conflicts with --limit-tracking-algo)")
95 parser.add_argument(
"--ptcut", action=
"store_true",
96 help=
"Include plots with pT > 0.9 GeV cut (with --limit-relval, does not have any effect)")
97 parser.add_argument(
"--extended", action=
"store_true",
98 help=
"Include extended set of plots (e.g. bunch of distributions; default off)")
99 parser.add_argument(
"--no-html", action=
"store_true",
100 help=
"Disable HTML page genration")
101 parser.add_argument(
"--html-sample", default=
"Sample",
102 help=
"Sample name for HTML page generation (default 'Sample')")
103 parser.add_argument(
"--html-validation-name", default=
"",
104 help=
"Validation name for HTML page generation (enters to <title> element) (default '')")
105 parser.add_argument(
"--verbose", action=
"store_true",
108 group = parser.add_argument_group(
"deprecated arguments (they have no effect and will be removed in the future):")
109 group.add_argument(
"--ignoreMissing", action=
"store_true",
110 help=
"Ignore missing histograms and directories (deprecated, is this is already the default mode)")
111 group.add_argument(
"--ratio", action=
"store_true",
112 help=
"Create ratio pads (deprecated, as it is already the default")
113 group.add_argument(
"--html", action=
"store_true",
114 help=
"Generate HTML pages (deprecated, as it is already the default")
116 opts = parser.parse_args()
118 if not os.path.exists(f):
119 parser.error(
"DQM file %s does not exist" % f)
121 if opts.ignoreMissing:
122 print "--ignoreMissing is now the only operation mode, so you can stop using this parameter" 125 print "--ratio is now the default, so you can stop using this parameter" 128 print "--html is now the default, so you can stop using this parameter" 130 if opts.limit_tracking_algo
is not None:
131 if opts.limit_relval:
132 parser.error(
"--limit-tracking-algo and --limit-relval conflict with each other")
133 opts.limit_tracking_algo = opts.limit_tracking_algo.split(
",")
135 if opts.limit_relval
and opts.ptcut:
136 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)