Esempio n. 1
0
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)
Esempio n. 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
Esempio n. 3
0
def main(opts):
    files = opts.files
    labels = [f.replace(".root", "") for f in files]

    if opts.ignoreMissing:
        plotting.missingOk = True

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

    val = SimpleValidation(files, labels, opts.outputDir)
    val.doPlotsAuto(trackingPlots.plotter, subdirToAlgoQuality=subdirToAlgoQuality, newdirFunc=newdirname, plotterDrawArgs=drawArgs)
Esempio n. 4
0
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)
Esempio n. 5
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"

    val = SimpleValidation(files, labels, opts.outputDir)
    val.doPlots(Algos,
                Qualities,
                trackingPlots.plotter,
                algoDirMap=trackingPlots._tracks_map,
                newdirFunc=newdirname,
                plotterDrawArgs=drawArgs)
Esempio n. 6
0
def main(opts):
    files = opts.files
    labels = [f.replace(".root", "") for f in files]

    if opts.ignoreMissing:
        plotting.missingOk = True

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

    val = SimpleValidation(files, labels, opts.outputDir)
    val.doPlotsAuto(trackingPlots.plotter,
                    subdirToAlgoQuality=subdirToAlgoQuality,
                    newdirFunc=newdirname,
                    plotterDrawArgs=drawArgs)
Esempio n. 7
0
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,
            "seeding": limitProcessing,
            "building": limitProcessing,
            "bhadron": limitProcessing,
        }
    }
    if opts.limit_relval:
        ignore = lambda a,q: False
        kwargs_tracking["limitSubFoldersOnlyTo"] = {
            "": limitRelVal,
            "allTPEffic": ignore,
            "fromPV": ignore,
            "fromPVAllTP": ignore,
            "tpPtLess09": limitRelVal,
            "seeding": ignore,
            "bhadron": 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
Esempio n. 9
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
    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)))
Esempio n. 10
0
# This is an example of plotting the standard vertex validation
# plots from an explicit set of DQM root files.

import Validation.RecoTrack.plotting.plotting as plotting
from Validation.RecoTrack.plotting.validation import SimpleValidation
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"

### Track algorithm name and quality. Can be a list.
Collections = ["offlinePrimaryVertices", "selectedOfflinePrimaryVertices"]
Qualities=None

def newdirname(algo, quality):
    ret = ""
    if algo is not None:
        ret += "_"+algo
    return ret


val = SimpleValidation([x[0] for x in filesLabels], [x[1] for x in filesLabels], outputDir)
val.doPlots(Collections, Qualities, vertexPlots.plotter, algoDirMap=lambda a, q: a, newdirFunc=newdirname)
Esempio n. 11
0
        plotGroup.getPlot("efficPt").setProperties(legendDx=-0,
                                                   legendDy=-0,
                                                   **common)

    # Example of customization of vertex plots
    common["lineWidth"] = 4
    plotFolder = vertexPlots.plotterExt.getPlotFolder("gen")
    plotGroup = plotFolder.getPlotGroup("genpos")
    plotGroup.getPlot("GenAllV_Z").setProperties(
        xtitle="Simulated vertex z (cm)",
        legendDy=-0.1,
        legendDx=-0.45,
        ratioYmax=2.5,
        **common)

val = SimpleValidation(samples, outputDir)
report = val.createHtmlReport(validationName=description)
val.doPlots(
    [
        trackingPlots.plotter,  # standard tracking plots
        #trackingPlots.plotterExt, # extended tracking plots (e.g. distributions)
    ],
    plotterDrawArgs=plotterDrawArgs,
    **kwargs_tracking)
