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