CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/DQMServices/Diagnostic/scripts/Database/Python/ProducePlots.py

Go to the documentation of this file.
00001 import os
00002 
00003 class ProducePlots:
00004     def makePlots(self):
00005         # print "cd "+self.CMSSW_Version+"/src; eval `scramv1 r -sh`; cd "+self.Dir+"; mkdir -pv HistoricDQMPlots/"+self.TagName+"; cd HistoricDQMPlots/"+self.TagName+"; "+self.DetName+"HDQMInspector "+self.Database+" "+self.TagName+" "+self.Password+" empty 40"
00006         # Plots without any selection
00007         plotsDir = self.Dir+"/HistoricDQMPlots/Plots_"+self.DetName+"HistoricInfoClient"
00008         self.plotAllAndLast40Runs(plotsDir, "NoSelection")
00009         # Plots with good runs selection
00010         plotsDir = self.Dir+"/HistoricDQMPlots/Plots_"+self.DetName+"HistoricInfoClient"
00011         import SelectRuns
00012         selectRuns = SelectRuns.SelectRuns()
00013         selectRuns.BaseDir = self.Dir
00014         selectRuns.Group = self.Group
00015         selectRuns.FirstRun = self.FirstRun
00016         selectRuns.FileName = self.Dir+"/SelectedGoodRuns_"+self.DetName+"_"+self.RunType+".txt"
00017         selectRuns.HLTNameFilter = ""
00018         selectRuns.QualityFlag = self.QualityFlag
00019         selectRuns.makeList()
00020         self.plotAllAndLast40Runs(plotsDir, "GoodRuns", selectRuns.FileName)
00021 
00022     def plotAllAndLast40Runs(self, plotsDir, selectionType, selectionFileName = "empty"):
00023         # Plot all runs
00024         os.system("mkdir -pv "+plotsDir)
00025         os.system("cd "+self.CMSSW_Version+"/src; eval `scramv1 r -sh`; cd "+plotsDir+"; "+self.DetName+"HDQMInspector "+self.Database+" "+self.TagName+" "+self.Password+" "+selectionFileName+" 1 2000000")
00026         self.convertAndMove(plotsDir, selectionType+"/AllRuns")
00027         # Plot the last 40 runs
00028         os.system("mkdir -pv "+plotsDir)
00029         os.system("cd "+self.CMSSW_Version+"/src; eval `scramv1 r -sh`; cd "+plotsDir+"; "+self.DetName+"HDQMInspector "+self.Database+" "+self.TagName+" "+self.Password+" "+selectionFileName+" 40")
00030         self.convertAndMove(plotsDir, selectionType+"/Last40Runs")
00031 
00032     def convertAndMove(self, plotsDir, type):
00033         # print "cd "+plotsDir+"; cp "+self.Dir+"/DeanConvert.pl .; ./DeanConvert.pl; rm -f DeanConvert.pl"
00034         # print "cp "+self.Dir+"/html/"+self.DetName+"HDQMInspector.html "+plotsDir+"/index.html"
00035         # print "rm -rf "+self.StorageDir+"backup/"+self.RunType+"/"+type
00036         # print "mkdir -pv "+self.StorageDir+"backup/"+self.RunType+"/"+type
00037         # print "mv "+destinationDir+"/Plots_"+self.DetName+"HistoricInfoClient "+self.StorageDir+"backup/"+self.RunType+"/"+type
00038         # print "mkdir -pv "+destinationDir
00039         # print "mv "+plotsDir+" "+destinationDir
00040         # print "cp "+self.Dir+"/index.html "+destinationDir
00041         destinationDir = self.StorageDir+"/"+self.RunType+"/"+type
00042         # Create the small images and copy the html for the expert plots
00043         os.system("cd "+plotsDir+"; cp "+self.Dir+"/DeanConvert.pl .; ./DeanConvert.pl; rm -f DeanConvert.pl")
00044         os.system("cp "+self.Dir+"/html/"+self.DetName+"HDQMInspector.html "+plotsDir+"/index.html")
00045         # Backup the old files
00046         backupDir = self.StorageDir+"backup/"+self.RunType+"/"+type
00047         os.system("rm -rf "+backupDir)
00048         os.system("mkdir -pv "+backupDir)
00049         os.system("mv "+destinationDir+"/Plots_"+self.DetName+"HistoricInfoClient "+backupDir)
00050         # Move the plots to the web area and copy the html file for the main web page
00051         os.system("mkdir -pv "+destinationDir)
00052         os.system("mv "+plotsDir+" "+destinationDir)
00053         os.system("cp "+self.Dir+"/index.html "+destinationDir)