14from ROOT
import Belle2
19 """A simple module to timing of SVD clusters.
20 Intended for use
with the RandomizeEventTimes feature of SVDDigitizer,
21 which stores (randomized) event times
in EventMetaData.
22 For background studies, it distinguishes signal
and background clusters..
25 def __init__(self, filename='dump_clusters.txt', collection='SVDClusters'):
26 """Initialize the module"""
30 self.
file = open(filename,
'w')
32 self.collection = collection
34 self.vxdid_factors = (8192, 256, 32)
37 """ Write legend for file columns """
40 'EventNo Layer Ladder Sensor Side Position Bg Time_event' +
41 'Time_cluster Charge_cluster Size_cluster Chi2_cluster\n'
45 """Save information on all clusters together with event time data. """
48 eventNo = eventData.getEvent()
50 mode_byte = svd_evt_info.getModeByte()
53 for cluster
in clusters:
56 reco_digit = cluster.getRelatedTo(
'SVDRecoDigits')
60 triggerBin = ord(mode_byte.getTriggerBin())
61 triggerTime = 0.25 * 31.44 * (-4 + triggerBin + 0.5)
63 sensorID = cluster.getRawSensorID()
65 uSide = cluster.isUCluster()
68 [layer, ladder, sensor] = self.decode(sensorID)
69 side_str =
'u' if uSide
else 'v'
71 s = f
'{eventNo} {layer} {ladder} {sensor} {side_str} {cluster.getPosition()} {bg_label} {triggerTime}'
73 s += f
' {cluster.getClsTime()} {cluster.getCharge()} {cluster.getSize()} {cluster.getChi2()}\n'
77 """ Close the output file."""
81 def decode(self, vxdid):
82 """ Utility to decode sensor IDs """
85 for f
in self.vxdid_factors:
86 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')