26from ROOT.Belle2
import CDCDedxMomentumAlgorithm, CDCDedxCosineAlgorithm
27from ROOT.Belle2
import CDCDedxWireGainAlgorithm, CDCDedxRunGainAlgorithm
28from ROOT.Belle2
import CDCDedx2DCorrectionAlgorithm, CDCDedx1DCleanupAlgorithm
29from caf.framework
import Calibration, CAF
31ROOT.gROOT.SetBatch(
True)
34input_files = [os.path.abspath(
35 '/group/belle2/users/jbennett/GCR2/release-01-02-01/DB00000359/r00282/dst.cosmic.0002.0282.f00000.root')]
38momentum_col = b2.register_module(
'CDCDedxElectronCollector')
39momentum_col_params = {
'cleanupCuts':
False,
42 'momentumCorFromDB':
False,
45momentum_col.param(momentum_col_params)
47mod_col = b2.register_module(
'CDCDedxElectronCollector')
48mod_col_params = {
'cleanupCuts':
True,
51 'momentumCorFromDB':
False,
54mod_col.param(mod_col_params)
57momentum_alg = CDCDedxMomentumAlgorithm()
58cosine_alg = CDCDedxCosineAlgorithm()
59run_gain_alg = CDCDedxRunGainAlgorithm()
60wire_gain_alg = CDCDedxWireGainAlgorithm()
61twod_alg = CDCDedx2DCorrectionAlgorithm()
62oned_alg = CDCDedx1DCleanupAlgorithm()
66 name=
'MomentumCalibration',
67 collector=momentum_col,
68 algorithms=[momentum_alg],
69 input_files=input_files)
72 name=
'CosineCalibration',
74 algorithms=[cosine_alg],
75 input_files=input_files)
78 name=
'WireGainCalibration',
80 algorithms=[wire_gain_alg],
81 input_files=input_files)
84 name=
'RunGainCalibration',
86 algorithms=[run_gain_alg],
87 input_files=input_files)
90 name=
'OtherDedxCalibrations',
92 algorithms=[twod_alg, oned_alg],
93 input_files=input_files)
96momdb =
'calibration_results/MomentumCalibration/outputdb'
97cosdb =
'calibration_results/CosineCalibration/outputdb'
98wgdb =
'calibration_results/WireGainCalibration/outputdb'
99rgdb =
'calibration_results/RunGainCalibration/outputdb'
100localdb =
'/home/belle2/jbennett/CRDATA/release-00-09-01/DB00000266/r03118/calib/localdb/database.txt'
102momentum_cal.use_local_database(localdb)
104cosine_cal.use_local_database(localdb)
105cosine_cal.use_local_database(momdb)
107wire_gain_cal.use_local_database(localdb)
108wire_gain_cal.use_local_database(momdb)
109wire_gain_cal.use_local_database(cosdb)
111run_gain_cal.use_local_database(localdb)
112run_gain_cal.use_local_database(momdb)
113run_gain_cal.use_local_database(cosdb)
114run_gain_cal.use_local_database(wgdb)
116other_cal.use_local_database(localdb)
117other_cal.use_local_database(momdb)
118other_cal.use_local_database(cosdb)
119other_cal.use_local_database(wgdb)
120other_cal.use_local_database(rgdb)
123correct_for_mom = b2.create_path()
124correct_for_mom.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
False,
125 momentumCorFromDB=
False, cosineCor=
True,
126 runGain=
True, wireGain=
True)
127momentum_cal.pre_collector_path = correct_for_mom
129correct_for_cos = b2.create_path()
130correct_for_cos.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
True,
131 momentumCorFromDB=
True, cosineCor=
False,
132 runGain=
True, wireGain=
True)
133cosine_cal.pre_collector_path = correct_for_cos
134cosine_cal.depends_on(momentum_cal)
136correct_for_wire_gain = b2.create_path()
137correct_for_wire_gain.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
True,
138 momentumCorFromDB=
True, cosineCor=
True,
139 runGain=
True, wireGain=
False)
140wire_gain_cal.pre_collector_path = correct_for_wire_gain
141wire_gain_cal.depends_on(momentum_cal)
142wire_gain_cal.depends_on(cosine_cal)
144correct_for_run_gain = b2.create_path()
145correct_for_run_gain.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
True,
146 momentumCorFromDB=
True, cosineCor=
True,
147 runGain=
False, wireGain=
True)
148run_gain_cal.pre_collector_path = correct_for_run_gain
149run_gain_cal.depends_on(momentum_cal)
150run_gain_cal.depends_on(cosine_cal)
151run_gain_cal.depends_on(wire_gain_cal)
153correct_for_others = b2.create_path()
154correct_for_others.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
True,
155 momentumCorFromDB=
True, cosineCor=
True,
156 runGain=
True, wireGain=
True)
157other_cal.pre_collector_path = correct_for_others
158other_cal.depends_on(momentum_cal)
159other_cal.depends_on(cosine_cal)
160other_cal.depends_on(wire_gain_cal)
161other_cal.depends_on(run_gain_cal)
166caf_fw.add_calibration(momentum_cal)
167caf_fw.add_calibration(cosine_cal)
168caf_fw.add_calibration(wire_gain_cal)
169caf_fw.add_calibration(run_gain_cal)
170caf_fw.add_calibration(other_cal)