25 from caf
import backends
26 from caf.framework
import CAF
27 from basf2
import B2ERROR
28 from top_calibration
import BS13d_calibration_cdst
29 from top_calibration
import moduleT0_calibration_DeltaT, moduleT0_calibration_LL
30 from top_calibration
import commonT0_calibration_BF, commonT0_calibration_LL
31 from top_calibration
import offset_calibration
35 globalTags = [
'Reco_master_patch',
'data_reprocessing_proc10']
37 data_dir =
'/group/belle2/dataprod/Data/OfficialReco/proc10/'
38 bhabha_skim_dir =
'skim/hlt_bhabha/cdst/sub00'
39 dimuon_skim_dir =
'offskim/offskim_mumutop/cdst/sub00'
40 main_output_dir =
'top_calibration'
41 default_sample =
'bhabha'
44 new_cdst_format =
False
51 print(
"usage: basf2", argvs[0],
"experiment runFirst runLast [sample method]")
52 print(
" sample = bhabha/dimuon (D = bhabha)")
53 print(
" method = BF/LL (D = BF)")
55 experiment = int(argvs[1])
56 run_first = int(argvs[2])
57 run_last = int(argvs[3])
58 sample = default_sample
59 method = default_method
67 if sample ==
'bhabha':
68 skim_dir = bhabha_skim_dir
69 elif sample ==
'dimuon':
70 skim_dir = dimuon_skim_dir
72 B2ERROR(
"Invalid sample name: " + sample)
77 expNo =
'e' +
'{:0=4d}'.format(experiment)
78 for run
in range(run_first, run_last + 1):
79 runNo =
'r' +
'{:0=5d}'.format(run)
80 filename = f
"{data_dir}/{expNo}/*/{runNo}/{skim_dir}/cdst*.root"
81 inputFiles += glob.glob(filename)
83 if len(inputFiles) == 0:
84 B2ERROR(
'No cdst files found in ' + data_dir +
' for exp=' + str(experiment) +
85 ' runFirst=' + str(run_first) +
' runLast=' + str(run_last) +
86 ' (skim_dir=' + skim_dir +
')')
90 run_range =
'r' +
'{:0=5d}'.format(run_first) +
'-' +
'{:0=5d}'.format(run_last)
91 output_dir = f
"{main_output_dir}/postTracking-{sample}-{method}-{expNo}-{run_range}"
94 cal1 = BS13d_calibration_cdst(inputFiles, time_offset, globalTags, localDBs, new_cdst_format)
95 cal2 = moduleT0_calibration_DeltaT(inputFiles, globalTags, localDBs, new_cdst_format)
96 cal3 = moduleT0_calibration_LL(inputFiles, sample, globalTags, localDBs, new_cdst_format)
98 cal4 = commonT0_calibration_BF(inputFiles, globalTags, localDBs, new_cdst_format)
100 cal4 = commonT0_calibration_LL(inputFiles, sample, globalTags, localDBs, new_cdst_format)
102 B2ERROR(
'Invalid method name: ' + method)
104 cal5 = offset_calibration(inputFiles, globalTags, localDBs, new_cdst_format)
106 cal1.backend_args = {
"queue":
"s"}
107 cal2.backend_args = {
"queue":
"s"}
108 cal3.backend_args = {
"queue":
"s"}
109 cal4.backend_args = {
"queue":
"s"}
110 cal5.backend_args = {
"queue":
"s"}
113 cal2.depends_on(cal1)
114 cal3.depends_on(cal2)
115 cal4.depends_on(cal3)
116 cal5.depends_on(cal4)
120 cal_fw.add_calibration(cal1)
121 cal_fw.add_calibration(cal2)
122 cal_fw.add_calibration(cal3)
123 cal_fw.add_calibration(cal4)
124 cal_fw.add_calibration(cal5)
125 cal_fw.output_dir = output_dir
126 cal_fw.backend = backends.LSF()