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