1 from __future__
import absolute_import
2 from .SequenceTypes
import *
3 from .Modules
import OutputModule, EDProducer, EDFilter, EDAnalyzer, Service, ESProducer, ESSource, _Module
4 from .Mixins
import _Labelable
12 if isinstance(visitee, _Labelable):
13 if not visitee.hasLabel_():
14 raise ValueError(
"A task associated with the Schedule contains a module of type '"+visitee.type_()+
"'\nwhich has no assigned label.")
15 elif isinstance(visitee, Service):
16 if not visitee._inProcess:
17 raise ValueError(
"A task associated with the Schedule contains a service of type '"+visitee.type_()+
"'\nwhich is not attached to the process.")
28 if isinstance(visitee,OutputModule):
29 raise ValueError(
"Path "+self.
__label+
"cannot contain an OutputModule, '"+visitee.type_()+
"', with label '"+visitee.label_()+
"'")
31 if isinstance(visitee, _Labelable):
32 if not visitee.hasLabel_():
33 raise ValueError(
"Path "+self.
__label+
"contains a module of type '"+visitee.type_()+
"' which has no assigned label.")
34 elif isinstance(visitee, Service):
35 if not visitee._inProcess:
36 raise ValueError(
"Path "+self.
__label+
"contains a service of type '"+visitee.type_()+
"' which is not attached to the process.\n")
42 _presetFilters = [
"TriggerResultsFilter",
"HLTPrescaler"]
51 if isinstance(visitee, _Labelable):
52 if not visitee.hasLabel_():
53 raise ValueError(
"EndPath "+self.
__label+
"contains a module of type '"+visitee.type_()+
"' which has\nno assigned label.")
54 elif isinstance(visitee, Service):
55 if not visitee._inProcess:
56 raise ValueError(
"EndPath "+self.
__label+
"contains a service of type '"+visitee.type_()+
"' which is not attached to the process.\n")
57 if isinstance(visitee, Task):
61 if isinstance(visitee,EDFilter):
67 if isinstance(visitee, Task):
81 if isinstance(visitee, _Labelable):
82 if not visitee.hasLabel_():
83 raise ValueError(
"FinalPath "+self.
__label+
"contains a module of type '"+visitee.type_()+
"' which has\nno assigned label.")
84 elif isinstance(visitee, Service):
85 if not visitee._inProcess:
86 raise ValueError(
"FinalPath "+self.
__label+
"contains a service of type '"+visitee.type_()+
"' which is not attached to the process.\n")
87 if isinstance(visitee, Task):
91 if isinstance(visitee,EDFilter):
93 if isinstance(visitee,EDProducer):
97 if isinstance(visitee, Task):
101 """Form sets of all modules, ESProducers, ESSources and Services in visited objects. Can be used 102 to visit Paths, EndPaths, Sequences or Tasks. Includes in sets objects on sub-Sequences and sub-Tasks""" 110 if isinstance(visitee, _Module):
112 elif isinstance(visitee, ESProducer):
114 elif isinstance(visitee, ESSource):
116 elif isinstance(visitee, Service):
122 """ Combines 3 different visitor classes in 1 so we only have to visit all the paths and endpaths once""" 123 def __init__(self, validator, node, decorated, optional=None):
143 """Fill a list with the names of Event module types in a sequence. The names are determined 144 by using globals() to lookup the variable names assigned to the modules. This 145 allows the determination of the labels before the modules have been attached to a Process.""" 147 self.
_moduleToName = { v[1]:v[0]
for v
in globals_.items()
if isinstance(v[1],_Module) }
150 if isinstance(node,_Module):
155 if __name__==
"__main__":
161 def testValidators(self):
167 producer.setLabel(
"producer")
168 analyzer.setLabel(
"analyzer")
169 output.setLabel(
"output")
170 filter.setLabel(
"filter")
175 p3 =
Path(s1+unlabeled)
176 ep1 =
EndPath(producer+output+analyzer)
182 p1.visit(pathValidator)
183 self.assertRaises(ValueError, p2.visit, pathValidator)
184 self.assertRaises(ValueError, p3.visit, pathValidator)
185 ep1.visit(endpathValidator)
186 ep2.visit(endpathValidator)
187 ep3.visit(endpathValidator)
188 self.assertRaises(ValueError, ep4.visit, endpathValidator)
def setLabel(self, label)
def __init__(self, globals_, l)
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
def __init__(self, validator, node, decorated, optional=None)
def setLabel(self, label)
def setLabel(self, label)