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

Constructor & Destructor Documentation

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

Definition at line 287 of file __init__.py.

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

Definition at line 330 of file __init__.py.

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

331  def __del__ (self):
332  """(Internal) Destructor"""
333  # print "Goodbye cruel world, I'm leaving you today."
334  del self._run
335  # print "Goodbye, goodbye, goodbye."
336 
def __del__
Definition: __init__.py:330

Member Function Documentation

def python.Runs.__iter__ (   self)

Definition at line 337 of file __init__.py.

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

338  def __iter__ (self):
339  return self._next()
340 
def __iter__
Definition: __init__.py:337
def python.Runs._createFWLiteRun (   self)
private

Private Member Functions ##.

(Internal) Creates an FWLite Run

Definition at line 396 of file __init__.py.

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

Referenced by python.Runs._next().

397  def _createFWLiteRun (self):
398  """(Internal) Creates an FWLite Run"""
399  # are there any files left?
400  if not self._filenames:
401  return False
402  if self._run:
403  del self._run
404  self._run = None
405  self._veryFirstTime = False
406  self._currFilename = self._filenames.pop(0)
407  #print "Opening file", self._currFilename
408  if self._tfile:
409  del self._tfile
410  self._tfile = ROOT.TFile.Open (self._currFilename)
411  self._run = ROOT.fwlite.Run (self._tfile);
412  self._run.toBegin()
413  return True
414 
def _createFWLiteRun
Private Member Functions ##.
Definition: __init__.py:396
def python.Runs._next (   self)
private
(Internal) Iterator internals

Definition at line 415 of file __init__.py.

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

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

416  def _next (self):
417  """(Internal) Iterator internals"""
418  while True:
419  if self._run.atEnd():
420  if not self._createFWLiteRun():
421  # there are no more files here, so we are done
422  break
423  yield self
424  self._runCounts += 1
425  if self._maxRuns > 0 and self._runCounts >= self._maxRuns:
426  break
427  self._run.__preinc__()
428 
_maxRuns
Parse optional arguments ##.
Definition: __init__.py:291
def _createFWLiteRun
Private Member Functions ##.
Definition: __init__.py:396
def python.Runs.aux (   self)

Definition at line 341 of file __init__.py.

342  def aux (self):
343  try:
344  return self._run.runAuxiliary()
345  except:
346  raise RuntimeError, "Runs.aux() called on object in invalid state"
347 
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 355 of file __init__.py.

References join(), and list().

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

349  def runAuxiliary (self):
350  try:
351  return self._run.runAuxiliary()
352  except:
353  raise RuntimeError, "Runs.runAuxiliary() called on object in invalid state"
354 
def runAuxiliary
Definition: __init__.py:348

Member Data Documentation

python.Runs._currFilename
private

Definition at line 405 of file __init__.py.

python.Runs._filenames
private

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

Referenced by python.Runs._next().

python.Runs._run
private

Definition at line 288 of file __init__.py.

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

python.Runs._runCounts
private

Definition at line 289 of file __init__.py.

Referenced by python.Runs._next().

python.Runs._secondaryFilenames
private

Definition at line 313 of file __init__.py.

python.Runs._tfile
private

Definition at line 290 of file __init__.py.

python.Runs._veryFirstTime
private

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