Belle II Software
development
read_array_example.py
1
import
basf2
2
import
ROOT
# noqa
3
from
ROOT.Belle2
import
PyStoreArray, DataStore
4
5
import
generators
as
ge
6
import
simulation
as
si
7
8
9
class
PXDReader
(basf2.Module):
10
'''
11
Simple module that reads the content of the PyStoreArray
12
and prints a dictionary with the read values
13
'''
14
15
def
initialize
(self):
16
'''
17
Initialize the PyStoreArray and regiter it into the DataStore
18
'''
19
20
self.
pxddigits
= PyStoreArray(
"PXDDigits"
, DataStore.c_Event)
21
self.
pxddigits
.registerInDataStore(
"PXDDigits"
)
22
23
def
event
(self):
24
'''
25
Loop over the number of events and read the content of the
26
PyStoreArray into a dictionary
27
'''
28
digits = self.
pxddigits
.readArray()
29
print(digits)
30
31
32
main = basf2.Path()
33
main.add_module(
'EventInfoSetter'
, evtNumList=[1], expList=[0])
34
ge.add_evtgen_generator(path=main, finalstate=
'mixed'
)
35
si.add_simulation(path=main)
36
main.add_module(
PXDReader
())
37
38
basf2.process(main)
39
basf2.statistics
read_array_example.PXDReader
Definition
read_array_example.py:9
read_array_example.PXDReader.initialize
initialize(self)
Definition
read_array_example.py:15
read_array_example.PXDReader.pxddigits
pxddigits
PyStoreArray.
Definition
read_array_example.py:20
read_array_example.PXDReader.event
event(self)
Definition
read_array_example.py:23
framework
examples
read_array_example.py
Generated on Mon Sep 1 2025 02:51:23 for Belle II Software by
1.13.2