################ ## ## ########## ## ## ## ## 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 ##. | |
def | _next |
Private Attributes | |
_currFilename | |
_filenames | |
_maxRuns | |
Parse optional arguments ##. | |
_run | |
_runCounts | |
_secondaryFilenames | |
_tfile | |
_veryFirstTime |
################ ## ## ########## ## ## ## ## Runs ## ## ## ## ########## ## ## ################ ##
Python interface to FWLite LuminosityBlock
Definition at line 285 of file __init__.py.
def python::Runs::__init__ | ( | self, | |
inputFiles = '' , |
|||
kwargs | |||
) |
Definition at line 287 of file __init__.py.
00288 : 00289 self._run = None 00290 self._runCounts = 0 00291 self._tfile = None 00292 self._maxRuns = 0 00293 if isinstance (inputFiles, list): 00294 # it's a list 00295 self._filenames = inputFiles[:] 00296 elif isinstance (inputFiles, VarParsing): 00297 # it's a VarParsing object 00298 options = inputFiles 00299 self._maxRuns = options.maxEvents 00300 self._filenames = options.inputFiles 00301 else: 00302 # it's probably a single string 00303 self._filenames = [inputFiles] 00304 ############################## 00305 ## Parse optional arguments ## 00306 ############################## 00307 if kwargs.has_key ('maxEvents'): 00308 self._maxRuns = kwargs['maxEvents'] 00309 del kwargs['maxEvents'] 00310 if kwargs.has_key ('options'): 00311 options = kwargs ['options'] 00312 self._maxRuns = options.maxEvents 00313 self._filenames = options.inputFiles 00314 self._secondaryFilenames = options.secondaryInputFiles 00315 del kwargs['options'] 00316 # Since we deleted the options as we used them, that means 00317 # that kwargs should be empty. If it's not, that means that 00318 # somebody passed in an argument that we're not using and we 00319 # should complain. 00320 if len (kwargs): 00321 raise RuntimeError, "Unknown arguments %s" % kwargs 00322 if not self._filenames: 00323 raise RuntimeError, "No input files given" 00324 if not self._createFWLiteRun(): 00325 # this shouldn't happen as you are getting nothing the 00326 # very first time out, but let's at least check to 00327 # avoid problems. 00328 raise RuntimeError, "Never and information about Run" 00329
def python::Runs::__del__ | ( | self | ) |
(Internal) Destructor
Definition at line 330 of file __init__.py.
def python::Runs::__iter__ | ( | self | ) |
Definition at line 337 of file __init__.py.
def python::Runs::_createFWLiteRun | ( | self | ) | [private] |
Private Member Functions ##.
(Internal) Creates an FWLite Run
Definition at line 396 of file __init__.py.
00397 : 00398 """(Internal) Creates an FWLite Run""" 00399 # are there any files left? 00400 if not self._filenames: 00401 return False 00402 if self._run: 00403 del self._run 00404 self._run = None 00405 self._veryFirstTime = False 00406 self._currFilename = self._filenames.pop(0) 00407 #print "Opening file", self._currFilename 00408 if self._tfile: 00409 del self._tfile 00410 self._tfile = ROOT.TFile.Open (self._currFilename) 00411 self._run = ROOT.fwlite.Run (self._tfile); 00412 self._run.toBegin() 00413 return True 00414
def python::Runs::_next | ( | self | ) | [private] |
(Internal) Iterator internals
Definition at line 415 of file __init__.py.
00416 : 00417 """(Internal) Iterator internals""" 00418 while True: 00419 if self._run.atEnd(): 00420 if not self._createFWLiteRun(): 00421 # there are no more files here, so we are done 00422 break 00423 yield self 00424 self._runCounts += 1 00425 if self._maxRuns > 0 and self._runCounts >= self._maxRuns: 00426 break 00427 self._run.__preinc__() 00428
def python::Runs::aux | ( | self | ) |
Definition at line 341 of file __init__.py.
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.
00356 : 00357 """Calls FWLite's getByLabel. Called: 00358 getByLabel (moduleLabel, handle) 00359 getByLabel (moduleLabel, productInstanceLabel, handle), 00360 getByLabel (moduleLabel, productInstanceLabel, processLabel, handle), 00361 or 00362 getByLabel ( (mL, pIL,pL), handle) 00363 """ 00364 length = len (args) 00365 if length < 2 or length > 4: 00366 # not called correctly 00367 raise RuntimeError, "Incorrect number of arguments" 00368 # handle is always the last argument 00369 argsList = list (args) 00370 handle = argsList.pop() 00371 if len(argsList)==1 and \ 00372 ( isinstance (argsList[0], tuple) or 00373 isinstance (argsList[0], list) ) : 00374 if len (argsList) > 3: 00375 raise RuntimeError, "getByLabel Error: label tuple has too " \ 00376 "many arguments '%s'" % argsList[0] 00377 argsList = list(argsList[0]) 00378 while len(argsList) < 3: 00379 argsList.append ('') 00380 (moduleLabel, productInstanceLabel, processLabel) = argsList 00381 labelString = "'" + "', '".join(argsList) + "'" 00382 handle._setStatus ( self._run.getByLabel( handle._typeInfoGetter(), 00383 moduleLabel, 00384 productInstanceLabel, 00385 processLabel, 00386 handle._addressOf() ), 00387 labelString ) 00388 return handle.isValid() 00389 00390 00391
def python::Runs::runAuxiliary | ( | self | ) |
Definition at line 348 of file __init__.py.
python::Runs::_currFilename [private] |
Definition at line 396 of file __init__.py.
python::Runs::_filenames [private] |
Definition at line 287 of file __init__.py.
python::Runs::_maxRuns [private] |
Parse optional arguments ##.
Definition at line 287 of file __init__.py.
python::Runs::_run [private] |
Definition at line 287 of file __init__.py.
python::Runs::_runCounts [private] |
Definition at line 287 of file __init__.py.
python::Runs::_secondaryFilenames [private] |
Definition at line 290 of file __init__.py.
python::Runs::_tfile [private] |
Definition at line 287 of file __init__.py.
python::Runs::_veryFirstTime [private] |
Definition at line 396 of file __init__.py.