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

Public Member Functions

def __init__ (self)
 
def beginRun (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

A simple module to check the reconstruction of PXDTrueHits.
This module writes its output to a ROOT tree.

Definition at line 51 of file PXDHitErrorsTTree.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)
Initialize the module

Definition at line 58 of file PXDHitErrorsTTree.py.

58 def __init__(self):
59 """Initialize the module"""
60
61 super().__init__()
62
63 self.file = ROOT.TFile('PXDHitErrorOutput.root', 'recreate')
64
65 self.tree = ROOT.TTree('tree', 'Event data of PXD simulation')
66
67 self.data = EventData()
68 # Declare tree branches
69 for key in EventData.__dict__:
70 if '__' not in key:
71 formstring = '/F'
72 if isinstance(self.data.__getattribute__(key), int):
73 formstring = '/I'
74 self.tree.Branch(
75 key,
76 AddressOf(
77 self.data,
78 key),
79 key +
80 formstring)
81

Member Function Documentation

◆ beginRun()

def beginRun (   self)
 Does nothing 

Definition at line 82 of file PXDHitErrorsTTree.py.

82 def beginRun(self):
83 """ Does nothing """
84

◆ event()

def event (   self)
Find clusters with a truehit and print some stats.

Definition at line 85 of file PXDHitErrorsTTree.py.

85 def event(self):
86 """Find clusters with a truehit and print some stats."""
87
88 clusters = Belle2.PyStoreArray('PXDClusters')
89
90 # Start with clusters and use the relation to get the corresponding
91 # digits and truehits.
92 for cluster in clusters:
93 cluster_truehits = cluster.getRelationsTo('PXDTrueHits')
94
95 # Here we ask only for clusters with exactly one TrueHit.
96 if len(cluster_truehits) != 1:
97 continue
98
99 for truehit in cluster_truehits:
100 # Now let's store some data
101 # Sesnor identification
102 vxd_id = truehit.getSensorID()
103 self.data.vxd_id = vxd_id.getID()
104 self.data.layer = vxd_id.getLayerNumber()
105 self.data.ladder = vxd_id.getLadderNumber()
106 self.data.sensor = vxd_id.getSensorNumber()
107 self.data.truehit_index = truehit.getArrayIndex()
108 self.data.cluster_index = cluster.getArrayIndex()
109
110 # Get sensor geometry information
111 sensor_info = Belle2.VXD.GeoCache.getInstance().getSensorInfo(vxd_id)
112 thickness = sensor_info.getThickness()
113
114 # TrueHit information
115 self.data.truehit_u = truehit.getU()
116 self.data.truehit_v = truehit.getV()
117 self.data.truehit_time = truehit.getGlobalTime()
118 self.data.truehit_charge = truehit.getEnergyDep()
119 self.data.theta_u = math.atan2(
120 truehit.getExitU() - truehit.getEntryU(), thickness)
121 self.data.theta_v = math.atan2(
122 truehit.getExitV() - truehit.getEntryV(), thickness)
123 # Cluster information
124 self.data.cluster_u = cluster.getU()
125 self.data.cluster_v = cluster.getV()
126 self.data.cluster_uError = cluster.getUSigma()
127 self.data.cluster_vError = cluster.getVSigma()
128 self.data.cluster_rho = cluster.getRho()
129 self.data.cluster_charge = cluster.getCharge()
130 self.data.cluster_seed = cluster.getSeedCharge()
131 self.data.cluster_size = cluster.getSize()
132 self.data.cluster_uSize = cluster.getUSize()
133 self.data.cluster_vSize = cluster.getVSize()
134 self.data.cluster_uPull = (
135 cluster.getU() - truehit.getU()) / cluster.getUSigma()
136 self.data.cluster_vPull = (
137 cluster.getV() - truehit.getV()) / cluster.getVSigma()
138 self.file.cd()
139 self.tree.Fill()
140
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214

◆ terminate()

def terminate (   self)
 Close the output file.

Definition at line 141 of file PXDHitErrorsTTree.py.

141 def terminate(self):
142 """ Close the output file."""
143
144 self.file.cd()
145 self.file.Write()
146 self.file.Close()

Member Data Documentation

◆ data

data

Instance of EventData class.

Definition at line 67 of file PXDHitErrorsTTree.py.

◆ file

file

Output ROOT file.

Definition at line 63 of file PXDHitErrorsTTree.py.

◆ tree

tree

TTree for output data.

Definition at line 65 of file PXDHitErrorsTTree.py.


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