Belle II Software  release-08-01-10
SvdPackerUnpackerTestModule Class Reference
Inheritance diagram for SvdPackerUnpackerTestModule:
Collaboration diagram for SvdPackerUnpackerTestModule:

Public Member Functions

def sortDigits (self, unsortedPyStoreArray)
 
def event (self)
 

Detailed Description

module which ckecks if two collection of SVDShaperDigits are equal

Definition at line 22 of file svd_packer_unpacker.py.

Member Function Documentation

◆ event()

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

Definition at line 45 of file svd_packer_unpacker.py.

45  def event(self):
46  """ load SVDShaperDigits of the simulation and the packed/unpacked ones
47  and compare them"""
48 
49  svdDigitsPackedUnpacked = Belle2.PyStoreArray(svd_digits_pack_unpack_collection)
50  # direct from simulation
51  svdDigits = Belle2.PyStoreArray("SVDShaperDigits")
52 
53  svdDigits_sorted = self.sortDigits(svdDigits)
54  svdDigitsPackedUnpacked_sorted = self.sortDigits(svdDigitsPackedUnpacked)
55 
56  if not len(svdDigits_sorted) == len(svdDigitsPackedUnpacked_sorted):
57  b2.B2FATAL("SVDShaperDigits count not equal after packing and unpacking")
58 
59  # check all quantities between the direct and the packed/unpacked svd digits
60  for i in range(len(svdDigits_sorted)):
61 
62  # sort the digits, because the packer sorts the
63  # the 32-bit frames are sorted by FADC numbers by the packer module
64  hit = svdDigits_sorted[i]
65  hitPackedUnpacked = svdDigitsPackedUnpacked_sorted[i]
66 
67  # check content of the digit
68  assert hit.getTime() == hitPackedUnpacked.getTime()
69  assert hit.getIndex() == hitPackedUnpacked.getIndex()
70 
71  # note: The charge will only be checked if between 0 and 255
72  # These two cases will be addressed in future SVDShaperDigits and packer/unpacker version
73  assert numpy.isclose(hit.getCharge(), hitPackedUnpacked.getCharge())
74 
75  # check the VxdID information
76  assert hit.getSensorID().getID() == hitPackedUnpacked.getSensorID().getID()
77  assert hit.getSensorID().getLayerNumber() == hitPackedUnpacked.getSensorID().getLayerNumber()
78  assert hit.getSensorID().getLadderNumber() == hitPackedUnpacked.getSensorID().getLadderNumber()
79  assert hit.getSensorID().getSensorNumber() == hitPackedUnpacked.getSensorID().getSensorNumber()
80  assert hit.getSensorID().getSegmentNumber() == hitPackedUnpacked.getSensorID().getSegmentNumber()
81 
82 
83 # to run the framework the used modules need to be registered
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Definition: calibTools.h:60

◆ sortDigits()

def sortDigits (   self,
  unsortedPyStoreArray 
)
 use some digit information to sort the SVDShaperDigits list
    Returns a python-list containing the SVDShaperDigits

Definition at line 28 of file svd_packer_unpacker.py.


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