Belle II Software development
PXDHitErrorGen.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12from PXDHitErrorsTTree import PXDHitErrorsTTree
13b2.logging.log_level = b2.LogLevel.WARNING
14
15# Particle gun module
16particlegun = b2.register_module('ParticleGun')
17# Create Event information
18eventinfosetter = b2.register_module('EventInfoSetter')
19# Show progress of processing
20progress = b2.register_module('Progress')
21# Load parameters
22gearbox = b2.register_module('Gearbox')
23# Create geometry
24geometry = b2.register_module('Geometry')
25# Run simulation
26simulation = b2.register_module('FullSim')
27# PXD digitization module
28pxddigi = b2.register_module('PXDDigitizer')
29# PXD clustering module
30pxdclust = b2.register_module('PXDClusterizer')
31# RootOutput
32output = b2.register_module('RootOutput')
33
34analyze = PXDHitErrorsTTree()
35
36# Specify number of events to generate
37eventinfosetter.param({'evtNumList': [10000], 'runList': [1]})
38
39# Set parameters for particlegun
40particlegun.param({
41 # Generate 1 track (always)
42 'nTracks': 1,
43 # don't vary the number according to Poisson distribution
44 'varyNTracks': False,
45 # Generate pi+, pi-, e+ and e-
46 'pdgCodes': [211, -211, 11, -11],
47 # with a normal distributed transversal momentum
48 'momentumGeneration': 'normal',
49 # with a center of 2 GeV and a width of 0.2 GeV
50 'momentumParams': [2, 0.2],
51 # a uniform distributed phi angle,
52 'phiGeneration': 'uniform',
53 # full circle
54 'phiParams': [0, 360],
55 # Generate theta angles uniform in cos theta
56 'thetaGeneration': 'uniformCos',
57 # between 30 and 150 degree
58 'thetaParams': [30, 150],
59 # normal distributed vertex generation
60 'vertexGeneration': 'normal',
61 # around the origin with a sigma of 0.5cm in each direction
62 'xVertexParams': [0.0, 0.5],
63 'yVertexParams': [0.0, 0.5],
64 'zVertexParams': [0.0, 0.5],
65 # all one track sharing the same vertex per event
66 'independentVertices': False,
67})
68
69# Select subdetectors to be built
70geometry.param('components', ['MagneticField', 'PXD'])
71
72# pxddigi.param('statisticsFilename', 'digi.root')
73pxddigi.param('ElectronicEffects', True)
74pxddigi.param('SimpleDriftModel', False)
75
76# create processing path
77main = b2.create_path()
78main.add_module(eventinfosetter)
79main.add_module(progress)
80main.add_module(particlegun)
81main.add_module(gearbox)
82main.add_module(geometry)
83main.add_module(simulation)
84main.add_module(pxddigi)
85main.add_module(pxdclust)
86main.add_module(analyze)
87# main.add_module(output)
88
89# generate events
90b2.process(main)
91
92# show call statistics
93print(b2.statistics)