Belle II Software development
SVDValidationTTreeSpacePoint Class Reference
Inheritance diagram for SVDValidationTTreeSpacePoint:

Public Member Functions

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

Public Attributes

 file
 output file
 
 tree
 output ttree
 
 data
 instance of EventDataSpacePoint class
 

Detailed Description

class to create spacepoint ttree

Definition at line 43 of file SVDValidationTTreeSpacePoint.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)
Initialize the module

Definition at line 46 of file SVDValidationTTreeSpacePoint.py.

46 def __init__(self):
47 """Initialize the module"""
48
49 super().__init__()
50
51 self.file = ROOT.TFile('../SVDValidationTTreeSpacePoint.root', 'recreate')
52
53 self.tree = ROOT.TTree('tree', 'Event data of SVD validation events')
54
55 self.data = EventDataSpacePoint()
56
57 # Declare tree branches
58 for key in EventDataSpacePoint.__dict__:
59 if '__' not in key:
60 formstring = '/F'
61 if isinstance(self.data.__getattribute__(key), int):
62 formstring = '/I'
63 self.tree.Branch(key, addressof(self.data, key), key + formstring)
64

Member Function Documentation

◆ event()

def event (   self)
Find SVD SpacePoints in the event

Definition at line 65 of file SVDValidationTTreeSpacePoint.py.

65 def event(self):
66 """Find SVD SpacePoints in the event"""
67
68 spacepoints = Belle2.PyStoreArray('SVDSpacePoints')
69
70 for sp in spacepoints:
71
72 # Sensor identification
73 sensorID = sp.getVxdID()
74 self.data.sensor_id = int(sensorID)
75 sensorNum = sensorID.getSensorNumber()
76 self.data.sensor = sensorNum
77 layerNum = sensorID.getLayerNumber()
78
79 # look at SP on SVD only
80 sp_type = sp.getType()
81 if sp_type != 1:
82 continue
83
84 self.data.layer = layerNum
85 if (layerNum == 3):
86 sensorType = 1
87 else:
88 if (sensorNum == 1):
89 sensorType = 0
90 else:
91 sensorType = 1
92 self.data.sensor_type = sensorType
93 self.data.ladder = sensorID.getLadderNumber()
94
95 # space point information
96 self.data.time_u = sp.TimeU()
97 self.data.time_v = sp.TimeV()
98
99 # Fill tree
100 self.file.cd()
101 self.tree.Fill()
102
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72

◆ terminate()

def terminate (   self)
Close the output file. 

Definition at line 103 of file SVDValidationTTreeSpacePoint.py.

103 def terminate(self):
104 """Close the output file. """
105 self.file.cd()
106 self.file.Write()
107 self.file.Close()

Member Data Documentation

◆ data

data

instance of EventDataSpacePoint class

Definition at line 55 of file SVDValidationTTreeSpacePoint.py.

◆ file

file

output file

Definition at line 51 of file SVDValidationTTreeSpacePoint.py.

◆ tree

tree

output ttree

Definition at line 53 of file SVDValidationTTreeSpacePoint.py.


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