CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.

185 def PlotPerformanceCurves(ReleasesToBuildFrom, OutputFile):
186  # Setup
187  myCanvas = TCanvas("Validation", "Validation", 800, 800)
188  # Cut label on the plots
189  CutLabel = TPaveText(0.6, 0.1, 0.9, 0.27, "brNDC")
190  CutLabel.AddText("%0.1f%s < %s < %0.1f%s" % (KinematicVarMin, VarUnit, LatexVar, KinematicVarMax, VarUnit))
191  CutLabel.SetFillStyle(0)
192  CutLabel.SetBorderSize(0)
193 
194  # Build the TGraphs of sigEff versus bkgFakeRate for each release
195  for aRelease in ReleasesToBuildFrom:
196  aRelease.LoadHistograms()
197  aRelease.ComputeEfficiencies()
198  aRelease.BuildTGraphSummary()
199 
200  CurrentHistogram = 0
201 
202  for aRelease in ReleasesToBuildFrom:
203  if CurrentHistogram == 0:
204  aRelease.SummaryTGraph.Draw("ALP")
205  CurrentHistogram = aRelease.SummaryTGraph.GetHistogram()
206  else:
207  aRelease.SummaryTGraph.Draw("LP")
208 
209 
210  CurrentHistogram.SetAxisRange(0, 1)
211  CurrentHistogram.GetYaxis().SetRangeUser(0.0001,1)
212  CurrentHistogram.GetXaxis().SetTitle("Efficiency")
213  CurrentHistogram.GetYaxis().SetTitle("Fake Rate")
214  CurrentHistogram.SetTitle("Performance Points")
215 
216  gPad.SetLogy(True)
217 
218  for aRelease in ReleasesToBuildFrom:
219  for aPoint in aRelease.DiscriminatorPoints:
220  aPoint['PerformancePoint'].Draw("P")
221 
222  TauValidationInfo.SummaryLegend.Draw()
223  TauValidationInfo.DiscriminatorLegend.Draw()
224  CutLabel.Draw()
225 
226  myCanvas.SaveAs(OutputFile)

Variable Documentation

PerformanceCurvePlotter.HideMuonAndElectronRej = True

Definition at line 57 of file PerformanceCurvePlotter.py.

string PerformanceCurvePlotter.KinematicVar = 'pt'

Definition at line 50 of file PerformanceCurvePlotter.py.

int PerformanceCurvePlotter.KinematicVarMax = 50

Definition at line 53 of file PerformanceCurvePlotter.py.

int PerformanceCurvePlotter.KinematicVarMin = 20

Definition at line 52 of file PerformanceCurvePlotter.py.

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

Definition at line 51 of file PerformanceCurvePlotter.py.

string PerformanceCurvePlotter.VarUnit = "GeV/c"

Definition at line 54 of file PerformanceCurvePlotter.py.