10 from ROOT
import Belle2
11 from ROOT
import gROOT, AddressOf
14 gROOT.ProcessLine(
'struct EventDataDigit {\
32 from ROOT
import EventDataDigit
38 A simple module to check the simulation of PXDTrueHits with Geant4 steps.
39 This module writes its output to a ROOT tree.
40 Primary goal is supporting of validation plots
44 """Initialize the module"""
46 super(PXDValidationTTreeDigit, self).
__init__()
48 self.
file = ROOT.TFile(
'PXDValidationTTreeDigitOutput.root',
'recreate'
51 self.
tree = ROOT.TTree(
'tree',
'Event data of PXD simulation')
53 self.
data = EventDataDigit()
55 for key
in EventDataDigit.__dict__:
58 if isinstance(self.
data.__getattribute__(key), int):
60 self.
tree.Branch(key, AddressOf(self.
data, key), key + formstring)
66 """Find digits with a clusters and save needed information."""
71 for cluster
in pxd_clusters:
72 cluster_truehits = cluster.getRelationsTo(
'PXDTrueHits')
75 if len(cluster_truehits) != 1:
78 cluster_digits = cluster.getRelationsTo(
'PXDDigits')
79 for digit
in cluster_digits:
86 vxd_id = digit.getSensorID()
87 self.data.vxd_id = vxd_id.getID()
88 self.data.layer = vxd_id.getLayerNumber()
89 self.data.ladder = vxd_id.getLadderNumber()
90 self.data.sensor = vxd_id.getSensorNumber()
96 self.data.cluster_index = cluster.getArrayIndex()
100 thickness = sensor_info.getThickness()
101 UPitch = sensor_info.getUPitch()
102 VPitch = sensor_info.getVPitch(digit.getVCellPosition())
103 self.data.pixel_type = (vxd_id.getLayerNumber() - 1) * 2
104 if vxd_id.getLayerNumber() == 1:
106 self.data.pixel_type += 1
107 if vxd_id.getLayerNumber() == 2:
109 self.data.pixel_type += 1
111 self.data.digit_u = digit.getUCellPosition()
112 self.data.digit_v = digit.getVCellPosition()
113 self.data.digit_uID = digit.getUCellID()
114 self.data.digit_vID = digit.getVCellID()
115 self.data.digit_charge = digit.getCharge()
121 """ Close the output file."""