Belle II Software  release-08-01-10
TreeWriterModule Class Reference
Inheritance diagram for TreeWriterModule:
Collaboration diagram for TreeWriterModule:

Public Member Functions

def __init__ (self)
 
def event (self)
 
def terminate (self)
 

Public Attributes

 file
 Output ROOT file.
 
 tree
 TTree for output data.
 
 data
 Instance of EventData class.
 

Detailed Description

This module writes its output to a ROOT tree.
Adapted from pxd/validation/PXDValidationTTreeSimHit.py

Definition at line 50 of file pid_ttree_writer.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)
Initialize the module

Definition at line 57 of file pid_ttree_writer.py.

57  def __init__(self):
58  """Initialize the module"""
59 
60  super(TreeWriterModule, self).__init__()
61 
62 
63  self.file = ROOT.TFile('PID_TTree.root', 'recreate')
64 
65  self.tree = ROOT.TTree('tree', '')
66 
67  self.data = TreeStruct()
68  """ Declare tree branches """
69  for key in TreeStruct.__dict__.keys():
70  if '__' not in key:
71  formstring = '/F'
72  if isinstance(self.data.__getattribute__(key), int):
73  formstring = '/I'
74  self.tree.Branch(key, AddressOf(self.data, key), key + formstring)
75 

Member Function Documentation

◆ event()

def event (   self)
Store TOP and dE/dx info in tree

Definition at line 76 of file pid_ttree_writer.py.

◆ terminate()

def terminate (   self)
 Close the output file.

Definition at line 130 of file pid_ttree_writer.py.


The documentation for this class was generated from the following file: