Belle II Software  release-08-01-10
Cosmics.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import basf2
13 
14 # suppress messages and warnings during processing:
15 basf2.set_log_level(basf2.LogLevel.ERROR)
16 
17 # to run the framework the used modules need to be registered
18 cosmics = basf2.register_module('Cosmics')
19 cosmics.param('level', 1)
20 cosmics.param('ipRequirement', 0)
21 # ipdr and ipdz are only relevant for level = 1 and ipRequirement = 1
22 # cosmics.param('ipdr', 3.)
23 # cosmics.param('ipdz', 3.)
24 # cosmics.param('ptmin', 0.7)
25 
26 # ============================================================================
27 # Setting the random seed for particle generation: this number can be any int,
28 # preferably large a value of 0 will use a different random seed each time
29 # default is 3452346.
30 # set_random_seed(1028307)
31 
32 # ============================================================================
33 # Now lets create the necessary modules to perform a simulation
34 #
35 # Create Event information
36 eventinfosetter = basf2.register_module('EventInfoSetter')
37 # Show progress of processing
38 progress = basf2.register_module('Progress')
39 
40 # Save output of generation
41 output = basf2.register_module('RootOutput')
42 
43 # Setting the option for all modules: want to process 100 MC events
44 eventinfosetter.param({'evtNumList': [100], 'runList': [1]})
45 
46 # Set output filename
47 output.param('outputFileName', 'CosmicsOutput.root')
48 
49 # ============================================================================
50 # Do the simulation
51 
52 main = basf2.create_path()
53 main.add_module(eventinfosetter)
54 main.add_module(progress)
55 main.add_module(cosmics)
56 main.add_module(output)
57 
58 # Process events
59 basf2.process(main)
60 
61 # Print call statistics
62 print(basf2.statistics)