99 filesDir =
"LatestRuns/Results/";
100 fileList =
ls(filesDir)
101 listOfRunsAndLumi = {};
103 if(
not listOfRunsAndLumi):
104 listOfRunsAndLumi =
getListOfRunsAndLumiFromFile(-1,
"/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions10/7TeV/StreamExpress/Cert_132440-149442_7TeV_StreamExpress_Collisions10_JSON_v3.txt");
106 runKeys = listOfRunsAndLumi.keys();
109 for fileName
in fileList:
110 regExp = re.search(
'(\D+)(\d+)_(\d+)_(\d+).txt',fileName);
112 error =
"Can't find reg exp";
114 runFiles.append(long(regExp.group(3)));
120 runsAndLumisInRR = {};
123 for lumiRange
in listOfRunsAndLumi[run]:
125 for l
in range(lumiRange[0],lumiRange[1]+1):
126 RRList.append(long(l));
128 runsAndLumisInRR[run] = RRList;
130 runsAndLumisProcessed = {}
131 for fileName
in fileList:
132 file = open(filesDir+fileName)
134 if line.find(
"Runnumber") != -1:
135 run = long(line.replace(
'\n',
'').
split(
' ')[1])
136 elif line.find(
"LumiRange") != -1:
137 lumiLine = line.replace(
'\n',
'').
split(
' ')
138 begLumi = long(lumiLine[1])
139 endLumi = long(lumiLine[3])
140 if begLumi != endLumi:
141 error =
"The lumi range is greater than 1 for run " +
str(run) +
" " + line +
" in file: " + runListDir + fileName
144 if not run
in runsAndLumisProcessed:
145 runsAndLumisProcessed[run] = []
146 if begLumi
in runsAndLumisProcessed[run]:
147 print "Lumi " +
str(begLumi) +
" in event " +
str(run) +
" already exist. This MUST not happen but right now I will ignore this lumi!" 149 runsAndLumisProcessed[run].
append(begLumi)
155 for lumi
in runsAndLumisInRR[run]:
158 if(run
not in runFiles):
159 print "Can't find run", run,
"in the files!" 161 elif(
not lumi
in runsAndLumisProcessed[run]):
162 missingLumis.append(lumi)
163 if(len(missingLumis) != 0):
164 print "In run", run,
"these lumis are missing ->", missingLumis
def getListOfRunsAndLumiFromFile(firstRun=-1, fileName="")