11from ROOT
import EventData
17from ROOT
import Belle2
19from ROOT
import gROOT, AddressOf
22gROOT.ProcessLine(
'struct EventData {\
32 float truehit_charge;\
37 float cluster_uError;\
38 float cluster_vError;\
40 float cluster_charge;\
54 A simple module to check the reconstruction of PXDTrueHits.
55 This module writes its output to a ROOT tree.
59 """Initialize the module"""
63 self.
file = ROOT.TFile(
'PXDHitErrorOutput.root',
'recreate')
65 self.
tree = ROOT.TTree(
'tree',
'Event data of PXD simulation')
69 for key
in EventData.__dict__:
72 if isinstance(self.
data.__getattribute__(key), int):
86 """Find clusters with a truehit and print some stats."""
92 for cluster
in clusters:
93 cluster_truehits = cluster.getRelationsTo(
'PXDTrueHits')
96 if len(cluster_truehits) != 1:
99 for truehit
in cluster_truehits:
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()
112 thickness = sensor_info.getThickness()
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)
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()
142 """ Close the output file."""
A (simplified) python wrapper for StoreArray.
static GeoCache & getInstance()
Return a reference to the singleton instance.
data
Instance of EventData class.
tree
TTree for output data.