12 import simulation
as sim
13 from ROOT
import Belle2
15 basf2.set_random_seed(321)
16 basf2.set_log_level(basf2.LogLevel.INFO)
22 module which checks if two collections of EKLMDigits and BKLMDigits are
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]
49 load original digits and the packed/unpacked ones, sort and compare them
59 klm_digits_unpacked_sorted = self.
sort_klm_digitssort_klm_digits(klm_digits_unpacked)
62 if not len(klm_digits_sorted) == len(klm_digits_unpacked_sorted):
63 basf2.B2FATAL(
"KLMDigits: size not equal after packing and unpacking")
65 for i
in range(len(klm_digits_sorted)):
67 digit = klm_digits_sorted[i]
68 digit_unpacked = klm_digits_unpacked_sorted[i]
71 assert digit.getSubdetector() == digit_unpacked.getSubdetector()
72 assert digit.getSection() == digit_unpacked.getSection()
73 assert digit.getSector() == digit_unpacked.getSector()
74 assert digit.getLayer() == digit_unpacked.getLayer()
75 assert digit.getPlane() == digit_unpacked.getPlane()
76 assert digit.getStrip() == digit_unpacked.getStrip()
77 assert digit.inRPC() == digit_unpacked.inRPC()
78 assert digit.getCharge() == digit_unpacked.getCharge()
79 assert digit.getCTime() == digit_unpacked.getCTime()
80 assert digit.getTDC() == digit_unpacked.getTDC()
81 assert digit.getFitStatus() == digit_unpacked.getFitStatus()
84 main = basf2.create_path()
86 eventinfosetter = basf2.register_module(
'EventInfoSetter')
87 eventinfosetter.param(
'evtNumList', 50)
88 main.add_module(eventinfosetter)
90 particlegun = basf2.register_module(
'ParticleGun')
91 particlegun.param(
'pdgCodes', [13, -13])
92 particlegun.param(
'nTracks', 10)
93 particlegun.param(
'momentumParams', [0.5, 4.0])
94 main.add_module(particlegun)
96 sim.add_simulation(main, components=[
'KLM'])
97 basf2.set_module_parameters(main, type=
'Geometry', useDB=
False, components=[
'KLM'])
99 klm_packer = basf2.register_module(
'KLMPacker')
100 main.add_module(klm_packer)
102 unpacker = basf2.register_module(
'KLMUnpacker')
103 unpacker.param(
'outputKLMDigitsName',
'KLMDigitsUnpacked')
104 main.add_module(unpacker)
108 progress = basf2.register_module(
'Progress')
109 main.add_module(progress)
112 print(basf2.statistics)
A (simplified) python wrapper for StoreArray.
def sort_klm_digits(self, unsortedPyStoreArray)