CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 import os
00003 import glob
00004 
00005 try:
00006    ReleaseBase = os.path.join(os.environ['CMSSW_BASE'], "src")
00007    ReleaseVersion = os.environ['CMSSW_VERSION']
00008 except KeyError:
00009    print "CMSSW enviroment not set, please run cmsenv!"
00010    sys.exit()
00011 
00012 import FWCore.ParameterSet.Config as cms
00013 import FWCore.ParameterSet.VarParsing as VarParsing
00014 
00015 #options = VarParsing.VarParsing ('standard')
00016 options = VarParsing.VarParsing ()
00017 
00018 options.register( 'usesLegacyProdNames',
00019                   0,
00020                   VarParsing.VarParsing.multiplicity.singleton,
00021                   VarParsing.VarParsing.varType.int,
00022                   "Set to 1 if the reference files contains old (eg pfRecoTauProducer) PFTau product names"
00023                  ) 
00024 
00025 options.register( 'scale',
00026                   'linear',
00027                   VarParsing.VarParsing.multiplicity.singleton,
00028                   VarParsing.VarParsing.varType.string,
00029                   "Set scale of yaxis on plots (linear/log)"
00030                   )
00031 
00032 options.parseArguments()
00033 
00034 process = cms.Process('MakingPlots')
00035 process.DQMStore = cms.Service("DQMStore")
00036 
00037 process.maxEvents = cms.untracked.PSet(            
00038     input = cms.untracked.int32(0)         
00039 )
00040 
00041 process.source = cms.Source("EmptySource")
00042 
00043 # Get test file name
00044 rootFilesInCurrentDirectory = glob.glob("*.root")
00045 if len(rootFilesInCurrentDirectory) != 1:
00046    print "There must be one (and only one) root files in the current directory, otherwise I don't know what to compare!"
00047    sys.exit()
00048 testRootFile = rootFilesInCurrentDirectory[0]
00049 print "Loading test file: ", testRootFile
00050 
00051 EventType = "unknown"
00052 # Get event type
00053 if testRootFile.find("ZTT"):
00054    EventType = 'ZTT'
00055 elif testRootFile.find('QCD'):
00056    EventType = 'QCD'
00057 elif testRootFile.find('ZEE'):
00058    EventType = 'ZEE'
00059 elif testRootFile.find('ZMM'):
00060    EventType = 'ZMM'
00061 
00062 # Output dir to hold the comparision
00063 PlotOutputDir = "SummaryPlots"
00064 if not os.path.exists(PlotOutputDir):
00065    os.makedirs(PlotOutputDir)
00066 
00067 # Load plotting sequences
00068 process.load("Validation.RecoTau.RecoTauValidation_cfi")
00069 #set scale
00070 from Validation.RecoTau.RecoTauValidation_cfi import SetLogScale
00071 from Validation.RecoTau.RecoTauValidation_cfi import SetSmartLogScale
00072 if options.scale == 'log':
00073    print "Setting everything to log scale"
00074    SetLogScale(process.plotTauValidation)
00075 
00076 # Get helper functions
00077 from Validation.RecoTau.RecoTauValidation_cfi import SetTestFileToPlot
00078 from Validation.RecoTau.RecoTauValidation_cfi import SetReferenceFileToPlot
00079 from Validation.RecoTau.RecoTauValidation_cfi import SetPlotDirectory
00080 from Validation.RecoTau.RecoTauValidation_cfi import SetPlotOnlyStepByStep
00081 
00082 #Set the test/reference files
00083 SetTestFileToPlot(process, testRootFile)
00084 SetReferenceFileToPlot(process, None)
00085 
00086 # Set the right plot directory
00087 SetPlotDirectory(process.plotTauValidation, PlotOutputDir)
00088 
00089 # Only plot the summaries (we aren't comparing to anything)
00090 SetPlotOnlyStepByStep(process.plotTauValidation)
00091 
00092 #############################
00093 # Path to be executed
00094 ###############################
00095 
00096 process.p = cms.Path( process.loadTau 
00097                      +process.plotTauValidation
00098                      )
00099 
00100 cfgLog = open(os.path.join(PlotOutputDir, "plot_config.py"), "write")
00101 
00102 print >>cfgLog,  process.dumpPython()
00103  
00104