Beispiel #1
0
def main(opts):

    drawArgs={}
    if opts.no_ratio:
        drawArgs["ratio"] = False
    if opts.separate:
        drawArgs["separate"] = True
    if opts.png:
        drawArgs["saveFormat"] = ".png"
    if opts.verbose:
        plotting.verbose = True

    filenames = [(f, f.replace(".root", "")) for f in opts.files]
    sample = SimpleSample(opts.subdirprefix[0], opts.html_sample, filenames)
  
    val = SimpleValidation([sample], opts.outputDir[0])
    htmlReport = val.createHtmlReport(validationName=opts.html_validation_name[0])   

    if opts.collection=="hgcalLayerClusters":
      hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
      val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)
    elif opts.collection=="hgcalMultiClusters":
      hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter]
      val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs)
    elif opts.collection=="hitValidation":
    	hgchit = [hgcalPlots.hgcalHitPlotter]
    	val.doPlots(hgchit, plotterDrawArgs=drawArgs)   
    else :
        #In case of all you have to keep a specific order in one to one 
        #correspondance between subdirprefix and collections and validation names
	#layer clusters 
      hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
      val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)
        #multiclusters
      sample = SimpleSample(opts.subdirprefix[1], opts.html_sample, filenames)
      val = SimpleValidation([sample], opts.outputDir[1])
      htmlReport_2 = val.createHtmlReport(validationName=opts.html_validation_name[1])
      hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter]
      val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs)
        #hits
      sample = SimpleSample(opts.subdirprefix[2], opts.html_sample, filenames)
      val = SimpleValidation([sample], opts.outputDir[2])
      htmlReport_3 = val.createHtmlReport(validationName=opts.html_validation_name[2])
      hgchit = [hgcalPlots.hgcalHitPlotter]
      val.doPlots(hgchit, plotterDrawArgs=drawArgs)

    if opts.no_html:
        print("Plots created into directory '%s'." % opts.outputDir)
    else:
        htmlReport.write()
        if(opts.collection=="all"):
          htmlReport_2.write()
          htmlReport_3.write()

        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" % (','.join(opts.outputDir)))
Beispiel #2
0
def main(opts):
    files = opts.files
    labels = [f.replace(".root", "") for f in files]

    drawArgs={}
    if opts.ratio:
        drawArgs["ratio"] = True
    if opts.separate:
        drawArgs["separate"] = True
    if opts.png:
        drawArgs["saveFormat"] = ".png"
    if opts.verbose:
        plotting.verbose = True

    val = SimpleValidation(files, labels, opts.outputDir)
    kwargs = {}
    if opts.html:
        htmlReport = val.createHtmlReport(validationName=opts.html_validation_name)
        htmlReport.beginSample(SimpleSample(opts.html_prefix, opts.html_sample))
        kwargs["htmlReport"] = htmlReport
    val.doPlots(trackingPlots.plotter, subdirprefix=opts.subdirprefix, plotterDrawArgs=drawArgs, **kwargs)
    val.doPlots(trackingPlots.timePlotter, subdirprefix=opts.subdirprefix, plotterDrawArgs=drawArgs, **kwargs)
    val.doPlots(vertexPlots.plotter, subdirprefix=opts.subdirprefix, plotterDrawArgs=drawArgs, **kwargs)
    print
    if opts.html:
        htmlReport.write()
        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
    else:
        print "Plots created into directory '%s'." % opts.outputDir
def main(opts):
    sample = SimpleSample(opts.subdirprefix, opts.html_sample,
                          [(f, f.replace(".root", "")) for f in opts.files])

    drawArgs = {}
    if opts.no_ratio:
        drawArgs["ratio"] = False
    if opts.separate:
        drawArgs["separate"] = True
    if opts.png:
        drawArgs["saveFormat"] = ".png"
    if opts.verbose:
        plotting.verbose = True

    val = SimpleValidation([sample], opts.outputDir)
    htmlReport = val.createHtmlReport(validationName=opts.html_validation_name)

    hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
    val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)
    print()
    if opts.no_html:
        print("Plots created into directory '%s'." % opts.outputDir)
    else:
        htmlReport.write()
        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)
