Functions | |
def | getPerLSData |
def | getValidationData |
Variables | |
list | allowedActions = ['overview', 'delivered', 'recorded', 'lumibyls','lumibylstime','lumibylsXing','status'] |
list | beamModeChoices = [ "stable", "quiet", "either"] |
tuple | dataperrun = getValidationData(session,run=runnum,cmsls=lslist) |
tuple | delivereddata = lumiQueryAPI.deliveredLumiForRange(session, parameters, inputRange) |
string | hltpath = '' |
tuple | inputRange = str(options.runnumber) |
tuple | lsdata = getPerLSData(session,inputRange) |
tuple | lumidata = lumiQueryAPI.deliveredLumiForRange(session, parameters, inputRange) |
lumiXing = False | |
tuple | options = parser.parse_args() |
tuple | p = inputFilesetParser.inputFilesetParser(options.inputfile) |
tuple | parameters = lumiQueryAPI.ParametersObject() |
Let's start the fun. | |
tuple | parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description = "Lumi Calculations",formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
######################## ## ## ################## ## ## ## ## Main Program ## ## ## ## ################## ## ## ######################## ## | |
tuple | r = csvReporter.csvReporter(options.outputfile) |
tuple | recordeddata = lumiQueryAPI.recordedLumiForRange(session, parameters, inputRange) |
tuple | report = csvReporter.csvReporter(options.outputfile) |
dictionary | result = {} |
tuple | runs = lsdata.keys() |
tuple | runsandls = inputRange.runsandls() |
tuple | todump = lumiQueryAPI.dumpRecordedLumi(lumidata, hltpath) |
int | totalbad = 0 |
int | totalsuspect = 0 |
int | totalunknown = 0 |
string | VERSION = '2.00' |
def lumiCalc::getPerLSData | ( | dbsession, | |
inputRange, | |||
lumiversion = '0001' |
|||
) |
Definition at line 10 of file lumiCalc.py.
00011 : 00012 result={}#{run:[[cmslsnum,orbittime,orbittimestamp,delivered,recorded]]} 00013 datacollector={} 00014 if isinstance(inputRange, str): 00015 datacollector[int(inputRange)]=[] 00016 else: 00017 for run in inputRange.runs(): 00018 datacollector[run]=[] 00019 try: 00020 dbsession.transaction().start(True) 00021 schema=dbsession.nominalSchema() 00022 for run in datacollector.keys(): 00023 runsummaryOut=[] #[fillnum,sequence,hltkey,starttime,stoptime] 00024 lumisummaryOut=[] #[[cmslsnum,instlumi,numorbit,startorbit,beamstatus,beamenergy,cmsalive]] 00025 trgOut={} #{cmslsnum:[trgcount,deadtime,bitname,prescale]} 00026 q=schema.newQuery() 00027 runsummaryOut=lumiQueryAPI.runsummaryByrun(q,run) 00028 del q 00029 q=schema.newQuery() 00030 lumisummaryOut=lumiQueryAPI.lumisummaryByrun(q,run,lumiversion) 00031 del q 00032 q=schema.newQuery() 00033 trgOut=lumiQueryAPI.trgbitzeroByrun(q,run,) 00034 del q 00035 if len(runsummaryOut)!=0 and len(lumisummaryOut)!=0 and len(trgOut)!=0: 00036 datacollector[run].append(runsummaryOut) 00037 datacollector[run].append(lumisummaryOut) 00038 datacollector[run].append(trgOut) 00039 dbsession.transaction().commit() 00040 except Exception, e: 00041 dbsession.transaction().rollback() 00042 del dbsession 00043 raise Exception, 'lumiCalc.getPerLSData:'+str(e) 00044 for run,perrundata in datacollector.items(): 00045 result[run]=[] 00046 if len(perrundata)==0: 00047 continue 00048 runsummary=perrundata[0] 00049 lumisummary=perrundata[1] 00050 trg=perrundata[2] 00051 starttimestr=runsummaryOut[3] 00052 t=lumiTime.lumiTime() 00053 for dataperls in lumisummary: 00054 cmslsnum=dataperls[0] 00055 instlumi=dataperls[1] 00056 numorbit=dataperls[2] 00057 dellumi=instlumi*float(numorbit)*3564.0*25.0e-09 00058 startorbit=dataperls[3] 00059 orbittime=t.OrbitToTime(starttimestr,startorbit) 00060 orbittimestamp=time.mktime(orbittime.timetuple())+orbittime.microsecond/1e6 00061 trgcount=0 00062 deadtime=0 00063 prescale=0 00064 deadfrac=1.0 00065 if trg.has_key(cmslsnum): 00066 trgcount=trg[cmslsnum][0] 00067 deadtime=trg[cmslsnum][1] 00068 prescale=trg[cmslsnum][3] 00069 if trgcount!=0 and prescale!=0: 00070 deadfrac=float(deadtime)/(float(trgcount)*float(prescale)) 00071 recordedlumi=dellumi*(1.0-deadfrac) 00072 result[run].append( [cmslsnum,orbittime,orbittimestamp,dellumi,recordedlumi] ) 00073 return result
def lumiCalc::getValidationData | ( | dbsession, | |
run = None , |
|||
cmsls = None |
|||
) |
retrieve validation data per run or all input: runnum, if not runnum, retrive all output: {run:[[cmslsnum,flag,comment]]}
Definition at line 74 of file lumiCalc.py.
00075 : 00076 '''retrieve validation data per run or all 00077 input: runnum, if not runnum, retrive all 00078 output: {run:[[cmslsnum,flag,comment]]} 00079 ''' 00080 try: 00081 dbsession.transaction().start(True) 00082 schema=dbsession.nominalSchema() 00083 queryHandle=dbsession.nominalSchema().newQuery() 00084 result=lumiQueryAPI.validation(queryHandle,run,cmsls) 00085 del queryHandle 00086 dbsession.transaction().commit() 00087 except Exception, e: 00088 dbsession.transaction().rollback() 00089 del dbsession 00090 raise Exception, 'lumiValidate.getValidationData:'+str(e) 00091 return result
list lumiCalc::allowedActions = ['overview', 'delivered', 'recorded', 'lumibyls','lumibylstime','lumibylsXing','status'] |
Definition at line 102 of file lumiCalc.py.
list lumiCalc::beamModeChoices = [ "stable", "quiet", "either"] |
Definition at line 103 of file lumiCalc.py.
tuple lumiCalc::dataperrun = getValidationData(session,run=runnum,cmsls=lslist) |
Definition at line 235 of file lumiCalc.py.
tuple lumiCalc::delivereddata = lumiQueryAPI.deliveredLumiForRange(session, parameters, inputRange) |
Definition at line 184 of file lumiCalc.py.
string lumiCalc::hltpath = '' |
Definition at line 168 of file lumiCalc.py.
Referenced by lumi::HLTConf2DB::retrieveData().
tuple lumiCalc::inputRange = str(options.runnumber) |
Definition at line 150 of file lumiCalc.py.
tuple lumiCalc::lsdata = getPerLSData(session,inputRange) |
Definition at line 197 of file lumiCalc.py.
Referenced by LumiProducer::fillLSCache(), and LumiProducer::writeProductsForEntry().
tuple lumiCalc::lumidata = lumiQueryAPI.deliveredLumiForRange(session, parameters, inputRange) |
Definition at line 159 of file lumiCalc.py.
lumiCalc::lumiXing = False |
Definition at line 140 of file lumiCalc.py.
tuple lumiCalc::options = parser.parse_args() |
Definition at line 120 of file lumiCalc.py.
tuple lumiCalc::p = inputFilesetParser.inputFilesetParser(options.inputfile) |
Definition at line 255 of file lumiCalc.py.
Let's start the fun.
Save what we need in the parameters object
Definition at line 129 of file lumiCalc.py.
tuple lumiCalc::parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description = "Lumi Calculations",formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
######################## ## ## ################## ## ## ## ## Main Program ## ## ## ## ################## ## ## ######################## ##
Definition at line 101 of file lumiCalc.py.
tuple lumiCalc::r = csvReporter.csvReporter(options.outputfile) |
Definition at line 265 of file lumiCalc.py.
tuple lumiCalc::recordeddata = lumiQueryAPI.recordedLumiForRange(session, parameters, inputRange) |
Definition at line 185 of file lumiCalc.py.
tuple lumiCalc::report = csvReporter.csvReporter(options.outputfile) |
Definition at line 210 of file lumiCalc.py.
tuple lumiCalc::result = {} |
Definition at line 229 of file lumiCalc.py.
tuple lumiCalc::runs = lsdata.keys() |
Definition at line 198 of file lumiCalc.py.
tuple lumiCalc::runsandls = inputRange.runsandls() |
Definition at line 233 of file lumiCalc.py.
tuple lumiCalc::todump = lumiQueryAPI.dumpRecordedLumi(lumidata, hltpath) |
Definition at line 175 of file lumiCalc.py.
int lumiCalc::totalbad = 0 |
Definition at line 240 of file lumiCalc.py.
int lumiCalc::totalsuspect = 0 |
Definition at line 239 of file lumiCalc.py.
int lumiCalc::totalunknown = 0 |
Definition at line 241 of file lumiCalc.py.
string lumiCalc::VERSION = '2.00' |
Definition at line 2 of file lumiCalc.py.