CMS 3D CMS Logo

Functions
PDRates Namespace Reference

Functions

def PrimaryDatasets (Run)
 
def RateInPD (Run, PrimaryDataset, lsMin, lsMax, printLS=False)
 

Function Documentation

def PDRates.PrimaryDatasets (   Run)

Definition at line 30 of file PDRates.py.

Referenced by RateInPD().

30 def PrimaryDatasets(Run):
31  # -- List of Primary Datasets:
32 
33  dbs_cmd = """ dbs search --query='find primds.name
34  where run=%d and dataset like */RAW' """ % (Run)
35  rows = commands.getoutput(dbs_cmd)
36  lines = rows.split("\n")
37  j=0
38  print "\nThe primary datasets for this run are: \n"
39  for Line in lines:
40  j=j+1
41  if j <=4:
42  continue
43  print Line
44  line=Line.split()
45  Datasets.append(line[0])
46  print " "
47 
48 
49 
def PrimaryDatasets(Run)
Definition: PDRates.py:30
def PDRates.RateInPD (   Run,
  PrimaryDataset,
  lsMin,
  lsMax,
  printLS = False 
)

Definition at line 50 of file PDRates.py.

References cmsRelvalreport.exit, createfilelist.int, and PrimaryDatasets().

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")
57  j=0
58  LumiSections = []
59  Files = []
60  Evts = 0
61  Size = 0
62  LSinFile = {}
63  NumberOfLSInFile = {}
64  for Line in lines:
65  j=j+1
66  if j <=4:
67  continue
68  line=Line.split()
69  LS = line[1]
70  file = line[0]
71  Nevts = int(line[2])
72  size = int(line[3])
73  LSinFile[LS] = file
74  if LumiSections.count(LS) == 0:
75  LumiSections.append(LS)
76  if Files.count(file) == 0:
77  Files.append(file)
78  Evts += Nevts
79  Size += size
80  NumberOfLSInFile[file] =1
81  else:
82  NumberOfLSInFile[file] = NumberOfLSInFile[file]+1
83  RatePerLS[LS] = Nevts
84 
85  Number_of_LS = len(LumiSections)
86  LS_Length = 23.3
87  if Run < 125100:
88  LS_Length = 93.3
89  rate = Evts / (Number_of_LS * LS_Length)
90  if Evts > 0:
91  size_per_event = (Size / Evts) / 1000.
92  else:
93  size_per_event=-1
94  print "Rate in \t",PrimaryDataset,"\t is : \t",rate," Hz", " \t size is : \t",size_per_event, "kB / event "
95 
96  lsmin=9999999
97  lsmax=-1
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
102  if int(LS) > lsmax:
103  lsmax=int(LS)
104  if int(LS) < lsmin:
105  lsmin=int(LS)
106  if printLS:
107  print "lsmin lsmax",lsmin,lsmax
108  for ls in range(lsmin,lsmax):
109  if not repr(ls) in RatePerLS.keys():
110  RatePerLS[LS] = 0
111  print "Missing LS ",ls
112 
113 
def RateInPD(Run, PrimaryDataset, lsMin, lsMax, printLS=False)
Definition: PDRates.py:50