Belle II Software
development
awesome-simulation.py
1
#!/usr/bin/env python
2
3
10
11
'''
12
Minimal steering file to simulate the awesome detector.
13
'''
14
15
import
basf2
as
b2
16
17
# Don't show all the messages :)
18
b2.set_log_level(b2.LogLevel.ERROR)
19
20
# Here we create a processing path and add the modules
21
main = b2.create_path()
22
23
# create event meta-data
24
main.add_module(
'EventInfoSetter'
)
25
26
# Main XML parameter file to load, relative to global data directory
27
main.add_module(
'Gearbox'
, fileName=
'online_book/awesome/detector.xml'
)
28
main.add_module(
'Geometry'
, useDB=
False
)
29
30
# Shoot some particles into the detector
31
main.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 for all particles
57
independentVertices=
False
)
58
59
# Simulate our awesome detector
60
main.add_module(
'FullSim'
)
61
62
# do something with the awesome data
63
main.add_module(
'AWESOMEBasic'
,
64
logLevel=b2.LogLevel.INFO)
65
66
# save the awesome results
67
main.add_module(
'RootOutput'
, outputFileName=
'awesome-simulation.root'
)
68
69
70
# Now lets do the processing of the awesome events
71
b2.process(main)
72
73
# Print call statistics of our awesome event processing
74
print(b2.statistics)
online_book
awesome
examples
awesome-simulation.py
Generated on Fri Nov 8 2024 02:40:18 for Belle II Software by
1.9.6