示例#1
0
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)))