12from ROOT
import Belle2
13from simulation
import add_simulation
16b2.set_random_seed(12345)
22 module which ckecks if two collections of TOPDigits are equal
27 Use some digit information to sort the digits
28 Returns a python-list containing the sorted digits
32 py_list = [x
for x
in unsortedPyStoreArray]
45 load original TOPDigits and the packed/unpacked ones, sort
and compare them
55 digitsUnpacked_sorted = self.
sortDigits(digitsUnpacked)
58 if not len(digits_sorted) == len(digitsUnpacked_sorted):
59 b2.B2FATAL(
"TOPDigits: size not equal after packing and unpacking")
63 for i
in range(len(digits_sorted)):
64 digit = digits_sorted[i]
65 digitUnpacked = digitsUnpacked_sorted[i]
68 assert digit.getModuleID() == digitUnpacked.getModuleID()
69 assert digit.getPixelID() == digitUnpacked.getPixelID()
70 assert digit.getChannel() == digitUnpacked.getChannel()
71 assert digit.getRawTime() == digitUnpacked.getRawTime()
72 assert abs(digit.getTime() - digitUnpacked.getTime()) < precision
73 assert abs(digit.getTimeError() - digitUnpacked.getTimeError()) < precision
74 assert digit.getPulseHeight() == digitUnpacked.getPulseHeight()
75 assert abs(digit.getPulseWidth() - digitUnpacked.getPulseWidth()) < precision
76 assert digit.getIntegral() == digitUnpacked.getIntegral()
77 assert digit.getFirstWindow() == digitUnpacked.getFirstWindow()
78 assert digit.getHitQuality() == digitUnpacked.getHitQuality()
79 assert digit.getStatus() == digitUnpacked.getStatus()
80 assert digit.isChargeShare() == digitUnpacked.isChargeShare()
81 assert digit.isPrimaryChargeShare() == digitUnpacked.isPrimaryChargeShare()
84main = b2.create_path()
86eventinfosetter = b2.register_module(
'EventInfoSetter')
87eventinfosetter.param({
'evtNumList': [10]})
88main.add_module(eventinfosetter)
90particlegun = b2.register_module(
'ParticleGun')
91particlegun.param(
'pdgCodes', [13, -13])
92particlegun.param(
'nTracks', 10)
93main.add_module(particlegun)
95add_simulation(main, components=[
'TOP'])
96b2.set_module_parameters(main, type=
"Geometry", useDB=
False, components=[
"TOP"])
98converter = b2.register_module(
'TOPRawDigitConverter')
99converter.param(
'outputDigitsName',
'TOPDigitsUnpacked')
100converter.param(
'minPulseWidth', 0.0)
101converter.param(
'maxPulseWidth', 1000.0)
102main.add_module(converter)
106progress = b2.register_module(
'Progress')
107main.add_module(progress)
A (simplified) python wrapper for StoreArray.
def sortDigits(self, unsortedPyStoreArray)