Functions | |
def | DBSquery |
file dbs | |
def | defineOptions |
def | extractData |
def | filesize1 |
def | getData |
def | getElement |
def | getRegExp |
def | getText |
def | makecff |
file cff data | |
def | printLumi |
lumiCalc | |
def | printObj |
def | serverQuery |
Variables | |
tuple | data = extractData(options.workspaceName,options.regexp,options.dataset,options.site,options) |
int | DEBUG = 0 |
DEBUG. | |
tuple | options = defineOptions() |
def AlCaHLTBitMon_QueryRunRegistry::DBSquery | ( | dataset, | |
site, | |||
run | |||
) |
file dbs
Definition at line 52 of file AlCaHLTBitMon_QueryRunRegistry.py.
def AlCaHLTBitMon_QueryRunRegistry::defineOptions | ( | ) |
Definition at line 103 of file AlCaHLTBitMon_QueryRunRegistry.py.
00104 : 00105 parser = OptionParser() 00106 parser.add_option("-w", "--workspace", 00107 dest="workspaceName", 00108 default="GLOBAL", 00109 help="define workspace: GLOBAL TRACKER ") 00110 00111 parser.add_option("-r", "--regexp", 00112 dest="regexp", 00113 type="string", 00114 default='groupName : LIKE %Collisions10% , runNumber : = 136088', 00115 help=" \"{runNumber} >= 148127 and {runNumber} < 148128 \" ") 00116 00117 parser.add_option("-d", "--datasetPath", 00118 dest="dataset", \ 00119 default="/MinimumBias/Run2010A-TkAlMinBias-Dec22ReReco_v1/ALCARECO", 00120 help="For example : --datasetPath /MinimumBias/Run2010A-TkAlMinBias-Dec22ReReco_v1/ALCARECO") 00121 00122 parser.add_option("-s", "--site", 00123 dest="site", 00124 default="T2_CH_CAF", 00125 help="For example : site T2_CH_CAF") 00126 00127 parser.add_option("-i", "--info", 00128 action="store_true", 00129 dest="info", 00130 default=False, 00131 help="printout the column names on which it's possible to cut") 00132 00133 (options, args) = parser.parse_args() 00134 if len(sys.argv) == 1: 00135 print("\nUsage: %s --help"%sys.argv[0]) 00136 sys.exit(0) 00137 00138 return options 00139
def AlCaHLTBitMon_QueryRunRegistry::extractData | ( | mode, | |
reg, | |||
dataset, | |||
site, | |||
options | |||
) |
Definition at line 247 of file AlCaHLTBitMon_QueryRunRegistry.py.
def AlCaHLTBitMon_QueryRunRegistry::filesize1 | ( | n | ) |
Definition at line 34 of file AlCaHLTBitMon_QueryRunRegistry.py.
00034 : 00035 info = os.stat(n) 00036 sz = info[stat.ST_SIZE] 00037 return sz 00038
def AlCaHLTBitMon_QueryRunRegistry::getData | ( | doc, | |
options, | |||
dataset, | |||
site | |||
) |
Definition at line 165 of file AlCaHLTBitMon_QueryRunRegistry.py.
Referenced by HcalTBWriter::extractEventInfo(), PixelPopConDCSSourceHandler< Type >::getNewObjects(), and HcalTBSource::produce().
00166 : 00167 server = xmlrpclib.ServerProxy('https://cms-service-runregistry-api.web.cern.ch/cms-service-runregistry-api/xmlrpc') 00168 runs = getElement(doc,'RUN') 00169 txtLongData="" 00170 txtkey="" 00171 lista=[] 00172 00173 sep="\t" 00174 00175 for run in runs: 00176 txtrun=printObj(run,'NUMBER') + sep + printObj(run,'HLTKEY') 00177 txtLongData+= txtrun + sep + "\n" 00178 00179 for run in runs: 00180 test=printObj(run,'HLTKEY') 00181 if not (test in lista): 00182 lista.append(test) 00183 00184 file2=open("lista_key.txt",'w') 00185 for pkey in range(len(lista)): 00186 pwkey = lista[pkey] +"\n" 00187 file2.write(pwkey) 00188 00189 file2.close() 00190 00191 for i in range(len(lista)): 00192 if DEBUG: 00193 print lista[i] 00194 nameDBS="" 00195 nameDBS=str(i)+".data" 00196 name="" 00197 name=str(i)+".json" 00198 nameLumi="" 00199 nameLumi=str(i)+".lumi" 00200 file1 = open( name ,'w') 00201 listaDBS = [] 00202 if DEBUG: 00203 print nameDBS 00204 for run in runs: 00205 key=printObj(run,'HLTKEY') 00206 if (key == lista[i]): 00207 print "running......" 00208 if DEBUG: 00209 print printObj(run,'NUMBER') 00210 txtruns = "{runNumber} >= " + printObj(run,'NUMBER') + " and {runNumber} < " + str(int(printObj(run,'NUMBER'))+1) 00211 txtriv = txtruns + " and {cmpPix} in ('GOOD') and {cmpStrip} in ('GOOD') and {cmpTrack} in ('GOOD')" 00212 riv = server.RunDatasetTable.export('GLOBAL', 'csv_run_numbers',txtriv) 00213 if riv: 00214 lumirun = server.RunLumiSectionRangeTable.export('GLOBAL', 'json',txtruns) 00215 ###dbs file 00216 file = DBSquery(dataset,site,str(printObj(run,'NUMBER'))) 00217 for uno in file: 00218 stringDBS = {} 00219 stringDBS = uno['LogicalFileName'] 00220 listaDBS += [stringDBS] 00221 ### 00222 if DEBUG: 00223 print lumirun 00224 comp="{}" 00225 if (lumirun == comp): 00226 print "LUMI ZERO" 00227 else: 00228 file1.write(lumirun) 00229 00230 file1.close() 00231 string="" 00232 string="sed -i 's/}{/, /g'" 00233 string2="" 00234 string2= string + " " + name 00235 os.system(string2) 00236 printLumi(name,nameLumi) 00237 os.system("sed -i 's/\//_/g' lista_key.txt") 00238 listaDBS2 =[] 00239 for rootLSF in listaDBS: 00240 if not (rootLSF in listaDBS2): 00241 listaDBS2.append(rootLSF) 00242 makecff(listaDBS2,nameDBS) 00243 00244 return txtLongData 00245 00246 #---------------------------------------------
def AlCaHLTBitMon_QueryRunRegistry::getElement | ( | obj, | |
name | |||
) |
Definition at line 158 of file AlCaHLTBitMon_QueryRunRegistry.py.
Referenced by CSCBaseElectronicsSim::simulate().
def AlCaHLTBitMon_QueryRunRegistry::getRegExp | ( | regexp | ) |
Definition at line 251 of file AlCaHLTBitMon_QueryRunRegistry.py.
def AlCaHLTBitMon_QueryRunRegistry::getText | ( | nodelist | ) |
Definition at line 151 of file AlCaHLTBitMon_QueryRunRegistry.py.
def AlCaHLTBitMon_QueryRunRegistry::makecff | ( | file_list, | |
namefile | |||
) |
file cff data
Definition at line 63 of file AlCaHLTBitMon_QueryRunRegistry.py.
00064 : 00065 file1 = open(namefile ,'w') 00066 stringS = "process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )\n" 00067 stringS = stringS + "readFiles = cms.untracked.vstring()\n" 00068 stringS = stringS + "secFiles = cms.untracked.vstring()\n" 00069 stringS = stringS + "\n" 00070 file1.write(stringS) 00071 00072 filecount = 0 00073 extendOpen = 0 00074 for filename in file_list: 00075 00076 if extendOpen == 0: 00077 stringS = "readFiles.extend([\n" 00078 file1.write(stringS) 00079 extendOpen = 1 00080 00081 stringS = " '" 00082 stringS = stringS + str(filename) 00083 stringS = stringS + "',\n" 00084 file1.write(stringS) 00085 filecount = filecount + 1 00086 if filecount == 50: 00087 stringS = "])\n\n" 00088 file1.write(stringS) 00089 filecount = 0 00090 extendOpen = 0 00091 00092 if extendOpen == 1: 00093 stringS = "])\n\n" 00094 file1.write(stringS) 00095 00096 stringS = "process.source = cms.Source(\"PoolSource\",\n" 00097 stringS = stringS + " fileNames = readFiles,\n" 00098 stringS = stringS + " secondaryFileNames = secFiles\n" 00099 stringS = stringS + ")\n" 00100 file1.write(stringS) 00101 file1.close() 00102
def AlCaHLTBitMon_QueryRunRegistry::printLumi | ( | file, | |
namefile | |||
) |
lumiCalc
Definition at line 40 of file AlCaHLTBitMon_QueryRunRegistry.py.
00041 : 00042 if(filesize1(file) != 0): 00043 string= "lumiCalc.py -c frontier://LumiCalc/CMS_LUMI_PROD -i " 00044 string1= " --nowarning overview >" 00045 string2= string + file + string1 + namefile 00046 data = os.system(string2) 00047 else: 00048 data = "" 00049 print "0 lumi are not avaible" 00050 return data
def AlCaHLTBitMon_QueryRunRegistry::printObj | ( | obj, | |
name | |||
) |
Definition at line 161 of file AlCaHLTBitMon_QueryRunRegistry.py.
def AlCaHLTBitMon_QueryRunRegistry::serverQuery | ( | workspaceName, | |
regexp | |||
) |
Definition at line 140 of file AlCaHLTBitMon_QueryRunRegistry.py.
00141 : 00142 00143 # get handler to RR XML-RPC server 00144 server = xmlrpclib.ServerProxy('https://cms-service-runregistry-api.web.cern.ch/cms-service-runregistry-api/xmlrpc') 00145 if DEBUG: 00146 print regexp 00147 data = server.RunDatasetTable.export(workspaceName,'xml_all' ,regexp) 00148 return data 00149 00150 #----------------------------------------------------
tuple AlCaHLTBitMon_QueryRunRegistry::data = extractData(options.workspaceName,options.regexp,options.dataset,options.site,options) |
Definition at line 263 of file AlCaHLTBitMon_QueryRunRegistry.py.
DEBUG.
Definition at line 31 of file AlCaHLTBitMon_QueryRunRegistry.py.
tuple AlCaHLTBitMon_QueryRunRegistry::options = defineOptions() |
Definition at line 262 of file AlCaHLTBitMon_QueryRunRegistry.py.