CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
event.py
Go to the documentation of this file.
1 from ROOT import TChain
2 
3 class Event(object):
4  '''Event class.
5 
6  The Looper passes the Event object to each of its Analyzers,
7  which in turn can:
8  - read some information
9  - add more information
10  - modify existing information.
11 
12  Attributes:
13  iEv = event processing index, starting at 0
14  eventWeight = a weight, set to 1 at the beginning of the processing
15  input = input, as determined by the looper
16  #TODO: provide a clear interface for access control (put, get, del products) - we should keep track of the name and id of the analyzer.
17  '''
18 
19  def __init__(self, iEv, input_data, setup, eventWeight=1 ):
20  self.iEv = iEv
21  self.input = input_data
22  self.setup = setup
23  self.eventWeight = eventWeight
24 
25  def __str__(self):
26  header = '{type}: {iEv}'.format( type=self.__class__.__name__,
27  iEv = self.iEv)
28  varlines = []
29  for var,value in sorted(vars(self).iteritems()):
30  tmp = value
31  # check for recursivity
32  recursive = False
33  if hasattr(value, '__getitem__'):
34  if (len(value)>0 and value[0].__class__ == value.__class__):
35  recursive = True
36  if hasattr(value, '__contains__') and \
37  not isinstance(value, (str,unicode)) and \
38  not isinstance(value, TChain) and \
39  not recursive :
40  tmp = map(str, value)
41 
42  varlines.append( '\t{var:<15}: {value}'.format(var=var, value=tmp) )
43  all = [ header ]
44  all.extend(varlines)
45  return '\n'.join( all )
def __init__
Definition: event.py:19
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def __str__
Definition: event.py:25
eventWeight
Definition: event.py:23
list object
Definition: dbtoconf.py:77