CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PlotPerformanceCurves.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import FWCore.ParameterSet.Config as cms
4 import FWCore.ParameterSet.VarParsing as VarParsing
5 
6 from PerformanceCurvePlotter import *
7 
9 
10 options.register( 'signalFiles',
11  [os.cwd()],
12  VarParsing.VarParsing.multiplicity.list,
13  VarParsing.VarParsing.varType.string,
14  "Specify path(s) to signal files(s)"
15  )
16 
17 options.register( 'backgroundFiles',
18  [],
19  VarParsing.VarParsing.multiplicity.list,
20  VarParsing.VarParsing.varType.string,
21  "Specify paths(s) to background files(s)"
22  )
23 
24 options.register( 'referenceLabels',
25  [],
26  VarParsing.VarParsing.multiplicity.list,
27  VarParsing.VarParsing.varType.string,
28  "Specify labels for each sig/bkg pair"
29  )
30 
31 options.register( 'ValidationSequence',
32  'RunTancValidation',
33  VarParsing.VarParsing.multiplicity.singleton,
34  VarParsing.VarParsing.varType.sring,
35  "Specify the sequence of discriminators to plot. They are defined \
36  in the NUMERATOR/DENOMINATOR section of RecoTauValidation_cff "
37  )
38 
39 
40 options.parseArguments()
41 
42 if not hasattr(Validation.RecoTau.RecoTauValidation_cfi, options.ValidationSequence):
43  print "Error: Validation sequence %s is not defined in Validation.RecoTau.RecoTauValidation_cfi!!" % options.ValidationSequence
44 
45 filesAndLabels = zip(options.signalFiles, options.backgroundFiles, options.referenceLabels)
46 
47 ReleaseToPlot = []
48 
49 def checkFile(theFile):
50  if not os.path.isfile(theFile):
51  print "Can't stat file %s!" % theFile
52  sys.exit()
53 
54 for signalFile, backgroundFile, referenceLabel:
55  checkFile(signalFile)
56  checkFile(backgroundFile)
57  toPlot = TauValidationInfo(signalFiles,
58  backgroundFile,
59  referenceLabels,
60  getattr(Validation.RecoTau.RecoTauValidation_cfi, options.ValidationSequence)
61  )
62  ReleaseToPlot.append(toPlot)
63 
64 if not os.path.exists("SummaryPlots"):
65  os.mkdir("SummaryPlots)
66 
67 myOutputFileName = os.path.join("SummaryPlots", "PerformanceCurve.png")
68 
69 PlotPerformanceCurves(ReleaseToPlot, myOutputFileName)