16from ROOT
import Belle2
20from rawdata
import add_packers
21from rawdata
import add_unpackers
23pxd_rawhits_pack_unpack_collection =
"PXDRawHits_test"
24pxd_rawhits_pack_unpack_collection_digits =
"PXDDigits_test"
25pxd_rawhits_pack_unpack_collection_adc = pxd_rawhits_pack_unpack_collection +
"_adc"
26pxd_rawhits_pack_unpack_collection_roi = pxd_rawhits_pack_unpack_collection +
"_roi"
33 Module which checks if a collection of PXDDigits
and
34 a collection of PXDRawHits
from the packing/unpacking procedure are equal.
35 The PXDUnpacker does
not create PXDDigits but PXDRawHits
and therefore these two lists
39 def __init__(self, rawhits_collection='PXDRawHits', digits_collection="PXDDigits"):
50 """ use a some digit information to sort the PXDDigits list
51 Returns a python-list containing the PXDDigts
55 py_list = [x
for x
in unsortedPyStoreArray]
66 """ use a some digit information to sort the PXDRawHits list
67 Returns a python-list containing the PXDRawHits
71 py_list = [x
for x
in unsortedPyStoreArray]
82 """ load the PXD Digits of the simulation and the packed/unpacked ones
93 pxdDigits = self.
sortDigits(pxdDigits_unsorted)
94 pxdRawHitsPackedUnpacked = self.
sortRawHits(pxdRawHitsPackedUnpacked_unsorted)
96 if not len(pxdDigits) == len(pxdRawHitsPackedUnpacked):
97 b2.B2FATAL(
"PXDDigits and PXDRawHits count not equal after packing and unpacking")
99 print(f
"Comparing {len(pxdDigits)} pxd digits ")
102 for i
in range(len(pxdDigits)):
104 rawHitPackedUnpacked = pxdRawHitsPackedUnpacked[i]
108 assert rawHitPackedUnpacked.getSensorID().getID() == digit.getSensorID().getID()
109 assert rawHitPackedUnpacked.getRow() == digit.getVCellID()
110 assert rawHitPackedUnpacked.getColumn() == digit.getUCellID()
114 assert numpy.isclose(min(255.0, digit.getCharge()), rawHitPackedUnpacked.getCharge())
118particlegun = b2.register_module(
'ParticleGun')
119particlegun.param(
'pdgCodes', [13, -13])
120particlegun.param(
'nTracks', 10)
123eventinfosetter = b2.register_module(
'EventInfoSetter')
124eventinfosetter.param({
'evtNumList': [50]})
126progress = b2.register_module(
'Progress')
128main = b2.create_path()
130main.add_module(eventinfosetter)
131main.add_module(particlegun)
134b2.set_module_parameters(main, type=
"Geometry", useDB=
False, components=[
"PXD"])
136main.add_module(progress)
139add_packers(main, components=[
'PXD'])
142add_unpackers(main, components=[
'PXD'])
145for e
in main.modules():
146 if e.name() ==
'PXDUnpacker':
147 e.param(
"PXDRawHitsName", pxd_rawhits_pack_unpack_collection)
148 e.param(
"PXDRawAdcsName", pxd_rawhits_pack_unpack_collection_adc)
149 e.param(
"PXDRawROIsName", pxd_rawhits_pack_unpack_collection_roi)
151 if e.name() ==
'PXDRawHitSorter':
152 e.param(
'rawHits', pxd_rawhits_pack_unpack_collection)
153 e.param(
'digits', pxd_rawhits_pack_unpack_collection_digits)
165 rawhits_collection=pxd_rawhits_pack_unpack_collection,
166 digits_collection=pxd_rawhits_pack_unpack_collection_digits))
A (simplified) python wrapper for StoreArray.
def sortDigits(self, unsortedPyStoreArray)
digits_collection
the PXDDigits
rawhits_collection
the PXDRawHits
def __init__(self, rawhits_collection='PXDRawHits', digits_collection="PXDDigits")
def sortRawHits(self, unsortedPyStoreArray)
def add_simulation(path, components=None, bkgfiles=None, bkgOverlay=True, forceSetPXDDataReduction=False, usePXDDataReduction=True, cleanupPXDDataReduction=True, generate_2nd_cdc_hits=False, simulateT0jitter=True, isCosmics=False, FilterEvents=False, usePXDGatedMode=False, skipExperimentCheckForBG=False, save_slow_pions_in_mc=False)