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 geometry = register_module('Geometry')
33 # new ECL geometry contains custom objects that cannot be converted to TGeo
34 # add MagneticField off B-field (also greatly speeds up startup)
35 geometry.param('excludedComponents', ['ECL'])
36 
37 main.add_module(rootinput)
38 main.add_module(gearbox)
39 main.add_module(geometry)
40 
41 display = register_module('Display')
42 # --- MC options ---
43 # Should Monte Carlo info be shown? (MCParticles, SimHits)
44 display.param('showMCInfo', True)
45 
46 # should hits always be assigned to a particle with c_PrimaryParticle flag?
47 display.param('assignHitsToPrimaries', False)
48 
49 # show all primary MCParticles?
50 display.param('showAllPrimaries', True)
51 
52 # show all charged MCParticles?
53 display.param('showCharged', True)
54 
55 # show all neutral MCParticles?
56 display.param('showNeutrals', True)
57 
58 
59 # --- Intermediate options ---
60 # show track candidates?
61 # You most likely don't want this unless you are a tracking developer
62 display.param('showRecoTracks', False)
63 
64 # directly show CDCHits as drift cylinders (shortened, z position = 0)
65 display.param('showCDCHits', False)
66 
67 # show trigger objects?
68 display.param('showTriggerObjects', False)
69 
70 
71 # --- Track options ---
72 # show tracks, vertices, eclgammas?
73 display.param('showTrackLevelObjects', True)
74 
75 # The options parameter is a combination of:
76 # D draw detectors - draw simple detector representation (with different size)
77 # for each hit
78 # H draw track hits
79 # M draw track markers - intersections of track with detector planes
80 # P draw detector planes
81 #
82 # Note that you can always turn off an individual detector component or track
83 # interactively by removing its checkmark in the 'Eve' tab.
84 #
85 # only makes sense when showTrackLevelObjects/showTrackCandidates is used
86 display.param('options', 'MH') # default
87 
88 # --- Other options ---
89 
90 # save events non-interactively (without showing window)?
91 display.param('automatic', False)
92 
93 # change to True to show the full TGeo geometry instead of simplified extract
94 display.param('fullGeometry', False)
95 
96 # set to any downloaded/created extract (=simplified geometry + 2D projections)
97 # Default extract (for Phase 3) is stored in display/data
98 display.param('customGeometryExtractPath', '')
99 
100 # Objects which are to be hidden (can be manually re-enabled in tree view).
101 # Names correspond to the object names in the 'Event'. (Note that this won't
102 # work for objects somewhere deep in the tree, only for those immediately
103 # below 'Event'.
104 display.param('hideObjects', [])
105 
106 main.add_module(display)
107 
108 process(main)
109 # print(statistics(statistics.INIT))
Belle2::Environment::Instance
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:31