124def GetRuns( arg ):
125 """
126 arg: 'run data10_7TeV.periodA' or 'run periodA' (where 'data11_7TeV' is assumed)
127 # or 'data10_7TeV.periodA-periodC' or 'data10_7TeV.periodA,data10_7TeV.periodB,...'
128 # This is case sensitive !!
129 """
130
131
132 list_of_runs = []
133
134
135 for tag in arg.split(','):
136
137
138 m = pat_last.match(arg)
139 if m:
140
141 list_of_runs += [ "last%s" % m.group(1) ]
142 continue
143
144
145 if pat_number.match(tag):
146
147 list_of_runs += [tag]
148 continue
149
150
151 if pat_range.match(tag):
152
153 list_of_runs += [tag]
154 continue
155
156
157 if '-' in tag:
158
159 list_of_periods = getDataPeriodsWithinRange( tag.split('-') )
160 list_of_runs += getRunsFromPeriods(list_of_periods)
161 continue
162
163
164
165 if '.' not in tag or tag.endswith(".All") or tag.endswith(".AllYear") or tag.endswith(".periodAllYear"):
166
167 allyear = 0
168 projectName = None
169
170 m = re.match(r"20(?P<year>\d{2})(.All|.AllYear|.periodAllYear)?$", tag, re.I)
171 if m:
172 allyear = int(m.groupdict()['year'])
173 else:
174 m = re.match(r"(?P<proj>data(?P<year>\d{2})_.*?)(.All|.AllYear|.periodAllYear)?$", tag, re.I)
175 if m:
176 allyear = int(m.groupdict()['year'])
177 projectName = m.groupdict()['proj']
178
179 if allyear==0:
180 raise RuntimeError("Can't interpret run period %s" % tag)
181
182 print ("Interpret period: AllYear for %i" % (2000+allyear))
183
184
185 p1c = 10000*allyear
186 p2c = 10000*(allyear+1) - 1
187
188 list_of_periods = getListOfPeriodsFromOrdinateRange(p1c, p2c, projectName)
189
190 print (list_of_periods)
191
192 list_of_runs += getRunsFromPeriods(list_of_periods)
193 continue
194
195
196
197 m = re.match( r"(?P<first>(data|20)?(?P<year>\d{2})(_.*)?\.)?(period)?(?P<period>[a-zA-Z])(?P<subperiod>\d+)?$", tag, re.I )
198
199
200
201
202 d = { 'projname' : None }
203 m = re.match( r"20(?P<year>\d{2})\.(period)?(?P<period>[a-zA-Z]|VdM)(?P<subperiod>\d+)?$", tag, re.I )
204 if m:
205
206 d.update( m.groupdict() )
207 else:
208 m = re.match( r"(?P<projname>data(?P<year>\d{2})_.*?)\.(period)?(?P<period>[a-zA-Z]|VdM)(?P<subperiod>\d+)?$", tag, re.I )
209 if m:
210
211 d.update( m.groupdict() )
212 else:
213 d = None
214
215 if d:
216 d['subperiod'] = int(d['subperiod']) if d['subperiod'] else 0
217
218 print ("Interpret period: %r" % d)
219 if len(d['period'])==1:
220
221 p1c = 10000*int(d[
'year']) + 100*(ord(d[
'period'].
upper())-65) + d[
'subperiod']
222 if d['subperiod'] != 0:
223 p2c = p1c
224 else:
225 p2c = p1c+99
226 list_of_periods = getListOfPeriodsFromOrdinateRange(p1c, p2c, d['projname'])
227 else:
228
229 sp = '' if d['subperiod']==0 else str(d['subperiod'])
230 list_of_periods = getListOfPeriodsFromOrdinateRange( 0, 0, d['projname'], (int(d['year']), d['period'],sp) )
231
232 list_of_runs += getRunsFromPeriods(list_of_periods)
233 continue
234
235 if len(list_of_runs)==0:
236 print ("No runs matching pattern")
237
238 return list_of_runs
239
240
241
242
243
244