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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 299 of file __init__.py.

299  def __init__ (self, inputFiles = '', **kwargs):
300  self._run = None
301  self._runCounts = 0
302  self._tfile = None
303  self._maxRuns = 0
304  if isinstance (inputFiles, list):
305  # it's a list
306  self._filenames = inputFiles[:]
307  elif isinstance (inputFiles, VarParsing):
308  # it's a VarParsing object
309  options = inputFiles
310  self._maxRuns = options.maxEvents
311  self._filenames = options.inputFiles
312  else:
313  # it's probably a single string
314  self._filenames = [inputFiles]
315 
318  if 'maxEvents' in kwargs:
319  self._maxRuns = kwargs['maxEvents']
320  del kwargs['maxEvents']
321  if 'options' in kwargs:
322  options = kwargs ['options']
323  self._maxRuns = options.maxEvents
324  self._filenames = options.inputFiles
325  self._secondaryFilenames = options.secondaryInputFiles
326  del kwargs['options']
327  # Since we deleted the options as we used them, that means
328  # that kwargs should be empty. If it's not, that means that
329  # somebody passed in an argument that we're not using and we
330  # should complain.
331  if len (kwargs):
332  raise RuntimeError("Unknown arguments %s" % kwargs)
333  if not self._filenames:
334  raise RuntimeError("No input files given")
335  if not self._createFWLiteRun():
336  # this shouldn't happen as you are getting nothing the
337  # very first time out, but let's at least check to
338  # avoid problems.
339  raise RuntimeError("Never and information about Run")
340 
341 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

◆ __del__()

def python.Runs.__del__ (   self)
(Internal) Destructor

Definition at line 342 of file __init__.py.

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

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

Member Function Documentation

◆ __iter__()

def python.Runs.__iter__ (   self)

Definition at line 349 of file __init__.py.

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

349  def __iter__ (self):
350  return self._next()
351 
352 

◆ _createFWLiteRun()

def python.Runs._createFWLiteRun (   self)
private

Private Member Functions ##.

(Internal) Creates an FWLite Run

Definition at line 415 of file __init__.py.

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

Referenced by python.Runs._next().

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

◆ _next()

def python.Runs._next (   self)
private
(Internal) Iterator internals

Definition at line 434 of file __init__.py.

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

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

434  def _next (self):
435  """(Internal) Iterator internals"""
436  while True:
437  if self._run.atEnd():
438  if not self._createFWLiteRun():
439  # there are no more files here, so we are done
440  break
441  yield self
442  self._runCounts += 1
443  if self._maxRuns > 0 and self._runCounts >= self._maxRuns:
444  break
445  self._run.__preinc__()
446 
447 

◆ aux()

def python.Runs.aux (   self)

Definition at line 353 of file __init__.py.

References MELaserPrim._run, python.Runs._run, and python.Runs.runAuxiliary().

353  def aux (self):
354  try:
355  return self._run.runAuxiliary()
356  except:
357  raise RuntimeError("Runs.aux() called on object in invalid state")
358 
359 

◆ getByLabel()

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

References MELaserPrim._run, python.Runs._run, submitPVResolutionJobs.count, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets.if(), join(), and submitPVValidationJobs.split().

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

◆ runAuxiliary()

def python.Runs.runAuxiliary (   self)

Definition at line 360 of file __init__.py.

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

Referenced by python.Runs.aux().

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

Member Data Documentation

◆ _currFilename

python.Runs._currFilename
private

Definition at line 424 of file __init__.py.

◆ _filenames

python.Runs._filenames
private

Definition at line 306 of file __init__.py.

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

◆ _maxRuns

python.Runs._maxRuns
private

Parse optional arguments ##.

Definition at line 303 of file __init__.py.

Referenced by python.Runs._next().

◆ _run

python.Runs._run
private

◆ _runCounts

python.Runs._runCounts
private

Definition at line 301 of file __init__.py.

Referenced by python.Runs._next().

◆ _secondaryFilenames

python.Runs._secondaryFilenames
private

Definition at line 325 of file __init__.py.

◆ _tfile

python.Runs._tfile
private

Definition at line 302 of file __init__.py.

◆ _veryFirstTime

python.Runs._veryFirstTime
private