1 from __future__
import print_function
2 from __future__
import absolute_import
6 from .weight
import Weight
13 Summary printout for a list of components comps. 14 The components are assumed to have a name, and a list of files, 15 like the ones from this module. 20 if not hasattr(c,
'splitFactor'):
22 print(c.name, c.splitFactor, len(c.files))
28 nJobs += c.splitFactor
32 print(
'# components with files = ', nCompsWithFiles)
33 print(
'# jobs = ', nJobs)
37 '''Base configuration class. The attributes are used to store parameters of any type''' 39 '''All keyword arguments are added as attributes.''' 40 self.__dict__.update( **kwargs )
43 '''A useful printout''' 44 header =
'{type}: {name}'.
format( type=self.__class__.__name__,
46 varlines = [
'\t{var:<15}: {value}'.
format(var=var, value=value) \
47 for var,value
in sorted(vars(six.iteritems(self))) \
51 return '\n'.
join( all )
54 '''Make a copy of this object, redefining (or adding) some parameters, just 55 like in the CMSSW python configuration files. 57 For example, you can do 58 module1 = cfg.Analyzer(SomeClass, 63 module2 = module1.clone( 66 and module2 will inherit the configuration of module2 except for 67 the value of param2, and for having an extra newparam of value newvalue 68 (the latter may be useful if e.g. newparam were optional, and needed 69 only when param2 == othervalue) 71 Note that, just like in CMSSW, this is a shallow copy and not a deep copy, 72 i.e. if in the example above value1 were to be an object, them module1 and 73 module2 will share the same instance of value1, and not have two copies. 75 other = copy.copy(self)
76 for k,v
in six.iteritems(kwargs):
81 '''Base analyzer configuration, see constructor''' 85 def __init__(self, class_object, instance_label=None,
86 verbose=
False, **kwargs):
88 One could for example define the analyzer configuration for a 89 di-muon framework.Analyzer.Analyzer in the following way: 91 ZMuMuAna = cfg.Analyzer( 103 Any kinds of keyword arguments can be added. 104 The name must be present, and must be well chosen, as it will be used 105 by the Looper to find the module containing the Analyzer class. 106 This module should be in your PYTHONPATH. If not, modify your python path 107 accordingly in your script. 111 self.__class__.num_instance += 1
112 if instance_label
is None:
113 instance_label =
str(self.__class__.num_instance)
116 super(Analyzer, self).
__init__(**kwargs)
119 '''You may decide to copy an existing analyzer and change 120 its instance_label. In that case, one must stay consistent.''' 121 self.__dict__[name] = value
122 if name ==
'instance_label':
126 class_name =
'.'.
join([self.class_object.__module__,
127 self.class_object.__name__])
132 other = super(Analyzer, self).
clone(**kwargs)
133 if 'class_object' in kwargs
and 'name' not in kwargs:
134 other.name = other.build_name()
142 def __init__(self, class_object, instance_label=None,
143 verbose=
False, **kwargs):
145 self.__class__.num_instance += 1
146 if instance_label
is None:
147 instance_label =
str(self.__class__.num_instance)
149 self.__class__.num_instance += 1
152 super(Service, self).
__init__(**kwargs)
155 class_name =
'.'.
join([self.class_object.__module__,
156 self.class_object.__name__])
161 '''You may decide to copy an existing analyzer and change 162 its instance_label. In that case, one must stay consistent.''' 163 self.__dict__[name] = value
164 if name ==
'instance_label':
168 other = super(Service, self).
clone(**kwargs)
169 if 'class_object' in kwargs
and 'name' not in kwargs:
170 other.name = other.build_name()
175 '''A list with print functionalities. 177 Used to define a sequence of analyzers.''' 180 for index, ana
in enumerate( self ):
181 tmp.append(
'{index} :'.
format(index=index) )
182 tmp.append(
'{ana} :'.
format(ana=ana) )
183 return '\n'.
join(tmp)
188 '''Base component class. 190 See the child classes: 191 DataComponent, MCComponent, EmbedComponent 192 for more information.''' 193 def __init__(self, name, files, tree_name=None, triggers=None, **kwargs):
194 if isinstance(triggers, str):
195 triggers = [triggers]
196 if isinstance(files, str):
197 files = sorted(glob.glob(files))
198 super( Component, self).
__init__( name = name,
200 tree_name = tree_name,
201 triggers = triggers, **kwargs)
209 def __init__(self, name, files, intLumi=None, triggers=[], json=None):
210 super(DataComponent, self).
__init__(name, files, triggers=triggers)
216 return Weight( genNEvents = -1,
225 def __init__(self, name, files, triggers=[], xSection=1,
227 effCorrFactor=
None, **kwargs ):
228 super( MCComponent, self).
__init__( name = name,
230 triggers = triggers, **kwargs )
250 '''Main configuration object, holds a sequence of analyzers, and 251 a list of components.''' 252 def __init__(self, components, sequence, services, events_class,preprocessor=None):
263 return '\n'.
join([comp, sequence, services])
def __init__(self, components, sequence, services, events_class, preprocessor=None)
def __init__(self, name, files, triggers=[], xSection=1, nGenEvents=None, effCorrFactor=None, kwargs)
def getWeight(self, intLumi=None)
S & print(S &os, JobReport::InputFile const &f)
def printComps(comps, details=False)
def __setattr__(self, name, value)
def __init__(self, name, files, intLumi=None, triggers=[], json=None)
def __init__(self, class_object, instance_label=None, verbose=False, kwargs)
static std::string join(char **cmd)
def getWeight(self, intLumi=None)
def __init__(self, name, files, tree_name=None, triggers=None, kwargs)
def __init__(self, class_object, instance_label=None, verbose=False, kwargs)
def __setattr__(self, name, value)
def __init__(self, kwargs)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run