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 31 of file PDRates.py.

References edm.print().

Referenced by RateInPD().

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

Definition at line 51 of file PDRates.py.

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

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