Belle II Software  release-08-01-10
DBImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # --------------------------------------------------------------------------------
13 # Example of using Database importer
14 # Note: this example is not meant to be executed, but to see how to write the code
15 # --------------------------------------------------------------------------------
16 
17 import basf2 as b2
18 from ROOT.Belle2 import TOPDatabaseImporter
19 
20 # define local database with write access
21 b2.conditions.expert_settings(save_payloads="localDB/localDB.txt")
22 
23 
24 class 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
37 main = b2.create_path()
38 
39 # Event info setter - execute single event
40 main.add_module('EventInfoSetter')
41 
42 # Gearbox
43 main.add_module('Gearbox')
44 
45 # Geometry parameters
46 main.add_module('TOPGeometryParInitializer', useDB=False)
47 
48 # Importer
49 main.add_module(PayloadImporter())
50 
51 # process single event
52 b2.process(main)