10 from RecoLuminosity.LumiDB
import sessionManager,lumiTime,inputFilesetParser,csvSelectionParser,selectionParser,csvReporter,argparse,CommonUtil,lumiCalcAPI,revisionDML,normDML,lumiReport,lumiCorrections,RegexValidator
14 output ({run:[cmsls,cmsls,...]},[[resultlines]])
19 runlsbyfile=p.runsandls()
20 selectedProcessedRuns=p.selectedRunsWithresult()
21 selectedNonProcessedRuns=p.selectedRunsWithoutresult()
22 resultlines=p.resultlines()
23 for runinfile
in selectedNonProcessedRuns:
24 selectedrunlsInDB[runinfile]=runlsbyfile[runinfile]
25 return (selectedrunlsInDB,resultlines)
35 if __name__ ==
'__main__':
37 allowedActions = [
'overview',
'recorded',
'lumibyls']
44 parser.add_argument(
'action',choices=allowedActions,
45 help=
'command actions')
46 parser.add_argument(
'-c',dest=
'connect',action=
'store',
48 help=
'connect string to lumiDB,optional',
49 default=
'frontier://LumiCalc/CMS_LUMI_PROD')
50 parser.add_argument(
'-P',dest=
'authpath',action=
'store',
52 help=
'path to authentication file (optional)')
53 parser.add_argument(
'-r',dest=
'runnumber',action=
'store',
56 help=
'run number (optional)')
57 parser.add_argument(
'-o',dest=
'outputfile',action=
'store',
59 help=
'output to csv file (optional)')
63 parser.add_argument(
'-i',dest=
'inputfile',action=
'store',
65 help=
'lumi range selection file (optional)')
69 parser.add_argument(
'--hltpath',dest=
'hltpath',action=
'store',
70 default=
None,required=
False,
71 help=
'specific hltpath or hltpath pattern to calculate the effectived luminosity (optional)')
75 parser.add_argument(
'--normtag',dest=
'normtag',action=
'store',
77 help=
'version of lumi norm/correction')
78 parser.add_argument(
'--datatag',dest=
'datatag',action=
'store',
80 help=
'version of lumi/trg/hlt data')
84 parser.add_argument(
'-f',
'--fill',dest=
'fillnum',action=
'store',
85 default=
None,required=
False,
86 help=
'fill number (optional) ')
88 parser.add_argument(
'--begin',dest=
'begin',action=
'store',
92 help=
'min run start time (mm/dd/yy hh:mm:ss),min fill or min run'
94 parser.add_argument(
'--end',dest=
'end',action=
'store',
97 help=
'max run start time (mm/dd/yy hh:mm:ss),max fill or max run'
99 parser.add_argument(
'--minBiasXsec',dest=
'minbiasxsec',action=
'store',
103 help=
'minbias cross-section in ub'
108 parser.add_argument(
'-n',dest=
'scalefactor',action=
'store',
112 help=
'user defined global scaling factor on displayed lumi values,optional')
116 parser.add_argument(
'--siteconfpath',dest=
'siteconfpath',action=
'store',
119 help=
'specific path to site-local-config.xml file, optional. If path undefined, fallback to cern proxy&server')
121 parser.add_argument(
'--headerfile',dest=
'headerfile',action=
'store',
124 help=
'write command header output to specified file'
130 parser.add_argument(
'--without-correction',
133 help=
'without afterglow correction'
135 parser.add_argument(
'--without-checkforupdate',
136 dest=
'withoutCheckforupdate',
138 help=
'without check for update'
143 parser.add_argument(
'--nowarning',
146 help=
'suppress bad for lumi warnings' )
147 parser.add_argument(
'--debug',dest=
'debug',
151 options=parser.parse_args()
152 if not options.runnumber
and not options.inputfile
and not options.fillnum
and not options.begin:
153 raise RuntimeError(
'at least one run selection argument in [-r,-f,-i,--begin] is required')
163 timeFilter=[
None,
None]
164 noWarning=options.nowarning
168 if options.action==
'overview' or options.action==
'lumibyls':
170 if options.action==
'lumibyls' and options.hltpath:
172 if options.action==
'recorded':
175 if options.runnumber:
176 reqrunmax=options.runnumber
177 reqrunmin=options.runnumber
179 reqfillmin=options.fillnum
180 reqfillmax=options.fillnum
194 reqtimeminT=lute.StrToDatetime(reqtimemin,customfm=
'%m/%d/%y %H:%M:%S')
195 timeFilter[0]=reqtimeminT
208 reqtimemaxT=lute.StrToDatetime(reqtimemax,customfm=
'%m/%d/%y %H:%M:%S')
209 timeFilter[1]=reqtimemaxT
210 if options.inputfile
and (reqtimemax
or reqtimemin):
217 workingversion=
'UNKNOWN'
220 if not options.withoutCheckforupdate:
221 from RecoLuminosity.LumiDB
import checkforupdate
222 cmsswWorkingBase=os.environ[
'CMSSW_BASE']
223 if not cmsswWorkingBase:
224 print 'Please check out RecoLuminosity/LumiDB from CVS,scram b,cmsenv'
227 workingversion=c.runningVersion(cmsswWorkingBase,
'pixelLumiCalc.py',isverbose=
False)
229 updateversionList=c.checkforupdate(workingversion,isverbose=
False)
230 if updateversionList:
231 updateversion=updateversionList[-1][0]
236 os.environ[
'CORAL_AUTH_PATH'] = options.authpath
240 if options.action==
'recorded':
241 if not options.hltpath:
242 raise RuntimeError(
'argument --hltpath pathname is required for recorded action')
244 authpath=options.authpath,
245 siteconfpath=options.siteconfpath,
246 debugON=options.debug)
248 session=svc.openSession(isReadOnly=
True,cpp2sqltype=[(
'unsigned int',
'NUMBER(10)'),(
'unsigned long long',
'NUMBER(20)')])
254 session.transaction().
start(
True)
256 if options.inputfile:
258 filerunlist=irunlsdict.keys()
262 datatagname=options.datatag
268 dataidmap=
lumiCalcAPI.runList(session.nominalSchema(),datatagid,runmin=reqrunmin,runmax=reqrunmax,fillmin=reqfillmin,fillmax=reqfillmax,startT=reqtimemin,stopT=reqtimemax,l1keyPattern=
None,hltkeyPattern=
None,amodetag=
None,nominalEnergy=
None,energyFlut=
None,requiretrg=reqTrg,requirehlt=reqHlt,preselectedruns=filerunlist,lumitype=
'PIXEL')
270 print '[INFO] No qualified run found, do nothing'
273 for irun,(lid,tid,hid)
in dataidmap.items():
275 print '[INFO] No qualified lumi data found for run, ',irun
276 if reqTrg
and not tid:
277 print '[INFO] No qualified trg data found for run ',irun
279 if reqHlt
and not hid:
280 print '[INFO] No qualified hlt data found for run ',irun
284 irunlsdict=
dict(
list(
zip(rruns,[
None]*len(rruns))))
286 for selectedrun
in irunlsdict.keys():
287 if selectedrun
not in rruns:
288 del irunlsdict[selectedrun]
290 print '[INFO] No qualified run found, do nothing'
298 if not options.withoutNorm:
299 normname=options.normtag
303 normname=normmap.keys()[0]
304 normid=normmap[normname]
308 raise RuntimeError(
'[ERROR] cannot resolve norm/correction')
311 session.transaction().commit()
317 session.transaction().
start(
True)
319 if options.action ==
'overview':
320 result=
lumiCalcAPI.lumiForIds(session.nominalSchema(),irunlsdict,dataidmap,runsummaryMap=GrunsummaryData,beamstatusfilter=
None,timeFilter=timeFilter,normmap=normvalueDict,lumitype=
'PIXEL')
321 lumiReport.toScreenOverview(result,iresults,options.scalefactor,irunlsdict=irunlsdict,noWarning=noWarning,toFile=options.outputfile)
322 if options.action ==
'lumibyls':
323 if not options.hltpath:
324 result=
lumiCalcAPI.lumiForIds(session.nominalSchema(),irunlsdict,dataidmap,runsummaryMap=GrunsummaryData,beamstatusfilter=
None,timeFilter=timeFilter,normmap=normvalueDict,lumitype=
'PIXEL',minbiasXsec=options.minbiasxsec)
325 lumiReport.toScreenLumiByLS(result,iresults,options.scalefactor,irunlsdict=irunlsdict,noWarning=noWarning,toFile=options.outputfile)
327 hltname=options.hltpath
329 if hltname==
'*' or hltname==
'all':
331 elif 1
in [c
in hltname
for c
in '*?[]']:
334 result=
lumiCalcAPI.effectiveLumiForIds(session.nominalSchema(),irunlsdict,dataidmap,runsummaryMap=GrunsummaryData,beamstatusfilter=
None,timeFilter=timeFilter,normmap=normvalueDict,hltpathname=hltname,hltpathpattern=hltpat,withBXInfo=
False,bxAlgo=
None,withBeamIntensity=
False,lumitype=
'PIXEL')
336 if options.action ==
'recorded':
337 hltname=options.hltpath
339 if hltname
is not None:
340 if hltname==
'*' or hltname==
'all':
342 elif 1
in [c
in hltname
for c
in '*?[]']:
345 result=
lumiCalcAPI.effectiveLumiForIds(session.nominalSchema(),irunlsdict,dataidmap,runsummaryMap=GrunsummaryData,beamstatusfilter=
None,normmap=normvalueDict,hltpathname=hltname,hltpathpattern=hltpat,withBXInfo=
False,bxAlgo=
None,withBeamIntensity=
False,lumitype=
'PIXEL')
347 session.transaction().commit()
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run