37 def event(self):
38 """Find clusters with a truehit and print some stats."""
39
40
41
43 nClusters = clusters.getEntries()
44 print("nClusters = "+str(nClusters))
46
47
48 for cluster_index in range(nClusters):
49 cluster = clusters[cluster_index]
50
51 truehit = cluster.getRelated('SVDTrueHits')
52
53 if (not truehit):
54 continue
55
56
57 s = ''
58
60 info = geoCache.get(sensorID)
61 layer = sensorID.getLayerNumber()
62 ladder = sensorID.getLadderNumber()
63 sensor = sensorID.getSensorNumber()
64
65 if sensor == 1 and layer != 3:
66 continue
67
68 sensorType = 'barrel' if layer > 3 else 'layer3'
69 s += f'{sensorType} {layer} {ladder} {sensor} {truehit.getArrayIndex():4d} {cluster_index:4d} '
70
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(),
78 info.getThickness())
79 thetaV = math.atan2(truehit.getExitV() - truehit.getEntryV(),
80 info.getThickness())
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} '
83
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}'
88 s += '\n'
89 self.file.write(s)
90
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.