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