50 def RateInPD(Run,PrimaryDataset,lsMin,lsMax,printLS=False):
51 dbs_cmd =
""" dbs search --query='find file,lumi,file.numevents, file.size 52 where run=%d and dataset like /%s/*/RAW 53 and lumi >= %d and lumi <= %d 54 and file.status=VALID '""" % (Run, PrimaryDataset,lsMin, lsMax)
55 rows = commands.getoutput(dbs_cmd)
56 lines = rows.split(
"\n")
74 if LumiSections.count(LS) == 0:
75 LumiSections.append(LS)
76 if Files.count(file) == 0:
80 NumberOfLSInFile[file] =1
82 NumberOfLSInFile[file] = NumberOfLSInFile[file]+1
85 Number_of_LS = len(LumiSections)
89 rate = Evts / (Number_of_LS * LS_Length)
91 size_per_event = (Size / Evts) / 1000.
94 print "Rate in \t",PrimaryDataset,
"\t is : \t",rate,
" Hz",
" \t size is : \t",size_per_event,
"kB / event " 98 for (LS,file)
in six.iteritems(LSinFile):
99 nls = NumberOfLSInFile[file]
100 RatePerLS[LS] = RatePerLS[LS] / nls
101 RatePerLS[LS] = RatePerLS[LS] / LS_Length
107 print "lsmin lsmax",lsmin,lsmax
108 for ls
in range(lsmin,lsmax):
109 if not repr(ls)
in RatePerLS.keys():
111 print "Missing LS ",ls
def RateInPD(Run, PrimaryDataset, lsMin, lsMax, printLS=False)