23 from caf
import backends
24 from caf.framework
import CAF
25 from basf2
import B2ERROR
26 from top_calibration
import commonT0_calibration_BF, commonT0_calibration_LL
30 globalTags = [
'Reco_master_patch',
'data_reprocessing_proc10']
32 data_dir =
'/group/belle2/dataprod/Data/OfficialReco/proc10/'
33 bhabha_skim_dir =
'skim/hlt_bhabha/cdst/sub00'
34 dimuon_skim_dir =
'offskim/offskim_mumutop/cdst/sub00'
35 main_output_dir =
'top_calibration'
36 default_sample =
'bhabha'
38 new_cdst_format =
False
45 print(
"usage: basf2", argvs[0],
"experiment runFirst runLast [sample method]")
46 print(
" sample = bhabha/dimuon (D = bhabha)")
47 print(
" method = BF/LL (D = BF)")
49 experiment = int(argvs[1])
50 run_first = int(argvs[2])
51 run_last = int(argvs[3])
52 sample = default_sample
53 method = default_method
61 if sample ==
'bhabha':
62 skim_dir = bhabha_skim_dir
63 elif sample ==
'dimuon':
64 skim_dir = dimuon_skim_dir
66 B2ERROR(
"Invalid sample name: " + sample)
71 expNo =
'e' +
'{:0=4d}'.format(experiment)
72 for run
in range(run_first, run_last + 1):
73 runNo =
'r' +
'{:0=5d}'.format(run)
74 filename = f
"{data_dir}/{expNo}/*/{runNo}/{skim_dir}/cdst*.root"
75 inputFiles += glob.glob(filename)
77 if len(inputFiles) == 0:
78 B2ERROR(
'No cdst files found in ' + data_dir +
' for exp=' + str(experiment) +
79 ' runFirst=' + str(run_first) +
' runLast=' + str(run_last) +
80 ' (skim_dir=' + skim_dir +
')')
84 run_range =
'r' +
'{:0=5d}'.format(run_first) +
'-' +
'{:0=5d}'.format(run_last)
85 output_dir = f
"{main_output_dir}/commonT0-{sample}-{method}-{expNo}-{run_range}"
89 cal = commonT0_calibration_BF(inputFiles, globalTags, localDBs, new_cdst_format)
91 cal = commonT0_calibration_LL(inputFiles, sample, globalTags, localDBs, new_cdst_format)
93 B2ERROR(
'Invalid method name: ' + method)
95 cal.backend_args = {
"queue":
"s"}
99 cal_fw.add_calibration(cal)
100 cal_fw.output_dir = output_dir
101 cal_fw.backend = backends.LSF()