Belle II Software  release-08-01-10
select_events.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # Demonstrates selecting events to save in the event display:
13 # * create 'conditionspath' with e.g. RootOutput
14 # * use if_true() on the display module to activate it
15 #
16 # Once started, a widget will be shown to toggle the return value,
17 # if the box is checked when advancing to the next event, the event
18 # will be saved in saved_from_display.root.
19 
20 import basf2 as b2
21 from simulation import add_simulation
22 
23 # register necessary modules
24 eventinfosetter = b2.register_module('EventInfoSetter')
25 eventinfosetter.param('evtNumList', [5000])
26 
27 main = b2.Path()
28 
29 # add modules to paths
30 main.add_module(eventinfosetter)
31 
32 main.add_module('EvtGenInput')
33 
34 add_simulation(main)
35 
36 # add_reconstruction(main)
37 
38 display = main.add_module('Display')
39 conditionpath = b2.Path()
40 conditionpath.add_module('RootOutput', outputFileName='saved_from_display.root')
41 display.if_true(conditionpath)
42 
43 b2.process(main)
44 print(b2.statistics)