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

Constructor & Destructor Documentation

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

Definition at line 285 of file __init__.py.

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

Definition at line 328 of file __init__.py.

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

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

Member Function Documentation

def python.Runs.__iter__ (   self)

Definition at line 335 of file __init__.py.

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

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

Private Member Functions ##.

(Internal) Creates an FWLite Run

Definition at line 394 of file __init__.py.

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

Referenced by python.Runs._next().

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

Definition at line 413 of file __init__.py.

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

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

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

Definition at line 339 of file __init__.py.

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

References join(), and list().

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

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

Member Data Documentation

python.Runs._currFilename
private

Definition at line 403 of file __init__.py.

python.Runs._filenames
private

Definition at line 292 of file __init__.py.

Referenced by python.Events._createFWLiteEvent(), and python.Runs._createFWLiteRun().

python.Runs._maxRuns
private

Parse optional arguments ##.

Definition at line 289 of file __init__.py.

Referenced by python.Runs._next().

python.Runs._run
private

Definition at line 286 of file __init__.py.

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

python.Runs._runCounts
private

Definition at line 287 of file __init__.py.

Referenced by python.Runs._next().

python.Runs._secondaryFilenames
private

Definition at line 311 of file __init__.py.

python.Runs._tfile
private

Definition at line 288 of file __init__.py.

python.Runs._veryFirstTime
private

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