Belle II Software development
CDClayerTimeCutImporter.py
1#!/usr/bin/env python
2
3
10
11"""
12CDC Database importer.
13Simple example to import CDClayerTimeCut payload from json file to the database.
14"""
15
16import basf2
17from ROOT import Belle2 # noqa: make the Belle2 namespace available
18from ROOT.Belle2 import FileSystem
19from ROOT.Belle2 import CDCDatabaseImporter
20
21# Input json file containing the CDClayerTimeCut
22# N.B. In the json file, -1 as upper limit means unbound.
23INPUT = FileSystem.findFile("data/cdc/CDClayerTimeCut_example.json")
24
25# Specify the exp and run where iov is valid.
26# N.B. -1 means unbound.
27expFirst = 0
28expLast = -1
29runFirst = 0
30runLast = -1
31
32basf2.conditions.testing_payloads = ["localdb/database.txt"]
33
34main = basf2.create_path()
35
36# Event info setter - execute single event
37eventinfosetter = basf2.register_module('EventInfoSetter')
38main.add_module(eventinfosetter)
39
40# process single event
41basf2.process(main)
42
43dbImporter = CDCDatabaseImporter(expFirst, runFirst, expLast, runLast)
44dbImporter.importCDClayerTimeCut(INPUT)
45
46# This line print the result for exp0/run0
47dbImporter.printCDClayerTimeCut()