def _decidenormForRun(schema,run):
    rundata=dataDML.runsummary(schema,run)
    amodetagForRun=rundata[1]
    egevForRun=rundata[2]
    normdataid=dataDML.guessnormIdByContext(schema,amodetagForRun,egevForRun)
    normresult=dataDML.luminormById(schema,normdataid)
    return normresult[2]
def _getnorm(schema,norm):
    if isinstance(norm,int) or isinstance(norm,float) or CommonUtil.is_floatstr(norm) or CommonUtil.is_intstr(norm):
        return float(norm)
    if not isinstance(norm,str):
        raise ValueError('wrong parameter type')
    normdataid=dataDML.guessnormIdByName(schema,norm)
    normresult=dataDML.luminormById(schema,normdataid)
    return normresult[2]
示例#3
0
                              cpp2sqltype=[('unsigned int', 'NUMBER(10)'),
                                           ('unsigned long long', 'NUMBER(20)')
                                           ])
    session.transaction().start(True)
    schema = session.nominalSchema()
    runs = dataDML.runList(schema,
                           fillnum=1616,
                           runmin=160403,
                           runmax=160957,
                           nominalEnergy=3500.0)
    print(runs)
    myrun = runs[0]
    runsummary = dataDML.runsummary(schema, myrun)
    print(runsummary)
    normid = dataDML.guessnormIdByContext(schema, 'PROTPHYS', 3500)
    normval = dataDML.luminormById(schema, normid)[2]
    print('norm in use ', normval)
    (lumidataid, trgdataid,
     hltdataid) = dataDML.guessDataIdByRun(schema, myrun)
    print('all dataids ', lumidataid, trgdataid, hltdataid)
    (runnum, lumiLSdata) = dataDML.lumiLSById(schema, lumidataid)

    lumils = sorted(lumiLSdata.keys())
    for lsnum in lumils:
        print('lumilsnum,cmslsnum,instlumi ', lsnum, lumiLSdata[lsnum][0],
              lumiLSdata[lsnum][1] * normval)

    (runnum, trgLSdata) = dataDML.trgLSById(schema, trgdataid)
    cmsls = trgLSdata.keys()
    cmsls.sort()
    for lsnum in cmsls:
示例#4
0
文件: lumiNorm.py 项目: fabozzi/ST_44
     schema=session.nominalSchema()
     (revision_id,branch_id)=revisionDML.branchInfoByName(schema,'NORM')
     dataDML.addNormToBranch(schema,options.name,options.amodetag,float(options.input),int(options.egev),{},(revision_id,'NORM'))
     session.transaction().commit()
 elif options.action=='list':
     session=svc.openSession(isReadOnly=True,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
     session.transaction().start(True)
     schema=session.nominalSchema()
     if options.tag is None:#ask for the latest of name
         if options.name is None and options.amodetag is None and options.egev is None:
             branchfilter=revisionDML.revisionsInBranchName(schema,'NORM')
             allnorms=dataDML.mostRecentLuminorms(schema,branchfilter)
             lumiReport.toScreenNorm(allnorms)
         elif options.name is not None:
             normdataid=dataDML.guessnormIdByName(schema,options.name)
             norm=dataDML.luminormById(schema,normdataid)
             nname=norm[0]
             namodetag=norm[1]
             nnormval=norm[2]
             negev=norm[3]
             lumiReport.toScreenNorm({nname:[namodetag,nnormval,negev]})
         else:
             amodetag=options.amodetag 
             if options.amodetag is None:
                 print '[Warning] -amodetag is not specified, assume PROTPHYS'
                 amodetag='PROTPHYS'
             egev=options.egev
             if options.egev is None:
                 print '[Warning] -egev is not specified, assume 3500'
                 egev='3500'
             normdataid=dataDML.guessnormIdByContext(schema,amodetag,int(egev))
示例#5
0
import coral
from RecoLuminosity.LumiDB import sessionManager,dataDML,CommonUtil
DATABRANCH_ID=3
if __name__=='__main__':
    myconstr='oracle://cms_orcoff_prod/cms_lumi_prod'
    svc=sessionManager.sessionManager(myconstr,authpath='/afs/cern.ch/user/x/xiezhen',debugON=False)
    session=svc.openSession(isReadOnly=True,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
    session.transaction().start(True)
    schema=session.nominalSchema()
    runs=dataDML.runList(schema,fillnum=1616,runmin=160403,runmax=160957,nominalEnergy=3500.0)
    print runs
    myrun=runs[0]
    runsummary=dataDML.runsummary(schema,myrun)
    print runsummary
    normid=dataDML.guessnormIdByContext(schema,'PROTPHYS',3500)
    normval=dataDML.luminormById(schema,normid)[2]
    print 'norm in use ',normval
    (lumidataid,trgdataid,hltdataid)=dataDML.guessDataIdByRun(schema,myrun)
    print 'all dataids ',lumidataid,trgdataid,hltdataid
    (runnum,lumiLSdata)=dataDML.lumiLSById(schema,lumidataid)
    
    lumils=lumiLSdata.keys()
    lumils.sort()
    for lsnum in lumils:
        print 'lumilsnum,cmslsnum,instlumi ',lsnum,lumiLSdata[lsnum][0],lumiLSdata[lsnum][1]*normval
        
    (runnum,trgLSdata)=dataDML.trgLSById(schema,trgdataid)
    cmsls=trgLSdata.keys()
    cmsls.sort()
    for lsnum in cmsls:
        print 'cmslsnum,deadtime,bizerocount,bitzeroprescale,deadfrac ',lsnum,trgLSdata[lsnum][0],trgLSdata[lsnum][1],trgLSdata[lsnum][2],trgLSdata[lsnum][3]
def _decidenormFromContext(schema,amodetag,egev):
    normdataid=dataDML.guessnormIdByContext(schema,amodetag,egev)
    normresult=dataDML.luminormById(schema,normdataid)
    return normresult[2]