def main(opts):
    sample = SimpleSample(opts.subdirprefix, opts.html_sample, [(f, f.replace(".root", "")) for f in opts.files])

    drawArgs={}
    if opts.no_ratio:
        drawArgs["ratio"] = False
    if opts.separate:
        drawArgs["separate"] = True
    if opts.png:
        drawArgs["saveFormat"] = ".png"
    if opts.verbose:
        plotting.verbose = True

    val = SimpleValidation([sample], opts.outputDir)
    htmlReport = val.createHtmlReport(validationName=opts.html_validation_name)

    limitProcessing = LimitTrackAlgo(opts.limit_tracking_algo, includePtCut=opts.ptcut)
    kwargs_tracking = {
        "limitSubFoldersOnlyTo": {
            "": limitProcessing,
            "allTPEffic": limitProcessing,
            "fromPV": limitProcessing,
            "fromPVAllTP": limitProcessing,
            "tpPtLess09": limitProcessing,
            "tpEtaGreater2p7": limitProcessing,
            "seeding": limitProcessing,
            "building": limitProcessing,
            "bhadron": limitProcessing,
            "displaced": limitProcessing,
        }
    }
    if opts.limit_relval:
        ignore = lambda a,q: False
        kwargs_tracking["limitSubFoldersOnlyTo"] = {
            "": limitRelVal,
            "allTPEffic": ignore,
            "fromPV": ignore,
            "fromPVAllTP": ignore,
            "tpPtLess09": limitRelVal,
            "tpEtaGreater2p7": limitRelVal,
            "seeding": ignore,
            "bhadron": limitRelVal,
            "displaced": limitRelVal,
        }

    trk = [trackingPlots.plotter]
    other = [trackingPlots.timePlotter, vertexPlots.plotter, trackingPlots.plotterHLT]
    if opts.extended:
        trk.append(trackingPlots.plotterExt)
        other.extend([vertexPlots.plotterExt, trackingPlots.plotterHLTExt])
    val.doPlots(trk, plotterDrawArgs=drawArgs, **kwargs_tracking)
    val.doPlots(other, plotterDrawArgs=drawArgs)
    print()
    if opts.no_html:
        print("Plots created into directory '%s'." % opts.outputDir)
    else:
        htmlReport.write()
        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)
