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

Public Member Functions

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

Detailed Description

module which ckecks if two collections of TOPDigits are equal

Definition at line 20 of file top_packer_unpacker.py.

Member Function Documentation

◆ event()

def event (   self)
load original TOPDigits and the packed/unpacked ones, sort and compare them

Definition at line 44 of file top_packer_unpacker.py.

44  def event(self):
45  """
46  load original TOPDigits and the packed/unpacked ones, sort and compare them
47  """
48 
49  # direct from simulation
50  digits = Belle2.PyStoreArray("TOPDigits")
51  # processed by packer and unpacker
52  digitsUnpacked = Belle2.PyStoreArray("TOPDigitsUnpacked")
53 
54  # sort digits
55  digits_sorted = self.sortDigits(digits)
56  digitsUnpacked_sorted = self.sortDigits(digitsUnpacked)
57 
58  # check the sizes
59  if not len(digits_sorted) == len(digitsUnpacked_sorted):
60  print('size: ', len(digits_sorted), len(digitsUnpacked_sorted))
61  b2.B2FATAL("TOPDigits: size not equal after packing and unpacking")
62 
63  # check all quantities between the direct and the packed/unpacked
64  precision = 0.0001 # precision for floats (e.g. in [ns])
65  for i in range(len(digits_sorted)):
66 
67  digit = digits_sorted[i]
68  digitUnpacked = digitsUnpacked_sorted[i]
69 
70  # check the content of the digit
71  assert digit.getModuleID() == digitUnpacked.getModuleID()
72  assert digit.getPixelID() == digitUnpacked.getPixelID()
73  assert digit.getChannel() == digitUnpacked.getChannel()
74  assert digit.getRawTime() == digitUnpacked.getRawTime()
75  assert abs(digit.getTime() - digitUnpacked.getTime()) < precision
76  assert abs(digit.getTimeError() - digitUnpacked.getTimeError()) < precision
77  assert digit.getPulseHeight() == digitUnpacked.getPulseHeight()
78  assert abs(digit.getPulseWidth() - digitUnpacked.getPulseWidth()) < precision
79  # assert digit.getIntegral() == digitUnpacked.getIntegral()
80  assert digit.getFirstWindow() == digitUnpacked.getFirstWindow()
81  assert digit.getHitQuality() == digitUnpacked.getHitQuality()
82  assert digit.getStatus() == digitUnpacked.getStatus()
83  assert digit.isChargeShare() == digitUnpacked.isChargeShare()
84  assert digit.isPrimaryChargeShare() == digitUnpacked.isPrimaryChargeShare()
85 
86 
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72

◆ sortDigits()

def sortDigits (   self,
  unsortedPyStoreArray 
)
Use some digit information to sort the digits
Returns a python-list containing the sorted digits

Definition at line 26 of file top_packer_unpacker.py.


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