Belle II Software development
SVDCoGTimeCalibrationCheck.py
1# !/usr/bin/env python
2
3
10
11
21
22
23import basf2 as b2
24import sys
25from svd import add_svd_reconstruction
26from svd.CoGCalibration_utils_checkCalibration import SVDCoGTimeCalibrationCheckModule
27import rawdata as raw
28
29
30localdb = sys.argv[1]
31filename = sys.argv[2]
32run = sys.argv[3]
33exp = sys.argv[4]
34branches = ['RawSVDs', 'SVDShaperDigitsFromTracks', 'EventT0']
35
36trk_outputFile = "TrackFilterControlNtuples_" + localdb + ".root"
37nSVD = 6
38nCDC = 1
39pVal = 0.0 # 0001
40
41inputFileList = []
42
43if filename.rfind(".root") != -1:
44 inputFileList.append(filename)
45else:
46 with open(filename) as f:
47 inputFileList = [line.strip() for line in f]
48
49b2.conditions.override_globaltags()
50b2.conditions.globaltags = [
51 "svd_NOCoGCorrections",
52 "staging_data_reprocessing_proc11",
53 "data_reprocessing_proc11_baseline",
54 "online_proc11"]
55
56b2.conditions.testing_payloads = [
57 str(localdb) + "/database.txt",
58]
59
60main = b2.create_path()
61
62rootinput = b2.register_module('RootInput')
63rootinput.param('inputFileNames', inputFileList)
64rootinput.param('branchNames', branches)
65main.add_module(rootinput)
66
67main.add_module("Gearbox")
68main.add_module("Geometry", useDB=True)
69
70# unpack raw data to get SVDEventInfo
71raw.add_unpackers(main, components=['SVD'])
72
73# re-reconstruct SVDShaperDigitsFromTracks using the localDB
74add_svd_reconstruction(main)
75
76for moda in main.modules():
77 if moda.name() == 'SVDCoGTimeEstimator':
78 moda.param("ShaperDigits", 'SVDShaperDigitsFromTracks')
79 moda.param("RecoDigits", 'SVDRecoDigitsFromTracks')
80 if moda.name() == 'SVDSimpleClusterizer':
81 moda.param("Clusters", 'SVDClustersFromTracks')
82 moda.param("RecoDigits", 'SVDRecoDigitsFromTracks')
83 moda.param("timeAlgorithm", 0)
84 if moda.name() == 'SVDSpacePointCreator':
85 moda.param("SVDClusters", 'SVDClustersFromTracks')
86
87main = b2.remove_module(main, 'SVDMissingAPVsClusterCreator')
88
89check = SVDCoGTimeCalibrationCheckModule()
90check.set_localdb(localdb)
91check.set_run_number(run)
92check.set_exp_number(exp)
93main.add_module(check)
94
95# Show progress of processing
96progress = b2.register_module('ProgressBar')
97main.add_module(progress)
98
99b2.print_path(main)
100
101# Process events
102b2.process(main)
103
104print(b2.statistics)