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.Lumis Class Reference

## 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 ##. More...
 
def _next
 

Private Attributes

 _currFilename
 
 _filenames
 
 _lumi
 
 _lumiCounts
 
 _maxLumis
 Parse optional arguments ##. More...
 
 _secondaryFilenames
 
 _tfile
 
 _veryFirstTime
 

Detailed Description

## Lumis

Python interface to FWLite LuminosityBlock

Definition at line 134 of file __init__.py.

Constructor & Destructor Documentation

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

Definition at line 136 of file __init__.py.

137  def __init__ (self, inputFiles = '', **kwargs):
138  self._lumi = None
139  self._lumiCounts = 0
140  self._tfile = None
141  self._maxLumis = 0
142  if isinstance (inputFiles, list):
143  # it's a list
144  self._filenames = inputFiles[:]
145  elif isinstance (inputFiles, VarParsing):
146  # it's a VarParsing object
147  options = inputFiles
148  self._maxLumis = options.maxEvents
149  self._filenames = options.inputFiles
150  else:
151  # it's probably a single string
152  self._filenames = [inputFiles]
153  ##############################
154  ## Parse optional arguments ##
155  ##############################
156  if kwargs.has_key ('maxEvents'):
157  self._maxLumis = kwargs['maxEvents']
158  del kwargs['maxEvents']
159  if kwargs.has_key ('options'):
160  options = kwargs ['options']
161  self._maxLumis = options.maxEvents
162  self._filenames = options.inputFiles
163  self._secondaryFilenames = options.secondaryInputFiles
164  del kwargs['options']
165  # Since we deleted the options as we used them, that means
166  # that kwargs should be empty. If it's not, that means that
167  # somebody passed in an argument that we're not using and we
168  # should complain.
169  if len (kwargs):
170  raise RuntimeError, "Unknown arguments %s" % kwargs
171  if not self._filenames:
172  raise RuntimeError, "No input files given"
173  if not self._createFWLiteLumi():
174  # this shouldn't happen as you are getting nothing the
175  # very first time out, but let's at least check to
176  # avoid problems.
177  raise RuntimeError, "Never and information about Lumi"
178 
def _createFWLiteLumi
Private Member Functions ##.
Definition: __init__.py:243
_maxLumis
Parse optional arguments ##.
Definition: __init__.py:140
def __init__
Definition: __init__.py:136
def python.Lumis.__del__ (   self)
(Internal) Destructor

Definition at line 179 of file __init__.py.

References python.Lumis._lumi.

180  def __del__ (self):
181  """(Internal) Destructor"""
182  # print "Goodbye cruel world, I'm leaving you today."
183  del self._lumi
184  # print "Goodbye, goodbye, goodbye."
185 

Member Function Documentation

def python.Lumis.__iter__ (   self)

Definition at line 186 of file __init__.py.

References python.Lumis._next().

187  def __iter__ (self):
188  return self._next()
189 
def __iter__
Definition: __init__.py:186
def python.Lumis._createFWLiteLumi (   self)
private

Private Member Functions ##.

(Internal) Creates an FWLite Lumi

Definition at line 243 of file __init__.py.

References python.Lumis._filenames, and python.Lumis._lumi.

Referenced by python.Lumis._next().

244  def _createFWLiteLumi (self):
245  """(Internal) Creates an FWLite Lumi"""
246  # are there any files left?
247  if not self._filenames:
248  return False
249  if self._lumi:
250  del self._lumi
251  self._lumi = None
252  self._veryFirstTime = False
253  self._currFilename = self._filenames.pop(0)
254  #print "Opening file", self._currFilename
255  if self._tfile:
256  del self._tfile
257  self._tfile = ROOT.TFile.Open (self._currFilename)
258  self._lumi = ROOT.fwlite.LuminosityBlock (self._tfile);
259  self._lumi.toBegin()
260  return True
261 
def _createFWLiteLumi
Private Member Functions ##.
Definition: __init__.py:243
def python.Lumis._next (   self)
private
(Internal) Iterator internals

