5 from CoolRunQuery.selector.AtlRunQuerySelectorDQ
import DQSelector
6 from CoolRunQuery.selector.AtlRunQuerySelectorTrigger
import TrigKeySelector, TriggerSelector, L1TrigKeySelector, HLTTrigKeySelector, BGSKeySelector, RatesSelector
7 from CoolRunQuery.selector.AtlRunQuerySelectorMisc
import BPMSelector, LArcondSelector, DatasetsSelector, DetectorSelector, FilenameSelector, PartitionSelector, ReadyForPhysicsSelector, DurationSelector, BFieldSelector
8 from CoolRunQuery.selector.AtlRunQuerySelectorEvents
import EventSelector
9 from CoolRunQuery.selector.AtlRunQuerySelectorStreams
import StreamSelector
10 from CoolRunQuery.selector.AtlRunQuerySelectorLhcOlc
import LHCSelector, OLCLumiSelector, LuminositySelector, BeamspotSelector, OLCLBDataCondition, OLCFillParamsCondition
12 from CoolRunQuery.AtlRunQueryRun
import Run
18 def __init__(self,selector, priority, doesSelect, doesShow, executed):
27 __executedSelectorsInOrder = []
28 __showSelectorsInOrder = []
29 __selectorDependencies = {
'trigger':[
'trigkey',
'l1trigkey',
'hlttrigkey'],
30 'dataquality':[
'readyforphysics']
34 'dataquality' :
'DQSelector',
35 'streams' :
'StreamSelector',
36 'trigger' :
'TriggerSelector',
37 'datasets' :
'DatasetsSelector',
38 'rates' :
'RatesSelector',
39 'lhc' :
'LHCSelector',
40 'bfield' :
'BFieldSelector',
41 'events' :
'EventSelector',
42 'allevents' :
'AllEventsSelector',
43 'release' :
'TrigKeySelector',
44 'trigkey' :
'TrigKeySelector',
45 'l1trigkey' :
'L1TrigKeySelector',
46 'hlttrigkey' :
'HLTTrigKeySelector',
47 'bgskey' :
'BGSKeySelector',
48 'detmask' :
'DetectorSelector',
49 'olclumi' :
'OLCLumiSelector',
50 'olcfillparams' :
'OLCFillParamsCondition',
51 'olclbdata' :
'OLCLBDataCondition',
52 'datasets' :
'DatasetsSelector',
53 'partition' :
'PartitionSelector',
54 'readyforphysics' :
'ReadyForPhysicsSelector',
55 'larcond' :
'LArcondSelector',
56 'luminosity' :
'LuminositySelector',
57 'beamspot' :
'BeamspotSelector',
58 'bpm' :
'BPMSelector',
59 'filenametag' :
'FilenameSelector'
65 for s
in SelectorWorker.getOrderedSelectorList():
87 selname = client.selector.name
93 raise RuntimeError(
'Selector %s depends on %s which is not defined' % (selname,d))
103 cls.
__selectors += [cls.
SelDescr(selector=selector,priority=priority,doesSelect=
True,doesShow=
False,executed=
False)]
110 """ returns a SelDescr if name and class match"""
112 if s.selector.name == selname
and (selcls
is None or selcls==s.selector.__class__.__name__):
118 selcls = SelectorWorker.__creationRules[selname]
125 s.selector.addShowSelector(*args, **kwargs)
136 selcls = SelectorWorker.__creationRules[selname]
137 thecls = eval(
'%s' % selcls)
138 newsel = thecls(selname, *args, **kwargs)
140 s = cls.
SelDescr(selector=newsel, priority=0, doesSelect=
False, doesShow=
True, executed=
False)
149 s.selector.addShowSelector()
153 elif selcls
is not None:
165 sortedSel.sort(key =
lambda x: x.priority, reverse=
True)
171 s.selector.applySelection = s.doesSelect
176 s.selector.setShowOutput()
186 cls.
addSelector( LArcondSelector(name =
'larcond', larcond = options.larcond), 115 )
189 cls.
addSelector( DatasetsSelector(name =
'datasets', datasets = options.datasets), 110 )
192 cls.
addSelector( DurationSelector(name =
'duration', duration = options.duration), 95 )
195 cls.
addSelector( StreamSelector(name =
'streams', streams = options.streams), 95 )
198 cls.
addSelector( TrigKeySelector(name =
'trigkey'), 71 ).setSelectSMK(smks = options.smklist)
201 cls.
addSelector( TrigKeySelector(name =
'trigkey'), 70 ).setSelectRelease(release = options.release)
203 if options.detmaskin
or options.detmaskout:
204 cls.
addSelector( DetectorSelector(
'detmask', options.detmaskin, options.detmaskout), 60 )
207 cls.
addSelector( LHCSelector(name =
'lhc', lhc = options.lhc), 48 )
210 cls.
addSelector( BeamspotSelector(name =
'beamspot', beamspot = options.beamspot), 44 )
213 cls.
addSelector( OLCLumiSelector(name =
'olclumi', olclumi = options.olclumi), 43 )
216 cls.
addSelector( BPMSelector(name =
'bpm', release = options.bpm), 40 )
218 if options.luminosity:
219 cls.
addSelector( LuminositySelector(name =
'luminosity', luminosity = options.luminosity), 40 )
221 if options.projecttag:
222 cls.
addSelector( FilenameSelector(name =
'filenametag', projecttag = options.projecttag), 40 )
224 if options.readyforphysics:
225 cls.
addSelector( ReadyForPhysicsSelector(name =
'readyforphysics', readyforphysics = options.readyforphysics), 31 )
227 if options.partition:
228 cls.
addSelector( PartitionSelector(name =
'partition', partition = options.partition), 300 )
231 cls.
addSelector( TriggerSelector(name =
'trigger', trigger = options.trigger), 25 )
234 cls.
addSelector( BFieldSelector(name =
'bfield', bf = options.bfield), 10 )
236 if options.dqchannels:
237 cls.
addSelector( DQSelector(), 50 ).addSelectionChannel(options.dqchannels)
247 for s
in options.show:
249 if s ==
'summary' or s ==
'dqeff' or s ==
'dqsummary' or s ==
'dqplots' or s ==
'cosmics' or s ==
'heavyions':
259 Run.showduration =
True
261 elif s[0:3]==
'dq ' or s==
'dq':
262 SelectorWorker.getShowSelector(
'dataquality').addShowChannel(s[3:])
264 elif s[0:7] ==
'streams':
265 SelectorWorker.getShowSelector(
'streams').addShowStreamPattern(s[8:])
267 elif s[0:7] ==
'trigger':
268 SelectorWorker.getShowSelector(
'trigger').addShowTriggerPattern(s[8:])
270 elif s[0:8] ==
'datasets':
271 SelectorWorker.getShowSelector(
'datasets').addShowDatasetPattern(s[9:])
273 elif s[0:9] ==
'trigrates':
274 SelectorWorker.getShowSelector(
'rates').addPattern(s[10:])
276 elif s[0:3] ==
'lhc':
282 SelectorWorker.getShowSelector(
'lhc',addArg=arg)
285 SelectorWorker.getShowSelector(s)
288 SelectorWorker.getShowSelector(
'trigkey').setShow(
'smk')
290 elif s ==
'trigkeys' or s ==
'smk':
291 SelectorWorker.getShowSelector(
'trigkey').setShow(
'smk')
292 SelectorWorker.getShowSelector(
'l1trigkey')
293 SelectorWorker.getShowSelector(
'hlttrigkey')
294 SelectorWorker.getShowSelector(
'bgskey')
297 SelectorWorker.getShowSelector(
'trigkey').setShow(
'release')
299 elif s[0:10] ==
'luminosity':
300 SelectorWorker.getShowSelector(
'luminosity').addShowTag(s.split(
None,1)[1])
302 elif s[0:8] ==
'beamspot':
303 SelectorWorker.getShowSelector(
'beamspot',args=s[8:])
305 elif s[0:3] ==
'bpm':
306 SelectorWorker.getShowSelector(
'bpm')
308 elif s ==
'filenametag' or s ==
'projecttag':
309 SelectorWorker.getShowSelector(
'filenametag')
311 elif s
in [
'bfield',
'events',
'allevents',
'detmask',
'olcfillparams',
'olclbdata',
'datasets',
'partition',
'readyforphysics',
'larcond']:
312 SelectorWorker.getShowSelector(s)
315 raise RuntimeError(
"ERROR: option 'show %s' not implemented" %s)