Belle II Software development
DBImporter.py
1#!/usr/bin/env python
2
3
10
11# --------------------------------------------------------------------------------
12# Example of using Database importer
13# Note: this example is not meant to be executed, but to see how to write the code
14# --------------------------------------------------------------------------------
15
16import basf2 as b2
17from ROOT import Belle2 # noqa: make Belle2 namespace available
18from ROOT.Belle2 import TOPDatabaseImporter
19
20# define local database with write access
21b2.conditions.expert_settings(save_payloads="localDB/localDB.txt")
22
23
24class PayloadImporter(b2.Module):
25 ''' Payload importer using TOPDatabaseImporter '''
26
27 def initialize(self):
28 ''' Import dummy payloads '''
29
30 dbImporter = TOPDatabaseImporter()
31 dbImporter.importDummyCalTimebase(0, 0, 0, -1)
32 dbImporter.importDummyCalChannelT0(0, 0, 0, -1)
33 dbImporter.importDummyCalModuleT0(0, 0, 0, -1)
34
35
36# create path
37main = b2.create_path()
38
39# Event info setter - execute single event
40main.add_module('EventInfoSetter')
41
42# Gearbox
43main.add_module('Gearbox')
44
45# Geometry parameters
46main.add_module('TOPGeometryParInitializer', useDB=False)
47
48# Importer
49main.add_module(PayloadImporter())
50
51# process single event
52b2.process(main)