Belle II Software development
CDCWireHitRequirementsImporter.py
1#!/usr/bin/env python
2
3
10
11"""
12CDC Database importer.
13Simple example to import CDCWireHitRequirements 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 CDCWireHitRequirements
22# N.B. In the json file, -1 as upper limit means unbound.
23INPUT = FileSystem.findFile("data/cdc/CDCWireHitRequirements_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
31basf2.conditions.testing_payloads = ["localdb/database.txt"]
32
33main = basf2.create_path()
34
35# Event info setter - execute single event
36eventinfosetter = basf2.register_module('EventInfoSetter')
37main.add_module(eventinfosetter)
38
39# process single event
40basf2.process(main)
41
42dbImporter = CDCDatabaseImporter(expFirst, runFirst, expLast, runLast)
43dbImporter.importCDCWireHitRequirements(INPUT)
44
45# This line print the result for exp0/run0
46dbImporter.printCDCWireHitRequirements()