10 from __future__
import print_function
11 from xml.dom
import minidom
30 from optparse
import OptionParser
36 """Returns the current line number in our program.""" 37 return inspect.currentframe().f_back.f_lineno
42 sz = info[stat.ST_SIZE]
48 string=
"lumiCalc2.py -c frontier://LumiCalc/CMS_LUMI_PROD -i " 49 string1=
" --nowarning overview >" 50 string2= string + file + string1 + namefile
51 data = os.system(string2)
54 print(
"0 lumi are not avaible")
60 url =
"http://cmsdbsprod.cern.ch/cms_dbs_prod_global/servlet/DBSServlet" 65 args[
'level'] =
'CRITICAL' 68 api = DBSAPI.dbsApi.DbsApi(args)
72 files = api.listFiles(path=dataset,tier_list =site,runNumber=run)
73 except DbsApiException
as ex:
74 print(
"Caught API Exception %s: %s " % (ex.getClassName(), ex.getErrorMessage() ))
76 if ex.getErrorCode()
not in (
None,
""):
77 print(
"DBS Exception Error Code: ", ex.getErrorCode())
84 file1 = open(namefile ,
'w')
85 stringS =
"process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )\n" 86 stringS = stringS +
"readFiles = cms.untracked.vstring()\n" 87 stringS = stringS +
"secFiles = cms.untracked.vstring()\n" 88 stringS = stringS +
"\n" 93 for filename
in file_list:
96 stringS =
"readFiles.extend([\n" 101 stringS = stringS +
str(filename)
102 stringS = stringS +
"',\n" 104 filecount = filecount + 1
115 stringS =
"process.source = cms.Source(\"PoolSource\",\n" 116 stringS = stringS +
" fileNames = readFiles,\n" 117 stringS = stringS +
" secondaryFileNames = secFiles\n" 118 stringS = stringS +
")\n" 124 parser = OptionParser()
125 parser.add_option(
"-w",
"--workspace",
126 dest=
"workspaceName",
128 help=
"define workspace: GLOBAL TRACKER ")
130 parser.add_option(
"-r",
"--regexp",
133 default=
'groupName : LIKE %Collisions12% , runNumber : = 190000 ',
134 help=
" \"{runNumber} >= 148127 and {runNumber} < 148128 \" ")
136 parser.add_option(
"-d",
"--datasetPath",
138 default=
"/MinimumBias/Run2010A-TkAlMinBias-Dec22ReReco_v1/ALCARECO",
139 help=
"For example : --datasetPath /MinimumBias/Run2010A-TkAlMinBias-Dec22ReReco_v1/ALCARECO")
141 parser.add_option(
"-s",
"--site",
144 help=
"For example : site T2_CH_CAF")
146 parser.add_option(
"-i",
"--info",
150 help=
"printout the column names on which it's possible to cut")
152 (options, args) = parser.parse_args()
153 if len(sys.argv) == 1:
154 print(
"\nUsage: %s --help"%sys.argv[0])
163 server = xmlrpclib.ServerProxy(
'http://cms-service-runregistry-api.web.cern.ch/cms-service-runregistry-api/xmlrpc')
166 data = server.RunDatasetTable.export(workspaceName,
'xml_all' ,regexp)
173 for node
in nodelist:
174 if node.nodeType == node.TEXT_NODE:
179 return obj.getElementsByTagName(name)
188 server = xmlrpclib.ServerProxy(
'http://cms-service-runregistry-api.web.cern.ch/cms-service-runregistry-api/xmlrpc')
198 txtLongData+= txtrun + sep +
"\n" 201 if not (test
in lista):
204 file2=open(
"lista_key.txt",
'w')
205 for pkey
in range(len(lista)):
206 pwkey = lista[pkey] +
"\n" 213 for i
in range(len(lista)):
217 nameDBS=
str(i)+
".data" 221 nameLumi=
str(i)+
".lumi" 222 file1 = open( name ,
'w')
228 if (key == lista[i]):
229 print(
"running......", key)
232 txtruns =
"{runNumber} >= " +
printObj(run,
'NUMBER') +
" and {runNumber} <= " +
str(
int(
printObj(run,
'NUMBER')))
233 txtriv = txtruns +
" and {cmpDcsBPix} = 1 and {cmpDcsFPix} = 1 and {cmpDcsTibTid} = 1 and {cmpDcsTob} = 1 and {cmpDcsTecM} = 1 and {cmpDcsTecP} = 1" 234 lumirun = server.RunLumiSectionRangeTable.export(
'GLOBAL',
'json',txtriv)
245 stringDBS = uno[
'LogicalFileName']
246 listaDBS += [stringDBS]
250 if (lumirun == comp):
257 string=
"sed -i 's/}{/, /g'" 259 string2= string +
" " + name
262 os.system(
"sed -i 's/\//_/g' lista_key.txt")
264 for rootLSF
in listaDBS:
265 if not (rootLSF
in listaDBS2):
266 listaDBS2.append(rootLSF)
275 return getData(doc,options,dataset,site)
278 items = regexp.split(
',')
281 key,value = item.split(
':')
282 dd[key.replace(
' ',
'')] = value
289 data=
extractData(options.workspaceName,options.regexp,options.dataset,options.site,options)
def getData(doc, options, dataset, site)
def makecff(file_list, namefile)
file cff data
def printLumi(file, namefile)
lumiCalc
def serverQuery(workspaceName, regexp)
def DBSquery(dataset, site, run)
file dbs
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def extractData(mode, reg, dataset, site, options)
def getElement(obj, name)