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