Belle II Software  release-05-01-25
VisualizeGeometry+DAWN.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 import os
5 from basf2 import *
6 logging.log_level = LogLevel.WARNING
7 
8 # create path
9 main = create_path()
10 # process one event
11 main.add_module('EventInfoSetter', evtNumList=[1])
12 # Load XML parameters
13 main.add_module('Gearbox')
14 # Create Geometry and show info messages for that
15 main.add_module('Geometry', logLevel=LogLevel.INFO)
16 particlegun = main.add_module('ParticleGun')
17 simulation = main.add_module('FullSim')
18 
19 simulation.param('EnableVisualization', True)
20 simulation.param('UICommandsAtIdle', [
21  # Use VRML2 backend
22  '/vis/open DAWNFILE',
23  # Draw the geometry
24  '/vis/drawVolume',
25  # Draw coordinate axes at the origin with a length of 100mm in each direction
26  '/vis/scene/add/axes 0 0 0 100 mm',
27  # Draw simulated tracks
28  '/vis/scene/add/trajectories smooth',
29  '/vis/modeling/trajectories/create/drawByCharge'
30  # Uncomment the following two lines to have yellow dots at each step boundary
31  # along the trajectory
32  # '/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true',
33  # '/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 0.5',
34 ])
35 
36 # Parameters for particle gun
37 particlegun.param('nTracks', 1)
38 particlegun.param('pdgCodes', [211])
39 particlegun.param('momentumParams', [2.0, 5.0])
40 particlegun.param('thetaParams', [85.0, 95.0])
41 particlegun.param('phiParams', [-5.0, 5.0])
42 
43 process(main)