5 from ROOT
import Belle2
7 from svd
import add_svd_reconstruction
11 """Create SVD ShaperDigits"""
14 """digits is a list of (sensor, side, strip) for which to generate a digit"""
20 self.
samples = ROOT.array(
'unsigned char', 6)()
22 for i, sample
in zip(range(6), [0, 0, 12, 18, 12, 8]):
35 for sensor, side, strip
in self.
digits:
38 print(
'\nGenerated digits:')
40 print(
"digit: sensor %s, side %s, strip %d" %
41 (digit.getSensorID(),
'u' if digit.isUStrip()
else 'v', digit.getCellID()))
45 """Check ordering of SVD digits"""
52 new_ID = d.getUniqueChannelID()
53 if new_ID > current_ID:
56 Belle2.B2ERROR(
'Wrong ordering!')
60 """Print all SVD digits and clusters"""
65 print(
'\nSorted digits and clusters:')
67 print(
"digit: sensor %s, u-side %s, strip %d" %
68 (d.getSensorID(), d.isUStrip(), d.getCellID()))
70 print(
"cluster: sensor %s, side %s, position %d size %d" %
71 (c.getSensorID(),
'u' if c.isUCluster()
else 'v', c.getPosition(), c.getSize()))
74 if __name__ ==
"__main__":
87 basf2.B2INFO(
'Test SVDShaperDigitSorter\n' +
88 'In this test, we generate some ShaperDigits in radnom order\n' +
89 'and insert them in the DataStore. Then we call shaper digit\n' +
90 'sorter module and check whether the digits are correctly sorted.\n')
92 test_ordering = basf2.create_path()
93 test_ordering.add_module(
"EventInfoSetter")
94 test_ordering.add_module(
"Gearbox")
95 test_ordering.add_module(
"Geometry", components=[
"SVD"])
97 test_ordering.add_module(
"SVDShaperDigitSorter")
98 add_svd_reconstruction(test_ordering, useCoG=
True)
103 basf2.B2INFO(
'\nTest finished {0}.\n'.format(
104 [
'successfully',
'with failure'][result]))