3 import string, os, time
12 command =
'dumpRunInfo.py -c oracle://cms_omds_lb/cms_runinfo -P '+authpath+
' -r '+run+
' --collision-only l1key | wc'
13 statusAndOutput = commands.getstatusoutput(command)
14 if statusAndOutput[1].
split(
' ')[2] ==
'2': itIs =
True
15 command =
'dumpRunInfo.py -c oracle://cms_omds_lb/cms_runinfo -P '+authpath+
' -r '+run+
' --collision-only hltkey | wc'
16 statusAndOutput = commands.getstatusoutput(command)
17 if statusAndOutput[1].
split(
' ')[2] ==
'2': itIsAlso =
True
18 command =
'dumpRunInfo.py -c oracle://cms_omds_lb/cms_runinfo -P '+authpath+
' -r '+run+
' fill'
19 statusAndOutput = commands.getstatusoutput(command)
20 fillnum=statusAndOutput[1].
split(
'\n')[1].
split(
' ')[1]
21 if fillnum
and fillnum !=
'0':
23 return itIs
and itIsAlso
and isInAfill
26 runnumber=int(lumifilename.split(
'_')[4])
32 command =
'lumiData.py -c ' +connectionString+
' -P '+authpath+
' --raw listrun'
33 statusAndOutput = commands.getstatusoutput(command)
34 lastAnalyzedRunNumber = eval(statusAndOutput[1])[-1][0]
35 print 'Last run in DB: ', lastAnalyzedRunNumber
39 files=
filter(os.path.isfile,[os.path.join(dropbox,x)
for x
in os.listdir(dropbox)])
41 files.sort(key=
lambda x: os.path.getmtime(os.path.join(dropbox,x)))
46 print 'Last lumi file produced: ', lastRaw +
', Run: ', lastRecordedRun
50 if lastRecordedRun != lastAnalyzedRunNumber:
52 if len(file.split(
'_'))!=7:
continue
55 if thisrun>lastAnalyzedRunNumber
and isCollisionRun(str(thisrun),authpath):
56 runsToBeAnalyzed[str(thisrun)] = file
57 return runsToBeAnalyzed
60 from RecoLuminosity.LumiDB
import argparse
63 parser.add_argument(
'-c',dest=
'connect',action=
'store',required=
True,help=
'connect string to lumiDB')
64 parser.add_argument(
'-d',dest=
'dropbox',action=
'store',required=
True,help=
'location of the lumi root files')
65 parser.add_argument(
'-P',dest=
'authpath',action=
'store',required=
False,help=
'auth path')
66 parser.add_argument(
'-L',dest=
'logpath',action=
'store',required=
False,help=
'log path')
67 parser.add_argument(
'-f',dest=
'loaderconf',action=
'store',required=
True,help=
'path to loder config file')
68 args=parser.parse_args()
70 lumiauthpath=args.authpath
72 lumilogpath=args.logpath
73 loaderconf=args.loaderconf
77 rs=runsToBeAnalyzed.keys()
81 if runCounter==1:
print 'List of processed runs: '
82 print 'Run: ', run,
' file: ', runsToBeAnalyzed[run]
83 logFile=open(os.path.join(lumilogpath,
'loadDB_run'+run+
'.log'),
'w',0)
86 command =
'$LOCALRT/test/$SCRAM_ARCH/cmmdLoadLumiDB -r '+run+
' -L "file:'+runsToBeAnalyzed[run]+
'"'+
' -f '+loaderconf+
' --debug'
87 statusAndOutput = commands.getstatusoutput(command)
88 logFile.write(command+
'\n')
89 logFile.write(statusAndOutput[1])
90 if not statusAndOutput[0] == 0:
91 print 'ERROR while loading info onto DB for run ' + run
92 print statusAndOutput[1]
94 selectstring=
'"{'+run+
':[]}"'
95 command =
'lumiValidate.py -c '+args.connect+
' -P '+ lumiauthpath+
' -runls '+selectstring+
' update'
96 statusAndOutput = commands.getstatusoutput(command)
97 logFile.write(command+
'\n')
98 logFile.write(statusAndOutput[1])
100 if not statusAndOutput[0] == 0:
101 print 'ERROR while applying normalization to run '+ run
102 print statusAndOutput[1]
104 if runCounter == 0:
print 'No runs to be analyzed'
106 if __name__==
'__main__':
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
def getRunnumberFromFileName