CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Validation/RecoTau/Tools/PlotPerformanceCurves.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import FWCore.ParameterSet.Config as cms
00004 import FWCore.ParameterSet.VarParsing as VarParsing
00005 
00006 from PerformanceCurvePlotter import *
00007 
00008 options = VarParsing.VarParsing ()
00009 
00010 options.register( 'signalFiles',
00011                   [os.cwd()],
00012                   VarParsing.VarParsing.multiplicity.list,
00013                   VarParsing.VarParsing.varType.string,
00014                   "Specify path(s) to signal files(s)"
00015                  )
00016 
00017 options.register( 'backgroundFiles',
00018                   [],
00019                   VarParsing.VarParsing.multiplicity.list,
00020                   VarParsing.VarParsing.varType.string,
00021                   "Specify paths(s) to background files(s)"
00022                  )
00023 
00024 options.register( 'referenceLabels',
00025                   [],
00026                   VarParsing.VarParsing.multiplicity.list,
00027                   VarParsing.VarParsing.varType.string,
00028                   "Specify labels for each sig/bkg pair"
00029                 )
00030 
00031 options.register( 'ValidationSequence',
00032                   'RunTancValidation',
00033                   VarParsing.VarParsing.multiplicity.singleton,
00034                   VarParsing.VarParsing.varType.sring,
00035                   "Specify the sequence of discriminators to plot.  They are defined \
00036                    in the NUMERATOR/DENOMINATOR section of RecoTauValidation_cff "
00037                  )
00038 
00039 
00040 options.parseArguments()
00041 
00042 if not hasattr(Validation.RecoTau.RecoTauValidation_cfi, options.ValidationSequence):
00043    print "Error: Validation sequence %s is not defined in Validation.RecoTau.RecoTauValidation_cfi!!" % options.ValidationSequence
00044 
00045 filesAndLabels = zip(options.signalFiles, options.backgroundFiles, options.referenceLabels)
00046 
00047 ReleaseToPlot = []
00048 
00049 def checkFile(theFile):
00050    if not os.path.isfile(theFile):
00051       print "Can't stat file %s!" % theFile
00052       sys.exit()
00053 
00054 for signalFile, backgroundFile, referenceLabel:
00055    checkFile(signalFile)
00056    checkFile(backgroundFile)
00057    toPlot = TauValidationInfo(signalFiles,
00058                               backgroundFile,
00059                               referenceLabels,
00060                               getattr(Validation.RecoTau.RecoTauValidation_cfi, options.ValidationSequence)
00061                               )
00062    ReleaseToPlot.append(toPlot)
00063 
00064 if not os.path.exists("SummaryPlots"):
00065    os.mkdir("SummaryPlots)
00066 
00067 myOutputFileName = os.path.join("SummaryPlots", "PerformanceCurve.png")
00068 
00069 PlotPerformanceCurves(ReleaseToPlot, myOutputFileName)