CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
python.Runs Class Reference

## Runs

More...

Public Member Functions

def __del__ (self)
 
def __init__ (self, inputFiles='', kwargs)
 
def __iter__ (self)
 
def aux (self)
 
def getByLabel (self, args)
 
def runAuxiliary (self)
 

Private Member Functions

def _createFWLiteRun (self)
 Private Member Functions ##. More...
 
def _next (self)
 

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.

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

343  def __del__ (self):
344  """(Internal) Destructor"""
345  # print "Goodbye cruel world, I'm leaving you today."
346  del self._run
347  # print "Goodbye, goodbye, goodbye."
348 
349 
def __del__(self)
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().

350  def __iter__ (self):
351  return self._next()
352 
353 
def _next(self)
Definition: __init__.py:435
def __iter__(self)
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().

416  def _createFWLiteRun (self):
417  """(Internal) Creates an FWLite Run"""
418  # are there any files left?
419  if not self._filenames:
420  return False
421  if self._run:
422  del self._run
423  self._run = None
424  self._veryFirstTime = False
425  self._currFilename = self._filenames.pop(0)
426  #print "Opening file", self._currFilename
427  if self._tfile:
428  del self._tfile
429  self._tfile = ROOT.TFile.Open (self._currFilename)
430  self._run = ROOT.fwlite.Run (self._tfile);
431  self._run.toBegin()
432  return True
433 
434 
def _createFWLiteRun(self)
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__().

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

Definition at line 354 of file __init__.py.

354  def aux (self):
355  try:
356  return self._run.runAuxiliary()
357  except:
358  raise RuntimeError("Runs.aux() called on object in invalid state")
359 
360 
def aux(self)
Definition: __init__.py:354
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 KineDebug3.count(), join(), list(), and split.

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

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

Member Data Documentation

python.Runs._currFilename
private

Definition at line 425 of file __init__.py.

python.Runs._filenames
private
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