def main(opts):

    drawArgs = {}
    extendedFlag = False
    if opts.no_ratio:
        drawArgs["ratio"] = False
    if opts.separate:
        drawArgs["separate"] = True
    if opts.png:
        drawArgs["saveFormat"] = ".png"
    if opts.extended:
        extendedFlag = True
    if opts.verbose:
        plotting.verbose = True

    filenames = [(f, f.replace(".root", "")) for f in opts.files]
    sample = SimpleSample(opts.subdirprefix[0], opts.html_sample, filenames)

    val = SimpleValidation([sample], opts.outputDir[0])
    if opts.separate:
        val = SeparateValidation([sample], opts.outputDir[0])
    htmlReport = val.createHtmlReport(
        validationName=opts.html_validation_name[0])

    #layerClusters
    if (opts.collection == layerClustersGeneralLabel):
        hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
        hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters",
                                                  "Layer Clusters",
                                                  extendedFlag)
        val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)
    #simClusters
    elif (opts.collection == simClustersGeneralLabel):
        hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter]
        for i_iter in simClustersIters:
            hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter)
        val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs)
    #multiClusters
    elif (opts.collection == multiclustersGeneralLabel):
        hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter]
        hgcalPlots.append_hgcalMultiClustersPlots(multiclustersGeneralLabel,
                                                  "MultiClusters")
        val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs)
    #ticlTracksters
    elif (opts.collection == trackstersGeneralLabel):
        hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter]
        for i_iter in trackstersIters:
            tracksterCollection = i_iter.replace(
                "ticlMultiClustersFromTracksters", "ticlTracksters")
            hgcalPlots.append_hgcalMultiClustersPlots(i_iter,
                                                      tracksterCollection)
        val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs)
    elif (opts.collection == caloParticlesLabel):
        particletypes = {
            "pion-": "-211",
            "pion+": "211",
            "pion0": "111",
            "muon-": "-13",
            "muon+": "13",
            "electron-": "-11",
            "electron+": "11",
            "photon": "22",
            "kaon0L": "310",
            "kaon0S": "130",
            "kaon-": "-321",
            "kaon+": "321"
        }
        hgcaloPart = [hgcalPlots.hgcalCaloParticlesPlotter]
        for i_part, i_partID in particletypes.iteritems():
            hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID,
                                                      i_part)
        val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs)
    #hitValidation
    elif (opts.collection == hitValidationLabel):
        hgchit = [hgcalPlots.hgcalHitPlotter]
        hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits")
        hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits")
        hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis")
        val.doPlots(hgchit, plotterDrawArgs=drawArgs)
    #hitCalibration
    elif (opts.collection == hitCalibrationLabel):
        hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter]
        val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs)
    elif (opts.collection == allLabel):
        #caloparticles
        particletypes = {
            "pion-": "-211",
            "pion+": "211",
            "pion0": "111",
            "muon-": "-13",
            "muon+": "13",
            "electron-": "-11",
            "electron+": "11",
            "photon": "22",
            "kaon0L": "310",
            "kaon0S": "130",
            "kaon-": "-321",
            "kaon+": "321"
        }
        hgcaloPart = [hgcalPlots.hgcalCaloParticlesPlotter]
        for i_part, i_partID in particletypes.iteritems():
            hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID,
                                                      i_part)
        val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs)

        #hits
        hgchit = [hgcalPlots.hgcalHitPlotter]
        hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits")
        hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits")
        hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis")
        val.doPlots(hgchit, plotterDrawArgs=drawArgs)

        #calib
        hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter]
        val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs)

        #simClusters
        hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter]
        for i_iter in simClustersIters:
            hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter)
        val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs)

        #layer clusters
        hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
        hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters",
                                                  "Layer Clusters",
                                                  extendedFlag)
        val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)

        #multiclusters
        hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter]
        for i_iter in trackstersIters:
            tracksterCollection = i_iter.replace(
                "ticlMultiClustersFromTracksters", "ticlTracksters")
            hgcalPlots.append_hgcalMultiClustersPlots(i_iter,
                                                      tracksterCollection)
        val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs)

    if opts.no_html:
        print("Plots created into directory '%s'." % opts.outputDir)
    else:
        htmlReport.write()

        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"
            % (','.join(opts.outputDir)))
Beispiel #6
0
from Validation.RecoTrack.plotting.validation import SimpleValidation, SimpleSample
import Validation.RecoTrack.plotting.trackingPlots as trackingPlots
import Validation.RecoVertex.plotting.vertexPlots as vertexPlots

# Example of file - label pairs
filesLabels = [
    ("DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_1.root", "Option 1"),
    ("DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_2.root", "Option 2"),
]

outputDir = "plots"

# To auto-generate HTML pages, uncomment the commented lines below
val = SimpleValidation([x[0] for x in filesLabels],
                       [x[1] for x in filesLabels], outputDir)
sample = SimpleSample("sample_prefix", "Sample name")
#report = val.createHtmlReport(validationName="Short description of your comparison")
#report.beginSample(sample)
val.doPlots(
    trackingPlots.plotter,
    sample=sample,
    plotterDrawArgs={"ratio": True},
    #            htmlReport=report
)
## Uncomment this to include also vertex plots
##val.doPlots(vertexPlots.plotter, sample=sample, plotterDrawArgs={"ratio": True},
##            htmlReport=report
##)
#report.write()
Beispiel #7
0
plotterDrawArgs = dict(
    separate=False,  # Set to true if you want each plot in it's own canvas
    #    ratio=False,   # Uncomment to disable ratio pad
)

# Pairs of file names and legend labels
filesLabels = [
    ("DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_1.root", "Option 1"),
    ("DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_2.root", "Option 2"),
]
# Files are grouped together as a "sample" (the files don't
# necessarily have to come from the same sample, like ttbar, but this
# is the abstraction here)
sample = SimpleSample(
    "sample_prefix",  # Prefix for subdirectory names
    "Sample name",  # The name appears in the HTML pages
    filesLabels)  # Files and legend labels

