15 from ROOT
import Belle2
20 """A simple module to timing of SVD clusters.
21 Intended for use with the RandomizeEventTimes feature of SVDDigitizer,
22 which stores (randomized) event times in EventMetaData.
23 For background studies, it distinguishes signal and background clusters..
26 def __init__(self, filename='dump_clusters.txt', collection='SVDClusters'):
27 """Initialize the module"""
29 super(dump_clusters, self).
__init__()
31 self.
filefile = open(filename,
'w')
33 self.collection = collection
35 self.vxdid_factors = (8192, 256, 32)
38 """ Write legend for file columns """
41 'EventNo Layer Ladder Sensor Side Position Bg Time_event' +
42 'Time_cluster Charge_cluster Size_cluster Chi2_cluster\n'
46 """Save information on all clusters together with event time data. """
49 eventNo = eventData.getEvent()
51 mode_byte = svd_evt_info.getModeByte()
54 for cluster
in clusters:
57 reco_digit = cluster.getRelatedTo(
'SVDRecoDigits')
61 triggerBin = ord(mode_byte.getTriggerBin())
62 triggerTime = 0.25 * 31.44 * (-4 + triggerBin + 0.5)
64 sensorID = cluster.getRawSensorID()
66 uSide = cluster.isUCluster()
69 [layer, ladder, sensor] = self.decode(sensorID)
70 side_str =
'u' if uSide
else 'v'
72 s =
'{event} {layer} {ladder} {sensor} {side} {strip} {bg} {etime}'.format(
78 strip=cluster.getPosition(),
83 s +=
' {clstime} {clscharge} {clssize} {clschi}\n'.format(
84 clstime=cluster.getClsTime(),
85 clscharge=cluster.getCharge(),
86 clssize=cluster.getSize(),
87 clschi=cluster.getChi2()
89 self.
filefile.write(s)
92 """ Close the output file."""
96 def decode(self, vxdid):
97 """ Utility to decode sensor IDs """
100 for f
in self.vxdid_factors:
101 result.append(vxdid // f)
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.
def __init__(self, filename='dump_clusters.txt', collection='SVDClusters')