Belle II Software  release-08-01-10
CDCDatabaseImporter.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 CDC Database importer.
14 Simple example.
15 """
16 
17 import basf2 as b2
18 from ROOT.Belle2 import CDCDatabaseImporter
19 from ROOT.Belle2 import FileSystem
20 
21 # Specify the exp and run where iov is valid.
22 # N.B. -1 means unbound.
23 expFirst = 0
24 expLast = -1
25 runFirst = 0
26 runLast = -1
27 
28 mapfile = FileSystem.findFile('data/cdc/ch_map.dat')
29 t0file = FileSystem.findFile('data/cdc/t0_v1.dat')
30 bwfile = FileSystem.findFile('data/cdc/badwire_v1.dat')
31 psfile = FileSystem.findFile('data/cdc/propspeed_v0.dat')
32 twfile = FileSystem.findFile('data/cdc/tw_off.dat')
33 xtfile = FileSystem.findFile('data/cdc/xt_v3.0.1_chebyshev.dat.gz')
34 sgfile = FileSystem.findFile('data/cdc/sigma_v2.dat')
35 fffile = FileSystem.findFile('data/cdc/ffactor.dat')
36 dispfile = FileSystem.findFile('data/cdc/displacement_v1.1.dat')
37 alfile = FileSystem.findFile('data/cdc/alignment_v2.dat')
38 # misalfile = FileSystem.findFile('data/cdc/misalignment_v2.dat')
39 fefile = FileSystem.findFile('cdc/data/fee_phase3.dat')
40 # edfile = FileSystem.findFile('cdc/data/edeptoadc.dat')
41 b2.use_local_database("localDB/database.txt", "localDB")
42 
43 main = b2.create_path()
44 
45 # Event info setter - execute single event
46 eventinfosetter = b2.register_module('EventInfoSetter')
47 eventinfosetter.param({'evtNumList': [1], 'runList': [1]})
48 main.add_module(eventinfosetter)
49 
50 # Gearbox - access to xml files
51 gearbox = b2.register_module('Gearbox')
52 main.add_module(gearbox)
53 
54 # process single event
55 b2.process(main)
56 
57 dbImporter = CDCDatabaseImporter(expFirst, runFirst, expLast, runLast)
58 # dbImporter = CDCDatabaseImporter()
59 dbImporter.importChannelMap(mapfile)
60 # dbImporter.importFEEParam(fefile)
61 dbImporter.importTimeZero(t0file)
62 dbImporter.importBadWire(bwfile)
63 dbImporter.importPropSpeed(psfile)
64 dbImporter.importTimeWalk(twfile)
65 dbImporter.importXT(xtfile)
66 dbImporter.importSigma(sgfile)
67 dbImporter.importFFactor(fffile)
68 dbImporter.importDisplacement(dispfile)
69 dbImporter.importWirPosAlign(alfile)
70 dbImporter.importADCDeltaPedestal()
71 dbImporter.importFEElectronics(fefile)
72 # dbImporter.importEDepToADC(edfile)
73 # dbImporter.importWirPosMisalign(misalfile)
74 
75 # dbImporter.printChannelMap()
76 # dbImporter.printFEEParam()
77 # dbImporter.printTimeZero()
78 # dbImporter.printBadWire()
79 # dbImporter.printPropSpeed()
80 # dbImporter.printTimeWalk()
81 # dbImporter.printXT()
82 # dbImporter.printSigma()
83 # dbImporter.printFFactor()
84 # dbImporter.printDisplacement()
85 # dbImporter.printWirPosAlign()
86 # dbImporter.printWirPosMisalign()
87 # dbImporter.printFEElectronics()
88 # dbImporter.printEDepToADC()