Belle II Software  release-05-02-19
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 16 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 39 of file svd_packer_unpacker.py.

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

◆ sortDigits()

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

Definition at line 22 of file svd_packer_unpacker.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