15from ROOT
import Belle2
20 """A module to gather data on charge sharing in the SVD."""
23 """Initialize the module"""
27 self.
file = open(
'SVDChargeSharingData.txt',
'w')
30 """ Write legend for file columns """
32 self.
file.write(
'sensor_type layer ladder sensor truehit_index cluster_index ')
33 self.
file.write(
'truehit_u truehit_eta_u truehit_v truehit_eta_v charge_keV ')
34 self.
file.write(
'theta_u theta_v cluster_isU cluster_pos cluster_eta ')
35 self.
file.write(
'cluster_charge_ADU seed_charge_ADU cluster_size\n')
38 """Find clusters with a truehit and print some stats."""
43 nClusters = clusters.getEntries()
44 print(
"nClusters = "+str(nClusters))
48 for cluster_index
in range(nClusters):
49 cluster = clusters[cluster_index]
51 truehit = cluster.getRelated(
'SVDTrueHits')
60 info = geoCache.get(sensorID)
61 layer = sensorID.getLayerNumber()
62 ladder = sensorID.getLadderNumber()
63 sensor = sensorID.getSensorNumber()
65 if sensor == 1
and layer != 3:
68 sensorType =
'barrel' if layer > 3
else 'layer3'
69 s += f
'{sensorType} {layer} {ladder} {sensor} {truehit.getArrayIndex():4d} {cluster_index:4d} '
71 truehit_u = truehit.getU()
72 truehit_v = truehit.getV()
73 pitch_u = info.getUPitch()
74 truehit_eta_u = (truehit_u / pitch_u) % 1
75 pitch_v = info.getVPitch()
76 truehit_eta_v = (truehit_v / pitch_v) % 1
77 thetaU = math.atan2(truehit.getExitU() - truehit.getEntryU(),
79 thetaV = math.atan2(truehit.getExitV() - truehit.getEntryV(),
81 s += f
'{truehit_u:10.5f} {truehit_eta_u:10.5f} {truehit_v:10.5f} {truehit_eta_v:10.5f} ' + \
82 f
'{1.0e6 * truehit.getEnergyDep():10.7f} {thetaU:6.3f} {thetaV:6.3f} '
84 cluster_pitch = (pitch_u
if cluster.isUCluster()
else pitch_v)
85 cluster_eta = (cluster.getPosition() / cluster_pitch) % 1
86 s += f
'{cluster.isUCluster()} {cluster.getPosition():10.5f} {cluster_eta:10.5f} {cluster.getCharge():10.1f} ' + \
87 f
'{cluster.getSeedCharge():10.1f} {cluster.getSize():5d}'
92 """ Close the output file."""
A (simplified) python wrapper for StoreArray.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Class to uniquely identify a any structure of the PXD and SVD.