def recordedInvMicrobarns(json) : jsonALT = dict([(int(run),sum([range(begin,end+1) for begin,end in lumis],[])) for run,lumis in json.items()]) session = sessionManager.sessionManager("frontier://LumiCalc/CMS_LUMI_PROD").openSession( cpp2sqltype = [('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')]) session.transaction().start(True) lumidata = lumiCalcAPI.lumiForRange( session.nominalSchema(), jsonALT, norm = 1.0, finecorrections = lumiCorrections.pixelcorrectionsForRange(session.nominalSchema(),jsonALT.keys()), lumitype='PIXEL', branchName='DATA') return sum( sum(data[6] for data in lumis) for run,lumis in lumidata.iteritems() if lumis)
if options.inputfile: (irunlsdict,iresults)=parseInputFiles(options.inputfile,runlist,options.action) else: for run in runlist: irunlsdict[run]=None if options.verbose: print 'Selected run:ls' for run in sorted(irunlsdict): if irunlsdict[run] is not None: print '\t%d : %s'%(run,','.join([str(ls) for ls in irunlsdict[run]])) else: print '\t%d : all'%run finecorrections=None if not options.withoutCorrection: session.transaction().start(True) finecorrections=lumiCorrections.pixelcorrectionsForRange(session.nominalSchema(),irunlsdict.keys()) session.transaction().commit() if options.verbose: print 'afterglow ',finecorrections if options.action == 'delivered': session.transaction().start(True) result=lumiCalcAPI.deliveredLumiForRange(session.nominalSchema(),irunlsdict,amodetag=None,egev=None,beamstatus=None,norm=1.0,finecorrections=finecorrections,driftcorrections=None,usecorrectionv2=False,lumitype='PIXEL',branchName='DATA') session.transaction().commit() if not options.outputfile: lumiReport.toScreenTotDelivered(result,iresults,options.scalefactor,options.verbose) else: lumiReport.toCSVTotDelivered(result,options.outputfile,iresults,options.scalefactor,options.verbose) if options.action == 'overview': session.transaction().start(True) result=lumiCalcAPI.lumiForRange(session.nominalSchema(),irunlsdict,amodetag=None,egev=None,beamstatus=None,norm=1.0,finecorrections=finecorrections,driftcorrections=None,usecorrectionv2=False,lumitype='PIXEL',branchName='DATA') session.transaction().commit()