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

Public Member Functions

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

Public Attributes

 file = ROOT.TFile('../SVDValidationTTreeTrueHit.root', 'recreate')
 output file
 
 tree = ROOT.TTree('tree', 'Event data of SVD validation events')
 output ttree
 
 data = EventDataTrueHit()
 instance of EventDataTrueHit class
 

Detailed Description

class to create the true hit ttree

Definition at line 41 of file SVDValidationTTreeTrueHit.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self)
Initialize the module

Definition at line 44 of file SVDValidationTTreeTrueHit.py.

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

Member Function Documentation

◆ event()

event ( self)
 Start with truehits and use the relation to get the corresponding clusters 

Definition at line 63 of file SVDValidationTTreeTrueHit.py.

63 def event(self):
64 """ Start with truehits and use the relation to get the corresponding clusters """
65 svdtruehits = Belle2.PyStoreArray('SVDTrueHits')
66 for truehit in svdtruehits:
67 clusters = truehit.getRelationsFrom('SVDClusters')
68
69 if len(clusters) == 0:
70 self.data.reconstructed = 0
71 # Sensor identification
72 sensorID = truehit.getSensorID()
73 self.data.sensor_id = int(sensorID)
74 sensorNum = sensorID.getSensorNumber()
75 self.data.sensor = sensorNum
76 layerNum = sensorID.getLayerNumber()
77 self.data.layer = layerNum
78 if (layerNum == 3):
79 sensorType = 1
80 else:
81 if (sensorNum == 1):
82 sensorType = 0
83 else:
84 sensorType = 1
85 self.data.sensor_type = sensorType
86 ladderNum = sensorID.getLadderNumber()
87 self.data.ladder = ladderNum
88 self.data.strip_dir = -1
89 # Fill tree
90 self.file.cd()
91 self.tree.Fill()
92 else:
93 for cluster in clusters:
94 self.data.reconstructed = 1
95 # Sensor identification
96 sensorID = truehit.getSensorID()
97 self.data.sensor_id = int(sensorID)
98 sensorNum = sensorID.getSensorNumber()
99 self.data.sensor = sensorNum
100 layerNum = sensorID.getLayerNumber()
101 self.data.layer = layerNum
102 if (layerNum == 3):
103 sensorType = 1
104 else:
105 if (sensorNum == 1):
106 sensorType = 0
107 else:
108 sensorType = 1
109 self.data.sensor_type = sensorType
110 ladderNum = sensorID.getLadderNumber()
111 self.data.ladder = ladderNum
112 if cluster.isUCluster():
113 self.data.strip_dir = 0
114 else:
115 self.data.strip_dir = 1
116 # Fill tree
117 self.file.cd()
118 self.tree.Fill()
119
A (simplified) python wrapper for StoreArray.

◆ terminate()

terminate ( self)
Close the output file. 

Definition at line 120 of file SVDValidationTTreeTrueHit.py.

120 def terminate(self):
121 """Close the output file. """
122 self.file.cd()
123 self.file.Write()
124 self.file.Close()

Member Data Documentation

◆ data

data = EventDataTrueHit()

instance of EventDataTrueHit class

Definition at line 53 of file SVDValidationTTreeTrueHit.py.

◆ file

file = ROOT.TFile('../SVDValidationTTreeTrueHit.root', 'recreate')

output file

Definition at line 49 of file SVDValidationTTreeTrueHit.py.

◆ tree

tree = ROOT.TTree('tree', 'Event data of SVD validation events')

output ttree

Definition at line 51 of file SVDValidationTTreeTrueHit.py.


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