13 from svd
import add_svd_simulation
14 from ROOT
import Belle2
18 svd_digits_pack_unpack_collection =
"SVDShaperDigits_test"
19 b2.set_random_seed(42)
25 module which ckecks if two collection of SVDShaperDigits are equal
29 """ use some digit information to sort the SVDShaperDigits list
30 Returns a python-list containing the SVDShaperDigits
34 py_list = [x
for x
in unsortedPyStoreArray]
40 x.getSensorID().getLayerNumber(),
41 x.getSensorID().getLadderNumber(),
42 x.getSensorID().getSensorNumber(),
46 """ load SVDShaperDigits of the simulation and the packed/unpacked ones
53 svdDigits_sorted = self.
sortDigitssortDigits(svdDigits)
54 svdDigitsPackedUnpacked_sorted = self.
sortDigitssortDigits(svdDigitsPackedUnpacked)
56 if not len(svdDigits_sorted) == len(svdDigitsPackedUnpacked_sorted):
57 b2.B2FATAL(
"SVDShaperDigits count not equal after packing and unpacking")
60 for i
in range(len(svdDigits_sorted)):
64 hit = svdDigits_sorted[i]
65 hitPackedUnpacked = svdDigitsPackedUnpacked_sorted[i]
68 assert hit.getTime() == hitPackedUnpacked.getTime()
69 assert hit.getIndex() == hitPackedUnpacked.getIndex()
73 assert numpy.isclose(hit.getCharge(), hitPackedUnpacked.getCharge())
76 assert hit.getSensorID().
getID() == hitPackedUnpacked.getSensorID().
getID()
77 assert hit.getSensorID().getLayerNumber() == hitPackedUnpacked.getSensorID().getLayerNumber()
78 assert hit.getSensorID().getLadderNumber() == hitPackedUnpacked.getSensorID().getLadderNumber()
79 assert hit.getSensorID().getSensorNumber() == hitPackedUnpacked.getSensorID().getSensorNumber()
80 assert hit.getSensorID().getSegmentNumber() == hitPackedUnpacked.getSensorID().getSegmentNumber()
84 particlegun = b2.register_module(
'ParticleGun')
85 particlegun.param(
'pdgCodes', [13, -13])
86 particlegun.param(
'nTracks', 10)
89 eventinfosetter = b2.register_module(
'EventInfoSetter')
90 eventinfosetter.param({
'evtNumList': [10],
'runList': [1]})
92 progress = b2.register_module(
'Progress')
94 main = b2.create_path()
96 main.add_module(eventinfosetter)
97 main.add_module(particlegun)
99 add_svd_simulation(main)
101 main.add_module(progress)
104 Packer = b2.register_module(
'SVDPacker')
105 Packer.param(
'NodeID', nodeid)
106 Packer.param(
'svdShaperDigitListName',
'SVDShaperDigits')
107 Packer.param(
'rawSVDListName',
'SVDRaw')
108 main.add_module(Packer)
110 unPacker = b2.register_module(
'SVDUnpacker')
111 unPacker.param(
'rawSVDListName',
'SVDRaw')
112 unPacker.param(
'svdShaperDigitListName', svd_digits_pack_unpack_collection)
113 main.add_module(unPacker)
A (simplified) python wrapper for StoreArray.
def sortDigits(self, unsortedPyStoreArray)
int getID(const std::vector< double > &breaks, double t)
get id of the time point t