Belle II Software development
SVDCoGTimeCalibrationImporterTBIndependent.py
1# !/usr/bin/env python
2
3
10
11
25
26
27import basf2 as b2
28import svd
29import os
30import sys
31from svd.CoGCalibration_utils_tbindependent import SVDCoGTimeCalibrationImporterModule
32from basf2 import conditions as b2conditions
33
34localdb = sys.argv[1]
35# filename = sys.argv[2]
36# branches = ['SVDShaperDigits', 'SVDRecoDigits', 'SVDClusters', 'EventT0', 'Tracks', 'RecoTracks']
37branches = ['SVDShaperDigits', 'SVDShaperDigitsFromTracks', 'EventT0']
38
39trk_outputFile = "TrackFilterControlNtuples_" + localdb + ".root"
40nSVD = 6
41nCDC = 1
42pVal = 0.0 # 0001
43
44
45inputFileList = [
46 "/group/belle2/dataprod/Data/release-03-02-02/DB00000635/proc00000009/\
47e0008/4S/r01309/skim/hlt_bhabha/cdst/sub00/cdst.physics.0008.01309.HLT*"
48]
49'''
50if filename.rfind(".root") != -1:
51 inputFileList.append(filename)
52else:
53 with open(filename, 'r') as f:
54 inputFileList = [line.strip() for line in f]
55'''
56
57b2conditions.prepend_globaltag("online")
58b2conditions.prepend_globaltag("data_reprocessing_prompt")
59if '_CHECK' not in localdb:
60 b2conditions.prepend_globaltag('svd_NOCoGCorrections')
61 if os.path.isdir(localdb):
62 print('WARNING, you are using CoG corrections in ' + localdb + ' exiting')
63 sys.exit(1)
64 else:
65 b2conditions.testing_payloads = [str(localdb)]
66else:
67 localdb = localdb.split('_')
68 if not os.path.isdir(localdb[0]):
69 print('WARNING, the localDB ' + localdb[0] + ' containing the corrections is missing, exiting.')
70 sys.exit(1)
71 else:
72 b2conditions.testing_payloads = [str(localdb)]
73 localdb = sys.argv[1]
74 if os.path.isdir(localdb):
75 print('WARNING, you are using CoG corrections in ' + localdb + ' exiting')
76 sys.exit(1)
77 else:
78 b2conditions.testing_payloads = [str(localdb)]
79
80
81main = b2.create_path()
82
83rootinput = b2.register_module('RootInput')
84rootinput.param('inputFileNames', inputFileList)
85rootinput.param('branchNames', branches)
86main.add_module(rootinput)
87
88main.add_module("Gearbox")
89main.add_module("Geometry", useDB=True)
90
91# Track selection - NOT YET
92trkFlt = b2.register_module('TrackFilter')
93trkFlt.param('outputFileName', trk_outputFile)
94trkFlt.param('outputINArrayName', 'SelectedTracks')
95trkFlt.param('outputOUTArrayName', 'ExcludedTracks')
96trkFlt.param('min_NumHitSVD', nSVD)
97trkFlt.param('min_NumHitCDC', nCDC)
98trkFlt.param('min_Pvalue', pVal)
99# trkFlt.logging.log_level = LogLevel.DEBUG
100# main.add_module(trkFlt)
101
102# fil = register_module('SVDShaperDigitsFromTracks')
103# fil.param('outputINArrayName', 'SVDShaperDigitsFromTracks')
104# main.add_module(fil)
105
107
108for moda in main.modules():
109 if moda.name() == 'SVDCoGTimeEstimator':
110 moda.param("ShaperDigits", 'SVDShaperDigitsFromTracks')
111 moda.param("RecoDigits", 'SVDRecoDigitsFromTracks')
112 if moda.name() == 'SVDSimpleClusterizer':
113 moda.param("Clusters", 'SVDClustersFromTracks')
114 moda.param("RecoDigits", 'SVDRecoDigitsFromTracks')
115 if moda.name() == 'SVDSpacePointCreator':
116 moda.param("SVDClusters", 'SVDClustersFromTracks')
117
118calib = SVDCoGTimeCalibrationImporterModule()
119calib.set_localdb(localdb)
120calib.notApplyCorrectForCDCLatency(False) # False = apply correction, True = not apply correction
121main.add_module(calib)
122
123# Show progress of processing
124progress = b2.register_module('ProgressBar')
125main.add_module(progress)
126
127b2.print_path(main)
128
129# Process events
130b2.process(main)
131
132print(b2.statistics)
def add_svd_reconstruction(path, isROIsimulation=False, createRecoDigits=False, applyMasking=False)
Definition: __init__.py:14