27 from ROOT.Belle2
import CDCDedxMomentumAlgorithm, CDCDedxCosineAlgorithm
28 from ROOT.Belle2
import CDCDedxWireGainAlgorithm, CDCDedxRunGainAlgorithm
29 from ROOT.Belle2
import CDCDedx2DCorrectionAlgorithm, CDCDedx1DCleanupAlgorithm
30 from caf.framework
import Calibration, CAF
32 ROOT.gROOT.SetBatch(
True)
35 input_files = [os.path.abspath(
36 '/group/belle2/users/jbennett/GCR2/release-01-02-01/DB00000359/r00282/dst.cosmic.0002.0282.f00000.root')]
39 momentum_col = b2.register_module(
'CDCDedxElectronCollector')
40 momentum_col_params = {
'cleanupCuts':
False,
43 'momentumCorFromDB':
False,
46 momentum_col.param(momentum_col_params)
48 mod_col = b2.register_module(
'CDCDedxElectronCollector')
49 mod_col_params = {
'cleanupCuts':
True,
52 'momentumCorFromDB':
False,
55 mod_col.param(mod_col_params)
58 momentum_alg = CDCDedxMomentumAlgorithm()
59 cosine_alg = CDCDedxCosineAlgorithm()
60 run_gain_alg = CDCDedxRunGainAlgorithm()
61 wire_gain_alg = CDCDedxWireGainAlgorithm()
62 twod_alg = CDCDedx2DCorrectionAlgorithm()
63 oned_alg = CDCDedx1DCleanupAlgorithm()
67 name=
'MomentumCalibration',
68 collector=momentum_col,
69 algorithms=[momentum_alg],
70 input_files=input_files)
73 name=
'CosineCalibration',
75 algorithms=[cosine_alg],
76 input_files=input_files)
79 name=
'WireGainCalibration',
81 algorithms=[wire_gain_alg],
82 input_files=input_files)
85 name=
'RunGainCalibration',
87 algorithms=[run_gain_alg],
88 input_files=input_files)
91 name=
'OtherDedxCalibrations',
93 algorithms=[twod_alg, oned_alg],
94 input_files=input_files)
97 momdb =
'calibration_results/MomentumCalibration/outputdb'
98 cosdb =
'calibration_results/CosineCalibration/outputdb'
99 wgdb =
'calibration_results/WireGainCalibration/outputdb'
100 rgdb =
'calibration_results/RunGainCalibration/outputdb'
101 localdb =
'/home/belle2/jbennett/CRDATA/release-00-09-01/DB00000266/r03118/calib/localdb/database.txt'
103 momentum_cal.use_local_database(localdb)
105 cosine_cal.use_local_database(localdb)
106 cosine_cal.use_local_database(momdb)
108 wire_gain_cal.use_local_database(localdb)
109 wire_gain_cal.use_local_database(momdb)
110 wire_gain_cal.use_local_database(cosdb)
112 run_gain_cal.use_local_database(localdb)
113 run_gain_cal.use_local_database(momdb)
114 run_gain_cal.use_local_database(cosdb)
115 run_gain_cal.use_local_database(wgdb)
117 other_cal.use_local_database(localdb)
118 other_cal.use_local_database(momdb)
119 other_cal.use_local_database(cosdb)
120 other_cal.use_local_database(wgdb)
121 other_cal.use_local_database(rgdb)
124 correct_for_mom = b2.create_path()
125 correct_for_mom.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
False,
126 momentumCorFromDB=
False, cosineCor=
True,
127 runGain=
True, wireGain=
True)
128 momentum_cal.pre_collector_path = correct_for_mom
130 correct_for_cos = b2.create_path()
131 correct_for_cos.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
True,
132 momentumCorFromDB=
True, cosineCor=
False,
133 runGain=
True, wireGain=
True)
134 cosine_cal.pre_collector_path = correct_for_cos
135 cosine_cal.depends_on(momentum_cal)
137 correct_for_wire_gain = b2.create_path()
138 correct_for_wire_gain.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
True,
139 momentumCorFromDB=
True, cosineCor=
True,
140 runGain=
True, wireGain=
False)
141 wire_gain_cal.pre_collector_path = correct_for_wire_gain
142 wire_gain_cal.depends_on(momentum_cal)
143 wire_gain_cal.depends_on(cosine_cal)
145 correct_for_run_gain = b2.create_path()
146 correct_for_run_gain.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
True,
147 momentumCorFromDB=
True, cosineCor=
True,
148 runGain=
False, wireGain=
True)
149 run_gain_cal.pre_collector_path = correct_for_run_gain
150 run_gain_cal.depends_on(momentum_cal)
151 run_gain_cal.depends_on(cosine_cal)
152 run_gain_cal.depends_on(wire_gain_cal)
154 correct_for_others = b2.create_path()
155 correct_for_others.add_module(
'CDCDedxCorrection', scaleCor=
False, momentumCor=
True,
156 momentumCorFromDB=
True, cosineCor=
True,
157 runGain=
True, wireGain=
True)
158 other_cal.pre_collector_path = correct_for_others
159 other_cal.depends_on(momentum_cal)
160 other_cal.depends_on(cosine_cal)
161 other_cal.depends_on(wire_gain_cal)
162 other_cal.depends_on(run_gain_cal)
167 caf_fw.add_calibration(momentum_cal)
168 caf_fw.add_calibration(cosine_cal)
169 caf_fw.add_calibration(wire_gain_cal)
170 caf_fw.add_calibration(run_gain_cal)
171 caf_fw.add_calibration(other_cal)