test
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 Attributes
ntuple.TrackingNtuple Class Reference
Inheritance diagram for ntuple.TrackingNtuple:

Public Member Functions

def __init__
 
def __iter__
 
def hasHits
 
def hasSeeds
 
def nevents
 
def tree
 

Private Attributes

 _entries
 
 _file
 
 _tree
 

Detailed Description

Class abstracting the whole ntuple/TTree.

Main benefit is to provide nice interface for
- iterating over events
- querying whether hit/seed information exists

Definition at line 265 of file ntuple.py.

Constructor & Destructor Documentation

def ntuple.TrackingNtuple.__init__ (   self,
  fileName,
  tree = "trackingNtuple/tree" 
)
Constructor.

Arguments:
fileName -- String for path to the ROOT file
tree     -- Name of the TTree object inside the ROOT file (default: 'trackingNtuple/tree')

Definition at line 272 of file ntuple.py.

273  def __init__(self, fileName, tree="trackingNtuple/tree"):
274  """Constructor.
275 
276  Arguments:
277  fileName -- String for path to the ROOT file
278  tree -- Name of the TTree object inside the ROOT file (default: 'trackingNtuple/tree')
279  """
280  super(TrackingNtuple, self).__init__()
281  self._file = ROOT.TFile.Open(fileName)
282  self._tree = self._file.Get(tree)
283  self._entries = self._tree.GetEntriesFast()

Member Function Documentation

def ntuple.TrackingNtuple.__iter__ (   self)
Returns generator for iterating over TTree entries (events)

Generator returns Event objects.

Definition at line 298 of file ntuple.py.

References ntuple.TrackingNtuple._entries, ntuple._Collection._tree, python.cmstools.EventTree._tree, ntuple._Object._tree, and ntuple.TrackingNtuple._tree.

299  def __iter__(self):
300  """Returns generator for iterating over TTree entries (events)
301 
302  Generator returns Event objects.
303 
304  """
305  for jentry in xrange(self._entries):
306  # get the next tree in the chain and verify
307  ientry = self._tree.LoadTree( jentry )
308  if ientry < 0: break
309  # copy next entry into memory and verify
310  nb = self._tree.GetEntry( jentry )
311  if nb <= 0: continue
312 
313  yield Event(self._tree, jentry)
def ntuple.TrackingNtuple.hasHits (   self)
Returns true if the ntuple has hit information.

Definition at line 290 of file ntuple.py.

References ntuple._Collection._tree, python.cmstools.EventTree._tree, ntuple._Object._tree, and ntuple.TrackingNtuple._tree.

291  def hasHits(self):
292  """Returns true if the ntuple has hit information."""
293  return hasattr(self._tree, "pix_isBarrel")
def ntuple.TrackingNtuple.hasSeeds (   self)
Returns true if the ntuple has seed information.

Definition at line 294 of file ntuple.py.

References ntuple._Collection._tree, python.cmstools.EventTree._tree, ntuple._Object._tree, and ntuple.TrackingNtuple._tree.

295  def hasSeeds(self):
296  """Returns true if the ntuple has seed information."""
297  return hasattr(self._tree, "see_fitok")
def ntuple.TrackingNtuple.nevents (   self)

Definition at line 287 of file ntuple.py.

References ntuple.TrackingNtuple._entries.

288  def nevents(self):
289  return self._entries
def ntuple.TrackingNtuple.tree (   self)

Definition at line 284 of file ntuple.py.

References ntuple._Collection._tree, python.cmstools.EventTree._tree, ntuple._Object._tree, and ntuple.TrackingNtuple._tree.

Referenced by ZJetsTreeAnalyzer.ZJetsTreeAnalyzer.beginLoop(), MetTreeProducer.MetTreeProducer.declareVariables(), core.AutoFillTreeProducer.AutoFillTreeProducer.declareVariables(), core.AutoFillTreeProducer.AutoFillTreeProducer.fillTree(), ZJetsTreeAnalyzer.ZJetsTreeAnalyzer.process(), and MetTreeProducer.MetTreeProducer.process().

285  def tree(self):
286  return self._tree

Member Data Documentation

ntuple.TrackingNtuple._entries
private

Definition at line 282 of file ntuple.py.

Referenced by ntuple.TrackingNtuple.__iter__(), and ntuple.TrackingNtuple.nevents().

ntuple.TrackingNtuple._file
private

Definition at line 280 of file ntuple.py.

ntuple.TrackingNtuple._tree
private

Definition at line 281 of file ntuple.py.

Referenced by ntuple.BeamSpot.__getattr__(), ntuple.TrackingNtuple.__iter__(), ntuple._TrackingParticleMatchAdaptor._nMatchedTrackingParticles(), ntuple.Event.beamspot(), ntuple._RecoHitAdaptor.gluedHits(), ntuple.Event.gluedHits(), ntuple.TrackingNtuple.hasHits(), ntuple.TrackingNtuple.hasSeeds(), ntuple._RecoHitAdaptor.hits(), ntuple._RecoHitAdaptor.invalidHits(), ntuple._LayerStrAdaptor.layerStr(), ntuple._TrackingParticleMatchAdaptor.matchedTrackingParticleInfos(), ntuple._RecoHitAdaptor.pixelHits(), ntuple.Event.pixelHits(), ntuple.Event.seeds(), ntuple._SimHitAdaptor.simHits(), ntuple._RecoHitAdaptor.stripHits(), ntuple.Event.stripHits(), ntuple.Event.trackingParticles(), ntuple.Event.trackingVertices(), ntuple.Event.tracks(), ntuple.TrackingNtuple.tree(), and ntuple.Event.vertices().