Belle II Software  release-05-01-25
CDCWireHitRequirementsImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 """
5 CDC Database importer.
6 Simple example to import CDCWireHitRequirements to the database.
7 """
8 
9 import basf2
10 import ROOT
11 from ROOT.Belle2 import FileSystem
12 from ROOT.Belle2 import CDCDatabaseImporter
13 
14 # Input json file containing the CDCWireHitRequirements
15 # N.B. In the json file, -1 as upper limit means unbound.
16 INPUT = FileSystem.findFile("cdc/data/CDCWireHitRequirements_example.json")
17 
18 # Specify the exp and run where iov is valid.
19 # N.B. -1 means unbound.
20 expFirst = 0
21 expLast = -1
22 runFirst = 0
23 runLast = -1
24 basf2.use_local_database("localdb/database.txt", "localdb")
25 
26 main = basf2.create_path()
27 
28 # Event info setter - execute single event
29 eventinfosetter = basf2.register_module('EventInfoSetter')
30 main.add_module(eventinfosetter)
31 
32 # process single event
33 basf2.process(main)
34 
35 dbImporter = CDCDatabaseImporter(expFirst, runFirst, expLast, runLast)
36 dbImporter.importCDCWireHitRequirements(INPUT)
37 
38 # This line print the result for exp0/run0
39 dbImporter.printCDCWireHitRequirements()
CDCDatabaseImporter
Definition: CDCDatabaseImporter.py:1
basf2.process
def process(path, max_event=0)
Definition: __init__.py:25