# You can produce plots for multiple samples on one. Just construct
# multiple SimpleSample objects like above and add them to the list
# below.
samples = [sample]

# Example of how to limit tracking plots to specific iterations
kwargs_tracking = {}


class LimitTrackAlgo:  # helper class to limit to iterations
    def __init__(self, algos):
        self._algos = algos
Beispiel #8
0
def main(opts):
    files = opts.files
    labels = [f.replace(".root", "") for f in files]

    drawArgs = {}
    if opts.ratio:
        drawArgs["ratio"] = True
    if opts.separate:
        drawArgs["separate"] = True
    if opts.png:
        drawArgs["saveFormat"] = ".png"
    if opts.verbose:
        plotting.verbose = True

    val = SimpleValidation(files, labels, opts.outputDir)
    kwargs = {}
    if opts.html:
        htmlReport = val.createHtmlReport(
            validationName=opts.html_validation_name)
        htmlReport.beginSample(SimpleSample(opts.html_prefix,
                                            opts.html_sample))
        kwargs["htmlReport"] = htmlReport

    kwargs_tracking = {}
    kwargs_tracking.update(kwargs)
    if opts.limit_tracking_algo is not None:
        limitProcessing = LimitTrackAlgo(opts.limit_tracking_algo)
        kwargs_tracking["limitSubFoldersOnlyTo"] = {
            "": limitProcessing,
            "allTPEffic": limitProcessing,
            "fromPV": limitProcessing,
            "fromPVAllTP": limitProcessing,
            "seeding": limitProcessing,
            "building": limitProcessing,
        }
    if opts.limit_relval:
        ignore = lambda a, q: False
        kwargs_tracking["limitSubFoldersOnlyTo"] = {
            "": limitRelVal,
            "allTPEffic": ignore,
            "fromPV": ignore,
            "fromPVAllTP": ignore,
            "seeding": ignore,
            "building": ignore,
        }

    val.doPlots(trackingPlots.plotter,
                subdirprefix=opts.subdirprefix,
                plotterDrawArgs=drawArgs,
                **kwargs_tracking)
    if opts.extended:
        val.doPlots(trackingPlots.plotterExt,
                    subdirprefix=opts.subdirprefix,
                    plotterDrawArgs=drawArgs,
                    **kwargs_tracking)
    val.doPlots(trackingPlots.timePlotter,
                subdirprefix=opts.subdirprefix,
                plotterDrawArgs=drawArgs,
                **kwargs)
    val.doPlots(vertexPlots.plotter,
                subdirprefix=opts.subdirprefix,
                plotterDrawArgs=drawArgs,
                **kwargs)
    print
    if opts.html:
        htmlReport.write()
        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
    else:
        print "Plots created into directory '%s'." % opts.outputDir
