CMS 3D CMS Logo

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

## Lumis

More...

Public Member Functions

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

Private Member Functions

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

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

Constructor & Destructor Documentation

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

Definition at line 142 of file __init__.py.

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

Definition at line 185 of file __init__.py.

References python.Lumis._lumi.

185  def __del__ (self):
186  """(Internal) Destructor"""
187  # print "Goodbye cruel world, I'm leaving you today."
188  del self._lumi
189  # print "Goodbye, goodbye, goodbye."
190 
191 
def __del__(self)
Definition: __init__.py:185

Member Function Documentation

def python.Lumis.__iter__ (   self)

Definition at line 192 of file __init__.py.

References python.Lumis._next().

192  def __iter__ (self):
193  return self._next()
194 
195 
def _next(self)
Definition: __init__.py:275
def __iter__(self)
Definition: __init__.py:192
def python.Lumis._createFWLiteLumi (   self)
private

Private Member Functions ##.

(Internal) Creates an FWLite Lumi

Definition at line 256 of file __init__.py.

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

Referenced by python.Lumis._next().

256  def _createFWLiteLumi (self):
257  """(Internal) Creates an FWLite Lumi"""
258  # are there any files left?
259  if not self._filenames:
260  return False
261  if self._lumi:
262  del self._lumi
263  self._lumi = None
264  self._veryFirstTime = False
265  self._currFilename = self._filenames.pop(0)
266  #print "Opening file", self._currFilename
267  if self._tfile:
268  del self._tfile
269  self._tfile = ROOT.TFile.Open (self._currFilename)
270  self._lumi = ROOT.fwlite.LuminosityBlock (self._tfile);
271  self._lumi.toBegin()
272  return True
273 
274 
def _createFWLiteLumi(self)
Private Member Functions ##.
Definition: __init__.py:256
def python.Lumis._next (   self)
private
(Internal) Iterator internals

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

275  def _next (self):
276  """(Internal) Iterator internals"""
277  while True:
278  if self._lumi.atEnd():
279  if not self._createFWLiteLumi():
280  # there are no more files here, so we are done
281  break
282  yield self
283  self._lumiCounts += 1
284  if self._maxLumis > 0 and self._lumiCounts >= self._maxLumis:
285  break
286  self._lumi.__preinc__()
287 
288 
289 
def _next(self)
Definition: __init__.py:275
_maxLumis
Parse optional arguments ##.
Definition: __init__.py:146
def _createFWLiteLumi(self)
Private Member Functions ##.
Definition: __init__.py:256
def python.Lumis.aux (   self)

Definition at line 196 of file __init__.py.

196  def aux (self):
197  try:
198  return self._lumi.luminosityBlockAuxiliary()
199  except:
200  raise RuntimeError("Lumis.aux() called on object in invalid state")
201 
202 
def aux(self)
Definition: __init__.py: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 210 of file __init__.py.

References KineDebug3.count(), reco.if(), join(), list(), and split.

210  def getByLabel (self, *args):
211  """Calls FWLite's getByLabel. Called:
212  getByLabel (moduleLabel, handle)
213  getByLabel (moduleLabel, productInstanceLabel, handle),
214  getByLabel (moduleLabel, productInstanceLabel, processLabel, handle),
215  or
216  getByLabel ( (mL, pIL,pL), handle)
217  """
218  length = len (args)
219  if length < 2 or length > 4:
220  # not called correctly
221  raise RuntimeError("Incorrect number of arguments")
222  # handle is always the last argument
223  argsList = list (args)
224  handle = argsList.pop()
225  if len(argsList)==1 :
226  if( isinstance (argsList[0], tuple) or
227  isinstance (argsList[0], list) ) :
228  if len (argsList[0]) > 3:
229  raise RuntimeError("getByLabel Error: label tuple has too " \
230  "many arguments '%s'" % argsList[0])
231  argsList = list(argsList[0])
232  if( type(argsList[0]) is str and ":" in argsList[0] ):
233  if argsList[0].count(":") > 3:
234  raise RuntimeError("getByLabel Error: label tuple has too " \
235  "many arguments '%s'" % argsList[0].split(":"))
236  argsList = argsList[0].split(":")
237  while len(argsList) < 3:
238  argsList.append ('')
239  (moduleLabel, productInstanceLabel, processLabel) = argsList
240  labelString = "'" + "', '".join(argsList) + "'"
241  if not handle._wrapper :
242  handle._resetWrapper()
243  handle._setStatus ( self._lumi.getByLabel( handle._typeInfoGetter(),
244  moduleLabel,
245  productInstanceLabel,
246  processLabel,
247  handle._addressOf() ),
248  labelString )
249  return handle.isValid()
250 
251 
def getByLabel(self, args)
Definition: __init__.py:210
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
if(dp >Float(M_PI)) dp-
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.Lumis.luminosityBlockAuxiliary (   self)

Definition at line 203 of file __init__.py.

204  try:
205  return self._lumi.luminosityBlockAuxiliary()
206  except:
207  raise RuntimeError("Lumis.luminosityBlockAuxiliary() called on object in invalid state")
208 
209 
def luminosityBlockAuxiliary(self)
Definition: __init__.py:203

Member Data Documentation

python.Lumis._currFilename
private

Definition at line 265 of file __init__.py.

python.Lumis._filenames
private
python.Lumis._lumi
private

Definition at line 143 of file __init__.py.

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

python.Lumis._lumiCounts
private

Definition at line 144 of file __init__.py.

Referenced by python.Lumis._next().

python.Lumis._maxLumis
private

Parse optional arguments ##.

Definition at line 146 of file __init__.py.

Referenced by python.Lumis._next().

python.Lumis._secondaryFilenames
private

Definition at line 168 of file __init__.py.

python.Lumis._tfile
private

Definition at line 145 of file __init__.py.

python.Lumis._veryFirstTime
private