Belle II Software development
genDoublePulse.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12
13# ----------------------------------------------------------------------------
14# Example of generating double calibration pulses with TOPDoublePulseGenerator
15# ----------------------------------------------------------------------------
16
17# Create path
18main = b2.create_path()
19
20# Set number of events to generate
21eventinfosetter = b2.register_module('EventInfoSetter')
22eventinfosetter.param('evtNumList', [100])
23main.add_module(eventinfosetter)
24
25# Gearbox: access to database (xml files)
26gearbox = b2.register_module('Gearbox')
27main.add_module(gearbox)
28
29# Geometry
30geometry = b2.register_module('Geometry')
31geometry.param('useDB', False)
32geometry.param('components', ['TOP'])
33main.add_module(geometry)
34
35# pulse generator
36calpulse = b2.register_module('TOPDoublePulseGenerator')
37calpulse.param('asicChannels', [0])
38calpulse.param('moduleIDs', [1])
39# intervals = [math.exp(-float(i)/99.0)+1 for i in range(128)]
40# intervals = intervals + intervals
41# calpulse.param('sampleTimeIntervals', intervals)
42calpulse.param('useDatabase', True)
43calpulse.param('outputFileName', 'usedSampleTimes.root')
44main.add_module(calpulse)
45
46# output
47main.add_module('RootOutput')
48
49# Show progress of processing
50progress = b2.register_module('Progress')
51main.add_module(progress)
52
53# Process events
54b2.process(main)
55
56# Print call statistics
57print(b2.statistics)