################# ## ## ########### ## ## ## ## Lumis ## ## ## ## ########### ## ## ################# ## More...
Public Member Functions | |
def | __del__ |
def | __init__ |
def | __iter__ |
def | aux |
def | getByLabel |
def | luminosityBlockAuxiliary |
Private Member Functions | |
def | _createFWLiteLumi |
Private Member Functions ##. | |
def | _next |
Private Attributes | |
_currFilename | |
_filenames | |
_lumi | |
_lumiCounts | |
_maxLumis | |
Parse optional arguments ##. | |
_secondaryFilenames | |
_tfile | |
_veryFirstTime |
################# ## ## ########### ## ## ## ## Lumis ## ## ## ## ########### ## ## ################# ##
Python interface to FWLite LuminosityBlock
Definition at line 134 of file __init__.py.
def python::Lumis::__init__ | ( | self, | |
inputFiles = '' , |
|||
kwargs | |||
) |
Definition at line 136 of file __init__.py.
00137 : 00138 self._lumi = None 00139 self._lumiCounts = 0 00140 self._tfile = None 00141 self._maxLumis = 0 00142 if isinstance (inputFiles, list): 00143 # it's a list 00144 self._filenames = inputFiles[:] 00145 elif isinstance (inputFiles, VarParsing): 00146 # it's a VarParsing object 00147 options = inputFiles 00148 self._maxLumis = options.maxEvents 00149 self._filenames = options.inputFiles 00150 else: 00151 # it's probably a single string 00152 self._filenames = [inputFiles] 00153 ############################## 00154 ## Parse optional arguments ## 00155 ############################## 00156 if kwargs.has_key ('maxEvents'): 00157 self._maxLumis = kwargs['maxEvents'] 00158 del kwargs['maxEvents'] 00159 if kwargs.has_key ('options'): 00160 options = kwargs ['options'] 00161 self._maxLumis = options.maxEvents 00162 self._filenames = options.inputFiles 00163 self._secondaryFilenames = options.secondaryInputFiles 00164 del kwargs['options'] 00165 # Since we deleted the options as we used them, that means 00166 # that kwargs should be empty. If it's not, that means that 00167 # somebody passed in an argument that we're not using and we 00168 # should complain. 00169 if len (kwargs): 00170 raise RuntimeError, "Unknown arguments %s" % kwargs 00171 if not self._filenames: 00172 raise RuntimeError, "No input files given" 00173 if not self._createFWLiteLumi(): 00174 # this shouldn't happen as you are getting nothing the 00175 # very first time out, but let's at least check to 00176 # avoid problems. 00177 raise RuntimeError, "Never and information about Lumi" 00178
def python::Lumis::__del__ | ( | self | ) |
(Internal) Destructor
Definition at line 179 of file __init__.py.
def python::Lumis::__iter__ | ( | self | ) |
Definition at line 186 of file __init__.py.
def python::Lumis::_createFWLiteLumi | ( | self | ) | [private] |
Private Member Functions ##.
(Internal) Creates an FWLite Lumi
Definition at line 243 of file __init__.py.
00244 : 00245 """(Internal) Creates an FWLite Lumi""" 00246 # are there any files left? 00247 if not self._filenames: 00248 return False 00249 if self._lumi: 00250 del self._lumi 00251 self._lumi = None 00252 self._veryFirstTime = False 00253 self._currFilename = self._filenames.pop(0) 00254 #print "Opening file", self._currFilename 00255 if self._tfile: 00256 del self._tfile 00257 self._tfile = ROOT.TFile.Open (self._currFilename) 00258 self._lumi = ROOT.fwlite.LuminosityBlock (self._tfile); 00259 self._lumi.toBegin() 00260 return True 00261
def python::Lumis::_next | ( | self | ) | [private] |
(Internal) Iterator internals
Definition at line 262 of file __init__.py.
00263 : 00264 """(Internal) Iterator internals""" 00265 while True: 00266 if self._lumi.atEnd(): 00267 if not self._createFWLiteLumi(): 00268 # there are no more files here, so we are done 00269 break 00270 yield self 00271 self._lumiCounts += 1 00272 if self._maxLumis > 0 and self._lumiCounts >= self._maxLumis: 00273 break 00274 self._lumi.__preinc__() 00275 00276
def python::Lumis::aux | ( | self | ) |
Definition at line 190 of file __init__.py.
def python::Lumis::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 204 of file __init__.py.
00205 : 00206 """Calls FWLite's getByLabel. Called: 00207 getByLabel (moduleLabel, handle) 00208 getByLabel (moduleLabel, productInstanceLabel, handle), 00209 getByLabel (moduleLabel, productInstanceLabel, processLabel, handle), 00210 or 00211 getByLabel ( (mL, pIL,pL), handle) 00212 """ 00213 length = len (args) 00214 if length < 2 or length > 4: 00215 # not called correctly 00216 raise RuntimeError, "Incorrect number of arguments" 00217 # handle is always the last argument 00218 argsList = list (args) 00219 handle = argsList.pop() 00220 if len(argsList)==1 and \ 00221 ( isinstance (argsList[0], tuple) or 00222 isinstance (argsList[0], list) ) : 00223 if len (argsList) > 3: 00224 raise RuntimeError, "getByLabel Error: label tuple has too " \ 00225 "many arguments '%s'" % argsList[0] 00226 argsList = list(argsList[0]) 00227 while len(argsList) < 3: 00228 argsList.append ('') 00229 (moduleLabel, productInstanceLabel, processLabel) = argsList 00230 labelString = "'" + "', '".join(argsList) + "'" 00231 handle._setStatus ( self._lumi.getByLabel( handle._typeInfoGetter(), 00232 moduleLabel, 00233 productInstanceLabel, 00234 processLabel, 00235 handle._addressOf() ), 00236 labelString ) 00237 return handle.isValid() 00238
def python::Lumis::luminosityBlockAuxiliary | ( | self | ) |
Definition at line 197 of file __init__.py.
python::Lumis::_currFilename [private] |
Definition at line 243 of file __init__.py.
python::Lumis::_filenames [private] |
Definition at line 136 of file __init__.py.
python::Lumis::_lumi [private] |
Definition at line 136 of file __init__.py.
python::Lumis::_lumiCounts [private] |
Definition at line 136 of file __init__.py.
python::Lumis::_maxLumis [private] |
Parse optional arguments ##.
Definition at line 136 of file __init__.py.
python::Lumis::_secondaryFilenames [private] |
Definition at line 139 of file __init__.py.
python::Lumis::_tfile [private] |
Definition at line 136 of file __init__.py.
python::Lumis::_veryFirstTime [private] |
Definition at line 243 of file __init__.py.