Belle II Software  release-08-01-10
genCalPulse.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import basf2 as b2
13 
14 # ----------------------------------------------------------------------------
15 # Example of generating realistic calibration pulses with TOPCalPulseGenerator
16 # ----------------------------------------------------------------------------
17 
18 # Create path
19 main = b2.create_path()
20 
21 # Set number of events to generate
22 eventinfosetter = b2.register_module('EventInfoSetter')
23 eventinfosetter.param('evtNumList', [100])
24 main.add_module(eventinfosetter)
25 
26 # Gearbox: access to database (xml files)
27 gearbox = b2.register_module('Gearbox')
28 main.add_module(gearbox)
29 
30 # Geometry
31 geometry = b2.register_module('Geometry')
32 geometry.param('useDB', False)
33 geometry.param('components', ['TOP'])
34 main.add_module(geometry)
35 
36 # pulse generator
37 calpulse = b2.register_module('TOPCalPulseGenerator')
38 calpulse.param('asicChannels', [0])
39 calpulse.param('moduleIDs', [1])
40 calpulse.param('amplitude', 750.0)
41 main.add_module(calpulse)
42 
43 # digitization
44 topdigi = b2.register_module('TOPDigitizer')
45 topdigi.param('useSampleTimeCalibration', True)
46 main.add_module(topdigi)
47 
48 # output
49 main.add_module('RootOutput')
50 
51 # Show progress of processing
52 progress = b2.register_module('Progress')
53 main.add_module(progress)
54 
55 # Process events
56 b2.process(main)
57 
58 # Print call statistics
59 print(b2.statistics)