Definition at line 262 of file __init__.py.

References python.Lumis._createFWLiteLumi(), python.Lumis._lumiCounts, and python.Lumis._maxLumis.

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

263  def _next (self):
264  """(Internal) Iterator internals"""
265  while True:
266  if self._lumi.atEnd():
267  if not self._createFWLiteLumi():
268  # there are no more files here, so we are done
269  break
270  yield self
271  self._lumiCounts += 1
272  if self._maxLumis > 0 and self._lumiCounts >= self._maxLumis:
273  break
274  self._lumi.__preinc__()
275 
276 
def _createFWLiteLumi
Private Member Functions ##.
Definition: __init__.py:243
_maxLumis
Parse optional arguments ##.
Definition: __init__.py:140
def python.Lumis.aux (   self)

Definition at line 190 of file __init__.py.

191  def aux (self):
192  try:
193  return self._lumi.luminosityBlockAuxiliary()
194  except:
195  raise RuntimeError, "Lumis.aux() called on object in invalid state"
196 
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.

References join(), and list().

205  def getByLabel (self, *args):
206  """Calls FWLite's getByLabel. Called:
207  getByLabel (moduleLabel, handle)
208  getByLabel (moduleLabel, productInstanceLabel, handle),
209  getByLabel (moduleLabel, productInstanceLabel, processLabel, handle),
210  or
211  getByLabel ( (mL, pIL,pL), handle)
212  """
213  length = len (args)
214  if length < 2 or length > 4:
215  # not called correctly
216  raise RuntimeError, "Incorrect number of arguments"
217  # handle is always the last argument
218  argsList = list (args)
219  handle = argsList.pop()
220  if len(argsList)==1 and \
221  ( isinstance (argsList[0], tuple) or
222  isinstance (argsList[0], list) ) :
223  if len (argsList) > 3:
224  raise RuntimeError, "getByLabel Error: label tuple has too " \
225  "many arguments '%s'" % argsList[0]
226  argsList = list(argsList[0])
227  while len(argsList) < 3:
228  argsList.append ('')
229  (moduleLabel, productInstanceLabel, processLabel) = argsList
230  labelString = "'" + "', '".join(argsList) + "'"
231  handle._setStatus ( self._lumi.getByLabel( handle._typeInfoGetter(),
232  moduleLabel,
233  productInstanceLabel,
234  processLabel,
235  handle._addressOf() ),
236  labelString )
237  return handle.isValid()
238 
def getByLabel
Definition: __init__.py:204
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.Lumis.luminosityBlockAuxiliary (   self)

Definition at line 197 of file __init__.py.

198  def luminosityBlockAuxiliary (self):
199  try:
200  return self._lumi.luminosityBlockAuxiliary()
201  except:
202  raise RuntimeError, "Lumis.luminosityBlockAuxiliary() called on object in invalid state"
203 
def luminosityBlockAuxiliary
Definition: __init__.py:197

Member Data Documentation

python.Lumis._currFilename
private

Definition at line 252 of file __init__.py.

python.Lumis._filenames
private

Definition at line 143 of file __init__.py.

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

python.Lumis._lumi
private

Definition at line 137 of file __init__.py.

Referenced by python.Lumis.__del__(), and python.Lumis._createFWLiteLumi().

python.Lumis._lumiCounts
private

Definition at line 138 of file __init__.py.

Referenced by python.Lumis._next().

python.Lumis._maxLumis
private

Parse optional arguments ##.

Definition at line 140 of file __init__.py.

Referenced by python.Lumis._next().

python.Lumis._secondaryFilenames
private

Definition at line 162 of file __init__.py.

python.Lumis._tfile
private

Definition at line 139 of file __init__.py.

python.Lumis._veryFirstTime
private

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