Belle II Software  release-08-01-10
PXDHitErrorGen.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2 as b2
12 from PXDHitErrorsTTree import PXDHitErrorsTTree
13 b2.logging.log_level = b2.LogLevel.WARNING
14 
15 # Particle gun module
16 particlegun = b2.register_module('ParticleGun')
17 # Create Event information
18 eventinfosetter = b2.register_module('EventInfoSetter')
19 # Show progress of processing
20 progress = b2.register_module('Progress')
21 # Load parameters
22 gearbox = b2.register_module('Gearbox')
23 # Create geometry
24 geometry = b2.register_module('Geometry')
25 # Run simulation
26 simulation = b2.register_module('FullSim')
27 # PXD digitization module
28 pxddigi = b2.register_module('PXDDigitizer')
29 # PXD clustering module
30 pxdclust = b2.register_module('PXDClusterizer')
31 # RootOutput
32 output = b2.register_module('RootOutput')
33 
34 analyze = PXDHitErrorsTTree()
35 
36 # Specify number of events to generate
37 eventinfosetter.param({'evtNumList': [10000], 'runList': [1]})
38 
39 # Set parameters for particlegun
40 particlegun.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
70 geometry.param('components', ['MagneticField', 'PXD'])
71 
72 # pxddigi.param('statisticsFilename', 'digi.root')
73 pxddigi.param('ElectronicEffects', True)
74 pxddigi.param('SimpleDriftModel', False)
75 
76 # create processing path
77 main = b2.create_path()
78 main.add_module(eventinfosetter)
79 main.add_module(progress)
80 main.add_module(particlegun)
81 main.add_module(gearbox)
82 main.add_module(geometry)
83 main.add_module(simulation)
84 main.add_module(pxddigi)
85 main.add_module(pxdclust)
86 main.add_module(analyze)
87 # main.add_module(output)
88 
89 # generate events
90 b2.process(main)
91 
92 # show call statistics
93 print(b2.statistics)