Belle II Software  release-06-02-00
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 23 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 46 of file pxd_roi_payload.py.

46  def event(self):
47  """ load the PXD Digits of the simulation and the packed/unpacked ones
48  and compare them"""
49 
50  orgroisuns = Belle2.PyStoreArray('ROIs')
51  if not orgroisuns:
52  b2.B2FATAL("ROIs not in file")
53  return
54 
55  unpackedroisuns = Belle2.PyStoreArray('PXDROIsPayHLT')
56  if not unpackedroisuns:
57  b2.B2FATAL("PXDROIsPayHLT not in file")
58  return
59 
60  # To make a 1:1 comparison, we have to sort both arrays.
61  # As the order of the payload differs from the original array.
62  # (its sorted by DHHID)
63  # We have to sort both, because sorting by coordinate is not defined.
64 
65  orgrois = self.sortROIs(orgroisuns)
66  unpackedrois = self.sortROIs(unpackedroisuns)
67 
68  # For some unknown reason, the ROI array contains a lot of
69  # doubles. For creating the payload, these have been removed. to make a 1:1
70  # comparison, we have to skip the following check and lateron skip ROIs
71  # which are identical to the one before (ordered array).
72 
73  # if not len(orgrois) == len(unpackedrois):
74  # B2FATAL("Org. ROIs and Unpacked ROIs count not equal after packing and unpacking")
75 
76  print("Comparing %i ROIs " % len(orgrois))
77 
78  def f(x):
79  return (
80  x.getSensorID(),
81  x.getMinUid(),
82  x.getMaxUid(),
83  x.getMinVid(),
84  x.getMaxVid())
85 
86  # check all quantities between the direct and the packed/unpacked pxd digits
87  # for i in range(len(orgrois)):
88  # org = orgrois[i]
89  # if i == 0 or f(org) != f(orgrois[i - 1]):
90  # B2INFO(" Org $%X %3d %3d %3d %3d" % (org.getSensorID().getID(), org.getMinUid(),
91  # org.getMaxUid(), org.getMinVid(), org.getMaxVid()))
92 
93  # for i in range(len(unpackedrois)):
94  # unp = unpackedrois[i]
95  # B2INFO(" Unp $%X %3d %3d %3d %3d" % (unp.getSensorID().getID(),
96  # unp.getMinUid(), unp.getMaxUid(), unp.getMinVid(), unp.getMaxVid()))
97 
98  j = 0
99  for i in range(len(orgrois)):
100  org = orgrois[i]
101  if i != 0 and f(org) == f(orgrois[i - 1]):
102  b2.B2WARNING("Found the same ROI a second time (Double ROI)!")
103  b2.B2WARNING(
104  "Check $%X %3d %3d %3d %3d" %
105  (org.getSensorID().getID(),
106  org.getMinUid(),
107  org.getMaxUid(),
108  org.getMinVid(),
109  org.getMaxVid()))
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!")
113  break
114 
115  unp = unpackedrois[j]
116 
117  b2.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  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!")
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
a (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:56
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Definition: calibTools.h:60

◆ sortROIs()

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

Definition at line 29 of file pxd_roi_payload.py.


The documentation for this class was generated from the following file: