Belle II Software  release-06-02-00
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 # (no ECL because of unsupported solids)
35 components = [
36  'MagneticField',
37  'BeamPipe',
38  'PXD',
39  'SVD',
40  'CDC',
41  'TOP',
42  'ARICH',
43  'EKLM',
44  'BKLM',
45 ]
46 add_simulation(main, components)
47 
48 # add_reconstruction(main, components)
49 
50 display = main.add_module('Display')
51 conditionpath = b2.Path()
52 conditionpath.add_module('RootOutput', outputFileName='saved_from_display.root')
53 display.if_true(conditionpath)
54 
55 b2.process(main)
56 print(b2.statistics)