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