Belle II Software  release-05-01-25
display.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 #
5 # Opens a .root/.sroot file and shows MCParticles,
6 # SimHits and Tracks using the Display module.
7 # Usage:
8 # basf2 display/example/display.py -i MyInputFile.root
9 #
10 # Note: this file is also used by the 'b2display' command,
11 # so the following is also possible:
12 # b2display MyInputFile.root
13 #
14 # If you want custom settings for b2display, you thus only need to
15 # edit this steering file.
16 
17 from basf2 import *
18 from ROOT import Belle2
19 
20 # create paths
21 main = create_path()
22 
23 # Get type of input file to decide, which input module we want to use
24 input_files = Belle2.Environment.Instance().getInputFilesOverride()
25 if not input_files.empty() and input_files.front().endswith(".sroot"):
26  rootinput = register_module('SeqRootInput')
27 else:
28  rootinput = register_module('RootInput')
29 
30 # create geometry
31 gearbox = register_module('Gearbox')
32 # gearbox.param('fileName', '/geometry/Beast2_phase1.xml')
33 gearbox.param('fileName', 'beast/microtpc/detector.xml')
34 geometry = register_module('Geometry')
35 # new ECL geometry contains custom objects that cannot be converted to TGeo
36 # add MagneticField off B-field (also greatly speeds up startup)
37 # geometry.param('excludedComponents', ['ECL'])
38 
39 main.add_module(rootinput)
40 main.add_module(gearbox)
41 main.add_module(geometry)
42 
43 display = register_module('Display')
44 # --- MC options ---
45 # Should Monte Carlo info be shown? (MCParticles, SimHits)
46 display.param('showMCInfo', True)
47 
48 # should hits always be assigned to a particle with c_PrimaryParticle flag?
49 display.param('assignHitsToPrimaries', False)
50 
51 # show all primary MCParticles?
52 display.param('showAllPrimaries', True)
53 
54 # show all charged MCParticles?
55 display.param('showCharged', True)
56 
57 # show all neutral MCParticles?
58 display.param('showNeutrals', True)
59 
60 
61 # --- Intermediate options ---
62 # show track candidates?
63 # You most likely don't want this unless you are a tracking developer
64 display.param('showRecoTracks', False)
65 
66 # directly show CDCHits as drift cylinders (shortened, z position = 0)
67 display.param('showCDCHits', False)
68 
69 
70 # --- Track options ---
71 # show tracks, vertices, eclgammas?
72 display.param('showTrackLevelObjects', True)
73 
74 # The options parameter is a combination of:
75 # D draw detectors - draw simple detector representation (with different size)
76 # for each hit
77 # H draw track hits
78 # M draw track markers - intersections of track with detector planes
79 # P draw detector planes
80 #
81 # Note that you can always turn off an individual detector component or track
82 # interactively by removing its checkmark in the 'Eve' tab.
83 #
84 # only makes sense when showTrackLevelObjects/showTrackCandidates is used
85 display.param('options', 'MH') # default
86 
87 # --- Other options ---
88 
89 # save events non-interactively (without showing window)?
90 display.param('automatic', False)
91 
92 # change to True to show the full TGeo geometry instead of simplified extract
93 display.param('fullGeometry', True)
94 
95 # Objects which are to be hidden (can be manually re-enabled in tree view).
96 # Names correspond to the object names in the 'Event'. (Note that this won't
97 # work for objects somewhere deep in the tree, only for those immediately
98 # below 'Event'.
99 display.param('hideObjects', [])
100 
101 main.add_module(display)
102 
103 process(main)
104 # print(statistics(statistics.INIT))
Belle2::Environment::Instance
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:31