Belle II Software  release-05-01-25
PxdROIPayloadTestModule Class Reference
Inheritance diagram for PxdROIPayloadTestModule:
Collaboration diagram for PxdROIPayloadTestModule:

Public Member Functions

def sortROIs (self, unsortedPyStoreArray)
 
def event (self)
 

Detailed Description

module which checks if the roy payload from HLT can be created and depacked correctly

Definition at line 18 of file pxd_roi_payload.py.

Member Function Documentation

◆ event()

def event (   self)
load the PXD Digits of the simulation and the packed/unpacked ones
and compare them

Definition at line 41 of file pxd_roi_payload.py.

41  def event(self):
42  """ load the PXD Digits of the simulation and the packed/unpacked ones
43  and compare them"""
44 
45  orgroisuns = Belle2.PyStoreArray('ROIs')
46  if not orgroisuns:
47  B2FATAL("ROIs not in file")
48  return
49 
50  unpackedroisuns = Belle2.PyStoreArray('PXDROIsPayHLT')
51  if not unpackedroisuns:
52  B2FATAL("PXDROIsPayHLT not in file")
53  return
54 
55  # To make a 1:1 comparison, we have to sort both arrays.
56  # As the order of the payload differs from the original array.
57  # (its sorted by DHHID)
58  # We have to sort both, because sorting by coordinate is not defined.
59 
60  orgrois = self.sortROIs(orgroisuns)
61  unpackedrois = self.sortROIs(unpackedroisuns)
62 
63  # For some unknown reason, the ROI array contains a lot of
64  # doubles. For creating the paload, thesehave been removed. to make a 1:1
65  # comparison, we have to skip the following check and lateron skip ROIs
66  # which are identical to the one before (ordered array).
67 
68  # if not len(orgrois) == len(unpackedrois):
69  # B2FATAL("Org. ROIs and Unpacked ROIs count not equal after packing and unpacking")
70 
71  print("Comparing %i ROIs " % len(orgrois))
72 
73  def f(x):
74  return (
75  x.getSensorID(),
76  x.getMinUid(),
77  x.getMaxUid(),
78  x.getMinVid(),
79  x.getMaxVid())
80 
81  # check all quantities between the direct and the packed/unpacked pxd digits
82  # for i in range(len(orgrois)):
83  # org = orgrois[i]
84  # if i == 0 or f(org) != f(orgrois[i - 1]):
85  # B2INFO(" Org $%X %3d %3d %3d %3d" % (org.getSensorID().getID(), org.getMinUid(),
86  # org.getMaxUid(), org.getMinVid(), org.getMaxVid()))
87 
88  # for i in range(len(unpackedrois)):
89  # unp = unpackedrois[i]
90  # B2INFO(" Unp $%X %3d %3d %3d %3d" % (unp.getSensorID().getID(),
91  # unp.getMinUid(), unp.getMaxUid(), unp.getMinVid(), unp.getMaxVid()))
92 
93  j = 0
94  for i in range(len(orgrois)):
95  org = orgrois[i]
96  if i != 0 and f(org) == f(orgrois[i - 1]):
97  B2WARNING("Found the same ROI a second time (Double ROI)!")
98  B2WARNING(
99  "Check Org $%X %3d %3d %3d %3d Unp $%X %3d %3d %3d %3d" %
100  (org.getSensorID().getID(),
101  org.getMinUid(),
102  org.getMaxUid(),
103  org.getMinVid(),
104  org.getMaxVid(),
105  unp.getSensorID().getID(),
106  unp.getMinUid(),
107  unp.getMaxUid(),
108  unp.getMinVid(),
109  unp.getMaxVid()))
110  if i == 0 or f(org) != f(orgrois[i - 1]):
111  if j == len(unpackedrois):
112  B2FATAL("Unpacked ROIs comparison exceeds array limit!")
113  break
114 
115  unp = unpackedrois[j]
116 
117  B2INFO(
118  "Check Org $%X %3d %3d %3d %3d Unp $%X %3d %3d %3d %3d" %
119  (org.getSensorID().getID(),
120  org.getMinUid(),
121  org.getMaxUid(),
122  org.getMinVid(),
123  org.getMaxVid(),
124  unp.getSensorID().getID(),
125  unp.getMinUid(),
126  unp.getMaxUid(),
127  unp.getMinVid(),
128  unp.getMaxVid()))
129  # compare all available quantities
130  if unp.getMinUid() == 0 and unp.getMinVid() == 0 and unp.getMaxUid() == 250 - 1 and unp.getMaxVid() == 768 - 1:
131  B2INFO("Full size ROI")
132  if org.getSensorID().getID() != unp.getSensorID().getID():
133  B2INFO("DHHID changed")
134  if j == len(unpackedrois):
135  B2FATAL("Unpacked ROIs comparison exceeds array limit!")
136  break
137  j += 1
138  unp = unpackedrois[j]
139 
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()
146  j += 1
147 
148 
149 # to run the framework the used modules need to be registered

◆ sortROIs()

def sortROIs (   self,
  unsortedPyStoreArray 
)
sort ROI list
    Returns a python-list containing the ROIs

Definition at line 24 of file pxd_roi_payload.py.


The documentation for this class was generated from the following file:
Belle2::getID
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Definition: calibTools.h:71
ClusterEfficiency.ClusterEfficiency.event
def event(self)
Definition: ClusterEfficiency.py:146
Belle2::PyStoreArray
a (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:58