Belle II Software light-2406-ragdoll
awesome-simulation.py
1#!/usr/bin/env python
2
3
10
11'''
12Minimal steering file to simulate the awesome detector.
13'''
14
15import basf2 as b2
16
17# Don't show all the messages :)
18b2.set_log_level(b2.LogLevel.ERROR)
19
20# Here we create a processing path and add the modules
21main = b2.create_path()
22
23# create event meta-data
24main.add_module('EventInfoSetter')
25
26# Main XML parameter file to load, relative to global data directory
27main.add_module('Gearbox', fileName='online_book/awesome/detector.xml')
28main.add_module('Geometry', useDB=False)
29
30# Shoot some particles into the detector
31main.add_module('ParticleGun',
32 # Shoot electrons and positrons
33 pdgCodes=[11, -11],
34 # 5 particles per event
35 nTracks=5,
36 # but let the number be poisson distributed
37 varyNTracks=True,
38 # with a fixed momentum
39 momentumGeneration='fixed',
40 # of 7 GeV
41 momentumParams=[7.0],
42 # and a gaussian distributed theta angle
43 thetaGeneration='normal',
44 # with mean 0 degree and width 1 degree
45 thetaParams=[0.0, 1.0],
46 # and a uniform distributed phi angle
47 phiGeneration='uniform',
48 # between 0 and 360 degree
49 phiParams=[0, 360.0],
50 # but from a fixed position
51 vertexGeneration='fixed',
52 # namely 0,0,0
53 xVertexParams=[0.0],
54 yVertexParams=[0.0],
55 zVertexParams=[0.0],
56 # and the same vertex vor all particles
57 independentVertices=False)
58
59# Simulate our awesome detector
60main.add_module('FullSim')
61
62# do something with the awesome data
63main.add_module('AWESOMEBasic',
64 logLevel=b2.LogLevel.INFO)
65
66# save the awesome results
67main.add_module('RootOutput', outputFileName='awesome-simulation.root')
68
69
70# Now lets do the processing of the awesome events
71b2.process(main)
72
73# Print call statistics of our awesome event processing
74print(b2.statistics)