Belle II Software
light-2406-ragdoll
root_output.py
1
#!/usr/bin/env python3
2
3
10
11
import
os
12
from
basf2
import
create_path, process, B2FATAL, set_random_seed
13
from
ROOT
import
TFile
14
15
set_random_seed(
"something important"
)
16
17
# Create paths
18
main = create_path()
19
# Add modules to paths
20
main.add_module(
"EventInfoSetter"
, expList=[1, 1], runList=[1, 2], evtNumList=[100, 100])
21
main.add_module(
"EventInfoPrinter"
)
22
main.add_module(
"RootOutput"
, outputFileName=
'root_output_test.root'
, updateFileCatalog=
False
)
23
24
# Process events
25
process(main)
26
27
# check wether output file contains correct number of events
28
tfile = TFile(
'root_output_test.root'
)
29
tree = tfile.Get(
'tree'
)
30
if
tree.GetEntries() != 200:
31
B2FATAL(
'Created output file contains wrong number of events!'
)
32
33
os.remove(
'root_output_test.root'
)
framework
tests
root_output.py
Generated on Tue Jul 9 2024 23:29:17 for Belle II Software by
1.9.6