Belle II Software development
RawDigitsTest Class Reference
Inheritance diagram for RawDigitsTest:

Public Member Functions

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

Detailed Description

module which ckecks if two collections of TOPRawDigits are equal

Definition at line 86 of file top_packer_unpacker.py.

Member Function Documentation

◆ event()

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

Definition at line 112 of file top_packer_unpacker.py.

112 def event(self):
113 """
114 load original TOPRawDigits and the packed/unpacked ones, sort and compare them
115 """
116
117 # direct from simulation
118 digits = Belle2.PyStoreArray("TOPRawDigits")
119 # processed by packer and unpacker
120 digitsUnpacked = Belle2.PyStoreArray("TOPRawDigitsUnpacked")
121
122 # sort digits
123 digits_sorted = self.sortDigits(digits)
124 digitsUnpacked_sorted = self.sortDigits(digitsUnpacked)
125
126 # check the sizes
127 if not len(digits_sorted) == len(digitsUnpacked_sorted):
128 print('size: ', len(digits_sorted), len(digitsUnpacked_sorted))
129 b2.B2FATAL("TOPRawDigits: size not equal after packing and unpacking")
130
131 # check all quantities between the direct and the packed/unpacked
132 for i in range(len(digits_sorted)):
133
134 digit = digits_sorted[i]
135 digitUnpacked = digitsUnpacked_sorted[i]
136
137 # check the content of the digit
138 assert digit.getScrodID() == digitUnpacked.getScrodID()
139 assert digit.getCarrierNumber() == digitUnpacked.getCarrierNumber()
140 assert digit.getASICNumber() == digitUnpacked.getASICNumber()
141 assert digit.getASICChannel() == digitUnpacked.getASICChannel()
142 assert digit.getASICWindow() == digitUnpacked.getASICWindow()
143 assert digit.getTFine() == digitUnpacked.getTFine()
144 assert digit.getSampleRise() == digitUnpacked.getSampleRise()
145 assert digit.getDeltaSamplePeak() == digitUnpacked.getDeltaSamplePeak()
146 assert digit.getDeltaSampleFall() == digitUnpacked.getDeltaSampleFall()
147 assert digit.getValueRise0() == digitUnpacked.getValueRise0()
148 assert digit.getValueRise1() == digitUnpacked.getValueRise1()
149 assert digit.getValuePeak() == digitUnpacked.getValuePeak()
150 assert digit.getValueFall0() == digitUnpacked.getValueFall0()
151 assert digit.getValueFall1() == digitUnpacked.getValueFall1()
152 # assert digit.getIntegral() == digitUnpacked.getIntegral()
153 assert digit.getRevo9Counter() == digitUnpacked.getRevo9Counter()
154 assert digit.getPhase() == digitUnpacked.getPhase()
155 assert digit.getErrorFlags() == digitUnpacked.getErrorFlags()
156 assert digit.getDataType() == digitUnpacked.getDataType()
157
158
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 92 of file top_packer_unpacker.py.

92 def sortDigits(self, unsortedPyStoreArray):
93 """
94 Use some digit information to sort the digits
95 Returns a python-list containing the sorted digits
96 """
97
98 # first convert to a python-list to be able to sort
99 py_list = [x for x in unsortedPyStoreArray]
100
101 # sort via a hierachy of sort keys
102 return sorted(
103 py_list,
104 key=lambda x: (
105 x.getScrodID(),
106 x.getCarrierNumber(),
107 x.getASICNumber(),
108 x.getASICChannel(),
109 x.getSampleRise())
110 )
111

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