CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
dataDML Namespace Reference

Functions

def addCorrToBranch
 
def addHLTRunDataToBranch
 
def addLumiRunDataToBranch
 
def addNormToBranch
 
def addTrgRunDataToBranch
 
def allfillschemes
 
def beamInfoById
 
def beamstatusByIds
 
def bulkInsertHltLSData
 
def bulkInsertLumiLSSummary
 
def bulkInsertTrgLSData
 
def dataentryIdByRun
 
def fillInRange
 
def fillrunMap
 
def fillschemePatternMap
 
def guesscorrIdByName
 LumiDB DML API # # Author: Zhen Xie #. More...
 
def guessDataIdByRun
 
def guessDataIdForRange
 
def guessHltDataIdByRunInBranch
 
def guessLumiDataIdByRunInBranch
 
def guessnormIdByContext
 
def guessnormIdByName
 
def guessTrgDataIdByRunInBranch
 
def hltLSById
 
def hltRunById
 
def hlttrgMappingByrun
 
def insertRunSummaryData
 
def insertTrgHltMap
 
def intglumiForRange
 
def latestdataIdByEntry
 
def lumiBXByAlgo
 
def lumicorrById
 
def lumiLSById
 
def luminormById
 
def lumiRunById
 
def lumiRunByIds
 
def runList
 
def runsummary
 
def trgLSById
 
def trgRunById
 

Variables

tuple branchinfo = (branchid,'DATA')
 
tuple datainfo = revisionDML.createBranch(schema,'DATA','TRUNK',comment='hold data')
 
tuple hltdata = generateDummyData.hlt(schema,20)
 
list hltlsdata = hltdata[2]
 
list hltrundata = [hltdata[0],hltdata[1]]
 
tuple hlttrgmap = generateDummyData.hlttrgmap(schema)
 
tuple latestNorms = revisionDML.latestDataRevisionOfEntry(schema,nameDealer.luminormTableName(),luminormentry_id,normrevlist)
 
tuple latestrevision = revisionDML.latestDataRevisionOfEntry(schema,nameDealer.lumidataTableName(),lumientry_id,revlist)
 
tuple lumidummydata = generateDummyData.lumiSummary(schema,20)
 
tuple lumientry_id = revisionDML.entryInBranch(schema,nameDealer.lumidataTableName(),'1211','DATA')
 
list lumilsdata = lumidummydata[1]
 
tuple luminormentry_id = revisionDML.entryInBranch(schema,nameDealer.luminormTableName(),'pp7TeV','NORM')
 
list lumirundata = [lumidummydata[0]]
 
string myconstr = 'oracle://devdb10/cms_xiezhen_dev'
 
tuple normbranchinfo = (normbranchid,'NORM')
 
tuple norminfo = revisionDML.createBranch(schema,'NORM','TRUNK',comment='hold normalization factor')
 
tuple normrevlist = revisionDML.revisionsInBranchName(schema,'NORM')
 
tuple revlist = revisionDML.revisionsInBranchName(schema,'DATA')
 
tuple runsummarydata = generateDummyData.runsummary(schema,'PROTPHYS',3500)
 
tuple schema = session.nominalSchema()
 
tuple session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
 
tuple svc = sessionManager.sessionManager(myconstr,authpath='/afs/cern.ch/user/x/xiezhen',debugON=False)
 
tuple tables = lumidbDDL.createTables(schema)
 
tuple trgdata = generateDummyData.trg(schema,20)
 
tuple trgentry_id = revisionDML.entryInBranch(schema,nameDealer.trgdataTableName(),'1222','DATA')
 
list trglsdata = trgdata[3]
 
list trgrundata = [trgdata[0],trgdata[1],trgdata[2]]
 
tuple trunkinfo = revisionDML.createBranch(schema,'TRUNK',None,comment='main')
 

Function Documentation

def dataDML.addCorrToBranch (   schema,
  corrname,
  a1,
  optionalcorrdata,
  branchinfo 
)
input:
   branchinfo(corrrevisionid,branchname)
   optionalcorrdata {'a2':a2,'drift':drif}
output:
   (revision_id,entry_id,data_id)

Definition at line 1931 of file dataDML.py.

def dataDML.addHLTRunDataToBranch (   schema,
  runnumber,
  hltrundata,
  branchinfo 
)
input:
    hltrundata [pathnameclob(0),datasource(1)]
output:
    (revision_id,entry_id,data_id)

Definition at line 2028 of file dataDML.py.

