test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SelectRuns.py
Go to the documentation of this file.
1 import os
2 
3 class SelectRuns:
4 
5  BaseDir = "/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/HDQM/Cron/Scripts/RunSelection/Test"
6  Group = "Collisions10"
7  # Group = "Cosmics10"
8  FirstRun = "1"
9  FileName = BaseDir+"/SelectedGoodRuns.txt"
10  HLTNameFilter = ""
11  QualityFlag = "Strip:GOOD"
12 
13  def makeList(self):
14  # Save the old run list file
15  os.system("mv "+self.FileName+" "+self.FileName+".old")
16 
17  # Create the cfg for the run registry script
18  inputFile = open(self.BaseDir+"/runreg_template.cfg", "r")
19  # print "OutputFileName = ", self.FileName
20  outputFileContent = inputFile.read().replace("GROUP", self.Group).replace("FIRSTRUN", self.FirstRun).replace("OUTPUTFILENAME", self.FileName).replace("HLTNAMEFILTER", self.HLTNameFilter).replace("QUALITYFLAG", self.QualityFlag)
21  outputFile = open(self.BaseDir+"/runreg.cfg", "w")
22  outputFile.write(outputFileContent)
23  outputFile.close()
24 
25  # Produce the new run list file
26  os.system("source /afs/cern.ch/cms/ccs/wm/scripts/Crab/crab.sh; python "+self.BaseDir+"/runregparse.py")
27 
28  # Check if the file changed
29  import filecmp
30  if os.path.isfile(self.FileName+".old"):
31  if filecmp.cmp(self.FileName, self.FileName+".old"):
32  # They are equal
33  return 1
34  return 0