CMS 3D CMS Logo

Classes | Functions | Variables

PerformanceCurvePlotter Namespace Reference

Classes

class  TauValidationInfo

Functions

def PlotPerformanceCurves

Variables

 HideMuonAndElectronRej = True
string KinematicVar = 'pt'
int KinematicVarMax = 50
int KinematicVarMin = 20
string LatexVar = "True p_{T}"
string VarUnit = "GeV/c"

Detailed Description

    PerformanceCurvePlotter

    Author: Evan K. Friis, UC Davis (friis@physics.ucdavis.edu)

    Plot the efficiency for a given fake rate 
    for a series of cuts in a set pt range.

    With the default cuts (20 < pt < 50), this is designed
    to reproduce (independently) the TancBenchmark plots produced in
    RecoTauTag/TauTagTools/test/MVABenchmarks.py


        Instructions:

        Add the releases to as shown.  You must specify and signal 
        and backround file for each release, and a descriptive label.
        To choose the chain of discriminators to plot, select the appropriate
        EDProducer defined in Validation.RecoTau.TauTagValidation_cfi

        PreFourTanc = TauValidationInfo("Signal.root", 
                                        "Background.root",
                                        "310pre5 TaNC",
                                        Validation.RecoTau.RecoTauValidation_cfi.RunTancValidation)

        PreFourIso = TauValidationInfo("Signal.root", 
                                        "Background.root",
                                        "310pre4 Iso",
                                        Validation.RecoTau.RecoTauValidation_cfi.PFTausHighEfficiencyLeadingPionBothProngs)


        ReleasesToBuildFrom = []
        ReleasesToBuildFrom.append(PreFourTanc)
        ReleasesToBuildFrom.append(PreFourIso)

        PlotPerformanceCurves(ReleasesToBuildFrom, "output.png")


Function Documentation

def PerformanceCurvePlotter::PlotPerformanceCurves (   ReleasesToBuildFrom,
  OutputFile 
)

Definition at line 184 of file PerformanceCurvePlotter.py.

00185                                                           :
00186    # Setup
00187    myCanvas = TCanvas("Validation", "Validation", 800, 800)
00188    # Cut label on the plots
00189    CutLabel = TPaveText(0.6, 0.1, 0.9, 0.27, "brNDC")
00190    CutLabel.AddText("%0.1f%s < %s < %0.1f%s" % (KinematicVarMin, VarUnit, LatexVar, KinematicVarMax, VarUnit))
00191    CutLabel.SetFillStyle(0)
00192    CutLabel.SetBorderSize(0)
00193 
00194    # Build the TGraphs of sigEff versus bkgFakeRate for each release
00195    for aRelease in ReleasesToBuildFrom:
00196       aRelease.LoadHistograms()
00197       aRelease.ComputeEfficiencies()
00198       aRelease.BuildTGraphSummary()
00199 
00200    CurrentHistogram = 0
00201 
00202    for aRelease in ReleasesToBuildFrom:
00203       if CurrentHistogram == 0:
00204          aRelease.SummaryTGraph.Draw("ALP")
00205          CurrentHistogram = aRelease.SummaryTGraph.GetHistogram()
00206       else:
00207          aRelease.SummaryTGraph.Draw("LP")
00208 
00209 
00210    CurrentHistogram.SetAxisRange(0, 1)
00211    CurrentHistogram.GetYaxis().SetRangeUser(0.0001,1)
00212    CurrentHistogram.GetXaxis().SetTitle("Efficiency")
00213    CurrentHistogram.GetYaxis().SetTitle("Fake Rate")
00214    CurrentHistogram.SetTitle("Performance Points")
00215 
00216    gPad.SetLogy(True)
00217 
00218    for aRelease in ReleasesToBuildFrom:
00219       for aPoint in aRelease.DiscriminatorPoints:
00220          aPoint['PerformancePoint'].Draw("P")
00221 
00222    TauValidationInfo.SummaryLegend.Draw()
00223    TauValidationInfo.DiscriminatorLegend.Draw()
00224    CutLabel.Draw()
00225 
00226    myCanvas.SaveAs(OutputFile)

Variable Documentation

Definition at line 57 of file PerformanceCurvePlotter.py.

Definition at line 50 of file PerformanceCurvePlotter.py.

Definition at line 53 of file PerformanceCurvePlotter.py.

Definition at line 52 of file PerformanceCurvePlotter.py.

string PerformanceCurvePlotter::LatexVar = "True p_{T}"

Definition at line 51 of file PerformanceCurvePlotter.py.

Definition at line 54 of file PerformanceCurvePlotter.py.