17 from ROOT
import Belle2
21 from rawdata
import add_packers
22 from rawdata
import add_unpackers
24 pxd_rawhits_pack_unpack_collection =
"PXDRawHits_test"
25 pxd_rawhits_pack_unpack_collection_digits =
"PXDDigits_test"
26 pxd_rawhits_pack_unpack_collection_adc = pxd_rawhits_pack_unpack_collection +
"_adc"
27 pxd_rawhits_pack_unpack_collection_roi = pxd_rawhits_pack_unpack_collection +
"_roi"
28 b2.set_random_seed(42)
34 Module which checks if a collection of PXDDigits and
35 a collection of PXDRawHits from the packing/unpacking procedure are equal.
36 The PXDUnpacker does not create PXDDigits but PXDRawHits and therefore these two lists
40 def __init__(self, rawhits_collection='PXDRawHits', digits_collection="PXDDigits"):
51 """ use a some digit information to sort the PXDDigits list
52 Returns a python-list containing the PXDDigts
56 py_list = [x
for x
in unsortedPyStoreArray]
67 """ use a some digit information to sort the PXDRawHits list
68 Returns a python-list containing the PXDRawHits
72 py_list = [x
for x
in unsortedPyStoreArray]
83 """ load the PXD Digits of the simulation and the packed/unpacked ones
94 pxdDigits = self.
sortDigitssortDigits(pxdDigits_unsorted)
95 pxdRawHitsPackedUnpacked = self.
sortRawHitssortRawHits(pxdRawHitsPackedUnpacked_unsorted)
97 if not len(pxdDigits) == len(pxdRawHitsPackedUnpacked):
98 b2.B2FATAL(
"PXDDigits and PXDRawHits count not equal after packing and unpacking")
100 print(
"Comparing %i pxd digits " % len(pxdDigits))
103 for i
in range(len(pxdDigits)):
105 rawHitPackedUnpacked = pxdRawHitsPackedUnpacked[i]
109 assert rawHitPackedUnpacked.getSensorID().
getID() == digit.getSensorID().
getID()
110 assert rawHitPackedUnpacked.getRow() == digit.getVCellID()
111 assert rawHitPackedUnpacked.getColumn() == digit.getUCellID()
115 assert numpy.isclose(min(255.0, digit.getCharge()), rawHitPackedUnpacked.getCharge())
119 particlegun = b2.register_module(
'ParticleGun')
120 particlegun.param(
'pdgCodes', [13, -13])
121 particlegun.param(
'nTracks', 10)
124 eventinfosetter = b2.register_module(
'EventInfoSetter')
125 eventinfosetter.param({
'evtNumList': [50]})
127 progress = b2.register_module(
'Progress')
129 main = b2.create_path()
131 main.add_module(eventinfosetter)
132 main.add_module(particlegun)
135 b2.set_module_parameters(main, type=
"Geometry", useDB=
False, components=[
"PXD"])
137 main.add_module(progress)
140 add_packers(main, components=[
'PXD'])
143 add_unpackers(main, components=[
'PXD'])
146 for e
in main.modules():
147 if e.name() ==
'PXDUnpacker':
148 e.param(
"PXDRawHitsName", pxd_rawhits_pack_unpack_collection)
149 e.param(
"PXDRawAdcsName", pxd_rawhits_pack_unpack_collection_adc)
150 e.param(
"PXDRawROIsName", pxd_rawhits_pack_unpack_collection_roi)
152 if e.name() ==
'PXDRawHitSorter':
153 e.param(
'rawHits', pxd_rawhits_pack_unpack_collection)
154 e.param(
'digits', pxd_rawhits_pack_unpack_collection_digits)
166 rawhits_collection=pxd_rawhits_pack_unpack_collection,
167 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)
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
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)