Beispiel #9
0
def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "-s",
        "--sample",
        type=str,
        action='append',
        required=True,
        help=
        "DQM files to compare for a single sample, in the format 'name:file1.root:file2.root:...:fileN.root'",
        #default=[
        #    "QCD:DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root:DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root"
        #]
    )
    parser.add_argument(
        "-p",
        "--plots",
        type=str,
        action='append',
        required=False,
        help=
        "Plots to put on a single canvas, in the format 'folder:name:plot1:plot2:...:plotN'",
        default=[],
        #default=[
        #    "JetResponse:reso_dist_10_24:reso_dist_10_24_eta05:reso_dist_10_24_eta13"
        #]
    )
    parser.add_argument("--doResponsePlots",
                        action='store_true',
                        required=False,
                        help="If enabled, do all jet response plots")
    parser.add_argument("--doOffsetPlots",
                        action='store_true',
                        required=False,
                        help="If enabled, do all offset plots")
    parser.add_argument("--offsetVar",
                        type=str,
                        action='store',
                        default="npv",
                        help="variable to bin offset eT")
    parser.add_argument("--offsetDR",
                        type=float,
                        action='store',
                        default=0.4,
                        help="offset deltaR value")
    args = parser.parse_args()

    #collect all the SimpleSample objects
    samples = []
    plots = []

    sample_strings = args.sample
    for ss in sample_strings:
        name, files = parse_sample_string(ss)
        samp = SimpleSample(name, name,
                            [(fn, fn.split('/')[-2]) for fn in files])
        samples += [samp]

    for ss in args.plots:
        folder, name, histograms = parse_plot_string(ss)
        plots += [(folder, name, histograms)]

    # This needs to be also changed whenever changing binning
    if args.doResponsePlots:
        plots += [("JetResponse", "reso_pt", [
            "preso_eta05", "preso_eta13", "preso_eta21", "preso_eta25",
            "preso_eta30", "preso_eta50"
        ])]
        plots += [("JetResponse", "reso_pt_rms", [
            "preso_eta05_rms", "preso_eta13_rms", "preso_eta21_rms",
            "preso_eta25_rms", "preso_eta30_rms", "preso_eta50_rms"
        ])]
        plots += [("JetResponse", "response_pt", [
            "presponse_eta05", "presponse_eta13", "presponse_eta21",
            "presponse_eta25", "presponse_eta30", "presponse_eta50"
        ])]
        for iptbin in range(len(ptbins) - 1):
            pthistograms = []
            for ietabin in range(len(etabins) - 1):
                pthistograms += [response_distribution_name(iptbin, ietabin)]
            plots += [("JetResponse", "response_{0:.0f}_{1:.0f}".format(
                ptbins[iptbin], ptbins[iptbin + 1]), pthistograms)]

    if args.doOffsetPlots:
        if args.offsetVar == "npv":
            varHigh, varLow = npvHighOffset, npvLowOffset
        else:
            varHigh, varLow = muHighOffset, muLowOffset
        for ivar in range(varLow, varHigh):
            offsetHists = []
            for itype in candidateType:
                offsetHists += [offset_name(args.offsetVar, ivar, itype)]
            plots += [("Offset/{0}Plots/{0}{1}".format(args.offsetVar, ivar),
                       "{0}{1}".format(args.offsetVar, ivar), offsetHists)]
    return samples, plots, args.doOffsetPlots, args.offsetVar, args.offsetDR
def main(opts):

    drawArgs = {}
    extendedFlag = False
    if opts.no_ratio:
        drawArgs["ratio"] = False
    if opts.separate:
        drawArgs["separate"] = True
    if opts.png:
        drawArgs["saveFormat"] = ".png"
    if opts.extended:
        extendedFlag = True
    if opts.verbose:
        plotting.verbose = True

    filenames = [(f, f.replace(".root", "")) for f in opts.files]
    sample = SimpleSample(opts.subdirprefix[0], opts.html_sample, filenames)

    val = SimpleValidation([sample], opts.outputDir[0])
    if opts.separate:
        val = SeparateValidation([sample], opts.outputDir[0])
    htmlReport = val.createHtmlReport(
        validationName=opts.html_validation_name[0])

    #layerClusters
    def plot_LC():
        hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
        hgcalPlots.append_hgcalLayerClustersPlots(
            hgcalValidator.label_layerClusterPlots._InputTag__moduleLabel,
            "Layer Clusters", extendedFlag)
        val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)

    #simClusters
    def plot_SC():
        hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter]
        for i_iter in simClustersIters:
            hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter)
        val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs)

    #tracksters
    def plot_Tst():
        hgctrackster = [hgcalPlots.hgcalTrackstersPlotter]
        for tracksterCollection in trackstersIters:
            hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection,
                                                   tracksterCollection)
        val.doPlots(hgctrackster, plotterDrawArgs=drawArgs)

    #trackstersWithEdges
    def plot_TstEdges():
        plot_Tst()
        for tracksterCollection in trackstersIters:
            hgctracksters = [
                hgcalPlots.create_hgcalTrackstersPlotter(
                    sample.files(), tracksterCollection, tracksterCollection)
            ]
            val.doPlots(hgctracksters, plotterDrawArgs=drawArgs)

    #caloParticles
    def plot_CP():
        particletypes = {
            "pion-": "-211",
            "pion+": "211",
            "pion0": "111",
            "muon-": "-13",
            "muon+": "13",
            "electron-": "-11",
            "electron+": "11",
            "photon": "22",
            "kaon0L": "310",
            "kaon0S": "130",
            "kaon-": "-321",
            "kaon+": "321"
        }
        hgcaloPart = [hgcalPlots.hgcalCaloParticlesPlotter]
        for i_part, i_partID in particletypes.items():
            hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID,
                                                      i_part)
        val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs)

    #hitValidation
    def plot_hitVal():
        hgchit = [hgcalPlots.hgcalHitPlotter]
        hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits")
        hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits")
        hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis")
        val.doPlots(hgchit, plotterDrawArgs=drawArgs)

    #hitCalibration
    def plot_hitCal():
        hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter]
        val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs)

    plotDict = {
        hitCalLabel: [plot_hitCal],
        hitValLabel: [plot_hitVal],
        layerClustersLabel: [plot_LC],
        trackstersLabel: [plot_Tst],
        trackstersWithEdgesLabel: [plot_TstEdges],
        simLabel: [plot_SC, plot_CP]
    }

    if (opts.collection != allLabel):
        for task in plotDict[opts.collection]:
            task()
    else:
        for label in plotDict:
            if (label == trackstersLabel):
                continue  # already run in trackstersWithEdges
            for task in plotDict[label]:
                task()

    if opts.no_html:
        print("Plots created into directory '%s'." % opts.outputDir)
    else:
        htmlReport.write()

        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"
            % (','.join(opts.outputDir)))
