Belle II Software  release-08-01-10
PXDTest.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
20 
21 import basf2 as b2
22 
23 # show warnings during processing
24 b2.set_log_level(b2.LogLevel.WARNING)
25 
26 # Register modules
27 
28 # Particle gun module
29 particlegun = b2.register_module('ParticleGun')
30 # Create Event information
31 eventinfosetter = b2.register_module('EventInfoSetter')
32 # Show progress of processing
33 progress = b2.register_module('Progress')
34 # Load parameters
35 gearbox = b2.register_module('Gearbox')
36 # Create geometry
37 geometry = b2.register_module('Geometry')
38 # Run simulation
39 simulation = b2.register_module('FullSim')
40 # PXD digitization module
41 PXDDIGI = b2.register_module('PXDDigitizer')
42 # PXD clusterizer
43 PXDCLUST = b2.register_module('PXDClusterizer')
44 # Save output of simulation
45 output = b2.register_module('RootOutput')
46 
47 # ============================================================================
48 # Set a fixed random seed for particle generation:
49 b2.set_random_seed(1028307)
50 
51 # ============================================================================
52 # Setting the list of particle codes (PDG codes) for the generated particles
53 particlegun.param('pdgCodes', [-11, 11])
54 
55 # ============================================================================
56 # Setting the number of tracks to be generated per event:
57 particlegun.param('nTracks', 1)
58 
59 # ============================================================================
60 # Set the number of events to be processed (10 events)
61 eventinfosetter.param({'evtNumList': [1000], 'runList': [1]})
62 
63 # Set output filename
64 output.param('outputFileName', 'PXDTestOutput.root')
65 
66 # Select subdetectors to be built
67 geometry.param('components', ['MagneticField', 'PXD'])
68 
69 PXDDIGI.set_log_level(b2.LogLevel.INFO)
70 
71 PXDCLUST.set_log_level(b2.LogLevel.INFO)
72 
73 # ============================================================================
74 # Do the simulation
75 
76 main = b2.create_path()
77 main.add_module(eventinfosetter)
78 main.add_module(progress)
79 main.add_module(gearbox)
80 main.add_module(geometry)
81 main.add_module(particlegun)
82 main.add_module(simulation)
83 main.add_module(PXDDIGI)
84 main.add_module(PXDCLUST)
85 
86 main.add_module(output)
87 
88 # Process events
89 b2.process(main)
90 
91 # Print call statistics
92 print(b2.statistics)
93 #