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