test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
python.Runs Class Reference

## Runs

More...

Public Member Functions

def __del__
 
def __init__
 
def __iter__
 
def aux
 
def getByLabel
 
def runAuxiliary
 

Private Member Functions

def _createFWLiteRun
 Private Member Functions ##. More...
 
def _next
 

Private Attributes

 _currFilename
 
 _filenames
 
 _maxRuns
 Parse optional arguments ##. More...
 
 _run
 
 _runCounts
 
 _secondaryFilenames
 
 _tfile
 
 _veryFirstTime
 

Detailed Description

## Runs

Python interface to FWLite LuminosityBlock

Definition at line 298 of file __init__.py.

Constructor & Destructor Documentation

def python.Runs.__init__ (   self,
  inputFiles = '',
  kwargs 
)

Definition at line 300 of file __init__.py.

301  def __init__ (self, inputFiles = '', **kwargs):
302  self._run = None
303  self._runCounts = 0
304  self._tfile = None
305  self._maxRuns = 0
306  if isinstance (inputFiles, list):
307  # it's a list
308  self._filenames = inputFiles[:]
309  elif isinstance (inputFiles, VarParsing):
310  # it's a VarParsing object
311  options = inputFiles
312  self._maxRuns = options.maxEvents
313  self._filenames = options.inputFiles
314  else:
315  # it's probably a single string
316  self._filenames = [inputFiles]
317  ##############################
318  ## Parse optional arguments ##
319  ##############################
320  if kwargs.has_key ('maxEvents'):
321  self._maxRuns = kwargs['maxEvents']
322  del kwargs['maxEvents']
323  if kwargs.has_key ('options'):
324  options = kwargs ['options']
325  self._maxRuns = options.maxEvents
326  self._filenames = options.inputFiles
327  self._secondaryFilenames = options.secondaryInputFiles
328  del kwargs['options']
329  # Since we deleted the options as we used them, that means
330  # that kwargs should be empty. If it's not, that means that
331  # somebody passed in an argument that we're not using and we
332  # should complain.
333  if len (kwargs):
334  raise RuntimeError, "Unknown arguments %s" % kwargs
335  if not self._filenames:
336  raise RuntimeError, "No input files given"
337  if not self._createFWLiteRun():
338  # this shouldn't happen as you are getting nothing the
339  # very first time out, but let's at least check to
340  # avoid problems.
341  raise RuntimeError, "Never and information about Run"
342 
_secondaryFilenames
Definition: __init__.py:326
_maxRuns
Parse optional arguments ##.
Definition: __init__.py:304
def _createFWLiteRun
Private Member Functions ##.
Definition: __init__.py:416
def __init__
Definition: __init__.py:300
def python.Runs.__del__ (   self)
(Internal) Destructor

Definition at line 343 of file __init__.py.

References MELaserPrim._run, and python.Runs._run.

344  def __del__ (self):
345  """(Internal) Destructor"""
346  # print "Goodbye cruel world, I'm leaving you today."
347  del self._run
348  # print "Goodbye, goodbye, goodbye."
349 
def __del__
Definition: __init__.py:343

Member Function Documentation

def python.Runs.__iter__ (   self)

Definition at line 350 of file __init__.py.

References python.Lumis._next(), and python.Runs._next().

351  def __iter__ (self):
352  return self._next()
353 
def __iter__
Definition: __init__.py:350
def python.Runs._createFWLiteRun (   self)
private

Private Member Functions ##.

(Internal) Creates an FWLite Run

Definition at line 416 of file __init__.py.

References python.Lumis._filenames, python.Runs._filenames, MELaserPrim._run, and python.Runs._run.

Referenced by python.Runs._next().

417  def _createFWLiteRun (self):
418  """(Internal) Creates an FWLite Run"""
419  # are there any files left?
420  if not self._filenames:
421  return False
422  if self._run:
423  del self._run
424  self._run = None
425  self._veryFirstTime = False
426  self._currFilename = self._filenames.pop(0)
427  #print "Opening file", self._currFilename
428  if self._tfile:
429  del self._tfile
430  self._tfile = ROOT.TFile.Open (self._currFilename)
431  self._run = ROOT.fwlite.Run (self._tfile);
432  self._run.toBegin()
433  return True
434 
def _createFWLiteRun
Private Member Functions ##.
Definition: __init__.py:416
def python.Runs._next (   self)
private
(Internal) Iterator internals

Definition at line 435 of file __init__.py.

References python.Runs._createFWLiteRun(), python.Runs._maxRuns, and python.Runs._runCounts.

Referenced by python.Runs.__iter__(), and python.Events.__iter__().

