12 from ROOT
import EventData
18 from ROOT
import Belle2
20 from ROOT
import gROOT, AddressOf
23 gROOT.ProcessLine(
'struct EventData {\
33 float truehit_charge;\
38 float cluster_uError;\
39 float cluster_vError;\
41 float cluster_charge;\
55 A simple module to check the reconstruction of PXDTrueHits.
56 This module writes its output to a ROOT tree.
60 """Initialize the module"""
62 super(PXDHitErrorsTTree, self).
__init__()
64 self.
filefile = ROOT.TFile(
'PXDHitErrorOutput.root',
'recreate')
66 self.
treetree = ROOT.TTree(
'tree',
'Event data of PXD simulation')
68 self.
datadata = EventData()
70 for key
in EventData.__dict__:
73 if isinstance(self.
datadata.__getattribute__(key), int):
87 """Find clusters with a truehit and print some stats."""
93 for cluster
in clusters:
94 cluster_truehits = cluster.getRelationsTo(
'PXDTrueHits')
97 if len(cluster_truehits) != 1:
100 for truehit
in cluster_truehits:
103 vxd_id = truehit.getSensorID()
104 self.data.vxd_id = vxd_id.getID()
105 self.data.layer = vxd_id.getLayerNumber()
106 self.data.ladder = vxd_id.getLadderNumber()
107 self.data.sensor = vxd_id.getSensorNumber()
108 self.data.truehit_index = truehit.getArrayIndex()
109 self.data.cluster_index = cluster.getArrayIndex()
113 thickness = sensor_info.getThickness()
116 self.data.truehit_u = truehit.getU()
117 self.data.truehit_v = truehit.getV()
118 self.data.truehit_time = truehit.getGlobalTime()
119 self.data.truehit_charge = truehit.getEnergyDep()
120 self.data.theta_u = math.atan2(
121 truehit.getExitU() - truehit.getEntryU(), thickness)
122 self.data.theta_v = math.atan2(
123 truehit.getExitV() - truehit.getEntryV(), thickness)
125 self.data.cluster_u = cluster.getU()
126 self.data.cluster_v = cluster.getV()
127 self.data.cluster_uError = cluster.getUSigma()
128 self.data.cluster_vError = cluster.getVSigma()
129 self.data.cluster_rho = cluster.getRho()
130 self.data.cluster_charge = cluster.getCharge()
131 self.data.cluster_seed = cluster.getSeedCharge()
132 self.data.cluster_size = cluster.getSize()
133 self.data.cluster_uSize = cluster.getUSize()
134 self.data.cluster_vSize = cluster.getVSize()
135 self.data.cluster_uPull = (
136 cluster.getU() - truehit.getU()) / cluster.getUSigma()
137 self.data.cluster_vPull = (
138 cluster.getV() - truehit.getV()) / cluster.getVSigma()
143 """ Close the output file."""
146 self.
filefile.Write()
147 self.
filefile.Close()
a (simplified) python wrapper for StoreArray.
static const SensorInfoBase & get(Belle2::VxdID id)
Return a reference to the SensorInfo of a given SensorID.
data
Instance of EventData class.
tree
TTree for output data.