10 parser.add_argument(
'-c',dest=
'connect',action=
'store',help=
'connect string to lumiDB,optional',default=
'frontier://LumiCalc/CMS_LUMI_PROD')
11 parser.add_argument(
'-P',dest=
'authpath',action=
'store',help=
'path to authentication file')
12 parser.add_argument(
'-r',dest=
'runnumber',action=
'store',help=
'run number')
13 parser.add_argument(
'-hltpath',dest=
'hltpath',action=
'store',required=
True,help=
'hltpath')
14 parser.add_argument(
'-trgbits',dest=
'trgbits',action=
'store',help=
'trgbits',default=
'all')
15 parser.add_argument(
'-siteconfpath',dest=
'siteconfpath',action=
'store',help=
'specific path to site-local-config.xml file, optional. If path undefined, fallback to cern proxy&server')
16 parser.add_argument(
'--debug',dest=
'debug',action=
'store_true',help=
'debug')
17 args=parser.parse_args()
18 runnumber=args.runnumber
19 if args.authpath
and len(args.authpath)!=0:
20 os.environ[
'CORAL_AUTH_PATH']=args.authpath
22 session,svc = lumiQueryAPI.setupSession (args.connect
or \
23 'frontier://LumiCalc/CMS_LUMI_PROD',
24 args.siteconfpath,parameters,args.debug)
25 session.transaction().
start(
True)
26 schema=session.nominalSchema()
29 msg=coral.MessageStream(
'')
30 msg.setMsgVerbosity(coral.message_Level_Debug)
32 runlist.append(int(args.runnumber))
37 hltpathStr=re.sub(
'\s',
'',args.hltpath)
39 if args.trgbits
and args.trgbits!=
'all':
40 bitlistStr=args.trgbits
41 bitlistStr=bitlistStr.strip()
42 bitlistStr=re.sub(
'\s',
'',bitlistStr)
43 bitlist=bitlistStr.split(
',')
47 for runnum
in runlist:
52 hltdict[runnum]=hltdump[1][-1]
54 print 'run ',runnum,
' hltpath ',
'"'+hltpathStr+
'"',
'not found'
56 if not args.trgbits
or args.trgbits==
'all':
60 if len(l1seeds)==0
or not l1seeds.has_key(hltpathStr):
61 print 'hlt path',hltpathStr,
'has no l1 seed'
63 l1seed=l1seeds[hltpathStr]
64 rmQuotes=l1seed.replace(
'\"',
'')
65 rmOR=rmQuotes.replace(
' OR',
'')
66 rmNOT=rmOR.replace(
' NOT',
'')
67 rmAND=rmOR.replace(
' AND',
'')
68 bitlist=rmAND.split(
' ')
69 if not trgdict.has_key(runnum):
71 for bitname
in bitlist:
76 trgprescale=trgbitdump[1][-1]
77 trgdict[runnum].
append((bitname,trgprescale))
79 print 'run ',runnum,
' bit ',
'"'+bitname+
'"',
' not found'
81 session.transaction().commit()
85 print 'no result found for',hltpathStr
90 if not hltdict.has_key(r):
continue
91 hltprescale=hltdict[r]
92 toprint=[str(r),hltpathStr,str(hltprescale)]
93 if trgdict.has_key(r):
94 trgbitsinfo=trgdict[r]
95 for trgbitinfo
in trgbitsinfo:
97 toprint.append(trgname)
98 trgprescale=trgbitinfo[1]
99 toprint.append(str(trgprescale))
100 print ' '.
join(toprint)