2 "Interface with the DBS API to get the whatever you want of a requirements. ALWAYS RETURN A LIST OF STRINGS"
3 from xml.dom.minidom
import parseString
4 from DBSAPI.dbsApi
import DbsApi
6 args[
'url']=
'http://cmsdbsprod.cern.ch/cms_dbs_prod_global/servlet/DBSServlet'
7 args[
'version']=
'DBS_2_0_9'
10 data = api.executeQuery(
"find %s where %s" % (toFind, requirements))
12 dbs = domresults.getElementsByTagName(
'dbs')
13 result = dbs[0].getElementsByTagName(
'results')
14 rows=result[0].getElementsByTagName(
'row')
17 resultXML = row.getElementsByTagName(toFind)[0]
18 node=(resultXML.childNodes)[0]
19 retList.append(str(node.nodeValue))
25 'ZTT' : {
'primds' :
'RelValZTT',
'tier' :
'GEN-SIM-RECO',},
26 'QCD' : {
'primds' :
'RelValQCD_FlatPt_15_3000',
'tier' :
'GEN-SIM-RECO',},
27 'ZMM' : {
'primds' :
'RelValZMM',
'tier' :
'GEN-SIM-RECO',},
28 'ZEE' : {
'primds' :
'RelValZEE',
'tier' :
'GEN-SIM-RECO',},
30 'RealData' : {
'primds' :
'Jet',
'tier' :
'RECO',
'dataset' :
'*RelVal*'},
31 'RealMuonsData' : {
'primds' :
'Mu',
'tier' :
'RECO',
'dataset' :
'*RelVal*'},
32 'RealElectronsData' : {
'primds' :
'Electron',
'tier' :
'RECO',
'dataset' :
'*RelVal*'},
34 'ZTTFastSim' : {
'primds' :
'RelValZTT',
'tier' :
'GEN-SIM-DIGI-RECO',
'dataset' :
'*FastSim*',},
37 'ZEEFastSim' : {
'primds' :
'RelValZEE',
'tier' :
'GEN-SIM-DIGI-RECO',
'dataset' :
'*FastSim*',},
43 for item
in datasetDict[eventType].
items():
44 requirements += item[0]+
' = '+item[1]+
' and '
45 requirements +=
'release = %s' % os.environ[
'CMSSW_VERSION']
49 print "Multiple datasets found for %s! Which one you would like to use?" % eventType
51 print "%s : %s" % (foundDs.index(ds),ds)
52 cnum = int(raw_input(
"\nselect Dataset: "))
54 elif len(foundDs) == 0:
55 print "Sorry! No Dataset found, exiting..."
59 requirements =
'dataset = %s' % selDs
62 source.fileNames.append(entry)
66 for key
in root.keys():
67 if isinstance(root[key], dict):
68 xmlstr =
'%s<%s>%s</%s>' % (xmlstr, key,
serialize(root[key]), key)
69 elif isinstance(root[key], list):
70 xmlstr =
'%s<%s>' % (xmlstr, key)
71 for item
in root[key]:
72 xmlstr =
'%s%s' % (xmlstr,
serialize(item))
73 xmlstr =
'%s</%s>' % (xmlstr, key)
76 xmlstr =
'%s<%s>%s</%s>' % (xmlstr, key, value, key)
80 from xml.dom.minidom
import parseString
82 return outdom.toprettyxml()
85 from xml.dom.minidom
import parse
86 wrappedCont =
parse(xml)
87 content = wrappedCont.getElementsByTagName(
'dataFiles')[0]
88 byType = content.getElementsByTagName(eventType)
91 fnames = byType[0].getElementsByTagName(
'file')
93 node = (fname.childNodes)[0]
94 source.fileNames.append(str(node.nodeValue).
replace(
'\n',
'').
replace(
'\t',
''))
void parseString(std::string &title)