Belle II Software
release-05-01-25
root_output.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
import
os
5
from
basf2
import
create_path, process, B2FATAL, set_random_seed
6
from
ROOT
import
TFile, TTree
7
8
set_random_seed(
"something important"
)
9
10
# Create paths
11
main = create_path()
12
# Add modules to paths
13
main.add_module(
"EventInfoSetter"
, expList=[1, 1], runList=[1, 2], evtNumList=[100, 100])
14
main.add_module(
"EventInfoPrinter"
)
15
main.add_module(
"RootOutput"
, outputFileName=
'root_output_test.root'
, updateFileCatalog=
False
)
16
17
# Process events
18
process(main)
19
20
# check wether output file contains correct number of events
21
tfile = TFile(
'root_output_test.root'
)
22
tree = tfile.Get(
'tree'
)
23
if
tree.GetEntries() != 200:
24
B2FATAL(
'Created output file contains wrong number of events!'
)
25
26
os.remove(
'root_output_test.root'
)
framework
tests
root_output.py
Generated on Fri Nov 5 2021 03:53:02 for Belle II Software by
1.8.17