Belle II Software development
boards.py
1#!/usr/bin/env python
2
3
10
11"""
12CDC Database importer.
13Simple example to import CDCBadBoards to the database.
14"""
15
16import basf2
17from ROOT import Belle2 # noqa: make the Belle2 namespace available
18from ROOT.Belle2 import CDCDatabaseImporter
19
20basf2.conditions.expert_settings(save_payloads='boards/database.txt')
21
22INPUT = "CDCBadBoards_example.txt"
23# Specify the exp and run where iov is valid.
24# N.B. -1 means unbound.
25expFirst = 0
26expLast = -1
27runFirst = 0
28runLast = -1
29
30dbImporter = CDCDatabaseImporter(expFirst, runFirst, expLast, runLast)
31
32# basf2.conditions.testing_payloads = ["boards/database.txt"]
33basf2.conditions.prepend_testing_payloads('boards/database.txt')
34
35main = basf2.create_path()
36# Event info setter - execute single event
37eventinfosetter = basf2.register_module('EventInfoSetter')
38main.add_module(eventinfosetter)
39# process single event
40basf2.process(main)
41
42action = ['IMPORT', 'TEST'] # [0]
43
44for act in action:
45 if act == 'IMPORT':
46 dbImporter.importBadBoards(INPUT)
47 basf2.conditions.reset()
48
49 elif act == 'TEST':
50 dbImporter.printBadBoards()