436  def _next (self):
437  """(Internal) Iterator internals"""
438  while True:
439  if self._run.atEnd():
440  if not self._createFWLiteRun():
441  # there are no more files here, so we are done
442  break
443  yield self
444  self._runCounts += 1
445  if self._maxRuns > 0 and self._runCounts >= self._maxRuns:
446  break
447  self._run.__preinc__()
448 
_maxRuns
Parse optional arguments ##.
Definition: __init__.py:304
def _createFWLiteRun
Private Member Functions ##.
Definition: __init__.py:416
def python.Runs.aux (   self)

Definition at line 354 of file __init__.py.

355  def aux (self):
356  try:
357  return self._run.runAuxiliary()
358  except:
359  raise RuntimeError, "Runs.aux() called on object in invalid state"
360 
def python.Runs.getByLabel (   self,
  args 
)
Calls FWLite's getByLabel.  Called:
getByLabel (moduleLabel, handle)
getByLabel (moduleLabel, productInstanceLabel, handle),
getByLabel (moduleLabel, productInstanceLabel, processLabel, handle),
or
getByLabel ( (mL, pIL,pL), handle)

Definition at line 368 of file __init__.py.

References prof2calltree.count, citk.if(), join(), list(), and split.

369  def getByLabel (self, *args):
370  """Calls FWLite's getByLabel. Called:
371  getByLabel (moduleLabel, handle)
372  getByLabel (moduleLabel, productInstanceLabel, handle),
373  getByLabel (moduleLabel, productInstanceLabel, processLabel, handle),
374  or
375  getByLabel ( (mL, pIL,pL), handle)
376  """
377  length = len (args)
378  if length < 2 or length > 4:
379  # not called correctly
380  raise RuntimeError, "Incorrect number of arguments"
381  # handle is always the last argument
382  argsList = list (args)
383  handle = argsList.pop()
384  if len(argsList)==1 :
385  if( isinstance (argsList[0], tuple) or
386  isinstance (argsList[0], list) ) :
387  if len (argsList[0]) > 3:
388  raise RuntimeError, "getByLabel Error: label tuple has too " \
389  "many arguments '%s'" % argsList[0]
390  argsList = list(argsList[0])
391  if( type(argsList[0]) is str and ":" in argsList[0] ):
392  if argsList[0].count(":") > 3:
393  raise RuntimeError, "getByLabel Error: label tuple has too " \
394  "many arguments '%s'" % argsList[0].split(":")
395  argsList = argsList[0].split(":")
396  while len(argsList) < 3:
397  argsList.append ('')
398  (moduleLabel, productInstanceLabel, processLabel) = argsList
399  labelString = "'" + "', '".join(argsList) + "'"
400  if not handle._wrapper :
401  handle._resetWrapper()
402  handle._setStatus ( self._run.getByLabel( handle._typeInfoGetter(),
403  moduleLabel,
404  productInstanceLabel,
405  processLabel,
406  handle._addressOf() ),
407  labelString )
408  return handle.isValid()
409 
410 
411 
if(c.getParameter< edm::InputTag >("puppiValueMap").label().size()!=0)
def getByLabel
Definition: __init__.py:368
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
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 python.Runs.runAuxiliary (   self)

Definition at line 361 of file __init__.py.

362  def runAuxiliary (self):
363  try:
364  return self._run.runAuxiliary()
365  except:
366  raise RuntimeError, "Runs.runAuxiliary() called on object in invalid state"
367 
def runAuxiliary
Definition: __init__.py:361

Member Data Documentation

python.Runs._currFilename
private

Definition at line 425 of file __init__.py.

python.Runs._filenames
private

Definition at line 307 of file __init__.py.

Referenced by cfg-viewer.unscheduled._calcFilenames(), python.Events._createFWLiteEvent(), and python.Runs._createFWLiteRun().

python.Runs._maxRuns
private

Parse optional arguments ##.

Definition at line 304 of file __init__.py.

Referenced by python.Runs._next().

python.Runs._run
private

Definition at line 301 of file __init__.py.

Referenced by python.Runs.__del__(), and python.Runs._createFWLiteRun().

python.Runs._runCounts
private

Definition at line 302 of file __init__.py.

Referenced by python.Runs._next().

python.Runs._secondaryFilenames
private

Definition at line 326 of file __init__.py.

python.Runs._tfile
private

Definition at line 303 of file __init__.py.

python.Runs._veryFirstTime
private

Definition at line 424 of file __init__.py.

Referenced by python.Events._createFWLiteEvent(), python.Events._next(), python.Events.eventAuxiliary(), python.Events.getByLabel(), python.Events.size(), and python.Events.to().