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