Belle II Software  release-08-01-10
genDoublePulse.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import basf2 as b2
13 
14 # ----------------------------------------------------------------------------
15 # Example of generating double calibration pulses with TOPDoublePulseGenerator
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('TOPDoublePulseGenerator')
38 calpulse.param('asicChannels', [0])
39 calpulse.param('moduleIDs', [1])
40 # intervals = [math.exp(-float(i)/99.0)+1 for i in range(128)]
41 # intervals = intervals + intervals
42 # calpulse.param('sampleTimeIntervals', intervals)
43 calpulse.param('useDatabase', True)
44 calpulse.param('outputFileName', 'usedSampleTimes.root')
45 main.add_module(calpulse)
46 
47 # output
48 main.add_module('RootOutput')
49 
50 # Show progress of processing
51 progress = b2.register_module('Progress')
52 main.add_module(progress)
53 
54 # Process events
55 b2.process(main)
56 
57 # Print call statistics
58 print(b2.statistics)