normvalueDict={} if not options.withoutNorm: normname=options.normtag if not normname: normmap=normDML.normIdByType(session.nominalSchema(),lumitype='PIXEL',defaultonly=True) if len(normmap): normname=normmap.keys()[0] normid=normmap[normname] else: normid=normDML.normIdByName(session.nominalSchema(),normname) if not normid: raise RuntimeError('[ERROR] cannot resolve norm/correction') sys.exit(12) normvalueDict=normDML.normValueById(session.nominalSchema(),normid) #{since:[corrector(0),{paramname:paramvalue}(1),amodetag(2),egev(3),comment(4)]} session.transaction().commit() lumiReport.toScreenHeader(thiscmmd,datatagname,normname,workingversion,updateversion,'PIXEL',toFile=options.headerfile) ################## # ls level # ################## session.transaction().start(True) GrunsummaryData=lumiCalcAPI.runsummaryMap(session.nominalSchema(),irunlsdict,dataidmap,lumitype='PIXEL') if options.action == 'overview': result=lumiCalcAPI.lumiForIds(session.nominalSchema(),irunlsdict,dataidmap,runsummaryMap=GrunsummaryData,beamstatusfilter=None,timeFilter=timeFilter,normmap=normvalueDict,lumitype='PIXEL') lumiReport.toScreenOverview(result,iresults,options.scalefactor,irunlsdict=irunlsdict,noWarning=noWarning,toFile=options.outputfile) if options.action == 'lumibyls': if not options.hltpath: result=lumiCalcAPI.lumiForIds(session.nominalSchema(),irunlsdict,dataidmap,runsummaryMap=GrunsummaryData,beamstatusfilter=None,timeFilter=timeFilter,normmap=normvalueDict,lumitype='PIXEL',minbiasXsec=options.minbiasxsec) lumiReport.toScreenLumiByLS(result,iresults,options.scalefactor,irunlsdict=irunlsdict,noWarning=noWarning,toFile=options.outputfile) else: hltname=options.hltpath
print('[INFO] No qualified hlt data found for run ',irun) continue rruns.append(irun) if not irunlsdict: #no file irunlsdict=dict(list(zip(rruns,[None]*len(rruns)))) else: for selectedrun in irunlsdict.keys():#if there's further filter on the runlist,clean input dict if selectedrun not in rruns: del irunlsdict[selectedrun] if not irunlsdict: print('[INFO] No qualified run found, do nothing') sys.exit(13) session.transaction().commit() thiscmmd=sys.argv[0] lumiReport.toScreenHeader(thiscmmd,datatagname,'n/a','n/a','n/a','n/a') if options.action == 'trgbyls': session.transaction().start(True) result=lumiCalcAPI.trgForIds(session.nominalSchema(),irunlsdict,dataidmap,trgbitname=sname,trgbitnamepattern=spattern,withL1Count=True,withPrescale=True) session.transaction().commit() if not options.outputfile: lumiReport.toScreenLSTrg(result,iresults=iresults,irunlsdict=irunlsdict,noWarning=options.nowarning,withoutmask=options.withoutmask) else: lumiReport.toScreenLSTrg(result,iresults=iresults,irunlsdict=irunlsdict,noWarning=options.nowarning,toFile=options.outputfile,withoutmask=options.withoutmask) #print result sys.exit(0) if options.action == 'hltbyls': if not options.name: print('[ERROR] --name option is required by hltbyls, do nothing') sys.exit(0)
continue rruns.append(irun) if not irunlsdict: #no file irunlsdict = dict(list(zip(rruns, [None] * len(rruns)))) else: for selectedrun in irunlsdict.keys( ): #if there's further filter on the runlist,clean input dict if selectedrun not in rruns: del irunlsdict[selectedrun] if not irunlsdict: print '[INFO] No qualified run found, do nothing' sys.exit(13) session.transaction().commit() thiscmmd = sys.argv[0] lumiReport.toScreenHeader(thiscmmd, datatagname, 'n/a', 'n/a', 'n/a', 'n/a') if options.action == 'trgbyls': session.transaction().start(True) result = lumiCalcAPI.trgForIds(session.nominalSchema(), irunlsdict, dataidmap, trgbitname=sname, trgbitnamepattern=spattern, withL1Count=True, withPrescale=True) session.transaction().commit() if not options.outputfile: lumiReport.toScreenLSTrg(result, iresults=iresults, irunlsdict=irunlsdict,
if not normname: normmap = normDML.normIdByType(session.nominalSchema(), lumitype='PIXEL', defaultonly=True) if len(normmap): normname = normmap.keys()[0] normid = normmap[normname] else: normid = normDML.normIdByName(session.nominalSchema(), normname) if not normid: raise RuntimeError('[ERROR] cannot resolve norm/correction') sys.exit(-1) normvalueDict = normDML.normValueById( session.nominalSchema(), normid ) #{since:[corrector(0),{paramname:paramvalue}(1),amodetag(2),egev(3),comment(4)]} lumiReport.toScreenHeader(thiscmmd, datatagname, normname, workingversion, updateversion, 'PIXEL') session.transaction().commit() if not dataidmap: print '[INFO] No qualified data found, do nothing' sys.exit(0) session.transaction().start(True) if options.action == 'overview': result = lumiCalcAPI.lumiForIds(session.nominalSchema(), irunlsdict, dataidmap, runsummaryMap=GrunsummaryData, beamstatusfilter=None, timeFilter=timeFilter, normmap=normvalueDict, lumitype='PIXEL')