24from caf
import backends
25from caf.framework
import CAF
26from basf2
import B2ERROR
27from top_calibration
import BS13d_calibration_cdst
28from top_calibration
import moduleT0_calibration_DeltaT, moduleT0_calibration_LL
29from top_calibration
import commonT0_calibration_BF, commonT0_calibration_LL
30from top_calibration
import offset_calibration
34globalTags = [
'Reco_master_patch',
'data_reprocessing_proc10']
36data_dir =
'/group/belle2/dataprod/Data/OfficialReco/proc10/'
37bhabha_skim_dir =
'skim/hlt_bhabha/cdst/sub00'
38dimuon_skim_dir =
'offskim/offskim_mumutop/cdst/sub00'
39main_output_dir =
'top_calibration'
40default_sample =
'bhabha'
43new_cdst_format =
False
50 print(
"usage: basf2", argvs[0],
"experiment runFirst runLast [sample method]")
51 print(
" sample = bhabha/dimuon (D = bhabha)")
52 print(
" method = BF/LL (D = BF)")
54experiment = int(argvs[1])
55run_first = int(argvs[2])
56run_last = int(argvs[3])
57sample = default_sample
58method = default_method
67 skim_dir = bhabha_skim_dir
68elif sample ==
'dimuon':
69 skim_dir = dimuon_skim_dir
71 B2ERROR(
"Invalid sample name: " + sample)
76expNo =
'e' + f
'{experiment:04d}'
77for run
in range(run_first, run_last + 1):
78 runNo =
'r' + f
'{run:05d}'
79 filename = f
"{data_dir}/{expNo}/*/{runNo}/{skim_dir}/cdst*.root"
80 inputFiles += glob.glob(filename)
82if len(inputFiles) == 0:
83 B2ERROR(
'No cdst files found in ' + data_dir +
' for exp=' + str(experiment) +
84 ' runFirst=' + str(run_first) +
' runLast=' + str(run_last) +
85 ' (skim_dir=' + skim_dir +
')')
89run_range =
'r' + f
'{run_first:05d}' +
'-' + f
'{run_last:05d}'
90output_dir = f
"{main_output_dir}/postTracking-{sample}-{method}-{expNo}-{run_range}"
93cal1 = BS13d_calibration_cdst(inputFiles, time_offset, globalTags, localDBs, new_cdst_format)
94cal2 = moduleT0_calibration_DeltaT(inputFiles, globalTags, localDBs, new_cdst_format)
95cal3 = moduleT0_calibration_LL(inputFiles, sample, globalTags, localDBs, new_cdst_format)
97 cal4 = commonT0_calibration_BF(inputFiles, globalTags, localDBs, new_cdst_format)
99 cal4 = commonT0_calibration_LL(inputFiles, sample, globalTags, localDBs, new_cdst_format)
101 B2ERROR(
'Invalid method name: ' + method)
103cal5 = offset_calibration(inputFiles, globalTags, localDBs, new_cdst_format)
105cal1.backend_args = {
"queue":
"s"}
106cal2.backend_args = {
"queue":
"s"}
107cal3.backend_args = {
"queue":
"s"}
108cal4.backend_args = {
"queue":
"s"}
109cal5.backend_args = {
"queue":
"s"}
119cal_fw.add_calibration(cal1)
120cal_fw.add_calibration(cal2)
121cal_fw.add_calibration(cal3)
122cal_fw.add_calibration(cal4)
123cal_fw.add_calibration(cal5)
124cal_fw.output_dir = output_dir
125cal_fw.backend = backends.LSF()