val.doPlots(
    [
        #trackingPlots.timePlotter, # tracking timing plots
        vertexPlots.plotter,  # standard vertex plots
        #vertexPlots.plotterExt,    # extended vertex plots (e.g. distributions)
    ],
    plotterDrawArgs=plotterDrawArgs,
Esempio n. 12
0
import Validation.RecoTrack.plotting.trackingPlots as trackingPlots



# 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"

### Track algorithm name and quality. Can be a list.
Algos= ['ootb', 'initialStep', 'lowPtTripletStep','pixelPairStep','detachedTripletStep','mixedTripletStep','pixelLessStep','tobTecStep','jetCoreRegionalStep','muonSeededStepInOut','muonSeededStepOutIn']
#Algos= ['ootb']
Qualities=['', 'highPurity']

def newdirname(algo, quality):
    ret = ""
    if quality != "":
        ret += "_"+quality
    if not (algo == "ootb" and quality != ""):
        ret += "_"+algo

    return ret


val = SimpleValidation([x[0] for x in filesLabels], [x[1] for x in filesLabels], outputDir)
val.doPlots(Algos, Qualities, trackingPlots.plotter, algoDirMap=trackingPlots._tracks_map, newdirFunc=newdirname)

Esempio n. 13
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
Esempio n. 14
0
def main():

    # plot-dependent style options
    # style options can be found from Validation/RecoTrack/python/plotting/plotting.py
    styledict_resolution = {
        "xlog": True,
        "xgrid": False,
        "ygrid": False,
        "xtitle": "GenJet pT (GeV)",
        "ytitle": "Jet pT resolution",
        "xtitleoffset": 7.7,
        "ytitleoffset": 3.8,
        "adjustMarginLeft": 0.00
    }

    styledict_response = {
        "xlog": True,
        "xgrid": False,
        "ygrid": False,
        "xtitle": "GenJet pT (GeV)",
        "ytitle": "Jet response",
        "xtitleoffset": 7.7,
        "ytitleoffset": 3.8,
        "adjustMarginLeft": 0.00
    }
    plot_opts = {
        "reso_pt": styledict_resolution,
        "reso_pt_rms": styledict_resolution,
        "response_pt": styledict_response
    }
    for iptbin in range(len(ptbins) - 1):
        plot_opts["response_{0:.0f}_{1:.0f}".format(ptbins[iptbin],
                                                    ptbins[iptbin + 1])] = {
                                                        "stat": True
                                                    }

    samples, plots, doOffsetPlots, offsetVar, offsetDR = parse_args()

    plotter = Plotter()

    for folder, name, histograms in plots:
        opts = plot_opts.get(name, {})

        #fullfolder =  "DQMData/Run 1/Physics/Run summary/{0}".format(folder)
        fullfolder = "DQMData/Run 1/ParticleFlow/Run summary/{0}".format(
            folder)
        print "Booking histogram group {0}={1} from folder {2}".format(
            name, histograms, folder)
        if "Offset/" in folder:
            opts = {'xtitle': 'Default', 'ytitle': 'Default'}
            addPlots(plotter, fullfolder, name, folder, histograms, opts, True)
        else:
            addPlots(plotter, fullfolder, name, folder, histograms, opts)

    outputDir = "plots"  # Plot output directory
    description = "Simple ParticleFlow comparison"

    plotterDrawArgs = dict(
        separate=False,  # Set to true if you want each plot in it's own canvas
        #    ratio=False,   # Uncomment to disable ratio pad
    )

    val = SimpleValidation(samples, outputDir)
    report = val.createHtmlReport(validationName=description)
    val.doPlots([plotter], plotterDrawArgs=plotterDrawArgs)

    report.write()

    #add tdr-style stack plots to offset html file
    if doOffsetPlots:
        offsetDir = "OffsetStacks"
        fullOffsetDir = os.path.join(outputDir, offsetDir)
        os.makedirs(fullOffsetDir)

        for s in samples:
            offFile = open(outputDir + "/" + s.label() + "_offset.html", "r")
            lines = offFile.readlines()
            offFile.close()

            for f in s.files():
                fname = f.split('/')[-2]
                outName = offsetStack([(fname, f)], offsetVar, offsetDR,
                                      fullOffsetDir)
                outName = outName.replace(
                    "plots/", ""
                )  #KH: This "plots" look redundant and causes trouble for .html. Stripping it off.
                addLine(outName, lines)

                for f2 in s.files():
                    if f == f2: continue
                    fname2 = f2.split('/')[-2]
                    outName = offsetStack([(fname, f), (fname2, f2)],
                                          offsetVar, offsetDR, fullOffsetDir)
                    outName = outName.replace(
                        "plots/", ""
                    )  #KH: This "plots" look redundant and causes trouble for .html. Stripping it off.
                    addLine(outName, lines)

            offFile = open(outputDir + "/" + s.label() + "_offset.html", "w")
            lines = "".join(lines)
            offFile.write(lines)
            offFile.close()
Esempio n. 15
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)))
Esempio n. 16
0
# This is an example of plotting the standard vertex validation
# plots from an explicit set of DQM root files.

import Validation.RecoTrack.plotting.plotting as plotting
from Validation.RecoTrack.plotting.validation import SimpleValidation
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"

### Track algorithm name and quality. Can be a list.
Collections = ["offlinePrimaryVertices", "selectedOfflinePrimaryVertices"]
Qualities=None

def newdirname(algo, quality):
    ret = ""
    if algo is not None:
        ret += "_"+algo
    return ret


