CMS 3D CMS Logo

eventsfwlite.py
Go to the documentation of this file.
1 from __future__ import print_function
2 from DataFormats.FWLite import Events as FWLiteEvents
3 
4 from ROOT import gROOT, gSystem, AutoLibraryLoader
5 
6 print("Loading FW Lite")
7 gSystem.Load("libFWCoreFWLite");
8 gROOT.ProcessLine('FWLiteEnabler::enable();')
9 
10 gSystem.Load("libFWCoreFWLite");
11 gSystem.Load("libDataFormatsPatCandidates");
12 
13 from ROOT import gInterpreter
14 gInterpreter.ProcessLine("using namespace reco;")
15 gInterpreter.ProcessLine("using edm::refhelper::FindUsingAdvance;")
16 
17 class Events(object):
18  def __init__(self, files, tree_name, options=None):
19  if options is not None :
20  if not hasattr(options,"inputFiles"):
21  options.inputFiles=files
22  if not hasattr(options,"maxEvents"):
23  options.maxEvents = 0
24  if not hasattr(options,"secondaryInputFiles"):
25  options.secondaryInputFiles = []
26  self.events = FWLiteEvents(options=options)
27  else :
28  self.events = FWLiteEvents(files)
29 
30  def __len__(self):
31  return self.events.size()
32 
33  def __getattr__(self, key):
34  return getattr(self.events, key)
35 
36  def __getitem__(self, iEv):
37  self.events.to(iEv)
38  return self
39 
resolutioncreator_cfi.object
object
Definition: resolutioncreator_cfi.py:4
eventsfwlite.Events.__init__
def __init__(self, files, tree_name, options=None)
Definition: eventsfwlite.py:18
to
eventsfwlite.Events.__len__
def __len__(self)
Definition: eventsfwlite.py:30
eventsfwlite.Events.__getitem__
def __getitem__(self, iEv)
Definition: eventsfwlite.py:36
eventsfwlite.Events
Definition: eventsfwlite.py:17
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
eventsfwlite.Events.__getattr__
def __getattr__(self, key)
Definition: eventsfwlite.py:33
eventsfwlite.Events.events
events
Definition: eventsfwlite.py:26
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443