6 RXDATASET = re.compile(
r"^(/[-A-Za-z0-9_]+){3}$")
8 RXRELVALMC = re.compile(
r"^/RelVal[^/]+/(CMSSW(?:_[0-9]+)+(?:_pre[0-9]+)?)[-_].*$")
9 RXRELVALRUNDEPMC = re.compile(
r"^/RelVal[^/]+/(CMSSW(?:_[0-9]+)+(?:_pre[0-9]+)?)[-_].*rundepMC.*$")
10 RXRELVALDATA = re.compile(
r"^/[^/]+/(CMSSW(?:_[0-9]+)+(?:_pre[0-9]+)?)[-_].*$")
11 RXRUNDEPMC = re.compile(
r"^/(?!RelVal)[^/]+/.*rundepMC.*$")
14 RXONLINE = re.compile(
r"^(?:.*/)?DQM_V(\d+)(_[A-Za-z0-9]+)?_R(\d+)\.root$")
17 RXOFFLINE = re.compile(
r"^(?:.*/)?DQM_V(\d+)_R(\d+)((?:__[-A-Za-z0-9_]+){3})\.root$")
32 m = re.match(RXONLINE, path)
34 version =
int(m.group(1))
35 runnr =
int(m.group(3))
36 subsys = m.group(2)
and m.group(2)[1:]
38 return False,
"file version is not 1"
40 return False,
"online file has run number <= 10000"
43 return True, {
'class':
'online_data',
'version': version,
44 'subsystem': subsys,
'runnr': runnr,
45 'dataset':
"/Global/Online/ALL" }
47 m = re.match(RXOFFLINE, path)
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))
59 return False,
"file version is not 1"
61 return False,
"file matches offline naming, but run number is < 1"
64 return False,
"file matches Run Dependent MonteCarlo naming, but run number is 1"
67 return True, {
'class':
'simulated_rundep',
'version': version,
68 'runnr': runnr,
'dataset': dataset }
71 return False,
"file matches Run Dependent MonteCarlo naming, but run number is 1"
74 return True, {
'class':
'relval_rundepmc',
'version': version,
75 'runnr': runnr,
'dataset': dataset,
76 'release': relvalrundepmc.group(1)}
79 return False,
"file matches relval mc naming, but run number != 1"
82 return True, {
'class':
'relval_mc',
'version': version,
83 'runnr': runnr,
'dataset': dataset,
84 'release': relvalmc.group(1) }
87 return False,
"file matches relval data naming, but run number = 1"
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'"
97 return True, {
'class':
'offline_data',
'version': version,
98 'runnr': runnr,
'dataset': dataset }
101 return True, {
'class':
'simulated',
'version':
int(m.group(1)),
102 'runnr': runnr,
'dataset': dataset }
104 return False,
"file matches no known naming convention"
106 return False,
"error while classifying file name"