22 from caf
import backends
23 from caf.framework
import CAF
24 from basf2
import B2ERROR
25 from top_calibration
import photonYields_calibration
26 from caf.strategies
import SingleIOV
30 globalTags = [
'patch_main_release-08',
'patch_main_release-07_noTOP',
31 'data_reprocessing_proc13',
'online']
33 data_dir =
'/gpfs/group/belle2/dataprod/Data/PromptReco/bucket16_calib/'
34 bhabha_skim_dir =
'skim/bhabha_all_calib/cdst/sub00'
35 dimuon_skim_dir =
'skim/mumutight_calib/cdst/sub00/'
36 main_output_dir =
'top_calibration'
37 default_sample =
'dimuon'
44 print(
"usage: basf2", argvs[0],
"experiment runFirst runLast [sample]")
45 print(
" sample = bhabha/dimuon (D = dimuon)")
47 experiment = int(argvs[1])
48 run_first = int(argvs[2])
49 run_last = int(argvs[3])
50 sample = default_sample
55 if sample ==
'bhabha':
56 skim_dir = bhabha_skim_dir
57 elif sample ==
'dimuon':
58 skim_dir = dimuon_skim_dir
60 B2ERROR(
"Invalid sample name: " + sample)
65 expNo =
'e' + f
'{experiment:04d}'
66 for run
in range(run_first, run_last + 1):
67 runNo =
'r' + f
'{run:05d}'
68 filename = f
"{data_dir}/{expNo}/*/{runNo}/{skim_dir}/cdst*.root"
69 inputFiles += glob.glob(filename)
71 if len(inputFiles) == 0:
72 B2ERROR(
'No cdst files found in ' + data_dir +
' for exp=' + str(experiment) +
73 ' runFirst=' + str(run_first) +
' runLast=' + str(run_last) +
74 ' (skim_dir=' + skim_dir +
')')
78 run_range =
'r' + f
'{run_first:05d}' +
'-' + f
'{run_last:05d}'
79 output_dir = f
"{main_output_dir}/photonYields-{sample}-{expNo}-{run_range}"
82 cal = photonYields_calibration(inputFiles, sample, globalTags, localDBs)
83 cal.strategies = SingleIOV
84 cal.backend_args = {
"queue":
"s"}
88 cal_fw.add_calibration(cal)
89 cal_fw.output_dir = output_dir
90 cal_fw.backend = backends.LSF()