Classes | |
class | IOV |
class | ParsingError |
Functions | |
def | cmp_tags |
def | dump_footer |
def | dump_header |
def | exit |
def | get_lastIOVs |
def | get_listoftags |
def | get_plots |
def | get_productionFiles |
def | get_productionIOVs |
def | nonzero |
def | pack |
def | parse |
def | unpack |
def | unpackLumiid |
def | write_iovs |
def | write_plots |
def | write_tags |
Variables | |
string | auth = "/afs/cern.ch/cms/DB/conddb" |
string | br = '<BR>' |
string | dest = "oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT" |
Get the latest tags dest = "frontier://cmsfrontier.cern.ch:8000/Frontier/CMS_COND_31X_BEAMSPOT". | |
string | end = '\n' |
string | htmlwebsite = "https://yumiceva.web.cern.ch/yumiceva/beamspot/" |
tuple | lasttag = list_lastIOVs.keys() |
list | lines = [] |
tuple | list_lastIOVs = get_lastIOVs( list_tags, dest, auth) |
tuple | list_tags = get_listoftags( dest, auth) |
string | optionstring = "" |
tuple | outfile = open(option.output,'w') |
tuple | pngfiles = get_plots(option.path,option.output, list_lastIOVs[lasttag], lasttag) |
tuple | processedruns = get_productionIOVs('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_BSPOT/yumiceva/tmp_lumi_workflow/') |
tuple | USAGE = re.compile(r'(?s)\s*usage: (.*?)(\n[ \t]*\n|$)') |
def beamvalidation::cmp_tags | ( | a, | |
b | |||
) |
Definition at line 77 of file beamvalidation.py.
00078 : 00079 00080 yeara = int(a.split('_')[1]) 00081 yearb = int(b.split('_')[1]) 00082 00083 if yeara < yearb: return -1 00084 if yeara > yearb: return 1 00085 00086 suffix = "_offline" 00087 if a.find("_express") != -1: 00088 suffix = "_express" 00089 if a.find("_prompt") != -1: 00090 suffix = "_prompt" 00091 00092 tmpa = a.replace("BeamSpotObjects_2009_v","") 00093 tmpa = tmpa.replace(suffix,"") 00094 00095 tmpb = b.replace("BeamSpotObjects_2009_v","") 00096 tmpb = tmpb.replace(suffix,"") 00097 00098 na = int(tmpa) 00099 nb = int(tmpb) 00100 if na < nb: return -1 00101 if na == nb: return 0 00102 if na > nb: return 1 00103 00104 #___
def beamvalidation::dump_footer | ( | lines | ) |
Definition at line 125 of file beamvalidation.py.
def beamvalidation::dump_header | ( | lines | ) |
Definition at line 105 of file beamvalidation.py.
00106 : 00107 00108 lines.append(''' 00109 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> 00110 <head><title>Beam Spot Calibration Status</title></head> 00111 00112 <body> 00113 00114 <H1>Status of the Beam Spot Calibration</H1> 00115 <BR> 00116 <BR> 00117 This page is updated every 10 minutes: 00118 <BR> 00119 <strong><script src="datemod.js" 00120 type="text/javascript"></script></strong> 00121 00122 ''') 00123 00124 #____
def beamvalidation::exit | ( | msg = "" | ) |
Definition at line 50 of file beamvalidation.py.
def beamvalidation::get_lastIOVs | ( | listoftags, | |
dest, | |||
auth | |||
) |
Definition at line 228 of file beamvalidation.py.
00229 : 00230 00231 dbtags = ['offline','express','prompt'] 00232 00233 results = {} 00234 for itag in dbtags: 00235 00236 lasttag = listoftags[itag][0] 00237 #fix for the moment to read old tags 00238 if itag != "offline": 00239 lasttag = listoftags[itag][1] 00240 00241 queryIOVs_cmd = "cmscond_list_iov -c "+dest+" -P "+auth+" -t "+ lasttag 00242 print queryIOVs_cmd 00243 00244 outcmd = commands.getstatusoutput( queryIOVs_cmd ) 00245 00246 tmparr = outcmd[1].split('\n') 00247 00248 TimeType = tmparr[1].split()[1] 00249 listIOVs = [] 00250 00251 # look at number of payloads 00252 lastline = tmparr[len(tmparr)-1].split() 00253 npayloads = int( lastline[len(lastline)-1] ) 00254 00255 maxIOVs = 3 00256 if npayloads < 3: 00257 maxIOVs = npayloads 00258 # pick the last three IOVs 00259 for i in range(0,maxIOVs): 00260 tmpline = tmparr[len(tmparr) -2 -i] 00261 aIOV = IOV() 00262 aIOV.IOVfirst = tmpline.split()[0] 00263 aIOV.IOVlast = tmpline.split()[1] 00264 aIOV.type = TimeType 00265 listIOVs.append( aIOV ) 00266 00267 results[lasttag] = listIOVs 00268 00269 return results 00270 00271 # # lumi tools CondCore/Utilities/python/timeUnitHelper.py
def beamvalidation::get_listoftags | ( | dest, | |
auth | |||
) |
Definition at line 184 of file beamvalidation.py.
00185 : 00186 00187 queryTags_cmd = "cmscond_list_iov -c "+dest+" -P "+auth+" -a | grep BeamSpotObjects" 00188 print queryTags_cmd 00189 outcmd = commands.getstatusoutput( queryTags_cmd ) 00190 print outcmd[1] 00191 00192 listtags = outcmd[1].split() 00193 00194 listtags_offline = [] 00195 for itag in listtags: 00196 if itag[len(itag)-7:len(itag)] == "offline": 00197 listtags_offline.append(itag) 00198 listtags_express = [] 00199 for itag in listtags: 00200 if itag[len(itag)-7:len(itag)] == "express": 00201 listtags_express.append(itag) 00202 listtags_prompt = [] 00203 for itag in listtags: 00204 if itag[len(itag)-6:len(itag)] == "prompt": 00205 listtags_prompt.append(itag) 00206 00207 listtags_offline.sort( cmp = cmp_tags ) 00208 listtags_offline.reverse() 00209 listtags_express.sort( cmp = cmp_tags ) 00210 listtags_express.reverse() 00211 listtags_prompt.sort( cmp = cmp_tags ) 00212 listtags_prompt.reverse() 00213 00214 result = {} 00215 result['offline'] = listtags_offline 00216 result['express'] = listtags_express 00217 result['prompt'] = listtags_prompt 00218 00219 return result 00220 #______________________
def beamvalidation::get_plots | ( | path, | |
output, | |||
iovs, | |||
tag | |||
) |
Definition at line 293 of file beamvalidation.py.
00294 : 00295 00296 initial=iovs[len(iovs)-1].IOVfirst 00297 final =iovs[0].IOVfirst 00298 if iovs[0].type == "lumiid": 00299 initial = str(unpack(initial)[0])+":"+str(unpack(initial)[1]) 00300 final = str(unpack(final)[0])+":"+str(unpack(final)[1]) 00301 00302 initial = str(int(initial) -100 ) 00303 cmd = path+"/plotBeamSpotDB.py -b -P -t "+tag+" -i "+initial +" -f "+final 00304 print cmd 00305 outcmd = commands.getstatusoutput( cmd ) 00306 print outcmd[1] 00307 00308 cmd = "ls *.png" 00309 outcmd = commands.getstatusoutput( cmd ) 00310 00311 pngfiles = outcmd[1].split('\n') 00312 print pngfiles 00313 00314 cmd = "cp *.png "+os.path.dirname(output) 00315 outcmd = commands.getstatusoutput( cmd ) 00316 cmd = "rm *.png" 00317 outcmd = commands.getstatusoutput( cmd ) 00318 00319 pngfiles.sort() 00320 return pngfiles 00321 #_______________________________
def beamvalidation::get_productionFiles | ( | directory | ) |
Definition at line 344 of file beamvalidation.py.
def beamvalidation::get_productionIOVs | ( | directory | ) |
Definition at line 355 of file beamvalidation.py.
def beamvalidation::nonzero | ( | self | ) |
Definition at line 38 of file beamvalidation.py.
Referenced by CSCDigiValidator::zeroSupStripDigis().
00038 : # will become the nonzero method of optparse.Values 00039 "True if options were given" 00040 for v in self.__dict__.itervalues(): 00041 if v is not None: return True 00042 return False 00043 00044 optparse.Values.__nonzero__ = nonzero # dynamically fix optparse.Values 00045
def beamvalidation::pack | ( | high, | |
low | |||
) |
pack high,low 32bit unsigned int to one unsigned 64bit long long Note:the print value of result number may appear signed, if the sign bit is used.
Definition at line 272 of file beamvalidation.py.
def beamvalidation::parse | ( | docstring, | |
arglist = None |
|||
) |
Definition at line 53 of file beamvalidation.py.
00054 : 00055 global optionstring 00056 optionstring = docstring 00057 match = USAGE.search(optionstring) 00058 if not match: raise ParsingError("Cannot find the option string") 00059 optlines = match.group(1).splitlines() 00060 try: 00061 p = optparse.OptionParser(optlines[0]) 00062 for line in optlines[1:]: 00063 opt, help=line.split(':')[:2] 00064 short,long=opt.split(',')[:2] 00065 if '=' in opt: 00066 action='store' 00067 long=long.split('=')[0] 00068 else: 00069 action='store_true' 00070 p.add_option(short.strip(),long.strip(), 00071 action = action, help = help.strip()) 00072 except (IndexError,ValueError): 00073 raise ParsingError("Cannot parse the option string correctly") 00074 return p.parse_args(arglist) 00075 00076 #_______________________________
def beamvalidation::unpack | ( | i | ) |
unpack 64bit unsigned long long into 2 32bit unsigned int, return tuple (high,low)
Definition at line 279 of file beamvalidation.py.
def beamvalidation::unpackLumiid | ( | i | ) |
unpack 64bit lumiid to dictionary {'run','lumisection'}
Definition at line 286 of file beamvalidation.py.
def beamvalidation::write_iovs | ( | iovs, | |
lines | |||
) |
Definition at line 153 of file beamvalidation.py.
00154 : 00155 00156 end = '\n' 00157 br = '<BR>'+end 00158 # hearder 00159 lines.append('<tr>'+end) 00160 for i in iovs.keys(): 00161 lines.append('<th>'+i) 00162 lines.append('</th>'+end) 00163 lines.append('</tr>'+end) 00164 # lumi type 00165 lines.append('<tr>'+end) 00166 for i in iovs.keys(): 00167 aIOVlist = iovs[i] 00168 aIOV = IOV() 00169 if len(aIOVlist) > 0: 00170 aIOV = aIOVlist[0] 00171 lines.append('<td> '+aIOV.type+' </td>'+end) 00172 lines.append('</tr>'+end) 00173 # print iovs 00174 for niovs in range(0,len(iovs[iovs.keys()[0]])): 00175 lines.append('<tr>'+end) 00176 for i in iovs.keys(): 00177 aIOVlist = iovs[i] 00178 aIOV = IOV() 00179 if len(aIOVlist) > niovs: 00180 aIOV = aIOVlist[niovs] 00181 lines.append('<td> '+aIOV.IOVfirst +' - '+aIOV.IOVlast+' </td>'+end) 00182 lines.append('</tr>'+end) 00183 #______________
def beamvalidation::write_plots | ( | lines, | |
plots, | |||
web | |||
) |
Definition at line 322 of file beamvalidation.py.
00323 : 00324 00325 end = '\n' 00326 br = '<BR>'+end 00327 00328 lines.append(br) 00329 lines.append(''' 00330 <table border="1"> 00331 00332 ''') 00333 for i in range(0,len(plots)): 00334 plot = plots[i] 00335 plot = os.path.basename(plot) 00336 if i%2 == 0: 00337 lines.append("<tr>"+end) 00338 lines.append("<td> <a href=\""+web+"/"+plot+"\"> <img src="+plot+" alt="+plot+" width='700' height='250' /> </a> </td>"+end) 00339 if i%2 == 1: 00340 lines.append("</tr>"+end) 00341 00342 lines.append('</table>'+end) 00343 #________________________________
def beamvalidation::write_tags | ( | tags, | |
lines | |||
) |
Definition at line 130 of file beamvalidation.py.
00131 : 00132 00133 end = '\n' 00134 br = '<BR>'+end 00135 00136 lines.append('<tr>'+end) 00137 for i in tags.keys(): 00138 00139 lines.append('<th>'+i) 00140 lines.append('</th>'+end) 00141 lines.append('</tr>'+end) 00142 00143 for ntags in range(0,len(tags['offline'])): 00144 lines.append('<tr>'+end) 00145 for i in tags.keys(): 00146 alist = tags[i] 00147 if ntags < len(tags[i]): 00148 lines.append('<td> '+alist[ntags]+' </td>'+end) 00149 else: 00150 lines.append('<td> </td>') 00151 lines.append('</tr>'+end) 00152 #______________
string beamvalidation::auth = "/afs/cern.ch/cms/DB/conddb" |
Definition at line 381 of file beamvalidation.py.
string beamvalidation::br = '<BR>' |
Definition at line 395 of file beamvalidation.py.
Referenced by edm::RootTree::dropBranch(), dqm::StateMachine::failurePage(), LHEProducer::filter(), magfieldparam::TkBfield::getBrfz(), magfieldparam::TkBfield::getBxyz(), CustomParticleFactory::getDecayTable(), edm::FileInPath::initialize_(), OAE85lParametrizedMagneticField::inTeslaUnchecked(), GifDisplay::printHTML(), RBorderFinder::RBorderFinder(), edm::PoolOutputModule::OutputItem::Sorter::Sorter(), fwlite::internal::BranchMapReaderStrategyV11::updateFile(), fwlite::internal::BranchMapReaderStrategyV17::updateFile(), fwlite::internal::BranchMapReaderStrategyV8::updateFile(), and fwlite::internal::BranchMapReaderStrategyV1::updateMap().
string beamvalidation::dest = "oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT" |
Get the latest tags dest = "frontier://cmsfrontier.cern.ch:8000/Frontier/CMS_COND_31X_BEAMSPOT".
Definition at line 380 of file beamvalidation.py.
string beamvalidation::end = '\n' |
Definition at line 394 of file beamvalidation.py.
string beamvalidation::htmlwebsite = "https://yumiceva.web.cern.ch/yumiceva/beamspot/" |
Definition at line 375 of file beamvalidation.py.
tuple beamvalidation::lasttag = list_lastIOVs.keys() |
Definition at line 422 of file beamvalidation.py.
list beamvalidation::lines = [] |
Definition at line 393 of file beamvalidation.py.
tuple beamvalidation::list_lastIOVs = get_lastIOVs( list_tags, dest, auth) |
Definition at line 387 of file beamvalidation.py.
tuple beamvalidation::list_tags = get_listoftags( dest, auth) |
Definition at line 384 of file beamvalidation.py.
string beamvalidation::optionstring = "" |
Definition at line 48 of file beamvalidation.py.
tuple beamvalidation::outfile = open(option.output,'w') |
Definition at line 431 of file beamvalidation.py.
tuple beamvalidation::pngfiles = get_plots(option.path,option.output, list_lastIOVs[lasttag], lasttag) |
Definition at line 426 of file beamvalidation.py.
tuple beamvalidation::processedruns = get_productionIOVs('/afs/cern.ch/cms/CAF/CMSCOMM/COMM_BSPOT/yumiceva/tmp_lumi_workflow/') |
Definition at line 390 of file beamvalidation.py.
tuple beamvalidation::USAGE = re.compile(r'(?s)\s*usage: (.*?)(\n[ \t]*\n|$)') |
Definition at line 36 of file beamvalidation.py.