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

Constructor & Destructor Documentation

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

Definition at line 142 of file __init__.py.

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

Definition at line 185 of file __init__.py.

References python.Lumis._lumi.

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

Member Function Documentation

def python.Lumis.__iter__ (   self)

Definition at line 192 of file __init__.py.

References python.Lumis._next().

193  def __iter__ (self):
194  return self._next()
195 
def __iter__
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().

257  def _createFWLiteLumi (self):
258  """(Internal) Creates an FWLite Lumi"""
259  # are there any files left?
260  if not self._filenames:
261  return False
262  if self._lumi:
263  del self._lumi
264  self._lumi = None
265  self._veryFirstTime = False
266  self._currFilename = self._filenames.pop(0)
267  #print "Opening file", self._currFilename
268  if self._tfile:
269  del self._tfile
270  self._tfile = ROOT.TFile.Open (self._currFilename)
271  self._lumi = ROOT.fwlite.LuminosityBlock (self._tfile);
272  self._lumi.toBegin()
273  return True
274 
def _createFWLiteLumi
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__().

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

Definition at line 196 of file __init__.py.

197  def aux (self):
198  try:
199  return self._lumi.luminosityBlockAuxiliary()
200  except:
201  raise RuntimeError, "Lumis.aux() called on object in invalid state"
202 
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 prof2calltree.count, citk.if(), join(), list(), and split.

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

Member Data Documentation

python.Lumis._currFilename
private

Definition at line 265 of file __init__.py.

python.Lumis._filenames
private

Definition at line 149 of file __init__.py.

Referenced by cfg-viewer.unscheduled._calcFilenames(), python.Events._createFWLiteEvent(), python.Lumis._createFWLiteLumi(), and python.Runs._createFWLiteRun().

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

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