CMS 3D CMS Logo

Types.py
Go to the documentation of this file.
1 from __future__ import absolute_import
2 from .Mixins import PrintOptions, _SimpleParameterTypeBase, _ParameterTypeBase, _Parameterizable, _ConfigureComponent, _Labelable, _TypedParameterizable, _Unlabelable, _modifyParametersFromDict
3 from .Mixins import _ValidatingParameterListBase, specialImportRegistry
4 from .Mixins import saveOrigin
5 from .ExceptionHandling import format_typename, format_outerframe
6 from past.builtins import long
7 import codecs
8 import copy
9 import math
10 import six
11 from six.moves import builtins
12 
14  """Class type for 'untracked' to allow nice syntax"""
15  __name__ = "untracked"
16  @staticmethod
17  def __call__(param):
18  """used to set a 'param' parameter to be 'untracked'"""
19  param.setIsTracked(False)
20  return param
21  def __getattr__(self,name):
22  """A factory which allows syntax untracked.name(value) to construct an
23  instance of 'name' class which is set to be untracked"""
24  if name == "__bases__": raise AttributeError # isclass uses __bases__ to recognize class objects
25  class Factory(object):
26  def __init__(self,name):
27  self.name = name
28  def __call__(self,*value,**params):
29  param = globals()[self.name](*value,**params)
30  return _Untracked.__call__(param)
31  return Factory(name)
32 
33 untracked = _Untracked()
34 
35 
37  @staticmethod
38  def _isValid(value):
39  return isinstance(value,int)
40  @staticmethod
41  def _valueFromString(value):
42  """only used for cfg-parsing"""
43  if len(value) >1 and '0x' == value[:2]:
44  return int32(int(value,16))
45  return int32(int(value))
46  def insertInto(self, parameterSet, myname):
47  parameterSet.addInt32(self.isTracked(), myname, self.value())
48  def __nonzero__(self):
49  return self.value()!=0
50 
51 
53  @staticmethod
54  def _isValid(value):
55  return ((isinstance(value,int) and value >= 0) or
56  (isinstance(value,long) and value >= 0) and value <= 0xFFFFFFFF)
57  @staticmethod
58  def _valueFromString(value):
59  """only used for cfg-parsing"""
60  if len(value) >1 and '0x' == value[:2]:
61  return uint32(long(value,16))
62  return uint32(long(value))
63  def insertInto(self, parameterSet, myname):
64  parameterSet.addUInt32(self.isTracked(), myname, self.value())
65  def __nonzero__(self):
66  return self.value()!=0
67 
68 
69 
71  @staticmethod
72  def _isValid(value):
73  return isinstance(value,int) or (
74  isinstance(value,long) and
75  (-0x7FFFFFFFFFFFFFFF < value <= 0x7FFFFFFFFFFFFFFF) )
76  @staticmethod
77  def _valueFromString(value):
78  """only used for cfg-parsing"""
79  if len(value) >1 and '0x' == value[:2]:
80  return uint32(long(value,16))
81  return int64(long(value))
82  def insertInto(self, parameterSet, myname):
83  parameterSet.addInt64(self.isTracked(), myname, self.value())
84  def __nonzero__(self):
85  return self.value()!=0
86 
87 
88 
90  @staticmethod
91  def _isValid(value):
92  return ((isinstance(value,int) and value >= 0) or
93  (isinstance(value,long) and value >= 0) and value <= 0xFFFFFFFFFFFFFFFF)
94  @staticmethod
95  def _valueFromString(value):
96  """only used for cfg-parsing"""
97  if len(value) >1 and '0x' == value[:2]:
98  return uint32(long(value,16))
99  return uint64(long(value))
100  def insertInto(self, parameterSet, myname):
101  parameterSet.addUInt64(self.isTracked(), myname, self.value())
102  def __nonzero__(self):
103  return self.value()!=0
104 
105 
106 
108  @staticmethod
109  def _isValid(value):
110  return isinstance(value, (int, long, float))
111  @staticmethod
112  def _valueFromString(value):
113  """only used for cfg-parsing"""
114  return double(float(value))
115  def insertInto(self, parameterSet, myname):
116  parameterSet.addDouble(self.isTracked(), myname, float(self.value()))
117  def __nonzero__(self):
118  return self.value()!=0.
119  def configValue(self, options=PrintOptions()):
120  return double._pythonValue(self._value)
121  @staticmethod
122  def _pythonValue(value):
123  if math.isinf(value):
124  if value > 0:
125  return "float('inf')"
126  else:
127  return "-float('inf')"
128  if math.isnan(value):
129  return "float('nan')"
130  return str(value)
131 
132 
133 
135  @staticmethod
136  def _isValid(value):
137  return (isinstance(value,type(False)) or isinstance(value,type(True)))
138  @staticmethod
139  def _valueFromString(value):
140  """only used for cfg-parsing"""
141  if value.lower() in ('true', 't', 'on', 'yes', '1'):
142  return bool(True)
143  if value.lower() in ('false','f','off','no', '0'):
144  return bool(False)
145  try:
146  return bool(builtins.bool(eval(value)))
147  except:
148  pass
149  raise RuntimeError('can not make bool from string '+value)
150  def insertInto(self, parameterSet, myname):
151  parameterSet.addBool(self.isTracked(), myname, self.value())
152  def __nonzero__(self):
153  return self.value()
154  def __bool__(self):
155  return self.__nonzero__()
156 
157 
159  def __init__(self,value):
160  super(string,self).__init__(value)
161  @staticmethod
162  def _isValid(value):
163  return isinstance(value,type(''))
164  def configValue(self, options=PrintOptions()):
165  return self.formatValueForConfig(self.value())
166  def pythonValue(self, options=PrintOptions()):
167  return self.configValue(options)
168  @staticmethod
170  l = len(value)
171  import sys
172  if sys.version_info >= (3, 0): #python2 and python3 are different due to byptes vs strings
173  import codecs
174  t=codecs.escape_encode(value.encode('utf-8'))
175  value = t[0].decode('utf-8')
176  else: #be conservative and don't change the python2 version
177  value = value.encode("string-escape")
178  newL = len(value)
179  if l != newL:
180  #get rid of the hex encoding
181  value=value.replace('\\x0','\\')
182  if "'" in value:
183  return '"'+value+'"'
184  return "'"+value+"'"
185  @staticmethod
186  def _valueFromString(value):
187  """only used for cfg-parsing"""
188  return string(value)
189  def insertInto(self, parameterSet, myname):
190  value = self.value()
191  # doesn't seem to handle \0 correctly
192  #if value == '\0':
193  # value = ''
194  parameterSet.addString(self.isTracked(), myname, value)
195  def __nonzero__(self):
196  return len(self.value()) !=0
197 
198 
200  def __init__(self, run, *args):
201  super(EventID,self).__init__()
202  if isinstance(run, str):
203  self.__run = self._valueFromString(run).__run
204  self.__luminosityBlock = self._valueFromString(run).__luminosityBlock
205  self.__event = self._valueFromString(run).__event
206  else:
207  self.__run = run
208  if len(args) == 1:
209  self.__luminosityBlock = 0
210  self.__event = args[0]
211  elif len(args) == 2:
212  self.__luminosityBlock = args[0]
213  self.__event = args[1]
214  else:
215  raise RuntimeError('EventID ctor must have 2 or 3 arguments')
216  def run(self):
217  return self.__run
218  def luminosityBlock(self):
219  return self.__luminosityBlock
220  def event(self):
221  return self.__event
222  @staticmethod
223  def _isValid(value):
224  return True
225  @staticmethod
226  def _valueFromString(value):
227  parts = value.split(":")
228  run = parts[0]
229  try:
230  lumi = parts[1]
231  event = parts[2]
232  except IndexError:
233  lumi = 0
234  event = parts[1]
235  return EventID(int(run), int(lumi), int(event))
236  def pythonValue(self, options=PrintOptions()):
237  return str(self.__run)+ ', '+str(self.__luminosityBlock)+ ', '+str(self.__event)
238  def cppID(self, parameterSet):
239  return parameterSet.newEventID(self.run(), self.luminosityBlock(), self.event())
240  def insertInto(self, parameterSet, myname):
241  parameterSet.addEventID(self.isTracked(), myname, self.cppID(parameterSet))
242 
243 
245  def __init__(self, run, block=None):
246  super(LuminosityBlockID,self).__init__()
247  if isinstance(run, str):
248  self.__run = self._valueFromString(run).__run
249  self.__block = self._valueFromString(run).__block
250  else:
251  self.__run = run
252  self.__block = block
253  def run(self):
254  return self.__run
255  def luminosityBlock(self):
256  return self.__block
257  @staticmethod
258  def _isValid(value):
259  return True
260  @staticmethod
261  def _valueFromString(value):
262  """only used for cfg-parsing"""
263  parts = value.split(":")
264  return LuminosityBlockID(int(parts[0]), int(parts[1]))
265  def pythonValue(self, options=PrintOptions()):
266  return str(self.__run)+ ', '+str(self.__block)
267  def cppID(self, parameterSet):
268  return parameterSet.newLuminosityBlockID(self.run(), self.luminosityBlock())
269  def insertInto(self, parameterSet, myname):
270  parameterSet.addLuminosityBlockID(self.isTracked(), myname, self.cppID(parameterSet))
271 
272 
274  def __init__(self, start, startSub=None, end=None, endSub=None):
275  super(LuminosityBlockRange,self).__init__()
276  if isinstance(start, str):
277  parsed = self._valueFromString(start)
278  self.__start = parsed.__start
279  self.__startSub = parsed.__startSub
280  self.__end = parsed.__end
281  self.__endSub = parsed.__endSub
282  else:
283  self.__start = start
284  self.__startSub = startSub
285  self.__end = end
286  self.__endSub = endSub
287  if self.__end < self.__start:
288  raise RuntimeError('LuminosityBlockRange '+str(self.__start)+':'+str(self.__startSub)+'-'+str(self.__end)+':'+str(self.__endSub)+' out of order')
289  # 0 luminosity block number is a special case that means no limit
290  if self.__end == self.__start and (self.__endSub != 0 and self.__endSub < self.__startSub):
291  raise RuntimeError('LuminosityBlockRange '+str(self.__start)+':'+str(self.__startSub)+'-'+str(self.__end)+':'+str(self.__endSub)+' out of order')
292  def start(self):
293  return self.__start
294  def startSub(self):
295  return self.__startSub
296  def end(self):
297  return self.__end
298  def endSub(self):
299  return self.__endSub
300  @staticmethod
301  def _isValid(value):
302  return True
303  @staticmethod
304  def _valueFromString(value):
305  """only used for cfg-parsing"""
306  value = value.replace(' ','')
307  parts = value.split("-")
308  startParts = parts[0].split(":")
309  try:
310  endParts = parts[1].split(":")
311  except IndexError:
312  endParts = parts[0].split(":") # If just "1:2" turn into "1:2-1:2"
313 
314  if startParts[1].lower() == "0":
315  startParts[1] = "1"
316  elif startParts[1].lower() == "max":
317  startParts[1] = "0"
318  elif startParts[1].lower() == "min":
319  startParts[1] = "1"
320  if endParts[1].lower() == "max":
321  endParts[1] = "0"
322  elif endParts[1].lower() == "min":
323  endParts[1] = "1"
324  return LuminosityBlockRange(int(startParts[0]), int(startParts[1]),
325  int(endParts[0]), int(endParts[1]))
326  def pythonValue(self, options=PrintOptions()):
327  return str(self.__start) + ', ' + str(self.__startSub) + ', ' \
328  + str(self.__end) + ', ' + str(self.__endSub)
329  def cppID(self, parameterSet):
330  return parameterSet.newLuminosityBlockRange(self.start(), self.startSub(),self.end(), self.endSub())
331  def insertInto(self, parameterSet, myname):
332  parameterSet.addLuminosityBlockRange(self.isTracked(), myname, self.cppID(parameterSet))
333 
335  def __init__(self, start, *args):
336  super(EventRange,self).__init__()
337  if isinstance(start, str):
338  parsed = self._valueFromString(start)
339  self.__start = parsed.__start
340  self.__startLumi = parsed.__startLumi
341  self.__startSub = parsed.__startSub
342  self.__end = parsed.__end
343  self.__endLumi = parsed.__endLumi
344  self.__endSub = parsed.__endSub
345  else:
346  self.__start = start
347  if len(args) == 3:
348  self.__startLumi = 0
349  self.__startSub = args[0]
350  self.__end = args[1]
351  self.__endLumi = 0
352  self.__endSub = args[2]
353  elif len(args) == 5:
354  self.__startLumi = args[0]
355  self.__startSub = args[1]
356  self.__end = args[2]
357  self.__endLumi = args[3]
358  self.__endSub = args[4]
359  else:
360  raise RuntimeError('EventRange ctor must have 4 or 6 arguments')
361  if self.__end < self.__start or (self.__end == self.__start and self.__endLumi < self.__startLumi):
362  raise RuntimeError('EventRange '+str(self.__start)+':'+str(self.__startLumi)+':'+str(self.__startSub)+'-'+str(self.__end)+':'+str(self.__endLumi)+':'+str(self.__endSub)+' out of order')
363  # 0 event number is a special case that means no limit
364  if self.__end == self.__start and self.__endLumi == self.__startLumi and (self.__endSub != 0 and self.__endSub < self.__startSub):
365  raise RuntimeError('EventRange '+str(self.__start)+':'+str(self.__startLumi)+':'+str(self.__startSub)+'-'+str(self.__end)+':'+str(self.__endLumi)+':'+str(self.__endSub)+' out of order')
366  def start(self):
367  return self.__start
368  def startLumi(self):
369  return self.__startLumi
370  def startSub(self):
371  return self.__startSub
372  def end(self):
373  return self.__end
374  def endLumi(self):
375  return self.__endLumi
376  def endSub(self):
377  return self.__endSub
378  @staticmethod
379  def _isValid(value):
380  return True
381  @staticmethod
382  def _valueFromString(value):
383  """only used for cfg-parsing"""
384  value = value.replace(' ','')
385  parts = value.split("-")
386  startParts = parts[0].split(":")
387  try:
388  endParts = parts[1].split(":")
389  except IndexError:
390  endParts = parts[0].split(":") # If just "1:2" turn into "1:2-1:2"
391 
392  brun = startParts[0]
393  erun = endParts[0]
394  s = len(startParts)
395  e = len(endParts)
396  if s != e or s < 2 or s > 3:
397  raise RuntimeError('EventRange ctor must have 4 or 6 arguments')
398  i = s - 1
399  if startParts[i].lower() == "0":
400  startParts[i] = "1"
401  elif startParts[i].lower() == "max":
402  startParts[i] = "0"
403  elif startParts[i].lower() == "min":
404  startParts[i] = "1"
405  if endParts[i].lower() == "max":
406  endParts[i] = "0"
407  elif endParts[i].lower() == "min":
408  endParts[i] = "1"
409  if s == 3:
410  blumi = startParts[1]
411  elumi = endParts[1]
412  bevent = startParts[2]
413  eevent = endParts[2]
414  elif s == 2:
415  blumi = 0
416  elumi = 0
417  bevent = startParts[1]
418  eevent = endParts[1]
419  else:
420  raise RuntimeError('EventRange ctor must have 4 or 6 arguments')
421  # note int will return a long if the value is too large to fit in
422  # a smaller type
423  return EventRange(int(brun), int(blumi), int(bevent),
424  int(erun), int(elumi), int(eevent))
425 
426  def pythonValue(self, options=PrintOptions()):
427  return str(self.__start) + ', ' + str(self.__startLumi) + ', ' + str(self.__startSub) + ', ' \
428  + str(self.__end) + ', ' + str(self.__endLumi) + ', ' + str(self.__endSub)
429  def cppID(self, parameterSet):
430  return parameterSet.newEventRange(self.start(), self.startLumi(), self.startSub(), self.end(), self.endLumi(), self.endSub())
431  def insertInto(self, parameterSet, myname):
432  parameterSet.addEventRange(self.isTracked(), myname, self.cppID(parameterSet))
433 
435  def __init__(self,moduleLabel,productInstanceLabel='',processName=''):
436  super(InputTag,self).__init__()
437  self._setValues(moduleLabel, productInstanceLabel, processName)
438  def getModuleLabel(self):
439  return self.__moduleLabel
440  def setModuleLabel(self,label):
441  if self.__moduleLabel != label:
442  self.__moduleLabel = label
443  self._isModified=True
444  moduleLabel = property(getModuleLabel,setModuleLabel,"module label for the product")
446  return self.__productInstance
447  def setProductInstanceLabel(self,label):
448  if self.__productInstance != label:
449  self.__productInstance = label
450  self._isModified=True
451  productInstanceLabel = property(getProductInstanceLabel,setProductInstanceLabel,"product instance label for the product")
452  def getProcessName(self):
453  return self.__processName
454  def setProcessName(self,label):
455  if self.__processName != label:
456  self.__processName = label
457  self._isModified=True
458  processName = property(getProcessName,setProcessName,"process name for the product")
459  @staticmethod
461  """When used as the process name this value will make the framework skip the current process
462  when looking backwards in time for the data product.
463  """
464  return "@skipCurrentProcess"
465  @staticmethod
467  """When used as the process name this value will make the framework use the current process
468  as the process when looking for the data product.
469  """
470  return "@currentProcess"
471  def configValue(self, options=PrintOptions()):
472  result = self.__moduleLabel
473  if self.__productInstance != "" or self.__processName != "":
474  result += ':' + self.__productInstance
475  if self.__processName != "":
476  result += ':' + self.__processName
477  if result == "":
478  result = '\"\"'
479  return result;
480  def pythonValue(self, options=PrintOptions()):
481  cfgValue = self.configValue(options)
482  # empty strings already have quotes
483  if cfgValue == '\"\"':
484  return cfgValue
485  colonedValue = "\""+cfgValue+"\""
486  # change label:instance:process to "label","instance","process"
487  return colonedValue.replace(":","\",\"")
488  @staticmethod
489  def _isValid(value):
490  return True
491  def __eq__(self,other):
492  return ((self.__moduleLabel,self.__productInstance,self.__processName) ==
493  (other.__moduleLabel,other.__productInstance,other.__processName))
494  def __ne__(self,other):
495  return ((self.__moduleLabel,self.__productInstance,self.__processName) !=
496  (other.__moduleLabel,other.__productInstance,other.__processName))
497  def __lt__(self,other):
498  return ((self.__moduleLabel,self.__productInstance,self.__processName) <
499  (other.__moduleLabel,other.__productInstance,other.__processName))
500  def __gt__(self,other):
501  return ((self.__moduleLabel,self.__productInstance,self.__processName) >
502  (other.__moduleLabel,other.__productInstance,other.__processName))
503  def __le__(self,other):
504  return ((self.__moduleLabel,self.__productInstance,self.__processName) <=
505  (other.__moduleLabel,other.__productInstance,other.__processName))
506  def __ge__(self,other):
507  return ((self.__moduleLabel,self.__productInstance,self.__processName) >=
508  (other.__moduleLabel,other.__productInstance,other.__processName))
509 
510 
511  def value(self):
512  "Return the string rep"
513  return self.configValue()
514  @staticmethod
516  return value.configValue()
517  @staticmethod
518  def _valueFromString(string):
519  parts = string.split(":")
520  return InputTag(*parts)
521  def setValue(self,v):
522  self._setValues(v)
523  self._isModified=True
524  def _setValues(self,moduleLabel,productInstanceLabel='',processName=''):
525  self.__moduleLabel = moduleLabel
526  self.__productInstance = productInstanceLabel
527  self.__processName=processName
528  if -1 != moduleLabel.find(":"):
529  toks = moduleLabel.split(":")
530  self.__moduleLabel = toks[0]
531  if len(toks) > 1:
532  self.__productInstance = toks[1]
533  if len(toks) > 2:
534  self.__processName=toks[2]
535  # convert to the wrapper class for C++ InputTags
536  def cppTag(self, parameterSet):
537  return parameterSet.newInputTag(self.getModuleLabel(),
539  self.getProcessName())
540  def insertInto(self, parameterSet, myname):
541  parameterSet.addInputTag(self.isTracked(), myname, self.cppTag(parameterSet))
542 
544  def __init__(self,module='',data=''):
545  super(ESInputTag,self).__init__()
546  self._setValues(module, data)
547  def getModuleLabel(self):
548  return self.__moduleLabel
549  def setModuleLabel(self,label):
550  if self.__moduleLabel != label:
551  self.__moduleLabel = label
552  self._isModified=True
553  moduleLabel = property(getModuleLabel,setModuleLabel,"module label for the product")
554  def getDataLabel(self):
555  return self.__data
556  def setDataLabel(self,label):
557  if self.__data != label:
558  self.__data = label
559  self._isModified=True
560  dataLabel = property(getDataLabel,setDataLabel,"data label for the product")
561  def configValue(self, options=PrintOptions()):
562  result = self.__moduleLabel
563  if self.__data != "":
564  result += ':' + self.__data
565  if result == "":
566  result = '\"\"'
567  return result;
568  def pythonValue(self, options=PrintOptions()):
569  cfgValue = self.configValue(options)
570  # empty strings already have quotes
571  if cfgValue == '\"\"':
572  return cfgValue
573  colonedValue = "\""+cfgValue+"\""
574  # change label:instance:process to "label","instance","process"
575  return colonedValue.replace(":","\",\"")
576  @staticmethod
577  def _isValid(value):
578  return True
579  def __eq__(self,other):
580  return ((self.__moduleLabel,self.__data) == (other.__moduleLabel,other.__data))
581  def __ne__(self,other):
582  return ((self.__moduleLabel,self.__data) != (other.__moduleLabel,other.__data))
583  def __lt__(self,other):
584  return ((self.__moduleLabel,self.__data) < (other.__moduleLabel,other.__data))
585  def __gt__(self,other):
586  return ((self.__moduleLabel,self.__data) > (other.__moduleLabel,other.__data))
587  def __le__(self,other):
588  return ((self.__moduleLabel,self.__data) <= (other.__moduleLabel,other.__data))
589  def __ge__(self,other):
590  return ((self.__moduleLabel,self.__data) >= (other.__moduleLabel,other.__data))
591  def value(self):
592  "Return the string rep"
593  return self.configValue()
594  @staticmethod
596  return value.configValue()
597  @staticmethod
598  def _valueFromString(string):
599  parts = string.split(":")
600  return ESInputTag(*parts)
601  def setValue(self,v):
602  self._setValues(v)
603  self._isModified=True
604  def _setValues(self,moduleLabel='',dataLabel=''):
605  self.__moduleLabel = moduleLabel
606  self.__data = dataLabel
607  if -1 != moduleLabel.find(":"):
608  # raise RuntimeError("the module label '"+str(moduleLabel)+"' contains a ':'. If you want to specify more than one label, please pass them as separate arguments.")
609  # tolerate it, at least for the translation phase
610  toks = moduleLabel.split(":")
611  self.__moduleLabel = toks[0]
612  if len(toks) > 1:
613  self.__data = toks[1]
614  if len(toks) > 2:
615  raise RuntimeError("an ESInputTag was passed the value'"+moduleLabel+"' which contains more than one ':'")
616 
617  # convert to the wrapper class for C++ ESInputTags
618  def cppTag(self, parameterSet):
619  return parameterSet.newESInputTag(self.getModuleLabel(),
620  self.getDataLabel())
621  def insertInto(self, parameterSet, myname):
622  parameterSet.addESInputTag(self.isTracked(), myname, self.cppTag(parameterSet))
623 
625  def __init__(self,value):
626  super(FileInPath,self).__init__(value)
627  @staticmethod
628  def _isValid(value):
629  return True
630  def configValue(self, options=PrintOptions()):
631  return string.formatValueForConfig(self.value())
632  @staticmethod
634  return string.formatValueForConfig(value)
635  @staticmethod
636  def _valueFromString(value):
637  return FileInPath(value)
638  def insertInto(self, parameterSet, myname):
639  parameterSet.addNewFileInPath( self.isTracked(), myname, self.value() )
640 
642  def __init__(self,type_,*arg,**args):
643  _ParameterTypeBase.__init__(self)
644  _TypedParameterizable.__init__(self,type_,*arg,**args)
645  def value(self):
646  return self
647  @staticmethod
648  def _isValid(value):
649  return True
650  def configTypeName(self):
651  return "secsource"
652  def configValue(self, options=PrintOptions()):
653  return self.dumpConfig(options)
654  def dumpPython(self, options=PrintOptions()):
655  return _TypedParameterizable.dumpPython(self, options)
656  def copy(self):
657  # TODO is the one in TypedParameterizable better?
658  return copy.copy(self)
659  def _place(self,name,proc):
660  proc._placePSet(name,self)
661  def __str__(self):
662  return object.__str__(self)
663 
665  def __init__(self,*arg,**args):
666  #need to call the inits separately
667  _ParameterTypeBase.__init__(self)
668  _Parameterizable.__init__(self,*arg,**args)
669  def value(self):
670  return self
671  def isRef_(self):
672  """Returns true if this PSet is actually a reference to a different PSet
673  """
674  return hasattr(self,"refToPSet_")
675  @staticmethod
676  def _isValid(value):
677  return True
678 
679  def configValue(self, options=PrintOptions()):
680  config = '{ \n'
681  for name in self.parameterNames_():
682  param = getattr(self,name)
683  options.indent()
684  config+=options.indentation()+param.configTypeName()+' '+name+' = '+param.configValue(options)+'\n'
685  options.unindent()
686  config += options.indentation()+'}\n'
687  return config
688  def dumpPython(self, options=PrintOptions()):
689  return self.pythonTypeName()+"(\n"+_Parameterizable.dumpPython(self, options)+options.indentation()+")"
690  def clone(self, **params):
691  myparams = self.parameters_()
692  _modifyParametersFromDict(myparams, params, self._Parameterizable__raiseBadSetAttr)
693  returnValue = PSet(**myparams)
694  returnValue.setIsTracked(self.isTracked())
695  returnValue._isModified = False
696  returnValue._isFrozen = False
697  return returnValue
698  def copy(self):
699  return copy.copy(self)
700  def _place(self,name,proc):
701  proc._placePSet(name,self)
702  def __str__(self):
703  return object.__str__(self)
704  def insertInto(self, parameterSet, myname):
705  newpset = parameterSet.newPSet()
706  self.insertContentsInto(newpset)
707  parameterSet.addPSet(self.isTracked(), myname, newpset)
708  def insertContentsInto(self, parameterSet):
709  if self.isRef_():
710  ref = parameterSet.getTopPSet_(self.refToPSet_.value())
711  ref.insertContentsInto(parameterSet)
712  else:
713  super(PSet, self).insertContentsInto(parameterSet)
714 
715 
717  def __init__(self,*arg,**args):
718  super(vint32,self).__init__(*arg,**args)
719 
720  @staticmethod
721  def _itemIsValid(item):
722  return int32._isValid(item)
723  @staticmethod
724  def _valueFromString(value):
725  return vint32(*_ValidatingParameterListBase._itemsFromStrings(value,int32._valueFromString))
726  def insertInto(self, parameterSet, myname):
727  parameterSet.addVInt32(self.isTracked(), myname, self.value())
728 
729 
730 
732  def __init__(self,*arg,**args):
733  super(vuint32,self).__init__(*arg,**args)
734  @staticmethod
735  def _itemIsValid(item):
736  return uint32._isValid(item)
737  @staticmethod
738  def _valueFromString(value):
739  return vuint32(*_ValidatingParameterListBase._itemsFromStrings(value,uint32._valueFromString))
740  def insertInto(self, parameterSet, myname):
741  parameterSet.addVUInt32(self.isTracked(), myname, self.value())
742 
743 
744 
746  def __init__(self,*arg,**args):
747  super(vint64,self).__init__(*arg,**args)
748  @staticmethod
749  def _itemIsValid(item):
750  return int64._isValid(item)
751  @staticmethod
752  def _valueFromString(value):
753  return vint64(*_ValidatingParameterListBase._itemsFromStrings(value,int64._valueFromString))
754  def insertInto(self, parameterSet, myname):
755  parameterSet.addVInt64(self.isTracked(), myname, self.value())
756 
757 
758 
760  def __init__(self,*arg,**args):
761  super(vuint64,self).__init__(*arg,**args)
762  @staticmethod
763  def _itemIsValid(item):
764  return uint64._isValid(item)
765  @staticmethod
766  def _valueFromString(value):
767  return vuint64(*_ValidatingParameterListBase._itemsFromStrings(value,vuint64._valueFromString))
768  def insertInto(self, parameterSet, myname):
769  parameterSet.addVUInt64(self.isTracked(), myname, self.value())
770 
771 
772 
774  def __init__(self,*arg,**args):
775  super(vdouble,self).__init__(*arg,**args)
776  @staticmethod
777  def _itemIsValid(item):
778  return double._isValid(item)
779  @staticmethod
780  def _valueFromString(value):
781  return vdouble(*_ValidatingParameterListBase._itemsFromStrings(value,double._valueFromString))
782  def insertInto(self, parameterSet, myname):
783  parameterSet.addVDouble(self.isTracked(), myname, self.value())
784  def pythonValueForItem(self,item, options):
785  return double._pythonValue(item)
786 
787 
788 
789 
791  def __init__(self,*arg,**args):
792  super(vbool,self).__init__(*arg,**args)
793  @staticmethod
794  def _itemIsValid(item):
795  return bool._isValid(item)
796  @staticmethod
797  def _valueFromString(value):
798  return vbool(*_ValidatingParameterListBase._itemsFromStrings(value,bool._valueFromString))
799  def insertInto(self, parameterSet, myname):
800  parameterSet.addVBool(self.isTracked(), myname, self.value())
801 
802 
803 
805  def __init__(self,*arg,**args):
806  super(vstring,self).__init__(*arg,**args)
807  self._nPerLine = 1
808  @staticmethod
809  def _itemIsValid(item):
810  return string._isValid(item)
811  def configValueForItem(self,item,options):
812  return string.formatValueForConfig(item)
813  @staticmethod
814  def _valueFromString(value):
815  return vstring(*_ValidatingParameterListBase._itemsFromStrings(value,string._valueFromString))
816  def insertInto(self, parameterSet, myname):
817  parameterSet.addVString(self.isTracked(), myname, self.value())
818 
820  def __init__(self,*arg,**args):
821  super(VLuminosityBlockID,self).__init__(*arg,**args)
822  @staticmethod
823  def _itemIsValid(item):
824  return LuminosityBlockID._isValid(item)
825  def configValueForItem(self,item,options):
826  return LuminosityBlockID.formatValueForConfig(item)
827  def pythonValueForItem(self,item, options):
828  return item.dumpPython(options)
829  @staticmethod
830  def _valueFromString(value):
831  return VLuminosityBlockID(*_ValidatingParameterListBase._itemsFromStrings(value,LuminosityBlockID._valueFromString))
832  def insertInto(self, parameterSet, myname):
833  cppIDs = list()
834  for i in self:
835  item = i
836  if isinstance(item, str):
837  item = LuminosityBlockID._valueFromString(item)
838  cppIDs.append(item.cppID(parameterSet))
839  parameterSet.addVLuminosityBlockID(self.isTracked(), myname, cppIDs)
840 
841 
843  def __init__(self,*arg,**args):
844  super(VInputTag,self).__init__(*arg,**args)
845  @staticmethod
846  def _itemIsValid(item):
847  return InputTag._isValid(item)
848  def configValueForItem(self,item,options):
849  # we tolerate strings as members
850  if isinstance(item, str):
851  return '"'+item+'"'
852  else:
853  return InputTag.formatValueForConfig(item)
854  def pythonValueForItem(self,item, options):
855  # we tolerate strings as members
856  if isinstance(item, str):
857  return '"'+item+'"'
858  else:
859  return item.dumpPython(options)
860  @staticmethod
861  def _valueFromString(value):
862  return VInputTag(*_ValidatingParameterListBase._itemsFromStrings(value,InputTag._valueFromString))
863  def insertInto(self, parameterSet, myname):
864  cppTags = list()
865  for i in self:
866  item = i
867  if isinstance(item, str):
868  item = InputTag(i)
869  cppTags.append(item.cppTag(parameterSet))
870  parameterSet.addVInputTag(self.isTracked(), myname, cppTags)
871 
873  def __init__(self,*arg,**args):
874  super(VESInputTag,self).__init__(*arg,**args)
875  @staticmethod
876  def _itemIsValid(item):
877  return ESInputTag._isValid(item)
878  def configValueForItem(self,item,options):
879  # we tolerate strings as members
880  if isinstance(item, str):
881  return '"'+item+'"'
882  else:
883  return ESInputTag.formatValueForConfig(item)
884  def pythonValueForItem(self,item, options):
885  # we tolerate strings as members
886  if isinstance(item, str):
887  return '"'+item+'"'
888  else:
889  return item.dumpPython(options)
890  @staticmethod
891  def _valueFromString(value):
892  return VESInputTag(*_ValidatingParameterListBase._itemsFromStrings(value,ESInputTag._valueFromString))
893  def insertInto(self, parameterSet, myname):
894  cppTags = list()
895  for i in self:
896  item = i
897  if isinstance(item, str):
898  item = ESInputTag(i)
899  cppTags.append(item.cppTag(parameterSet))
900  parameterSet.addVESInputTag(self.isTracked(), myname, cppTags)
901 
903  def __init__(self,*arg,**args):
904  super(VEventID,self).__init__(*arg,**args)
905  @staticmethod
906  def _itemIsValid(item):
907  return EventID._isValid(item)
908  def configValueForItem(self,item,options):
909  return EventID.formatValueForConfig(item)
910  def pythonValueForItem(self,item, options):
911  # we tolerate strings as members
912  if isinstance(item, str):
913  return '"'+item+'"'
914  else:
915  return item.dumpPython(options)
916  @staticmethod
917  def _valueFromString(value):
918  return VEventID(*_ValidatingParameterListBase._itemsFromStrings(value,EventID._valueFromString))
919  def insertInto(self, parameterSet, myname):
920  cppIDs = list()
921  for i in self:
922  item = i
923  if isinstance(item, str):
924  item = EventID._valueFromString(item)
925  cppIDs.append(item.cppID(parameterSet))
926  parameterSet.addVEventID(self.isTracked(), myname, cppIDs)
927 
928 
930  def __init__(self,*arg,**args):
931  super(VLuminosityBlockRange,self).__init__(*arg,**args)
932  @staticmethod
933  def _itemIsValid(item):
934  return LuminosityBlockRange._isValid(item)
935  def configValueForItem(self,item,options):
936  return LuminosityBlockRange.formatValueForConfig(item)
937  def pythonValueForItem(self,item, options):
938  if isinstance(item, str):
939  return '"'+item+'"'
940  else:
941  return item.dumpPython(options)
942  @staticmethod
943  def _valueFromString(value):
944  return VLuminosityBlockRange(*_ValidatingParameterListBase._itemsFromStrings(value,VLuminosityBlockRange._valueFromString))
945  def insertInto(self, parameterSet, myname):
946  cppIDs = list()
947  for i in self:
948  item = i
949  if isinstance(item, str):
950  item = LuminosityBlockRange._valueFromString(item)
951  cppIDs.append(item.cppID(parameterSet))
952  parameterSet.addVLuminosityBlockRange(self.isTracked(), myname, cppIDs)
953 
954 
956  def __init__(self,*arg,**args):
957  super(VEventRange,self).__init__(*arg,**args)
958  @staticmethod
959  def _itemIsValid(item):
960  return EventRange._isValid(item)
961  def configValueForItem(self,item,options):
962  return EventRange.formatValueForConfig(item)
963  def pythonValueForItem(self,item, options):
964  if isinstance(item, str):
965  return '"'+item+'"'
966  else:
967  return item.dumpPython(options)
968  @staticmethod
969  def _valueFromString(value):
970  return VEventRange(*_ValidatingParameterListBase._itemsFromStrings(value,VEventRange._valueFromString))
971  def insertInto(self, parameterSet, myname):
972  cppIDs = list()
973  for i in self:
974  item = i
975  if isinstance(item, str):
976  item = EventRange._valueFromString(item)
977  cppIDs.append(item.cppID(parameterSet))
978  parameterSet.addVEventRange(self.isTracked(), myname, cppIDs)
979 
980 
982  def __init__(self,*arg,**args):
983  super(VPSet,self).__init__(*arg,**args)
984  self._nPerLine = 1
985  @staticmethod
986  def _itemIsValid(item):
987  return isinstance(item, PSet) and PSet._isValid(item)
988  def configValueForItem(self,item, options):
989  return PSet.configValue(item, options)
990  def pythonValueForItem(self,item, options):
991  return PSet.dumpPython(item,options)
992  def copy(self):
993  return copy.copy(self)
994  def _place(self,name,proc):
995  proc._placeVPSet(name,self)
996  def insertInto(self, parameterSet, myname):
997  # translate the PSet members into C++ parameterSets
998  parametersets = list()
999  for pset in self:
1000  newparameterset = parameterSet.newPSet()
1001  pset.insertContentsInto(newparameterset)
1002  parametersets.append(newparameterset)
1003  parameterSet.addVPSet(self.isTracked(), myname, parametersets)
1004  def __repr__(self):
1005  return self.dumpPython()
1006 
1007 def makeCppPSet(module,cppPSetMaker):
1008  """Extracts all PSets from the module and makes C++ equivalent
1009  """
1010  # if this isn't a dictionary, treat it as an object which holds PSets
1011  if not isinstance(module,dict):
1012  module = dict( ( (x,getattr(module,x)) for x in dir(module)) )
1013 
1014  for x,p in six.iteritems(module):
1015  if isinstance(p,PSet):
1016  p.insertInto(cppPSetMaker,x)
1017  return cppPSetMaker
1018 
1020  def __init__(self):
1021  self.pset = PSet()
1022  def addInt32(self,tracked,label,value):
1023  v = int32(value)
1024  v.setIsTracked(tracked)
1025  setattr(self.pset,label,v)
1026  def addUInt32(self,tracked,label,value):
1027  v = uint32(value)
1028  v.setIsTracked(tracked)
1029  setattr(self.pset,label,v)
1030  def addInt64(self,tracked,label,value):
1031  v = int64(value)
1032  v.setIsTracked(tracked)
1033  setattr(self.pset,label,v)
1034  def addUInt64(self,tracked,label,value):
1035  v = uint64(value)
1036  v.setIsTracked(tracked)
1037  setattr(self.pset,label,v)
1038  def addBool(self,tracked,label,value):
1039  v = bool(value)
1040  v.setIsTracked(tracked)
1041  setattr(self.pset,label,v)
1042  def addDouble(self,tracked,label,value):
1043  v = double(value)
1044  v.setIsTracked(tracked)
1045  setattr(self.pset,label,v)
1046  def addString(self,tracked,label,value):
1047  v = string(value)
1048  v.setIsTracked(tracked)
1049  setattr(self.pset,label,v)
1050  def addInputTag(self,tracked,label,value):
1051  v = copy.deepcopy(value)
1052  v.setIsTracked(tracked)
1053  setattr(self.pset,label,v)
1054  def addESInputTag(self,tracked,label,value):
1055  v = copy.deepcopy(value)
1056  v.setIsTracked(tracked)
1057  setattr(self.pset,label,v)
1058  def addEventID(self,tracked,label,value):
1059  v = copy.deepcopy(value)
1060  v.setIsTracked(tracked)
1061  setattr(self.pset,label,v)
1062  def addEventRange(self,tracked,label,value):
1063  v = copy.deepcopy(value)
1064  v.setIsTracked(tracked)
1065  setattr(self.pset,label,v)
1066  def addLuminosityBlockID(self,tracked,label,value):
1067  v = copy.deepcopy(value)
1068  v.setIsTracked(tracked)
1069  setattr(self.pset,label,v)
1070  def addLuminosityBlockRange(self,tracked,label,value):
1071  v = copy.deepcopy(value)
1072  v.setIsTracked(tracked)
1073  setattr(self.pset,label,v)
1074  def addVInt32(self,tracked,label,value):
1075  v = vint32(value)
1076  v.setIsTracked(tracked)
1077  setattr(self.pset,label,v)
1078  def addVUInt32(self,tracked,label,value):
1079  v = vuint32(value)
1080  v.setIsTracked(tracked)
1081  setattr(self.pset,label,v)
1082  def addVInt64(self,tracked,label,value):
1083  v = vint64(value)
1084  v.setIsTracked(tracked)
1085  setattr(self.pset,label,v)
1086  def addVUInt64(self,tracked,label,value):
1087  v = vuint64(value)
1088  v.setIsTracked(tracked)
1089  setattr(self.pset,label,v)
1090  def addVBool(self,tracked,label,value):
1091  v = vbool(value)
1092  v.setIsTracked(tracked)
1093  setattr(self.pset,label,v)
1094  def addVDouble(self,tracked,label,value):
1095  v = vdouble(value)
1096  v.setIsTracked(tracked)
1097  setattr(self.pset,label,v)
1098  def addVString(self,tracked,label,value):
1099  v = vstring(value)
1100  v.setIsTracked(tracked)
1101  setattr(self.pset,label,v)
1102  def addVInputTag(self,tracked,label,value):
1103  v = VInputTag(value)
1104  v.setIsTracked(tracked)
1105  setattr(self.pset,label,v)
1106  def addVESInputTag(self,tracked,label,value):
1107  v = VESInputTag(value)
1108  v.setIsTracked(tracked)
1109  setattr(self.pset,label,v)
1110  def addVEventID(self,tracked,label,value):
1111  v = VEventID(value)
1112  v.setIsTracked(tracked)
1113  setattr(self.pset,label,v)
1114  def addVEventRange(self,tracked,label,value):
1115  v = VEventRange(value)
1116  v.setIsTracked(tracked)
1117  setattr(self.pset,label,v)
1118  def addVLuminosityBlockID(self,tracked,label,value):
1119  v = VLuminosityBlockID(value)
1120  v.setIsTracked(tracked)
1121  setattr(self.pset,label,v)
1122  def addVLuminosityBlockRange(self,tracked,label,value):
1123  v = VLuminosityBlockRange(value)
1124  v.setIsTracked(tracked)
1125  setattr(self.pset,label,v)
1126  def addNewFileInPath(self,tracked,label,value):
1127  v = FileInPath(value)
1128  v.setIsTracked(tracked)
1129  setattr(self.pset,label,v)
1130  def newInputTag(self, label, instance, process):
1131  return InputTag(label,instance,process)
1132  def newESInputTag(self,moduleLabel,dataLabel):
1133  return ESInputTag(moduleLabel,dataLabel)
1134  def newEventID(self,r,l,e):
1135  return EventID(r,l,e)
1136  def newLuminosityBlockID(self,r,l):
1137  return LuminosityBlockID(r,l)
1138  def newEventRange(self,r,l,e,r2,l2,e2):
1139  return EventRange(r,l,e,r2,l2,e2)
1140  def newLuminosityBlockRange(self,r,l,r2,l2):
1141  return LuminosityBlockRange(r,l,r2,l2)
1142  def newPSet(self):
1143  return _ConvertToPSet()
1144  def addPSet(self,tracked,label,value):
1145  #value is of type _ConvertToPSet so we need
1146  # to extract the internally held PSet
1147  value.pset.setIsTracked(tracked)
1148  setattr(self.pset,label,value.pset)
1149  def addVPSet(self,tracked,label,value):
1150  #for each item in value gets its pset and create a new list
1151  v = VPSet()
1152  v.extend([x.pset for x in value])
1153  v.setIsTracked(tracked)
1154  setattr(self.pset,label,v)
1155 
1156 def convertToPSet(name,module):
1157  convert = _ConvertToPSet()
1158  module.insertInto(convert,name)
1159  return getattr(convert.pset,name)
1160 
1161 def convertToVPSet( **kw ):
1162  returnValue = VPSet()
1163  for name,module in six.iteritems(kw):
1164  returnValue.append(convertToPSet(name,module))
1165  return returnValue
1166 
1167 
1169  def __init__(self,*arg,**kargs):
1170  super(EDAlias,self).__init__(**kargs)
1171 
1172  def clone(self, *args, **params):
1173  returnValue = EDAlias.__new__(type(self))
1174  myparams = self.parameters_()
1175  if len(myparams) == 0 and len(params) and len(args):
1176  args.append(None)
1177 
1178  _modifyParametersFromDict(myparams, params, self._Parameterizable__raiseBadSetAttr)
1179 
1180  returnValue.__init__(*args, **myparams)
1181  saveOrigin(returnValue, 1)
1182  return returnValue
1183 
1184  def _place(self,name,proc):
1185  proc._placeAlias(name,self)
1186 
1187  def nameInProcessDesc_(self, myname):
1188  return myname;
1189 
1190  def appendToProcessDescList_(self, lst, myname):
1191  lst.append(self.nameInProcessDesc_(myname))
1192 
1193  def insertInto(self, parameterSet, myname):
1194  newpset = parameterSet.newPSet()
1195  newpset.addString(True, "@module_label", myname)
1196  newpset.addString(True, "@module_type", type(self).__name__)
1197  newpset.addString(True, "@module_edm_type", type(self).__name__)
1198  for name in self.parameterNames_():
1199  param = getattr(self,name)
1200  param.insertInto(newpset, name)
1201  parameterSet.addPSet(True, self.nameInProcessDesc_(myname), newpset)
1202 
1203  def dumpPython(self, options=PrintOptions()):
1204  specialImportRegistry.registerUse(self)
1205  resultList = ['cms.EDAlias(']
1206  separator = ""
1207  for name in self.parameterNames_():
1208  resultList[-1] = resultList[-1] + separator
1209  separator=","
1210  param = self.__dict__[name]
1211  options.indent()
1212  resultList.append(options.indentation()+name+' = '+param.dumpPython(options))
1213  options.unindent()
1214  return '\n'.join(resultList)+'\n)'
1215 
1216 if __name__ == "__main__":
1217 
1218  import unittest
1220  def addEventID(self,*pargs,**kargs):
1221  pass
1222  def newEventID(self,*pargs,**kargs):
1223  pass
1224  def addVEventID(self,*pargs,**kargs):
1225  pass
1226  def newLuminosityBlockID(self,*pargs,**kargs):
1227  pass
1228  def addLuminosityBlockID(self,*pargs,**kargs):
1229  pass
1230  def addVLuminosityBlockID(self,*pargs,**kargs):
1231  pass
1232  def addEventRange(self,*pargs,**kargs):
1233  pass
1234  def newEventRange(self,*pargs,**kargs):
1235  pass
1236  def addVEventRange(self,*pargs,**kargs):
1237  pass
1238  def newVEventRange(self,*pargs,**kargs):
1239  pass
1240  def addLuminosityBlockRange(self,*pargs,**kargs):
1241  pass
1242  def newLuminosityBlockRange(self,*pargs,**kargs):
1243  pass
1244  def addVLuminosityBlockRange(self,*pargs,**kargs):
1245  pass
1246  def newVLuminosityBlockRange(self,*pargs,**kargs):
1247  pass
1248  class testTypes(unittest.TestCase):
1249  def testint32(self):
1250  i = int32(1)
1251  self.assertEqual(i.value(),1)
1252  self.assert_(i)
1253  self.assertRaises(ValueError,int32,"i")
1254  i = int32._valueFromString("0xA")
1255  self.assertEqual(i.value(),10)
1256  self.assert_(not int32(0))
1257 
1258  def testuint32(self):
1259  i = uint32(1)
1260  self.assertEqual(i.value(),1)
1261  self.assert_(i)
1262  i = uint32(0)
1263  self.assertEqual(i.value(),0)
1264  self.assert_(not i)
1265  self.assertRaises(ValueError,uint32,"i")
1266  self.assertRaises(ValueError,uint32,-1)
1267  i = uint32._valueFromString("0xA")
1268  self.assertEqual(i.value(),10)
1269 
1270  def testdouble(self):
1271  d = double(1)
1272  self.assertEqual(d.value(),1)
1273  self.assertEqual(d.pythonValue(),'1')
1274  d = double(float('Inf'))
1275  self.assertEqual(d,float('Inf'))
1276  self.assertEqual(d.pythonValue(),"float('inf')")
1277  d = double(-float('Inf'))
1278  self.assertEqual(d,-float('Inf'))
1279  self.assertEqual(d.pythonValue(),"-float('inf')")
1280  d = double(float('Nan'))
1281  self.assert_(math.isnan(d.value()))
1282  self.assertEqual(d.pythonValue(),"float('nan')")
1283  def testvdouble(self):
1284  d = vdouble(1)
1285  self.assertEqual(d.value(),[1])
1286  self.assertEqual(d.dumpPython(),'cms.vdouble(1)')
1287  d = vdouble(float('inf'))
1288  self.assertEqual(d,[float('inf')])
1289  self.assertEqual(d.dumpPython(),"cms.vdouble(float('inf'))")
1290  d = vdouble(-float('Inf'))
1291  self.assertEqual(d,[-float('inf')])
1292  self.assertEqual(d.dumpPython(),"cms.vdouble(-float('inf'))")
1293  d = vdouble(float('nan'))
1294  self.assert_(math.isnan(d[0]))
1295  self.assertEqual(d.dumpPython(),"cms.vdouble(float('nan'))")
1296  def testvint32(self):
1297  v = vint32()
1298  self.assertEqual(len(v),0)
1299  self.assert_(not v)
1300  v.append(1)
1301  self.assertEqual(len(v),1)
1302  self.assertEqual(v[0],1)
1303  self.assert_(v)
1304  v.append(2)
1305  v.insert(1,3)
1306  self.assertEqual(v[1],3)
1307  v[1]=4
1308  self.assertEqual(v[1],4)
1309  v[1:1]=[5]
1310  self.assertEqual(len(v),4)
1311  self.assertEqual([1,5,4,2],list(v))
1312  self.assertEqual(repr(v), "cms.vint32(1, 5, 4, 2)")
1313  self.assertRaises(TypeError,v.append,('blah'))
1314  def testbool(self):
1315  b = bool(True)
1316  self.assertEqual(b.value(),True)
1317  self.assert_(b)
1318  b = bool(False)
1319  self.assertEqual(b.value(),False)
1320  self.assert_(not b)
1321  b = bool._valueFromString("2")
1322  self.assertEqual(b.value(),True)
1323  self.assertEqual(repr(b), "cms.bool(True)")
1324  self.assertRaises(ValueError, lambda: bool("False"))
1325  def testString(self):
1326  s=string('this is a test')
1327  self.assertEqual(s.value(),'this is a test')
1328  self.assertEqual(repr(s), "cms.string(\'this is a test\')")
1329  self.assert_(s)
1330  s=string('\0')
1331  self.assertEqual(s.value(),'\0')
1332  self.assertEqual(s.configValue(),"'\\0'")
1333  s2=string('')
1334  self.assertEqual(s2.value(),'')
1335  self.assert_(not s2)
1336  def testvstring(self):
1337  a = vstring("", "Barack", "John", "Sarah", "Joe")
1338  self.assertEqual(len(a), 5)
1339  self.assertEqual(a[0], "")
1340  self.assertEqual(a[3], "Sarah")
1341  ps = PSet(v = vstring('a', 'b'))
1342  ps.v = ['loose']
1343  def testUntracked(self):
1344  p=untracked(int32(1))
1345  self.assertRaises(TypeError,untracked,(1),{})
1346  self.failIf(p.isTracked())
1347  p=untracked.int32(1)
1348  self.assertEqual(repr(p), "cms.untracked.int32(1)")
1349  self.assertRaises(TypeError,untracked,(1),{})
1350  self.failIf(p.isTracked())
1351  p=untracked.vint32(1,5,3)
1352  self.assertRaises(TypeError,untracked,(1,5,3),{})
1353  self.failIf(p.isTracked())
1354  p = untracked.PSet(b=int32(1))
1355  self.failIf(p.isTracked())
1356  self.assertEqual(p.b.value(),1)
1357  def testInputTag(self):
1358  it = InputTag._valueFromString("label::proc")
1359  self.assertEqual(it.getModuleLabel(), "label")
1360  self.assertEqual(it.getProductInstanceLabel(), "")
1361  self.assertEqual(it.getProcessName(), "proc")
1362  # tolerate, at least for translation phase
1363  #self.assertRaises(RuntimeError, InputTag,'foo:bar')
1364  it=InputTag('label',processName='proc')
1365  self.assertEqual(it.getModuleLabel(), "label")
1366  self.assertEqual(it.getProductInstanceLabel(), "")
1367  self.assertEqual(it.getProcessName(), "proc")
1368  self.assertEqual(repr(it), "cms.InputTag(\"label\",\"\",\"proc\")")
1369  vit = VInputTag(InputTag("label1"), InputTag("label2"))
1370  self.assertEqual(repr(vit), "cms.VInputTag(cms.InputTag(\"label1\"), cms.InputTag(\"label2\"))")
1371  vit = VInputTag("label1", "label2:label3")
1372  self.assertEqual(repr(vit), "cms.VInputTag(\"label1\", \"label2:label3\")")
1373  it=InputTag('label',processName=InputTag.skipCurrentProcess())
1374  self.assertEqual(it.getModuleLabel(), "label")
1375  self.assertEqual(it.getProductInstanceLabel(), "")
1376  self.assertEqual(it.getProcessName(), "@skipCurrentProcess")
1377  it=InputTag('label','x',InputTag.skipCurrentProcess())
1378  self.assertEqual(it.getModuleLabel(), "label")
1379  self.assertEqual(it.getProductInstanceLabel(), "x")
1380  self.assertEqual(it.getProcessName(), "@skipCurrentProcess")
1381  it = InputTag("label:in:@skipCurrentProcess")
1382  self.assertEqual(it.getModuleLabel(), "label")
1383  self.assertEqual(it.getProductInstanceLabel(), "in")
1384  self.assertEqual(it.getProcessName(), "@skipCurrentProcess")
1386  a=InputTag("a")
1387  self.assertEqual(a.isModified(),False)
1388  a.setModuleLabel("a")
1389  self.assertEqual(a.isModified(),False)
1390  a.setModuleLabel("b")
1391  self.assertEqual(a.isModified(),True)
1392  a.resetModified()
1393  a.setProductInstanceLabel("b")
1394  self.assertEqual(a.isModified(),True)
1395  a.resetModified()
1396  a.setProcessName("b")
1397  self.assertEqual(a.isModified(),True)
1398  a.resetModified()
1399  a.setValue("b")
1400  self.assertEqual(a.isModified(),True)
1401  def testESInputTag(self):
1402  it = ESInputTag._valueFromString("label:data")
1403  self.assertEqual(it.getModuleLabel(), "label")
1404  self.assertEqual(it.getDataLabel(), "data")
1405  # tolerate, at least for translation phase
1406  #self.assertRaises(RuntimeError, InputTag,'foo:bar')
1407  it=ESInputTag(data='data')
1408  self.assertEqual(it.getModuleLabel(), "")
1409  self.assertEqual(it.getDataLabel(), "data")
1410  self.assertEqual(repr(it), "cms.ESInputTag(\"\",\"data\")")
1411  vit = VESInputTag(ESInputTag("label1"), ESInputTag("label2"))
1412  self.assertEqual(repr(vit), "cms.VESInputTag(cms.ESInputTag(\"label1\"), cms.ESInputTag(\"label2\"))")
1413  vit = VESInputTag("label1", "label2:label3")
1414  self.assertEqual(repr(vit), "cms.VESInputTag(\"label1\", \"label2:label3\")")
1415 
1416  def testPSet(self):
1417  p1 = PSet(anInt = int32(1), a = PSet(b = int32(1)))
1418  self.assertRaises(ValueError, PSet, "foo")
1419  self.assertRaises(TypeError, PSet, foo = "bar")
1420  self.assertEqual(repr(p1), "cms.PSet(\n a = cms.PSet(\n b = cms.int32(1)\n ),\n anInt = cms.int32(1)\n)")
1421  vp1 = VPSet(PSet(i = int32(2)))
1422  #self.assertEqual(vp1.configValue(), "
1423  self.assertEqual(repr(vp1), "cms.VPSet(cms.PSet(\n i = cms.int32(2)\n))")
1424  self.assert_(p1.hasParameter(['a', 'b']))
1425  self.failIf(p1.hasParameter(['a', 'c']))
1426  self.assertEqual(p1.getParameter(['a', 'b']).value(), 1)
1427  # test clones and trackedness
1428  p3 = untracked.PSet(i = int32(1), ui=untracked.int32(2), a = PSet(b = untracked.int32(1)), b = untracked.PSet(b = int32(1)))
1429  p4 = p3.clone()
1430  self.assertFalse(p4.isTracked())
1431  self.assert_(p4.i.isTracked())
1432  self.assertFalse(p4.ui.isTracked())
1433  self.assert_(p4.a.isTracked())
1434  self.assertFalse(p4.b.isTracked())
1435  self.assertFalse(p4.a.b.isTracked())
1436  self.assert_(p4.b.b.isTracked())
1437  p4 = p3.clone( i = None, b = dict(b = 5))
1438  self.assertEqual(p3.i.value(), 1)
1439  self.assertEqual(hasattr(p4,"i"), False)
1440  self.assertEqual(p3.b.b.value(), 1)
1441  self.assertEqual(p4.b.b.value(), 5)
1442  self.assertEqual(p4.a.b.value(), 1)
1443  self.assertEqual(p4.ui.value(), 2)
1444  # couple of cases of "weird" arguments
1445  self.assertRaises(TypeError, p4.clone, dict(b = None))
1446  self.assertRaises(TypeError, p4.clone, [])
1447  self.assertRaises(TypeError, p4.clone, 42)
1448  def testVPSet(self):
1449  p1 = VPSet(PSet(anInt = int32(1)), PSet(anInt=int32(2)))
1450  self.assertEqual(len(p1),2)
1451  self.assertEqual(p1[0].anInt.value(), 1)
1452  self.assertEqual(p1[1].anInt.value(), 2)
1453  self.assertRaises(TypeError, lambda : VPSet(3))
1454  self.assertRaises(TypeError, lambda : VPSet(int32(3)))
1455  self.assertRaises(SyntaxError, lambda : VPSet(foo=PSet()))
1456  def testEDAlias(self):
1457  aliasfoo2 = EDAlias(foo2 = VPSet(PSet(type = string("Foo2"))))
1458  self.assert_(hasattr(aliasfoo2,"foo2"))
1459  del aliasfoo2.foo2
1460  self.assert_(not hasattr(aliasfoo2,"foo2"))
1461  self.assert_("foo2" not in aliasfoo2.parameterNames_())
1462 
1463  aliasfoo2 = EDAlias(foo2 = VPSet(PSet(type = string("Foo2"))))
1464  aliasfoo3 = aliasfoo2.clone(
1465  foo2 = {0: dict(type = "Foo4")},
1466  foo3 = VPSet(PSet(type = string("Foo3")))
1467  )
1468  self.assertTrue(hasattr(aliasfoo3, "foo2"))
1469  self.assertTrue(hasattr(aliasfoo3, "foo3"))
1470  self.assertEqual(aliasfoo3.foo2[0].type, "Foo4")
1471  self.assertEqual(aliasfoo3.foo3[0].type, "Foo3")
1472 
1473  aliasfoo4 = aliasfoo3.clone(foo2 = None)
1474  self.assertFalse(hasattr(aliasfoo4, "foo2"))
1475  self.assertTrue(hasattr(aliasfoo4, "foo3"))
1476  self.assertEqual(aliasfoo4.foo3[0].type, "Foo3")
1477 
1478  def testFileInPath(self):
1479  f = FileInPath("FWCore/ParameterSet/python/Types.py")
1480  self.assertEqual(f.configValue(), "'FWCore/ParameterSet/python/Types.py'")
1481  def testSecSource(self):
1482  s1 = SecSource("EmbeddedRootSource", fileNames = vstring("foo.root"))
1483  self.assertEqual(s1.type_(), "EmbeddedRootSource")
1484  self.assertEqual(s1.configValue(),
1485 """EmbeddedRootSource { """+"""
1486  vstring fileNames = {
1487  'foo.root'
1488  }
1489 
1490 }
1491 """)
1492  s1=SecSource("EmbeddedRootSource",type=int32(1))
1493  self.assertEqual(s1.type.value(),1)
1494  def testEventID(self):
1495  eid = EventID(2, 0, 3)
1496  self.assertEqual( repr(eid), "cms.EventID(2, 0, 3)" )
1497  pset = PSetTester()
1498  eid.insertInto(pset,'foo')
1499  eid2 = EventID._valueFromString('3:4')
1500  eid2.insertInto(pset,'foo2')
1501  def testVEventID(self):
1502  veid = VEventID(EventID(2, 0, 3))
1503  veid2 = VEventID("1:2", "3:4")
1504  self.assertEqual( repr(veid[0]), "cms.EventID(2, 0, 3)" )
1505  self.assertEqual( repr(veid2[0]), "'1:2'" )
1506  self.assertEqual( veid2.dumpPython(), 'cms.VEventID("1:2", "3:4")')
1507  pset = PSetTester()
1508  veid.insertInto(pset,'foo')
1509 
1511  lid = LuminosityBlockID(2, 3)
1512  self.assertEqual( repr(lid), "cms.LuminosityBlockID(2, 3)" )
1513  pset = PSetTester()
1514  lid.insertInto(pset,'foo')
1515  lid2 = LuminosityBlockID._valueFromString('3:4')
1516  lid2.insertInto(pset,'foo2')
1517 
1520  vlid2 = VLuminosityBlockID("1:2", "3:4")
1521  self.assertEqual( repr(vlid[0]), "cms.LuminosityBlockID(2, 3)" )
1522  self.assertEqual( repr(vlid2[0]), "'1:2'" )
1523  pset = PSetTester()
1524  vlid.insertInto(pset,'foo')
1525 
1526  def testEventRange(self):
1527  range1 = EventRange(1, 0, 2, 3, 0, 4)
1528  range2 = EventRange._valueFromString("1:2 - 3:4")
1529  range3 = EventRange._valueFromString("1:MIN - 3:MAX")
1530  self.assertEqual(repr(range1), repr(range1))
1531  self.assertEqual(repr(range3), "cms.EventRange(1, 0, 1, 3, 0, 0)")
1532  pset = PSetTester()
1533  range1.insertInto(pset,'foo')
1534  range2.insertInto(pset,'bar')
1535  def testVEventRange(self):
1536  v1 = VEventRange(EventRange(1, 0, 2, 3, 0, 4))
1537  v2 = VEventRange("1:2-3:4", "5:MIN-7:MAX")
1538  self.assertEqual( repr(v1[0]), "cms.EventRange(1, 0, 2, 3, 0, 4)" )
1539  pset = PSetTester()
1540  v2.insertInto(pset,'foo')
1541 
1543  range1 = LuminosityBlockRange(1, 2, 3, 4)
1544  range2 = LuminosityBlockRange._valueFromString("1:2 - 3:4")
1545  range3 = LuminosityBlockRange._valueFromString("1:MIN - 3:MAX")
1546  self.assertEqual(repr(range1), repr(range1))
1547  self.assertEqual(repr(range3), "cms.LuminosityBlockRange(1, 1, 3, 0)")
1548  pset = PSetTester()
1549  range1.insertInto(pset,'foo')
1550  range2.insertInto(pset,'bar')
1553  v2 = VLuminosityBlockRange("1:2-3:4", "5:MIN-7:MAX")
1554  self.assertEqual( repr(v1[0]), "cms.LuminosityBlockRange(1, 2, 3, 4)" )
1555  pset = PSetTester()
1556  v2.insertInto(pset,'foo')
1557 
1559  p = PSet(a = untracked.int32(7),
1560  b = untracked.InputTag("b"),
1561  c = untracked.ESInputTag("c"),
1562  d = EventID(1,1,1),
1563  e = LuminosityBlockID(1,1),
1564  f = EventRange(1,1,1,8,8,8),
1565  g = LuminosityBlockRange(1,1,8,8),
1566  h = untracked.string('dummy'),
1567  i = untracked.bool(False),
1568  j = untracked.uint32(7),
1569  k = untracked.int64(7),
1570  l = untracked.uint64(7),
1571  m = untracked.double(7.0),
1572  n = FileInPath("xxx"),
1573  o = untracked.vint32(7,8),
1574  p = untracked.VInputTag(InputTag("b"),InputTag("c")),
1575  q = untracked.VESInputTag(ESInputTag("c"),ESInputTag("d")),
1576  r = untracked.VEventID(EventID(1,1,1),EventID(2,2,2)),
1577  s = untracked.VLuminosityBlockID(LuminosityBlockID(1,1),LuminosityBlockID(2,3)),
1578  t = untracked.VEventRange(EventRange(1,1,1,8,8,8), EventRange(9,9,9,18,18,18)),
1579  u = untracked.VLuminosityBlockRange(LuminosityBlockRange(1,1,8,8), LuminosityBlockRange(9,9,18,18)),
1580  v = untracked.vstring('dummy','anotherdummy'),
1581  w = untracked.vbool(False,True),
1582  x = untracked.vuint32(7,8),
1583  y = untracked.vint64(7,8),
1584  z = untracked.vuint64(7,8),
1585  A = vdouble(7.0,8.0)
1586  )
1587  convert = _ConvertToPSet()
1588  p.insertInto(convert,"p")
1589  self.assert_(hasattr(convert.pset,'p'))
1590  self.assert_(hasattr(convert.pset.p,'a'))
1591  self.assertEqual(p.a,convert.pset.p.a)
1592  self.assertEqual(p.a.isTracked(),convert.pset.p.a.isTracked())
1593 
1594  q = PSet(b = int32(1), p = p)
1595  q.insertInto(convert,"q")
1596  self.assert_(hasattr(convert.pset,'q'))
1597  self.assert_(hasattr(convert.pset.q,'b'))
1598  self.assertEqual(q.b,convert.pset.q.b)
1599  self.assert_(hasattr(convert.pset.q,'p'))
1600  self.assert_(hasattr(convert.pset.q.p,'a'))
1601  self.assertEqual(p.a,convert.pset.q.p.a)
1602  for i in p.parameterNames_():
1603  self.assertEqual(str(getattr(p,i)),str(getattr(convert.pset.p,i)))
1605  p = PSet(a = untracked.int32(7))
1606  q = PSet(b = int32(1), p = p)
1607  v = VPSet(p,q)
1608  convert = _ConvertToPSet()
1609  v.insertInto(convert,'v')
1610  self.assert_(hasattr(convert.pset,'v'))
1611  self.assert_(len(convert.pset.v)==2)
1612  self.assertEqual(v[0].a,convert.pset.v[0].a)
1613  self.assertEqual(v[1].b,convert.pset.v[1].b)
1614  self.assertEqual(v[1].p.a, convert.pset.v[1].p.a)
1615 
1616  class testInequalities(unittest.TestCase):
1617  def testnumbers(self):
1618  self.assertGreater(int32(5), int32(-1))
1619  self.assertGreater(int64(100), 99)
1620  self.assertLess(3, uint32(4))
1621  self.assertLess(6.999999999, uint64(7))
1622  self.assertLessEqual(-5, int32(-5))
1623  self.assertLessEqual(int32(-5), uint32(1))
1624  self.assertGreaterEqual(double(5.3), uint32(5))
1625  self.assertGreater(double(5.3), uint64(5))
1626  self.assertGreater(double(5.3), uint64(5))
1627  self.assertGreater(6, double(5))
1628  self.assertLess(uint64(0xFFFFFFFFFFFFFFFF), 0xFFFFFFFFFFFFFFFF+1)
1629  self.assertEqual(double(5.0), double(5))
1630  def teststring(self):
1631  self.assertGreater(string("I am a string"), "I am a strinf")
1632  self.assertGreaterEqual("I am a string", string("I am a string"))
1633  self.assertLess(5, string("I am a string"))
1635  import sys
1636  if sys.version_info < (3, 0): #python 2, comparing incompatible types compares the class name
1637  self.assertLess(double(3), "I am a string")
1638  self.assertLess(3, string("I am a string"))
1639  self.assertLess(double(5), "4")
1640  else: #python 3, comparing incompatible types fails
1641  with self.assertRaises(TypeError):
1642  double(3) < "I am a string"
1643  with self.assertRaises(TypeError):
1644  3 < string("I am a string")
1645  def testinfinity(self):
1646  self.assertLess(1e99, double(float("inf")))
1647  self.assertLess(double(1e99), float("inf"))
1648  self.assertGreater(1e99, double(float("-inf")))
1649  self.assertEqual(double(float("inf")), float("inf"))
1650  def testnan(self):
1651  nan = double(float("nan"))
1652  self.assertNotEqual(nan, nan)
1653  self.assertFalse(nan > 3 or nan < 3 or nan == 3)
1654 
1655  unittest.main()
def addInt32(self, tracked, label, value)
Definition: Types.py:1022
def configValueForItem(self, item, options)
Definition: Types.py:935
def addNewFileInPath(self, tracked, label, value)
Definition: Types.py:1126
def copy(self)
Definition: Types.py:698
def setValue(self, v)
Definition: Types.py:521
def __init__(self, arg, args)
Definition: Types.py:665
def convertToPSet(name, module)
Definition: Types.py:1156
def addVLuminosityBlockRange(self, tracked, label, value)
Definition: Types.py:1122
def _isValid(value)
Definition: Types.py:676
def startLumi(self)
Definition: Types.py:368
def newPSet(self)
Definition: Types.py:1142
def configValueForItem(self, item, options)
Definition: Types.py:811
def insertInto(self, parameterSet, myname)
Definition: Types.py:621
def testint32(self)
Definition: Types.py:1249
def _itemIsValid(item)
Definition: Types.py:777
def insertInto(self, parameterSet, myname)
Definition: Types.py:945
def addVPSet(self, tracked, label, value)
Definition: Types.py:1149
def addVEventID(self, tracked, label, value)
Definition: Types.py:1110
def newLuminosityBlockID(self, pargs, kargs)
Definition: Types.py:1226
def testEventRange(self)
Definition: Types.py:1526
def testincompatibletypes(self)
Definition: Types.py:1634
def newESInputTag(self, moduleLabel, dataLabel)
Definition: Types.py:1132
def end(self)
Definition: Types.py:372
def pythonTypeName(self)
Definition: Mixins.py:68
def _valueFromString(value)
Definition: Types.py:382
def testString(self)
Definition: Types.py:1325
def dumpPython(self, options=PrintOptions())
Definition: Mixins.py:72
def makeCppPSet(module, cppPSetMaker)
Definition: Types.py:1007
def dumpConfig(self, options=PrintOptions())
Definition: Mixins.py:443
def _isValid(value)
Definition: Types.py:577
def __gt__(self, other)
Definition: Types.py:500
def insertInto(self, parameterSet, myname)
Definition: Types.py:63
def _itemIsValid(item)
Definition: Types.py:986
def _valueFromString(value)
Definition: Types.py:752
def _isValid(value)
Definition: Types.py:72
def addDouble(self, tracked, label, value)
Definition: Types.py:1042
def insertInto(self, parameterSet, myname)
Definition: Types.py:1193
def cppID(self, parameterSet)
Definition: Types.py:267
def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth="")
Definition: Mixins.py:665
def setProcessName(self, label)
Definition: Types.py:454
def formatValueForConfig(value)
Definition: Types.py:169
def testLuminosityBlockID(self)
Definition: Types.py:1510
def insertInto(self, parameterSet, myname)
Definition: Types.py:704
def _valueFromString(value)
Definition: Types.py:261
def __init__(self, type_, arg, args)
Definition: Types.py:642
def insertInto(self, parameterSet, myname)
Definition: Types.py:540
def event(self)
Definition: Types.py:220
def insertInto(self, parameterSet, myname)
Definition: Types.py:832
def _valueFromString(value)
Definition: Types.py:943
def _isValid(value)
Definition: Types.py:648
def pythonValue(self, options=PrintOptions())
Definition: Types.py:480
def _itemIsValid(item)
Definition: Types.py:809
def pythonValue(self, options=PrintOptions())
Definition: Types.py:426
def configValueForItem(self, item, options)
Definition: Types.py:825
def addLuminosityBlockRange(self, tracked, label, value)
Definition: Types.py:1070
def __init__(self, arg, kargs)
Definition: Types.py:1169
def addVLuminosityBlockID(self, tracked, label, value)
Definition: Types.py:1118
def _valueFromString(value)
Definition: Types.py:139
def insertInto(self, parameterSet, myname)
Definition: Types.py:46
def insertInto(self, parameterSet, myname)
Definition: Types.py:754
def __eq__(self, other)
Definition: Types.py:579
def _setValues(self, moduleLabel='', dataLabel='')
Definition: Types.py:604
def configTypeName(self)
Definition: Types.py:650
def addVInt32(self, tracked, label, value)
Definition: Types.py:1074
def nameInProcessDesc_(self, myname)
Definition: Types.py:1187
def addBool(self, tracked, label, value)
Definition: Types.py:1038
def insertInto(self, parameterSet, myname)
Definition: Types.py:331
def addVString(self, tracked, label, value)
Definition: Types.py:1098
def luminosityBlock(self)
Definition: Types.py:218
def _valueFromString(value)
Definition: Types.py:797
def newLuminosityBlockRange(self, r, l, r2, l2)
Definition: Types.py:1140
def testPSetConversion(self)
Definition: Types.py:1558
def insertInto(self, parameterSet, myname)
Definition: Types.py:893
def __init__(self, moduleLabel, productInstanceLabel='', processName='')
Definition: Types.py:435
def addVUInt64(self, tracked, label, value)
Definition: Types.py:1086
def insertInto(self, parameterSet, myname)
Definition: Types.py:100
def getModuleLabel(self)
Definition: Types.py:438
def luminosityBlock(self)
Definition: Types.py:255
def setProductInstanceLabel(self, label)
Definition: Types.py:447
def addLuminosityBlockRange(self, pargs, kargs)
Definition: Types.py:1240
def _itemIsValid(item)
Definition: Types.py:906
def testVLuminosityBlockID(self)
Definition: Types.py:1518
def getDataLabel(self)
Definition: Types.py:554
def newLuminosityBlockRange(self, pargs, kargs)
Definition: Types.py:1242
def pythonValueForItem(self, item, options)
Definition: Types.py:827
def addLuminosityBlockID(self, pargs, kargs)
Definition: Types.py:1228
def __init__(self, arg, args)
Definition: Types.py:956
def cppTag(self, parameterSet)
Definition: Types.py:536
def configValueForItem(self, item, options)
Definition: Types.py:908
def __le__(self, other)
Definition: Types.py:587
def _valueFromString(value)
Definition: Types.py:738
def __init__(self, value)
Definition: Types.py:159
def testVLuminosityBlockRange(self)
Definition: Types.py:1551
def testbool(self)
Definition: Types.py:1314
def endLumi(self)
Definition: Types.py:374
def addVLuminosityBlockID(self, pargs, kargs)
Definition: Types.py:1230
def copy(self)
Definition: Types.py:992
def newEventRange(self, pargs, kargs)
Definition: Types.py:1234
def _valueFromString(value)
Definition: Types.py:186
def configValue(self, options=PrintOptions())
Definition: Types.py:471
def __repr__(self)
Definition: Types.py:1004
def cppID(self, parameterSet)
Definition: Types.py:429
def insertInto(self, parameterSet, myname)
Definition: Types.py:971
def formatValueForConfig(value)
Definition: Types.py:515
def configValueForItem(self, item, options)
Definition: Types.py:848
def addVEventRange(self, pargs, kargs)
Definition: Types.py:1236
def _isValid(value)
Definition: Types.py:109
def _isValid(value)
Definition: Types.py:628
def testdouble(self)
Definition: Types.py:1270
def _isValid(value)
Definition: Types.py:91
def insertInto(self, parameterSet, myname)
Definition: Types.py:863
def insertInto(self, parameterSet, myname)
Definition: Types.py:115
def configValue(self, options=PrintOptions())
Definition: Types.py:561
def _valueFromString(string)
Definition: Types.py:518
def insertInto(self, parameterSet, myname)
Definition: Types.py:782
def _itemIsValid(item)
Definition: Types.py:735
def insertInto(self, parameterSet, myname)
Definition: Types.py:726
def teststring(self)
Definition: Types.py:1630
def _valueFromString(value)
Definition: Types.py:41
def addInt64(self, tracked, label, value)
Definition: Types.py:1030
def pythonValue(self, options=PrintOptions())
Definition: Types.py:326
def configValue(self, options=PrintOptions())
Definition: Types.py:679
def skipCurrentProcess()
Definition: Types.py:460
def testinfinity(self)
Definition: Types.py:1645
def insertContentsInto(self, parameterSet)
Definition: Types.py:708
def configValue(self, options=PrintOptions())
Definition: Types.py:652
def insertInto(self, parameterSet, myname)
Definition: Types.py:816
def __nonzero__(self)
Definition: Types.py:102
def __str__(self)
Definition: Types.py:661
def __init__(self, run, block=None)
Definition: Types.py:245
def __gt__(self, other)
Definition: Types.py:585
def setValue(self, v)
Definition: Types.py:601
def _valueFromString(value)
Definition: Types.py:636
def _valueFromString(value)
Definition: Types.py:112
def _isValid(value)
Definition: Types.py:136
def __init__(self, arg, args)
Definition: Types.py:805
def value(self)
Definition: Types.py:591
def pythonValue(self, options=PrintOptions())
Definition: Types.py:166
def _isValid(value)
Definition: Types.py:223
def convertToVPSet(kw)
Definition: Types.py:1161
def insertInto(self, parameterSet, myname)
Definition: Types.py:996
def _isValid(value)
Definition: Types.py:489
def endSub(self)
Definition: Types.py:376
def addEventRange(self, tracked, label, value)
Definition: Types.py:1062
def insertInto(self, parameterSet, myname)
Definition: Types.py:919
def configValue(self, options=PrintOptions())
Definition: Types.py:119
def _isValid(value)
Definition: Types.py:38
def _itemIsValid(item)
Definition: Types.py:846
def newVLuminosityBlockRange(self, pargs, kargs)
Definition: Types.py:1246
def __getattr__(self, name)
Definition: Types.py:21
def newInputTag(self, label, instance, process)
Definition: Types.py:1130
def appendToProcessDescList_(self, lst, myname)
Definition: Types.py:1190
def _valueFromString(value)
Definition: Types.py:861
def _isValid(value)
Definition: Types.py:162
def testInputTag(self)
Definition: Types.py:1357
def clone(self, params)
Definition: Types.py:690
def testFileInPath(self)
Definition: Types.py:1478
def testVEventID(self)
Definition: Types.py:1501
def __lt__(self, other)
Definition: Types.py:497
def addVDouble(self, tracked, label, value)
Definition: Types.py:1094
def addVEventRange(self, tracked, label, value)
Definition: Types.py:1114
def __ge__(self, other)
Definition: Types.py:506
def __le__(self, other)
Definition: Types.py:503
def _valueFromString(value)
Definition: Types.py:830
def testuint32(self)
Definition: Types.py:1258
def isRef_(self)
Definition: Types.py:671
def _itemIsValid(item)
Definition: Types.py:721
def __init__(self, arg, args)
Definition: Types.py:791
def testvdouble(self)
Definition: Types.py:1283
def __eq__(self, other)
Definition: Types.py:491
bool decode(bool &, std::string const &)
Definition: types.cc:72
def __init__(self, arg, args)
Definition: Types.py:843
def __init__(self, arg, args)
Definition: Types.py:717
def insertInto(self, parameterSet, myname)
Definition: Types.py:240
def pythonValueForItem(self, item, options)
Definition: Types.py:910
def addEventID(self, tracked, label, value)
Definition: Types.py:1058
def __init__(self, arg, args)
Definition: Types.py:774
def addPSet(self, tracked, label, value)
Definition: Types.py:1144
def newLuminosityBlockID(self, r, l)
Definition: Types.py:1136
def __ne__(self, other)
Definition: Types.py:581
def __init__(self, arg, args)
Definition: Types.py:873
def addUInt32(self, tracked, label, value)
Definition: Types.py:1026
def value(self)
Definition: Types.py:645
def __init__(self, start, startSub=None, end=None, endSub=None)
Definition: Types.py:274
def _itemIsValid(item)
Definition: Types.py:749
def insertInto(self, parameterSet, myname)
Definition: Types.py:269
def run(self)
Definition: Types.py:216
def clone(self, args, params)
Definition: Types.py:1172
Definition: value.py:1
def _valueFromString(value)
Definition: Types.py:891
def pythonValue(self, options=PrintOptions())
Definition: Types.py:236
def testVPSetConversion(self)
Definition: Types.py:1604
def saveOrigin(obj, level)
Definition: Mixins.py:659
def _valueFromString(string)
Definition: Types.py:598
def __nonzero__(self)
Definition: Types.py:48
def startSub(self)
Definition: Types.py:370
def _valueFromString(value)
Definition: Types.py:969
def _itemIsValid(item)
Definition: Types.py:876
def insertInto(self, parameterSet, myname)
Definition: Types.py:638
def _isValid(value)
Definition: Types.py:54
def cppID(self, parameterSet)
Definition: Types.py:329
def __nonzero__(self)
Definition: Types.py:117
def addInputTag(self, tracked, label, value)
Definition: Types.py:1050
def configValueForItem(self, item, options)
Definition: Types.py:988
def testnumbers(self)
Definition: Types.py:1617
def pythonValueForItem(self, item, options)
Definition: Types.py:990
def __init__(self, arg, args)
Definition: Types.py:760
def _valueFromString(value)
Definition: Types.py:917
def insertInto(self, parameterSet, myname)
Definition: Types.py:82
def addESInputTag(self, tracked, label, value)
Definition: Types.py:1054
def __ne__(self, other)
Definition: Types.py:494
def setModuleLabel(self, label)
Definition: Types.py:440
def setDataLabel(self, label)
Definition: Types.py:556
def insertInto(self, parameterSet, myname)
Definition: Types.py:189
def dumpPython(self, options=PrintOptions())
Definition: Types.py:1203
def configValue(self, options=PrintOptions())
Definition: Mixins.py:101
def newEventID(self, pargs, kargs)
Definition: Types.py:1222
def __nonzero__(self)
Definition: Types.py:152
def addVLuminosityBlockRange(self, pargs, kargs)
Definition: Types.py:1244
def __init__(self, arg, args)
Definition: Types.py:732
def cppTag(self, parameterSet)
Definition: Types.py:618
def value(self)
Definition: Types.py:511
def _valueFromString(value)
Definition: Types.py:58
def testInputTagModified(self)
Definition: Types.py:1385
def testLuminosityBlockRange(self)
Definition: Types.py:1542
def _setValues(self, moduleLabel, productInstanceLabel='', processName='')
Definition: Types.py:524
def configValueForItem(self, item, options)
Definition: Types.py:961
def newVEventRange(self, pargs, kargs)
Definition: Types.py:1238
def testnan(self)
Definition: Types.py:1650
def __init__(self, value)
Definition: Types.py:625
def start(self)
Definition: Types.py:366
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def insertInto(self, parameterSet, myname)
Definition: Types.py:799
def testEventID(self)
Definition: Types.py:1494
def _itemIsValid(item)
Definition: Types.py:959
def __init__(self, arg, args)
Definition: Types.py:820
def _place(self, name, proc)
Definition: Types.py:1184
def formatValueForConfig(value)
Definition: Types.py:633
def testVPSet(self)
Definition: Types.py:1448
def insertInto(self, parameterSet, myname)
Definition: Types.py:768
def _itemIsValid(item)
Definition: Types.py:794
def _valueFromString(value)
Definition: Types.py:304
def addVInputTag(self, tracked, label, value)
Definition: Types.py:1102
def getModuleLabel(self)
Definition: Types.py:547
def parameterNames_(self)
Definition: Mixins.py:175
def addEventID(self, pargs, kargs)
Definition: Types.py:1220
def testESInputTag(self)
Definition: Types.py:1401
def _valueFromString(value)
Definition: Types.py:814
def pythonValueForItem(self, item, options)
Definition: Types.py:963
def testSecSource(self)
Definition: Types.py:1481
def cppID(self, parameterSet)
Definition: Types.py:238
def copy(self)
Definition: Types.py:656
__luminosityBlock
Definition: Types.py:204
def configValueForItem(self, item, options)
Definition: Types.py:878
def pythonValueForItem(self, item, options)
Definition: Types.py:937
def newEventID(self, r, l, e)
Definition: Types.py:1134
def __init__(self, run, args)
Definition: Types.py:200
def __nonzero__(self)
Definition: Types.py:84
def _valueFromString(value)
Definition: Types.py:766
def addLuminosityBlockID(self, tracked, label, value)
Definition: Types.py:1066
def __nonzero__(self)
Definition: Types.py:65
def pythonValueForItem(self, item, options)
Definition: Types.py:784
def testVEventRange(self)
Definition: Types.py:1535
def value(self)
Definition: Types.py:669
def getProcessName(self)
Definition: Types.py:452
def __init__(self, arg, args)
Definition: Types.py:982
def pythonValue(self, options=PrintOptions())
Definition: Types.py:568
def insertInto(self, parameterSet, myname)
Definition: Types.py:150
def _place(self, name, proc)
Definition: Types.py:700
def __init__(self, arg, args)
Definition: Types.py:903
def __init__(self, arg, args)
Definition: Types.py:746
def __str__(self)
Definition: Types.py:702
def __init__(self, start, args)
Definition: Types.py:335
def pythonValueForItem(self, item, options)
Definition: Types.py:854
def __call__(param)
Definition: Types.py:17
def _place(self, name, proc)
Definition: Types.py:994
def _valueFromString(value)
Definition: Types.py:780
def testPSet(self)
Definition: Types.py:1416
def insertInto(self, parameterSet, myname)
Definition: Types.py:431
def testEDAlias(self)
Definition: Types.py:1456
def addString(self, tracked, label, value)
Definition: Types.py:1046
def addUInt64(self, tracked, label, value)
Definition: Types.py:1034
def _place(self, name, proc)
Definition: Types.py:659
def __init__(self, arg, args)
Definition: Types.py:930
def __bool__(self)
Definition: Types.py:154
def _valueFromString(value)
Definition: Types.py:226
def newEventRange(self, r, l, e, r2, l2, e2)
Definition: Types.py:1138
def dumpPython(self, options=PrintOptions())
Definition: Types.py:688
dbl *** dir
Definition: mlp_gen.cc:35
def setModuleLabel(self, label)
Definition: Types.py:549
def addVEventID(self, pargs, kargs)
Definition: Types.py:1224
def addVESInputTag(self, tracked, label, value)
Definition: Types.py:1106
def parameters_(self)
Definition: Mixins.py:222
def addVInt64(self, tracked, label, value)
Definition: Types.py:1082
def _isValid(value)
Definition: Types.py:258
def getProductInstanceLabel(self)
Definition: Types.py:445
def _pythonValue(value)
Definition: Types.py:122
def _valueFromString(value)
Definition: Types.py:77
def testvstring(self)
Definition: Types.py:1336
#define str(s)
def configValue(self, options=PrintOptions())
Definition: Types.py:630
def testvint32(self)
Definition: Types.py:1296
def __ge__(self, other)
Definition: Types.py:589
def insertInto(self, parameterSet, myname)
Definition: Types.py:740
def formatValueForConfig(value)
Definition: Types.py:595
def __lt__(self, other)
Definition: Types.py:583
def _itemIsValid(item)
Definition: Types.py:823
double split
Definition: MVATrainer.cc:139
def _isValid(value)
Definition: Types.py:379
def _itemIsValid(item)
Definition: Types.py:763
def addEventRange(self, pargs, kargs)
Definition: Types.py:1232
def insertContentsInto(self, parameterSet)
Definition: Mixins.py:353
def __nonzero__(self)
Definition: Types.py:195
def currentProcess()
Definition: Types.py:466
def _valueFromString(value)
Definition: Types.py:95
def dumpPython(self, options=PrintOptions())
Definition: Types.py:654
def addVUInt32(self, tracked, label, value)
Definition: Types.py:1078
def testUntracked(self)
Definition: Types.py:1343
def __init__(self)
Definition: Types.py:1020
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
def pythonValue(self, options=PrintOptions())
Definition: Types.py:265
def addVBool(self, tracked, label, value)
Definition: Types.py:1090
def configValue(self, options=PrintOptions())
Definition: Types.py:164
def _valueFromString(value)
Definition: Types.py:724
def pythonValueForItem(self, item, options)
Definition: Types.py:884
def __init__(self, module='', data='')
Definition: Types.py:544