CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
visDQMUtils Namespace Reference

Functions

def classifyDQMFile (path)
 

Function Documentation

def visDQMUtils.classifyDQMFile (   path)

Definition at line 29 of file visDQMUtils.py.

References createfilelist.int, edm.print(), and python.rootplot.root2matplotlib.replace().

Referenced by visDQMUpload.upload().

29 def classifyDQMFile(path):
30  print(path)
31  try:
32  m = re.match(RXONLINE, path)
33  if m:
34  version = int(m.group(1))
35  runnr = int(m.group(3))
36  subsys = m.group(2) and m.group(2)[1:]
37  if version != 1:
38  return False, "file version is not 1"
39  elif runnr <= 10000:
40  return False, "online file has run number <= 10000"
41  else:
42  # online_data
43  return True, { 'class': 'online_data', 'version': version,
44  'subsystem': subsys, 'runnr': runnr,
45  'dataset': "/Global/Online/ALL" }
46 
47  m = re.match(RXOFFLINE, path)
48  if m:
49  version = int(m.group(1))
50  dataset = m.group(3).replace("__", "/")
51  if not re.match(RXDATASET, dataset):
52  return False, "Invalid dataset name"
53  relvalmc = re.match(RXRELVALMC, dataset)
54  relvaldata = re.match(RXRELVALDATA, dataset)
55  relvalrundepmc = re.match(RXRELVALRUNDEPMC, dataset)
56  rundepmc = re.match(RXRUNDEPMC, dataset)
57  runnr = int(m.group(2))
58  if version != 1:
59  return False, "file version is not 1"
60  if runnr < 1:
61  return False, "file matches offline naming, but run number is < 1"
62  elif rundepmc:
63  if runnr == 1:
64  return False, "file matches Run Dependent MonteCarlo naming, but run number is 1"
65  else:
66  # simulated_rundep
67  return True, { 'class': 'simulated_rundep', 'version': version,
68  'runnr': runnr, 'dataset': dataset }
69  elif relvalrundepmc:
70  if runnr == 1:
71  return False, "file matches Run Dependent MonteCarlo naming, but run number is 1"
72  else:
73  # relval_rundepmc
74  return True, { 'class': 'relval_rundepmc', 'version': version,
75  'runnr': runnr, 'dataset': dataset,
76  'release': relvalrundepmc.group(1)}
77  elif relvalmc:
78  if runnr != 1:
79  return False, "file matches relval mc naming, but run number != 1"
80  else:
81  # relval_mc
82  return True, { 'class': 'relval_mc', 'version': version,
83  'runnr': runnr, 'dataset': dataset,
84  'release': relvalmc.group(1) }
85  elif relvaldata:
86  if runnr == 1:
87  return False, "file matches relval data naming, but run number = 1"
88  else:
89  # relval_data
90  return True, { 'class': 'relval_data', 'version': version,
91  'runnr': runnr, 'dataset': dataset,
92  'release': relvaldata.group(1) }
93  elif dataset.find("CMSSW") >= 0:
94  return False, "non-relval dataset name contains 'CMSSW'"
95  elif runnr > 1:
96  # offline_data
97  return True, { 'class': 'offline_data', 'version': version,
98  'runnr': runnr, 'dataset': dataset }
99  else:
100  # simulated
101  return True, { 'class': 'simulated', 'version': int(m.group(1)),
102  'runnr': runnr, 'dataset': dataset }
103 
104  return False, "file matches no known naming convention"
105  except:
106  return False, "error while classifying file name"
107 
108 
def replace(string, replacements)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def classifyDQMFile(path)
Definition: visDQMUtils.py:29