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