CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProducePlots.py
Go to the documentation of this file.
1 import os
2 
4  def makePlots(self):
5  # 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"
6  # Plots without any selection
7  plotsDir = self.Dir+"/HistoricDQMPlots/Plots_"+self.DetName+"HistoricInfoClient"
8  self.plotAllAndLast40Runs(plotsDir, "NoSelection")
9  # Plots with good runs selection
10  plotsDir = self.Dir+"/HistoricDQMPlots/Plots_"+self.DetName+"HistoricInfoClient"
11  import SelectRuns
12  selectRuns = SelectRuns.SelectRuns()
13  selectRuns.BaseDir = self.Dir
14  selectRuns.Group = self.Group
15  selectRuns.FirstRun = self.FirstRun
16  selectRuns.FileName = self.Dir+"/SelectedGoodRuns_"+self.DetName+"_"+self.RunType+".txt"
17  selectRuns.HLTNameFilter = ""
18  selectRuns.QualityFlag = self.QualityFlag
19  selectRuns.makeList()
20  self.plotAllAndLast40Runs(plotsDir, "GoodRuns", selectRuns.FileName)
21 
22  def plotAllAndLast40Runs(self, plotsDir, selectionType, selectionFileName = "empty"):
23  # Plot all runs
24  os.system("mkdir -pv "+plotsDir)
25  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")
26  self.convertAndMove(plotsDir, selectionType+"/AllRuns")
27  # Plot the last 40 runs
28  os.system("mkdir -pv "+plotsDir)
29  os.system("cd "+self.CMSSW_Version+"/src; eval `scramv1 r -sh`; cd "+plotsDir+"; "+self.DetName+"HDQMInspector "+self.Database+" "+self.TagName+" "+self.Password+" "+selectionFileName+" 40")
30  self.convertAndMove(plotsDir, selectionType+"/Last40Runs")
31 
32  def convertAndMove(self, plotsDir, type):
33  # print "cd "+plotsDir+"; cp "+self.Dir+"/DeanConvert.pl .; ./DeanConvert.pl; rm -f DeanConvert.pl"
34  # print "cp "+self.Dir+"/html/"+self.DetName+"HDQMInspector.html "+plotsDir+"/index.html"
35  # print "rm -rf "+self.StorageDir+"backup/"+self.RunType+"/"+type
36  # print "mkdir -pv "+self.StorageDir+"backup/"+self.RunType+"/"+type
37  # print "mv "+destinationDir+"/Plots_"+self.DetName+"HistoricInfoClient "+self.StorageDir+"backup/"+self.RunType+"/"+type
38  # print "mkdir -pv "+destinationDir
39  # print "mv "+plotsDir+" "+destinationDir
40  # print "cp "+self.Dir+"/index.html "+destinationDir
41  destinationDir = self.StorageDir+"/"+self.RunType+"/"+type
42  # Create the small images and copy the html for the expert plots
43  os.system("cd "+plotsDir+"; cp "+self.Dir+"/DeanConvert.pl .; ./DeanConvert.pl; rm -f DeanConvert.pl")
44  os.system("cp "+self.Dir+"/html/"+self.DetName+"HDQMInspector.html "+plotsDir+"/index.html")
45  # Backup the old files
46  backupDir = self.StorageDir+"backup/"+self.RunType+"/"+type
47  os.system("rm -rf "+backupDir)
48  os.system("mkdir -pv "+backupDir)
49  os.system("mv "+destinationDir+"/Plots_"+self.DetName+"HistoricInfoClient "+backupDir)
50  # Move the plots to the web area and copy the html file for the main web page
51  os.system("mkdir -pv "+destinationDir)
52  os.system("mv "+plotsDir+" "+destinationDir)
53  os.system("cp "+self.Dir+"/index.html "+destinationDir)