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