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

Public Member Functions

 test_readArray (self)
 
 test_fillArray (self)
 

Detailed Description

Class that tests the function readArray and fillArray

Definition at line 11 of file test_fill_read.py.

Member Function Documentation

◆ test_fillArray()

test_fillArray ( self)
Test for the fillArray function

Definition at line 46 of file test_fill_read.py.

46 def test_fillArray(self):
47 '''
48 Test for the fillArray function
49 '''
50 sids = np.array([1, 2, 3, 4, 5])
51 ucells = np.array([10, 20, 30, 40, 50])
52 vcells = np.array([15, 25, 35, 45, 55])
53 charges = np.array([10, 50, 100, 150, 200])
54
55 store = Belle2.PyStoreArray("PXDDigits")
56 store.registerInDataStore()
57
58 store.fillArray(sensorID=sids, uCellID=ucells, vCellID=vcells, charge=charges)
59
60 sensorIDs, uCellIDs, vCellIDs, read_charges = [], [], [], []
61
62 for pxd in store:
63 sensorIDs.append(pxd.getSensorID().getID())
64 uCellIDs.append(pxd.getUCellID())
65 vCellIDs.append(pxd.getVCellID())
66 read_charges.append(pxd.getCharge())
67
68 self.assertTrue(np.array_equal(sids, np.array(sensorIDs)))
69 self.assertTrue(np.array_equal(ucells, np.array(uCellIDs)))
70 self.assertTrue(np.array_equal(vcells, np.array(vCellIDs)))
71 self.assertTrue(np.array_equal(charges, np.array(read_charges)))
72
73 arr_ptr = store.getPtr()
74 arr_ptr.Clear()
75
76
A (simplified) python wrapper for StoreArray.

◆ test_readArray()

test_readArray ( self)
Test for the readArray function

Definition at line 16 of file test_fill_read.py.

16 def test_readArray(self):
17 '''
18 Test for the readArray function
19 '''
20 l_pxd = []
21 sids = np.array([1, 2, 3, 4, 5], dtype=np.ushort)
22 ucells = np.array([10, 20, 30, 40, 50], dtype=np.ushort)
23 vcells = np.array([15, 25, 35, 45, 55], dtype=np.ushort)
24 charges = np.array([10, 50, 100, 150, 200], dtype=np.ushort)
25
26 for sid, u, v, c in zip(sids, ucells, vcells, charges):
27 l_pxd.append(Belle2.PXDDigit(Belle2.VxdID(int(sid)), int(u), int(v), int(c)))
28
29 store = Belle2.PyStoreArray("PXDDigits")
30 store.registerInDataStore()
31
32 for pxd in l_pxd:
33 ptr = store.appendNew()
34 ptr.__assign__(pxd)
35
36 d = store.readArray()
37
38 self.assertTrue(np.array_equal(d["sensorID"], sids))
39 self.assertTrue(np.array_equal(d["uCellID"], ucells))
40 self.assertTrue(np.array_equal(d["vCellID"], vcells))
41 self.assertTrue(np.array_equal(d["charge"], charges))
42
43 arr_ptr = store.getPtr()
44 arr_ptr.Clear()
45
The PXD digit class.
Definition PXDDigit.h:27
Class to uniquely identify a any structure of the PXD and SVD.
Definition VxdID.h:33

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