val = SimpleValidation([x[0] for x in filesLabels], [x[1] for x in filesLabels], outputDir)
val.doPlots(Collections, Qualities, vertexPlots.plotter, algoDirMap=lambda a, q: a, newdirFunc=newdirname)
Esempio n. 17
0
# This is an example of plotting the standard tracking validation
# plots from an explicit set of DQM root files.

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()

Esempio n. 18
0
# plots from an explicit set of DQM root files.

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()
Esempio n. 19
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])
    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)))
Esempio n. 20
0
#!/usr/bin/env python

# This is an example of plotting the standard tracking validation
# plots from an explicit set of DQM root files.

import Validation.RecoTrack.plotting.plotting as plotting
from Validation.RecoTrack.plotting.validation import SimpleValidation
import Validation.RecoTrack.plotting.trackingPlots as trackingPlots



# 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"

### Track algorithm name and quality. Can be a list.
Algos= ['ootb', 'initialStep', 'lowPtTripletStep','pixelPairStep','detachedTripletStep','mixedTripletStep','pixelLessStep','tobTecStep','jetCoreRegionalStep','muonSeededStepInOut','muonSeededStepOutIn']
#Algos= ['ootb']
Qualities=['', 'highPurity']

val = SimpleValidation([x[0] for x in filesLabels], [x[1] for x in filesLabels], outputDir)
val.doPlots(Algos, Qualities, trackingPlots.plotter, algoDirMap=trackingPlots._tracks_map)

Esempio n. 21
0
# This is an example of plotting the standard tracking validation
# plots from an explicit set of DQM root files.

import Validation.RecoTrack.plotting.plotting as plotting
from Validation.RecoTrack.plotting.validation import SimpleValidation
import Validation.RecoTrack.plotting.trackingPlots as trackingPlots

# 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"

### Track algorithm name and quality. Can be a list.
Algos = [
    'ootb', 'iter0', 'iter1', 'iter2', 'iter3', 'iter4', 'iter5', 'iter6',
    'iter7', 'iter9', 'iter10'
]
#Algos= ['ootb']
Qualities = ['', 'highPurity']

val = SimpleValidation([x[0] for x in filesLabels],
                       [x[1] for x in filesLabels], outputDir)
val.doPlots(Algos,
            Qualities,
            trackingPlots.plotter,
            algoDirMap=trackingPlots._tracks_map)
        # name is the same as the first parameter to PlotGroup constructor
        plotGroup = plotFolder.getPlotGroup("effandfake1")
        # From PlotGroup one can ask an individual Plot, again name is
        # the same as used for Plot constructor. The setProperties()
        # accepts the same parameters as the constructor, see
        # plotting.Plot for more information.
        plotGroup.getPlot("efficPt").setProperties(legendDx=-0, legendDy=-0, **common)

    # Example of customization of vertex plots
    common["lineWidth"] = 4
    plotFolder = vertexPlots.plotterExt.getPlotFolder("gen")
    plotGroup = plotFolder.getPlotGroup("genpos")
    plotGroup.getPlot("GenAllV_Z").setProperties(xtitle="Simulated vertex z (cm)", legendDy=-0.1, legendDx=-0.45, ratioYmax=2.5, **common)


val = SimpleValidation(samples, outputDir)
report = val.createHtmlReport(validationName=description)
val.doPlots([
    trackingPlots.plotter,     # standard tracking plots
    #trackingPlots.plotterExt, # extended tracking plots (e.g. distributions)
],
            plotterDrawArgs=plotterDrawArgs,
            **kwargs_tracking
)
val.doPlots([
    #trackingPlots.timePlotter, # tracking timing plots
    vertexPlots.plotter,        # standard vertex plots
    #vertexPlots.plotterExt,    # extended vertex plots (e.g. distributions)
],
            plotterDrawArgs=plotterDrawArgs,
)
Esempio n. 23
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)))
Esempio n. 24
0
# plots from an explicit set of DQM root files.

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"
subdirprefix = "sample"


# 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)
#report = val.createHtmlReport("INSERT_YOUR_BASE_URL_HERE", validationName="Short description of your comparison")
#report.beginSample(SimpleSample("prefix", "Sample name"))
val.doPlots(trackingPlots.plotter, subdirprefix=subdirprefix, plotterDrawArgs={"ratio": True},
#            htmlReport=report
)
## Uncomment this to include also vertex plots
##val.doPlots(vertexPlots.plotter, subdirprefix=subdirprefix, plotterDrawArgs={"ratio": True},
##            htmlReport=report
##)
#report.write()