45 def event(self):
46 """ load the PXD Digits of the simulation and the packed/unpacked ones
47 and compare them"""
48
50 if not orgroisuns:
51 b2.B2FATAL("ROIs not in file")
52 return
53
55 if not unpackedroisuns:
56 b2.B2FATAL("PXDROIsPayHLT not in file")
57 return
58
59
60
61
62
63
64 orgrois = self.sortROIs(orgroisuns)
65 unpackedrois = self.sortROIs(unpackedroisuns)
66
67
68
69
70
71
72
73
74
75 print(f"Comparing {len(orgrois)} ROIs ")
76
77 def f(x):
78 return (
79 x.getSensorID(),
80 x.getMinUid(),
81 x.getMaxUid(),
82 x.getMinVid(),
83 x.getMaxVid())
84
85
86
87
88
89
90
91
92
93
94
95
96
97 j = 0
98 for i in range(len(orgrois)):
99 org = orgrois[i]
100 if i != 0 and f(org) == f(orgrois[i - 1]):
101 b2.B2WARNING("Found the same ROI a second time (Double ROI)!")
102 b2.B2WARNING(
103 f"Check ${org.getSensorID().getID():X} {int(org.getMinUid()):3d} {int(org.getMaxUid()):3d} " +
104 f"{int(org.getMinVid()):3d} {int(org.getMaxVid()):3d}")
105 if i == 0 or f(org) != f(orgrois[i - 1]):
106 if j == len(unpackedrois):
107 b2.B2FATAL("Unpacked ROIs comparison exceeds array limit!")
108 break
109
110 unp = unpackedrois[j]
111
112 b2.B2INFO(
113 f"Check Org ${org.getSensorID().getID():X} {org.getMinUid():3d} {org.getMaxUid():3d} " +
114 f"{org.getMinVid():3d} {org.getMaxVid():3d} Unp ${unp.getSensorID().getID():X} {unp.getMinUid():3d} " +
115 f"{unp.getMaxUid():3d} {unp.getMinVid():3d} {unp.getMaxVid():3d}")
116
117 if unp.getMinUid() == 0 and unp.getMinVid() == 0 and unp.getMaxUid() == 250 - 1 and unp.getMaxVid() == 768 - 1:
118 b2.B2INFO("Full size ROI")
119 if org.getSensorID().getID() != unp.getSensorID().getID():
120 b2.B2INFO("DHHID changed")
121 if j == len(unpackedrois):
122 b2.B2FATAL("Unpacked ROIs comparison exceeds array limit!")
123 break
124 j += 1
125 unp = unpackedrois[j]
126
127 if not(unp.getMinUid() == 0 and unp.getMinVid() == 0 and unp.getMaxUid() == 250 - 1 and unp.getMaxVid() == 768 - 1):
128 assert org.getSensorID().getID() == unp.getSensorID().getID()
129 assert org.getMinUid() == unp.getMinUid()
130 assert org.getMaxUid() == unp.getMaxUid()
131 assert org.getMinVid() == unp.getMinVid()
132 assert org.getMaxVid() == unp.getMaxVid()
133 j += 1
134
135
136
A (simplified) python wrapper for StoreArray.