Belle II Software development
SADreader.py
1#!/usr/bin/env python3
2
3
10
11from basf2 import set_log_level, LogLevel, register_module, create_path, process, statistics
12
13# Set the global log level
14set_log_level(LogLevel.ERROR)
15
16# Register the event meta generator and set the number of events to a very
17# high number which exceeds the number of events in the input file.
18eventinfosetter = register_module('EventInfoSetter')
19eventinfosetter.param({'evtNumList': [10000000], 'runList': [1]})
20
21# Register the SADInput module and specify the location of the SAD input file.
22# The file can be downloaded from the TWiki.
23sadinput = register_module('SADInput')
24sadinput.param('Filename', 'SADreaderInput.root')
25
26# Set the ReadMode of the SAD input module. 0 = one SAD particle per event.
27# This produces weighted events. 1 = one real particle per event. This produces
28# unweighted events. 2 = all SAD particles in one event. Can be used for
29# visualization.
30sadinput.param('ReadMode', 1)
31
32# Set the accelerator ring with which the SAD input has been generated. 0 = LER
33# 1 = HER.
34sadinput.param('AccRing', 0)
35
36# Set the readout time for your subdetector in [ns]. Please note: The value
37# given here corresponds to the readout time of the PXD ! This setting is only
38# used if the 'ReadMode' is set to 1.
39sadinput.param('ReadoutTime', 20000)
40
41# Set the range around the IP in which SAD particles are accepted into the
42# simulation. The value given below is highly recommended.
43sadinput.param('Range', 390)
44
45# If you would like to see some information about the created particles set the
46# logging output of the Input module to DEBUG.
47sadinput.set_log_level(LogLevel.DEBUG)
48
49# Register the standard chain of modules to the framework, which are required
50# for the simulation.
51gearbox = register_module('Gearbox')
52
53geometry = register_module('Geometry')
54
55fullsim = register_module('FullSim')
56
57# Add additional modules according to your own needs
58# pxddigi = register_module('PXDDigitizer')
59# progress = register_module('Progress')
60
61# Write the output to a file
62rootoutput = register_module('RootOutput')
63rootoutput.param('outputFileName', 'SADreaderOutput.root')
64
65progress = register_module('Progress')
66
67# Create the main path and add the required modules
68main = create_path()
69main.add_module(eventinfosetter)
70main.add_module(gearbox)
71main.add_module(sadinput)
72main.add_module(geometry)
73main.add_module(fullsim)
74
75# Add additional modules if you like main.add_module(pxddigi)
76main.add_module(progress)
77
78# Add the output module
79main.add_module(rootoutput)
80
81# Start the event processing
82process(main)
83
84# Print some basic event statistics
85print('Event Statistics:')
86print(statistics)