CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 29 of file PDRates.py.

Referenced by RateInPD().

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

Definition at line 49 of file PDRates.py.

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

49 def RateInPD(Run,PrimaryDataset,lsMin,lsMax,printLS=False):
50  dbs_cmd = """ dbs search --query='find file,lumi,file.numevents, file.size
51  where run=%d and dataset like /%s/*/RAW
52  and lumi >= %d and lumi <= %d
53  and file.status=VALID '""" % (Run, PrimaryDataset,lsMin, lsMax)
54  rows = commands.getoutput(dbs_cmd)
55  lines = rows.split("\n")
56  j=0
57  LumiSections = []
58  Files = []
59  Evts = 0
60  Size = 0
61  LSinFile = {}
62  NumberOfLSInFile = {}
63  for Line in lines:
64  j=j+1
65  if j <=4:
66  continue
67  line=Line.split()
68  LS = line[1]
69  file = line[0]
70  Nevts = int(line[2])
71  size = int(line[3])
72  LSinFile[LS] = file
73  if LumiSections.count(LS) == 0:
74  LumiSections.append(LS)
75  if Files.count(file) == 0:
76  Files.append(file)
77  Evts += Nevts
78  Size += size
79  NumberOfLSInFile[file] =1
80  else:
81  NumberOfLSInFile[file] = NumberOfLSInFile[file]+1
82  RatePerLS[LS] = Nevts
83 
84  Number_of_LS = len(LumiSections)
85  LS_Length = 23.3
86  if Run < 125100:
87  LS_Length = 93.3
88  rate = Evts / (Number_of_LS * LS_Length)
89  if Evts > 0:
90  size_per_event = (Size / Evts) / 1000.
91  else:
92  size_per_event=-1
93  print "Rate in \t",PrimaryDataset,"\t is : \t",rate," Hz", " \t size is : \t",size_per_event, "kB / event "
94 
95  lsmin=9999999
96  lsmax=-1
97  for (LS,file) in LSinFile.iteritems():
98  nls = NumberOfLSInFile[file]
99  RatePerLS[LS] = RatePerLS[LS] / nls
100  RatePerLS[LS] = RatePerLS[LS] / LS_Length
101  if int(LS) > lsmax:
102  lsmax=int(LS)
103  if int(LS) < lsmin:
104  lsmin=int(LS)
105  if printLS:
106  print "lsmin lsmax",lsmin,lsmax
107  for ls in range(lsmin,lsmax):
108  if not repr(ls) in RatePerLS.keys():
109  RatePerLS[LS] = 0
110  print "Missing LS ",ls
111 
112 
def RateInPD(Run, PrimaryDataset, lsMin, lsMax, printLS=False)
Definition: PDRates.py:49