12from svd
import add_svd_simulation
13from ROOT
import Belle2
17svd_digits_pack_unpack_collection =
"SVDShaperDigits_test"
24 module which ckecks if two collection of SVDShaperDigits are equal
28 """ use some digit information to sort the SVDShaperDigits list
29 Returns a python-list containing the SVDShaperDigits
33 py_list = [x
for x
in unsortedPyStoreArray]
39 x.getSensorID().getLayerNumber(),
40 x.getSensorID().getLadderNumber(),
41 x.getSensorID().getSensorNumber(),
45 """ load SVDShaperDigits of the simulation and the packed/unpacked ones
53 svdDigitsPackedUnpacked_sorted = self.
sortDigits(svdDigitsPackedUnpacked)
55 if not len(svdDigits_sorted) == len(svdDigitsPackedUnpacked_sorted):
56 b2.B2FATAL(
"SVDShaperDigits count not equal after packing and unpacking")
59 for i
in range(len(svdDigits_sorted)):
63 hit = svdDigits_sorted[i]
64 hitPackedUnpacked = svdDigitsPackedUnpacked_sorted[i]
67 assert hit.getTime() == hitPackedUnpacked.getTime()
68 assert hit.getIndex() == hitPackedUnpacked.getIndex()
72 assert numpy.isclose(hit.getCharge(), hitPackedUnpacked.getCharge())
75 assert hit.getSensorID().getID() == hitPackedUnpacked.getSensorID().getID()
76 assert hit.getSensorID().getLayerNumber() == hitPackedUnpacked.getSensorID().getLayerNumber()
77 assert hit.getSensorID().getLadderNumber() == hitPackedUnpacked.getSensorID().getLadderNumber()
78 assert hit.getSensorID().getSensorNumber() == hitPackedUnpacked.getSensorID().getSensorNumber()
79 assert hit.getSensorID().getSegmentNumber() == hitPackedUnpacked.getSensorID().getSegmentNumber()
83particlegun = b2.register_module(
'ParticleGun')
84particlegun.param(
'pdgCodes', [13, -13])
85particlegun.param(
'nTracks', 10)
88eventinfosetter = b2.register_module(
'EventInfoSetter')
89eventinfosetter.param({
'evtNumList': [10],
'runList': [1]})
91progress = b2.register_module(
'Progress')
93main = b2.create_path()
95main.add_module(eventinfosetter)
96main.add_module(particlegun)
98add_svd_simulation(main)
100main.add_module(progress)
103Packer = b2.register_module(
'SVDPacker')
104Packer.param(
'NodeID', nodeid)
105Packer.param(
'svdShaperDigitListName',
'SVDShaperDigits')
106Packer.param(
'rawSVDListName',
'SVDRaw')
107main.add_module(Packer)
109unPacker = b2.register_module(
'SVDUnpacker')
110unPacker.param(
'rawSVDListName',
'SVDRaw')
111unPacker.param(
'svdShaperDigitListName', svd_digits_pack_unpack_collection)
112main.add_module(unPacker)
A (simplified) python wrapper for StoreArray.
def sortDigits(self, unsortedPyStoreArray)