Belle II Software  release-05-01-25
PXDRawDataGen.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 from basf2 import *
13 
14 # show warnings during processing
15 set_log_level(LogLevel.WARNING)
16 
17 # Register modules
18 
19 # Particle gun module
20 particlegun = register_module('ParticleGun')
21 # Create Event information
22 eventinfosetter = register_module('EventInfoSetter')
23 # Show progress of processing
24 progress = register_module('Progress')
25 # Load parameters
26 gearbox = register_module('Gearbox')
27 # Create geometry
28 geometry = register_module('Geometry')
29 # Run simulation
30 simulation = register_module('FullSim')
31 # PXD digitization module
32 PXDDIGI = register_module('PXDDigitizer')
33 # Convert digits to raw pxd data
34 PXDPACKER = register_module('PXDPacker')
35 # Save output of simulation
36 output = register_module('RootOutput')
37 
38 # ============================================================================
39 # Set a fixed random seed for particle generation:
40 set_random_seed(1028307)
41 
42 # ============================================================================
43 # Setting the list of particle codes (PDG codes) for the generated particles
44 particlegun.param('pdgCodes', [-11, 11])
45 
46 # ============================================================================
47 # Setting the number of tracks to be generated per event:
48 particlegun.param('nTracks', 1)
49 
50 # ============================================================================
51 # Set the number of events to be processed (10 events)
52 eventinfosetter.param({'evtNumList': [100], 'runList': [1]})
53 
54 # ============================================================================
55 # Set output filename
56 output.param('outputFileName', 'PXDRawHit.root')
57 
58 # ============================================================================
59 # [[dhhc1, dhh1, dhh2, dhh3, dhh4, dhh5] [ ... ]]
60 # -1 is disable port
61 PXDPACKER.param('dhe_to_dhc', [
62  [0, 2, 4, 34, 36, 38],
63  [1, 6, 8, 40, 42, 44],
64  [2, 10, 12, 46, 48, 50],
65  [3, 14, 16, 52, 54, 56],
66  [4, 3, 5, 35, 37, 39],
67  [5, 7, 9, 41, 43, 45],
68  [6, 11, 13, 47, 49, 51],
69  [7, 15, 17, 53, 55, 57],
70 ])
71 
72 # ============================================================================
73 # Select subdetectors to be built
74 geometry.param('components', ['MagneticField', 'PXD'])
75 
76 # ============================================================================
77 # Do the simulation
78 
79 main = create_path()
80 main.add_module(eventinfosetter)
81 main.add_module(progress)
82 main.add_module(gearbox)
83 main.add_module(geometry)
84 main.add_module(particlegun)
85 main.add_module(simulation)
86 main.add_module(PXDDIGI)
87 main.add_module(PXDPACKER)
88 main.add_module(output)
89 
90 # Process events
91 process(main)
92 
93 # Print call statistics
94 print(statistics)
95 #