101 filesDir =
"LatestRuns/Results/";
102 fileList =
ls(filesDir)
103 listOfRunsAndLumi = {};
105 if(
not listOfRunsAndLumi):
106 listOfRunsAndLumi =
getListOfRunsAndLumiFromFile(-1,
"/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions10/7TeV/StreamExpress/Cert_132440-149442_7TeV_StreamExpress_Collisions10_JSON_v3.txt");
108 runKeys = listOfRunsAndLumi.keys();
111 for fileName
in fileList:
112 regExp = re.search(
'(\D+)(\d+)_(\d+)_(\d+).txt',fileName);
114 error =
"Can't find reg exp";
116 runFiles.append(long(regExp.group(3)));
122 runsAndLumisInRR = {};
125 for lumiRange
in listOfRunsAndLumi[run]:
127 for l
in range(lumiRange[0],lumiRange[1]+1):
128 RRList.append(long(l));
130 runsAndLumisInRR[run] = RRList;
132 runsAndLumisProcessed = {}
133 for fileName
in fileList:
134 file = open(filesDir+fileName)
136 if line.find(
"Runnumber") != -1:
137 run = long(line.replace(
'\n',
'').
split(
' ')[1])
138 elif line.find(
"LumiRange") != -1:
139 lumiLine = line.replace(
'\n',
'').
split(
' ')
140 begLumi = long(lumiLine[1])
141 endLumi = long(lumiLine[3])
142 if begLumi != endLumi:
143 error =
"The lumi range is greater than 1 for run " +
str(run) +
" " + line +
" in file: " + runListDir + fileName
146 if not run
in runsAndLumisProcessed:
147 runsAndLumisProcessed[run] = []
148 if begLumi
in runsAndLumisProcessed[run]:
149 print(
"Lumi " +
str(begLumi) +
" in event " +
str(run) +
" already exist. This MUST not happen but right now I will ignore this lumi!")
151 runsAndLumisProcessed[run].
append(begLumi)
157 for lumi
in runsAndLumisInRR[run]:
160 if(run
not in runFiles):
161 print(
"Can't find run", run,
"in the files!")
163 elif(
not lumi
in runsAndLumisProcessed[run]):
164 missingLumis.append(lumi)
165 if(len(missingLumis) != 0):
166 print(
"In run", run,
"these lumis are missing ->", missingLumis)
def getListOfRunsAndLumiFromFile(firstRun=-1, fileName="")
S & print(S &os, JobReport::InputFile const &f)