14 from ROOT
import Belle2
18 import PXDROIUnpackerModule
20 b2.set_random_seed(42)
26 module which checks if the roy payload from HLT can be created and depacked correctly
31 Returns a python-list containing the ROIs
35 py_list = list(unsortedPyStoreArray)
38 return sorted(py_list,
47 """ load the PXD Digits of the simulation and the packed/unpacked ones
52 b2.B2FATAL(
"ROIs not in file")
56 if not unpackedroisuns:
57 b2.B2FATAL(
"PXDROIsPayHLT not in file")
65 orgrois = self.
sortROIssortROIs(orgroisuns)
66 unpackedrois = self.
sortROIssortROIs(unpackedroisuns)
76 print(
"Comparing %i ROIs " % len(orgrois))
99 for i
in range(len(orgrois)):
101 if i != 0
and f(org) == f(orgrois[i - 1]):
102 b2.B2WARNING(
"Found the same ROI a second time (Double ROI)!")
104 "Check $%X %3d %3d %3d %3d" %
105 (org.getSensorID().
getID(),
110 if i == 0
or f(org) != f(orgrois[i - 1]):
111 if j == len(unpackedrois):
112 b2.B2FATAL(
"Unpacked ROIs comparison exceeds array limit!")
115 unp = unpackedrois[j]
118 "Check Org $%X %3d %3d %3d %3d Unp $%X %3d %3d %3d %3d" %
119 (org.getSensorID().
getID(),
124 unp.getSensorID().
getID(),
130 if unp.getMinUid() == 0
and unp.getMinVid() == 0
and unp.getMaxUid() == 250 - 1
and unp.getMaxVid() == 768 - 1:
131 b2.B2INFO(
"Full size ROI")
132 if org.getSensorID().
getID() != unp.getSensorID().
getID():
133 b2.B2INFO(
"DHHID changed")
134 if j == len(unpackedrois):
135 b2.B2FATAL(
"Unpacked ROIs comparison exceeds array limit!")
138 unp = unpackedrois[j]
140 if not(unp.getMinUid() == 0
and unp.getMinVid() == 0
and unp.getMaxUid() == 250 - 1
and unp.getMaxVid() == 768 - 1):
141 assert org.getSensorID().
getID() == unp.getSensorID().
getID()
142 assert org.getMinUid() == unp.getMinUid()
143 assert org.getMaxUid() == unp.getMaxUid()
144 assert org.getMinVid() == unp.getMinVid()
145 assert org.getMaxVid() == unp.getMaxVid()
150 particlegun = b2.register_module(
'ParticleGun')
151 particlegun.param(
'pdgCodes', [13, -13])
152 particlegun.param(
'nTracks', 40)
155 eventinfosetter = b2.register_module(
'EventInfoSetter')
156 eventinfosetter.param({
'evtNumList': [10]})
158 main = b2.create_path()
160 main.add_module(eventinfosetter)
161 main.add_module(particlegun)
165 usePXDDataReduction=
True, cleanupPXDDataReduction=
False)
166 b2.set_module_parameters(main, type=
"Geometry", useDB=
False, components=[
'PXD',
'SVD',
'MagneticFieldConstant4LimitedRSVD'])
168 roiPayloadAssembler = b2.register_module(
'ROIPayloadAssembler')
169 roiPayloadAssembler.param({
"ROIListName":
"ROIs",
"SendAllDownscaler": 0,
170 "SendROIsDownscaler": 0,
"CutNrROIs": 5,
"AcceptAll":
True})
172 main.add_module(roiPayloadAssembler)
175 main.add_module(
'Progress')
a (simplified) python wrapper for StoreArray.
def sortROIs(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)