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 293 of file __init__.py.

Constructor & Destructor Documentation

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

Definition at line 295 of file __init__.py.

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

Definition at line 338 of file __init__.py.

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

339  def __del__ (self):
340  """(Internal) Destructor"""
341  # print "Goodbye cruel world, I'm leaving you today."
342  del self._run
343  # print "Goodbye, goodbye, goodbye."
344 
def __del__
Definition: __init__.py:338

Member Function Documentation

def python.Runs.__iter__ (   self)

Definition at line 345 of file __init__.py.

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

346  def __iter__ (self):
347  return self._next()
348 
def __iter__
Definition: __init__.py:345
def python.Runs._createFWLiteRun (   self)
private

Private Member Functions ##.

(Internal) Creates an FWLite Run

Definition at line 406 of file __init__.py.

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

Referenced by python.Runs._next().

407  def _createFWLiteRun (self):
408  """(Internal) Creates an FWLite Run"""
409  # are there any files left?
410  if not self._filenames:
411  return False
412  if self._run:
413  del self._run
414  self._run = None
415  self._veryFirstTime = False
416  self._currFilename = self._filenames.pop(0)
417  #print "Opening file", self._currFilename
418  if self._tfile:
419  del self._tfile
420  self._tfile = ROOT.TFile.Open (self._currFilename)
421  self._run = ROOT.fwlite.Run (self._tfile);
422  self._run.toBegin()
423  return True
424 
def _createFWLiteRun
Private Member Functions ##.
Definition: __init__.py:406
def python.Runs._next (   self)
private
(Internal) Iterator internals

Definition at line 425 of file __init__.py.

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

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

426  def _next (self):
427  """(Internal) Iterator internals"""
428  while True:
429  if self._run.atEnd():
430  if not self._createFWLiteRun():
431  # there are no more files here, so we are done
432  break
433  yield self
434  self._runCounts += 1
435  if self._maxRuns > 0 and self._runCounts >= self._maxRuns:
436  break
437  self._run.__preinc__()
438 
_maxRuns
Parse optional arguments ##.
Definition: __init__.py:299
def _createFWLiteRun
Private Member Functions ##.
Definition: __init__.py:406
def python.Runs.aux (   self)

Definition at line 349 of file __init__.py.

350  def aux (self):
351  try:
352  return self._run.runAuxiliary()
353  except:
354  raise RuntimeError, "Runs.aux() called on object in invalid state"
355 
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 363 of file __init__.py.

References join(), and list().

364  def getByLabel (self, *args):
365  """Calls FWLite's getByLabel. Called:
366  getByLabel (moduleLabel, handle)
367  getByLabel (moduleLabel, productInstanceLabel, handle),
368  getByLabel (moduleLabel, productInstanceLabel, processLabel, handle),
369  or
370  getByLabel ( (mL, pIL,pL), handle)
371  """
372  length = len (args)
373  if length < 2 or length > 4:
374  # not called correctly
375  raise RuntimeError, "Incorrect number of arguments"
376  # handle is always the last argument
377  argsList = list (args)
378  handle = argsList.pop()
379  if len(argsList)==1 and \
380  ( isinstance (argsList[0], tuple) or
381  isinstance (argsList[0], list) ) :
382  if len (argsList) > 3:
383  raise RuntimeError, "getByLabel Error: label tuple has too " \
384  "many arguments '%s'" % argsList[0]
385  argsList = list(argsList[0])
386  while len(argsList) < 3:
387  argsList.append ('')
388  (moduleLabel, productInstanceLabel, processLabel) = argsList
389  labelString = "'" + "', '".join(argsList) + "'"
390  if not handle._wrapper :
391  handle._resetWrapper()
392  handle._setStatus ( self._run.getByLabel( handle._typeInfoGetter(),
393  moduleLabel,
394  productInstanceLabel,
395  processLabel,
396  handle._addressOf() ),
397  labelString )
398  return handle.isValid()
399 
400 
401 
def getByLabel
Definition: __init__.py:363
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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 356 of file __init__.py.

357  def runAuxiliary (self):
358  try:
359  return self._run.runAuxiliary()
360  except:
361  raise RuntimeError, "Runs.runAuxiliary() called on object in invalid state"
362 
def runAuxiliary
Definition: __init__.py:356

Member Data Documentation

python.Runs._currFilename
private

Definition at line 415 of file __init__.py.

python.Runs._filenames
private

Definition at line 302 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 299 of file __init__.py.

Referenced by python.Runs._next().

python.Runs._run
private

Definition at line 296 of file __init__.py.

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

python.Runs._runCounts
private

Definition at line 297 of file __init__.py.

Referenced by python.Runs._next().

python.Runs._secondaryFilenames
private

Definition at line 321 of file __init__.py.

python.Runs._tfile
private

Definition at line 298 of file __init__.py.

python.Runs._veryFirstTime
private

Definition at line 414 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().