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 print(
'size: ', 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)):
66 digit = digits_sorted[i]
67 digitUnpacked = digitsUnpacked_sorted[i]
70 assert digit.getModuleID() == digitUnpacked.getModuleID()
71 assert digit.getPixelID() == digitUnpacked.getPixelID()
72 assert digit.getChannel() == digitUnpacked.getChannel()
73 assert digit.getRawTime() == digitUnpacked.getRawTime()
74 assert abs(digit.getTime() - digitUnpacked.getTime()) < precision
75 assert abs(digit.getTimeError() - digitUnpacked.getTimeError()) < precision
76 assert digit.getPulseHeight() == digitUnpacked.getPulseHeight()
77 assert abs(digit.getPulseWidth() - digitUnpacked.getPulseWidth()) < precision
79 assert digit.getFirstWindow() == digitUnpacked.getFirstWindow()
80 assert digit.getHitQuality() == digitUnpacked.getHitQuality()
81 assert digit.getStatus() == digitUnpacked.getStatus()
82 assert digit.isChargeShare() == digitUnpacked.isChargeShare()
83 assert digit.isPrimaryChargeShare() == digitUnpacked.isPrimaryChargeShare()
89 module which ckecks if two collections of TOPRawDigits are equal
94 Use some digit information to sort the digits
95 Returns a python-list containing the sorted digits
99 py_list = [x
for x
in unsortedPyStoreArray]
106 x.getCarrierNumber(),
114 load original TOPRawDigits and the packed/unpacked ones, sort
and compare them
124 digitsUnpacked_sorted = self.
sortDigits(digitsUnpacked)
127 if not len(digits_sorted) == len(digitsUnpacked_sorted):
128 print(
'size: ', len(digits_sorted), len(digitsUnpacked_sorted))
129 b2.B2FATAL(
"TOPRawDigits: size not equal after packing and unpacking")
132 for i
in range(len(digits_sorted)):
134 digit = digits_sorted[i]
135 digitUnpacked = digitsUnpacked_sorted[i]
138 assert digit.getScrodID() == digitUnpacked.getScrodID()
139 assert digit.getCarrierNumber() == digitUnpacked.getCarrierNumber()
140 assert digit.getASICNumber() == digitUnpacked.getASICNumber()
141 assert digit.getASICChannel() == digitUnpacked.getASICChannel()
142 assert digit.getASICWindow() == digitUnpacked.getASICWindow()
143 assert digit.getTFine() == digitUnpacked.getTFine()
144 assert digit.getSampleRise() == digitUnpacked.getSampleRise()
145 assert digit.getDeltaSamplePeak() == digitUnpacked.getDeltaSamplePeak()
146 assert digit.getDeltaSampleFall() == digitUnpacked.getDeltaSampleFall()
147 assert digit.getValueRise0() == digitUnpacked.getValueRise0()
148 assert digit.getValueRise1() == digitUnpacked.getValueRise1()
149 assert digit.getValuePeak() == digitUnpacked.getValuePeak()
150 assert digit.getValueFall0() == digitUnpacked.getValueFall0()
151 assert digit.getValueFall1() == digitUnpacked.getValueFall1()
153 assert digit.getRevo9Counter() == digitUnpacked.getRevo9Counter()
154 assert digit.getPhase() == digitUnpacked.getPhase()
155 assert digit.getErrorFlags() == digitUnpacked.getErrorFlags()
156 assert digit.getDataType() == digitUnpacked.getDataType()
159main = b2.create_path()
161eventinfosetter = b2.register_module(
'EventInfoSetter')
162eventinfosetter.param({
'evtNumList': [10]})
163main.add_module(eventinfosetter)
165particlegun = b2.register_module(
'ParticleGun')
166particlegun.param(
'pdgCodes', [13, -13])
167particlegun.param(
'nTracks', 10)
168main.add_module(particlegun)
170add_simulation(main, components=[
'TOP'])
171b2.set_module_parameters(main, type=
"Geometry", useDB=
False, components=[
"TOP"])
173Packer = b2.register_module(
'TOPPacker')
174main.add_module(Packer)
176unPacker = b2.register_module(
'TOPUnpacker')
177unPacker.param(
'outputRawDigitsName',
'TOPRawDigitsUnpacked')
178unPacker.param(
'outputDigitsName',
'TOPDigitsUnpacked')
179main.add_module(unPacker)
181converter = b2.register_module(
'TOPRawDigitConverter')
182converter.param(
'inputRawDigitsName',
'TOPRawDigitsUnpacked')
183converter.param(
'outputDigitsName',
'TOPDigitsUnpacked')
184converter.param(
'minPulseWidth', 0.0)
185converter.param(
'maxPulseWidth', 1000.0)
186main.add_module(converter)
191progress = b2.register_module(
'Progress')
192main.add_module(progress)
A (simplified) python wrapper for StoreArray.
def sortDigits(self, unsortedPyStoreArray)
def sortDigits(self, unsortedPyStoreArray)