test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
PhysicsTools
HeppyCore
python
framework
eventstfile.py
Go to the documentation of this file.
1
# Copyright (C) 2014 Colin Bernet
2
# https://github.com/cbernet/heppy/blob/master/LICENSE
3
4
from
ROOT
import
TFile
5
6
class
Events
(
object
):
7
'''Event list from a tree in a root file.
8
'''
9
def
__init__
(self, filename, treename, options=None):
10
self.
file
= TFile(filename)
11
if
self.file.IsZombie():
12
raise
ValueError(
'file {fnam} does not exist'
.
format
(fnam=filename))
13
self.
tree
= self.file.Get(treename)
14
if
self.
tree
==
None
:
# is None would not work
15
raise
ValueError(
'tree {tree} does not exist in file {fnam}'
.
format
(
16
tree = treename,
17
fnam = filename
18
))
19
20
def
size
(self):
21
return
self.tree.GetEntries()
22
23
def
to
(self, iEv):
24
'''navigate to event iEv.'''
25
self.tree.GetEntry(iEv)
26
return
self.
tree
27
28
def
__iter__
(self):
29
return
iter(self.
tree
)
eventstfile.Events.to
def to
Definition:
eventstfile.py:23
eventstfile.Events.file
file
Definition:
eventstfile.py:10
eventstfile.Events.__init__
def __init__
Definition:
eventstfile.py:9
eventstfile.Events.__iter__
def __iter__
Definition:
eventstfile.py:28
eventstfile.Events.size
def size
Definition:
eventstfile.py:20
eventstfile.Events
Definition:
eventstfile.py:6
eventstfile.Events.tree
tree
Definition:
eventstfile.py:13
dbtoconf.object
list object
Definition:
dbtoconf.py:77
format
Generated for CMSSW Reference Manual by
1.8.5