def dataDML.addLumiRunDataToBranch (   schema,
  runnumber,
  lumirundata,
  branchinfo,
  tableName 
)
input:
      lumirundata [datasource,nominalenergy,ncollidingbunches,starttime,stoptime,nls]
      branchinfo (branch_id,branch_name)
      tableName lumiruntablename
output:
      (revision_id,entry_id,data_id)

Definition at line 1962 of file dataDML.py.

def dataDML.addNormToBranch (   schema,
  normname,
  amodetag,
  norm1,
  egev1,
  optionalnormdata,
  branchinfo 
)
input:
   branchinfo(normrevisionid,branchname)
   optionalnormdata {'norm_occ2':norm_occ2,'norm_et':norm_et,'norm_pu':norm_pu,'constfactor':constfactor}
output:
   (revision_id,entry_id,data_id)

Definition at line 1893 of file dataDML.py.

def dataDML.addTrgRunDataToBranch (   schema,
  runnumber,
  trgrundata,
  branchinfo 
)
input:
   trgrundata [datasource(0),bitzeroname(1),bitnameclob(2)]
   bitnames clob, bitnames separated by ','
output:
   (revision_id,entry_id,data_id)

Definition at line 2001 of file dataDML.py.

def dataDML.allfillschemes (   schema)

Definition at line 1063 of file dataDML.py.

