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