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