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 = {}
    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)))
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)))