def main(opts):

    drawArgs={}
    if opts.no_ratio:
        drawArgs["ratio"] = False
    if opts.separate:
        drawArgs["separate"] = True
    if opts.png:
        drawArgs["saveFormat"] = ".png"
    if opts.verbose:
        plotting.verbose = True

    filenames = [(f, f.replace(".root", "")) for f in opts.files]
    sample = SimpleSample(opts.subdirprefix[0], opts.html_sample, filenames)
  
    val = SimpleValidation([sample], opts.outputDir[0])
    if opts.separate:
        val = SeparateValidation([sample], opts.outputDir[0])
    htmlReport = val.createHtmlReport(validationName=opts.html_validation_name[0])   

    if opts.collection==layerClustersGeneralLabel:
	hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
	hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters", "Layer Clusters")
        val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)
    elif opts.collection == multiclustersGeneralLabel:
        hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter]
        hgcalPlots.append_hgcalMultiClustersPlots(multiclustersGeneralLabel, "MultiClusters")
        val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs)
    elif (opts.collection == trackstersGeneralLabel) :
        hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter]
        for i_iter in trackstersIters :
            tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters")
            hgcalPlots.append_hgcalMultiClustersPlots(i_iter, tracksterCollection)
        val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs)
    elif opts.collection==hitValidationLabel:
    	hgchit = [hgcalPlots.hgcalHitPlotter]
        hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits")
        hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits")
        hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis")
    	val.doPlots(hgchit, plotterDrawArgs=drawArgs)   
    elif opts.collection==hitCalibrationLabel:
        hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter]
        val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs)
    else :

        #hits
    	hgchit = [hgcalPlots.hgcalHitPlotter]
        hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits")
        hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits")
        hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis")
    	val.doPlots(hgchit, plotterDrawArgs=drawArgs)   

        #calib
        hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter]
        val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs)

 	#layer clusters 
	hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter]
	hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters", "Layer Clusters")
	val.doPlots(hgclayclus, plotterDrawArgs=drawArgs)

        #multiclusters
        hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter]
        for i_iter in trackstersIters :
            tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters")
            hgcalPlots.append_hgcalMultiClustersPlots(i_iter, tracksterCollection)
        val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs)

    if opts.no_html:
        print("Plots created into directory '%s'." % opts.outputDir)
    else:
        htmlReport.write()

        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" % (','.join(opts.outputDir)))