13 import simulation
as sim
14 from ROOT
import Belle2
16 basf2.set_random_seed(321)
17 basf2.set_log_level(basf2.LogLevel.INFO)
23 module which checks if two collections of EKLMDigits and BKLMDigits are
29 Use some digit information to sort the digits
30 Returns a python-list containing the sorted digits
34 py_list = [x
for x
in unsortedPyStoreArray]
50 load original digits and the packed/unpacked ones, sort and compare them
60 klm_digits_unpacked_sorted = self.
sort_klm_digitssort_klm_digits(klm_digits_unpacked)
63 if not len(klm_digits_sorted) == len(klm_digits_unpacked_sorted):
64 basf2.B2FATAL(
"KLMDigits: size not equal after packing and unpacking")
66 for i
in range(len(klm_digits_sorted)):
68 digit = klm_digits_sorted[i]
69 digit_unpacked = klm_digits_unpacked_sorted[i]
72 assert digit.getSubdetector() == digit_unpacked.getSubdetector()
73 assert digit.getSection() == digit_unpacked.getSection()
74 assert digit.getSector() == digit_unpacked.getSector()
75 assert digit.getLayer() == digit_unpacked.getLayer()
76 assert digit.getPlane() == digit_unpacked.getPlane()
77 assert digit.getStrip() == digit_unpacked.getStrip()
78 assert digit.inRPC() == digit_unpacked.inRPC()
79 assert digit.getCharge() == digit_unpacked.getCharge()
80 assert digit.getCTime() == digit_unpacked.getCTime()
81 assert digit.getTDC() == digit_unpacked.getTDC()
82 assert digit.getFitStatus() == digit_unpacked.getFitStatus()
85 main = basf2.create_path()
87 eventinfosetter = basf2.register_module(
'EventInfoSetter')
88 eventinfosetter.param(
'evtNumList', 50)
89 main.add_module(eventinfosetter)
91 particlegun = basf2.register_module(
'ParticleGun')
92 particlegun.param(
'pdgCodes', [13, -13])
93 particlegun.param(
'nTracks', 10)
94 particlegun.param(
'momentumParams', [0.5, 4.0])
95 main.add_module(particlegun)
97 sim.add_simulation(main, components=[
'KLM'])
98 basf2.set_module_parameters(main, type=
'Geometry', useDB=
False, components=[
'KLM'])
100 klm_packer = basf2.register_module(
'KLMPacker')
101 main.add_module(klm_packer)
103 unpacker = basf2.register_module(
'KLMUnpacker')
104 unpacker.param(
'outputKLMDigitsName',
'KLMDigitsUnpacked')
105 main.add_module(unpacker)
109 progress = basf2.register_module(
'Progress')
110 main.add_module(progress)
113 print(basf2.statistics)
a (simplified) python wrapper for StoreArray.
def sort_klm_digits(self, unsortedPyStoreArray)