def dataDML.beamInfoById (   schema,
  dataid,
  withBeamIntensity = False,
  minIntensity = 0.1 
)
result (runnum,[(lumilsnum(0),cmslsnum(1),beamstatus(2),beamenergy(3),ncollidingbunches(4),beaminfolist(5),..])
     beaminfolist=[(bxidx,beam1intensity,beam2intensity)]

Definition at line 1192 of file dataDML.py.

def dataDML.beamstatusByIds (   schema,
  dataidMap 
)
input dataidMap : {run:lumidataid}
result {runnum:{cmslsnum:beamstatus}}

Definition at line 920 of file dataDML.py.

def dataDML.bulkInsertHltLSData (   session,
  runnumber,
  data_id,
  hltlsdata,
  bulksize = 500 
)
input:
hltlsdata {cmslsnum:[inputcountBlob,acceptcountBlob,prescaleBlob]}

Definition at line 2167 of file dataDML.py.

def dataDML.bulkInsertLumiLSSummary (   session,
  runnumber,
  data_id,
  lumilsdata,
  tableName,
  bulksize = 500,
  withDetails = True 
)
input:
      lumilsdata {lumilsnum:[cmslsnum,instlumi,instlumierror,instlumiquality,beamstatus,beamenergy,numorbit,startorbit,cmsbxindexblob,beam1intensity,beam2intensity,bxlumivalue_occ1,bxlumierror_occ1,bxlumiquality_occ1,bxlumivalue_occ2,bxlumierror_occ2,bxlumiquality_occ2,bxlumivalue_et,bxlumierror_et,bxlumiquality_et]}

Definition at line 2204 of file dataDML.py.

def dataDML.bulkInsertTrgLSData (   session,
  runnumber,
  data_id,
  trglsdata,
  bulksize = 500 
)
insert trg per-LS data for given run and data_id, this operation can be split in transaction chuncks 
input:
    trglsdata {cmslsnum:[deadtime,bitzerocount,bitzeroprescale,trgcountBlob,trgprescaleBlob]}
result nrows inserted
if nrows==0, then this insertion failed

Definition at line 2127 of file dataDML.py.

def dataDML.dataentryIdByRun (   schema,
  runnum,
  branchfilter 
)
select el.entry_id,et.entry_id,eh.entry_id,el.revision_id,et.revision_id,eh.revision_id from lumidataentiries el,trgdataentries et,hltdataentries eh where el.name=et.name and et.name=eh.name and el.name=:entryname;
check on entryrev
   
return [lumientryid,trgentryid,hltentryid]

Definition at line 1806 of file dataDML.py.

def dataDML.fillInRange (   schema,
  fillmin,
  fillmax,
  amodetag,
  startT,
  stopT 
)
select fillnum,runnum,starttime from cmsrunsummary where [where fillnum>=:fillmin and fillnum<=:fillmax and amodetag=:amodetag]
output: [fill]

Definition at line 89 of file dataDML.py.

def dataDML.fillrunMap (   schema,
  fillnum = None,
  runmin = None,
  runmax = None,
  startT = None,
  stopT = None,
  l1keyPattern = None,
  hltkeyPattern = None,
  amodetag = None 
)
select fillnum,runnum,starttime from cmsrunsummary [where fillnum=:fillnum and runnum>=runmin and runnum<=runmax and amodetag=:amodetag ]
output: {fill:[runnum,...]}

Definition at line 160 of file dataDML.py.

def dataDML.fillschemePatternMap (   schema,
  lumitype 
)
output:(patternStr:correctionFac)

Definition at line 1572 of file dataDML.py.

def dataDML.guesscorrIdByName (   schema,
  tagname = None 
)

LumiDB DML API # # Author: Zhen Xie #.

select data_id from lumicorrectionss [where entry_name=:tagname]
result lumicorrectionsdataid

Definition at line 16 of file dataDML.py.

def dataDML.guessDataIdByRun (   schema,
  runnum,
  tablename,
  revfilter = None 
)
select max data_id of the given run. In current design, it's the most recent data of the run

Definition at line 1620 of file dataDML.py.

def dataDML.guessDataIdForRange (   schema,
  inputRange,
  tablename 
)
input: inputRange [run]
output: {run:lumiid}
select data_id,runnum from hltdata where runnum<=runmax and runnum>=:runmin 

Definition at line 1651 of file dataDML.py.

def dataDML.guessHltDataIdByRunInBranch (   schema,
  runnum,
  tablename,
  branchName 
)

Definition at line 1614 of file dataDML.py.

def dataDML.guessLumiDataIdByRunInBranch (   schema,
  runnum,
  tablename,
  branchName 
)

Definition at line 1602 of file dataDML.py.

def dataDML.guessnormIdByContext (   schema,
  amodetag,
  egev1 
)
get norm dataids by amodetag, egev if there are duplicates, pick max(dataid).Bypass full version lookups
select data_id from luminorm where amodetag=:amodetag and egev_1=:egev1   

Definition at line 1739 of file dataDML.py.

def dataDML.guessnormIdByName (   schema,
  normname 
)
get norm dataids by name, if there are duplicates, pick max(dataid).Bypass full version lookups
select data_id from luminorms where entry_name=:normname
result luminormdataid

Definition at line 1774 of file dataDML.py.

def dataDML.guessTrgDataIdByRunInBranch (   schema,
  runnum,
  tablename,
  branchName 
)

Definition at line 1608 of file dataDML.py.

def dataDML.hltLSById (   schema,
  dataid,
  hltpathname = None,
  hltpathpattern = None,
  withL1Pass = False,
  withHLTAccept = False 
)
result (runnum, {cmslsnum:[(pathname,prescale,1lpass,hltaccept)](0)]} 

Definition at line 1437 of file dataDML.py.

def dataDML.hltRunById (   schema,
  dataid,
  hltpathname = None,
  hltpathpattern = None 
)
result [runnum(0),datasource(1),npath(2),hltnamedict(3)]
output :
     npath : total number of hltpath in DB
     hltnamedict : list of all selected paths [(hltpathidx,hltname),(hltpathidx,hltname)]

Definition at line 1333 of file dataDML.py.

def dataDML.hlttrgMappingByrun (   schema,
  runnum,
  hltpathname = None,
  hltpathpattern = None 
)
select m.hltpathname,m.l1seed from cmsrunsummary r,trghltmap m where r.runnum=:runnum and m.hltkey=r.hltkey and [m.hltpathname=:hltpathname] 
output: {hltpath:l1seed}

Definition at line 1390 of file dataDML.py.

def dataDML.insertRunSummaryData (   schema,
  runnumber,
  runsummarydata,
  complementalOnly = False 
)
input:
    runsummarydata [l1key,amodetag,egev,sequence,hltkey,fillnum,starttime,stoptime]
output:

Definition at line 2055 of file dataDML.py.

def dataDML.insertTrgHltMap (   schema,
  hltkey,
  trghltmap 
)
input:
    trghltmap {hltpath:l1seed}
output:

Definition at line 2097 of file dataDML.py.

def dataDML.intglumiForRange (   schema,
  runlist 
)
output: {run:intglumi_in_fb}

Definition at line 1536 of file dataDML.py.

def dataDML.latestdataIdByEntry (   schema,
  entryid,
  datatype,
  branchfilter 
)
select l.data_id,rl.revision_id from lumidatatable l,lumirevisions rl where  l.data_id=rl.data_id and l.entry_id=:entryid
check revision_id is in branch

Definition at line 1845 of file dataDML.py.

def dataDML.lumiBXByAlgo (   schema,
  dataid,
  algoname 
)
result {lumilsnum:[cmslsnum,numorbit,startorbit,bxlumivalue,bxlumierr,bxlumiqlty]}

Definition at line 1283 of file dataDML.py.

def dataDML.lumicorrById (   schema,
  correctiondataid 
)
select entry_name,a1,a2,drift from lumicorrections where DATA_ID=:dataid
output: {tagname:(data_id(0),a1(1),a2(2),driftcoeff(3))}

Definition at line 49 of file dataDML.py.

def dataDML.lumiLSById (   schema,
  dataid,
  beamstatus = None,
  withBXInfo = False,
  bxAlgo = 'OCC1',
  withBeamIntensity = False,
  tableName = None 
)
input:
   beamstatus: filter on beam status flag
output:
result (runnum,{lumilsnum,[cmslsnum(0),instlumi(1),instlumierr(2),instlumiqlty(3),beamstatus(4),beamenergy(5),numorbit(6),startorbit(7),(bxvalueArray,bxerrArray)(8),(bxindexArray,beam1intensityArray,beam2intensityArray)(9)]})

Definition at line 1085 of file dataDML.py.

def dataDML.luminormById (   schema,
  dataid 
)
select entry_name,amodetag,norm_1,egev_1,norm_2,egev_2 from luminorms where DATA_ID=:dataid
output: {norm_name:(amodetag(0),norm_1(1),egev_1(2),norm_occ2(3),norm_et(4),norm_pu(5),constfactor(6))}
select entry_name,amodetag,norm_1,egev_1,norm_2,egev_2 from luminorms where DATA_ID=:dataid
result (normname(0),amodetag(1),egev(2),norm(3),norm_occ2(4),norm_et(5),norm_pu(6),constfactor(7))

Definition at line 555 of file dataDML.py.

def dataDML.lumiRunById (   schema,
  lumidataid,
  lumitype = 'HF' 
)
input: lumidataid
output: (runnum(0),datasource(1),nominalegev(2),ncollidingbunches(3),starttimestr(4),stoptimestr(5),nls(6))

Definition at line 960 of file dataDML.py.

def dataDML.lumiRunByIds (   schema,
  dataidMap,
  lumitype = 'HF' 
)
input dataidMap : {run:lumidataid}
result {runnum: (datasource(0),nominalegev(1),ncollidingbunches(2),starttime(3),stoptime(4),nls(5)}

Definition at line 904 of file dataDML.py.

def dataDML.runList (   schema,
  datatagid,
  runmin = None,
  runmax = None,
  fillmin = None,
  fillmax = None,
  startT = None,
  stopT = None,
  l1keyPattern = None,
  hltkeyPattern = None,
  amodetag = None,
  nominalEnergy = None,
  energyFlut = 0.2,
  requiretrg = True,
  requirehlt = True,
  preselectedruns = None,
  lumitype = None 
)
select r.runnum,l.starttime,l.stoptime,l.data_id,tag.trgdataid,tag.hltdataid from cmsrunsummary r,tagruns tag,lumidata l,trgdata t,hltdata h where l.runnum=tag.runnum and r.runnum=l.runnum (and l.runnum=t.runnum and t.runnum=h.runnum) and r.fillnum>=:fillmin and r.fillnum<=fillmax and r.runnum>:runmin and r.runnum<:runmax and r.amodetag=:amodetag (and regexp_like(r.l1key,:l1keypattern) and regexp_like(hltkey,:hltkeypattern) ) and l.nominalEnergy>=:nominalEnergy*(1-energyFlut) and l.nominalEnergy<=:nominalEnergy*(1+energyFlut) and tag.tagid<=:tagid and l.starttime is not null and l.stoptime is not null
output: {runnum:[lumiid,trgid,hltid]}

Definition at line 240 of file dataDML.py.

def dataDML.runsummary (   schema,
  runnum,
  sessionflavor = '' 
)
select l1key,amodetag,hltkey,fillnum,fillscheme from cmsrunsummary where runnum=:runnum
output: [l1key(0),amodetag(1),hltkey(3),fillnum(4),fillscheme(5)]

Definition at line 422 of file dataDML.py.

def dataDML.trgLSById (   schema,
  dataid,
  trgbitname = None,
  trgbitnamepattern = None,
  withL1Count = False,
  withPrescale = False 
)
output: (runnum,{cmslsnum:[deadtimecount(0),bitzerocount(1),bitzeroprescale(2),deadfrac(3),[(bitname,trgcount,prescale,mask)](4)]})

Definition at line 797 of file dataDML.py.

def dataDML.trgRunById (   schema,
  dataid,
  trgbitname = None,
  trgbitnamepattern = None 
)
query: select RUNNUM,SOURCE,BITZERONAME,BITNAMECLOB,ALGOMASK_H,ALGOMASK_L,TECHMASK from trgdata where DATA_ID=:dataid

output: [runnum(0),datasource(1),bitzeroname(2),bitnamedict(3),algomask_h(4),algomask_l(5),techmask(6)]
         -- runnumber
         -- original source database name
         -- deadtime norm bitname
         -- bitnamedict [(bitidx,bitname),...]

Definition at line 729 of file dataDML.py.

Variable Documentation

tuple dataDML.branchinfo = (branchid,'DATA')

Definition at line 2355 of file dataDML.py.

tuple dataDML.datainfo = revisionDML.createBranch(schema,'DATA','TRUNK',comment='hold data')

Definition at line 2343 of file dataDML.py.

tuple dataDML.hltdata = generateDummyData.hlt(schema,20)

Definition at line 2371 of file dataDML.py.

list dataDML.hltlsdata = hltdata[2]

Definition at line 2373 of file dataDML.py.

list dataDML.hltrundata = [hltdata[0],hltdata[1]]

Definition at line 2372 of file dataDML.py.

tuple dataDML.hlttrgmap = generateDummyData.hlttrgmap(schema)

Definition at line 2359 of file dataDML.py.

Definition at line 2382 of file dataDML.py.

Definition at line 2390 of file dataDML.py.

tuple dataDML.lumidummydata = generateDummyData.lumiSummary(schema,20)

Definition at line 2361 of file dataDML.py.

tuple dataDML.lumientry_id = revisionDML.entryInBranch(schema,nameDealer.lumidataTableName(),'1211','DATA')

Definition at line 2389 of file dataDML.py.

list dataDML.lumilsdata = lumidummydata[1]

Definition at line 2363 of file dataDML.py.

tuple dataDML.luminormentry_id = revisionDML.entryInBranch(schema,nameDealer.luminormTableName(),'pp7TeV','NORM')

Definition at line 2381 of file dataDML.py.

list dataDML.lumirundata = [lumidummydata[0]]

Definition at line 2362 of file dataDML.py.

string dataDML.myconstr = 'oracle://devdb10/cms_xiezhen_dev'

Definition at line 2331 of file dataDML.py.

tuple dataDML.normbranchinfo = (normbranchid,'NORM')

Definition at line 2351 of file dataDML.py.

tuple dataDML.norminfo = revisionDML.createBranch(schema,'NORM','TRUNK',comment='hold normalization factor')

Definition at line 2345 of file dataDML.py.

tuple dataDML.normrevlist = revisionDML.revisionsInBranchName(schema,'NORM')

Definition at line 2380 of file dataDML.py.

tuple dataDML.revlist = revisionDML.revisionsInBranchName(schema,'DATA')

Definition at line 2387 of file dataDML.py.

tuple dataDML.runsummarydata = generateDummyData.runsummary(schema,'PROTPHYS',3500)

Definition at line 2357 of file dataDML.py.

tuple dataDML.schema = session.nominalSchema()
tuple dataDML.session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])

Definition at line 2333 of file dataDML.py.

tuple dataDML.svc = sessionManager.sessionManager(myconstr,authpath='/afs/cern.ch/user/x/xiezhen',debugON=False)
tuple dataDML.tables = lumidbDDL.createTables(schema)

Definition at line 2338 of file dataDML.py.

Referenced by ora::SchemaUtils.cleanUp().

tuple dataDML.trgdata = generateDummyData.trg(schema,20)

Definition at line 2366 of file dataDML.py.

tuple dataDML.trgentry_id = revisionDML.entryInBranch(schema,nameDealer.trgdataTableName(),'1222','DATA')

Definition at line 2395 of file dataDML.py.

list dataDML.trglsdata = trgdata[3]

Definition at line 2368 of file dataDML.py.

list dataDML.trgrundata = [trgdata[0],trgdata[1],trgdata[2]]

Definition at line 2367 of file dataDML.py.

tuple dataDML.trunkinfo = revisionDML.createBranch(schema,'TRUNK',None,comment='main')

Definition at line 2341 of file dataDML.py.