9"""ECL timing calibration that performs the crate calibrations, one for each physics run.""" 
   11from prompt 
import CalibrationSettings
 
   12from reconstruction 
import prepare_cdst_analysis
 
   24settings = CalibrationSettings(name=
"ECL crate time calibrations",
 
   25                               expert_username=
"ehill",
 
   27                               input_data_formats=[
"cdst"],
 
   28                               input_data_names=[
"bhabha_all_calib"],
 
   52def get_calibrations(input_data, **kwargs):
 
   55      input_data (dict): Should contain every name from the 
'input_data_names' variable 
as a key.
 
   56        Each value 
is a dictionary 
with {
"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful 
for 
   57        assigning to calibration.files_to_iov
 
   59      **kwargs: Configuration options to be sent 
in. Since this may change we use kwargs 
as a way to help prevent
 
   60        backwards compatibility problems. But you could use the correct arguments 
in b2caf-prompt-run 
for this
 
   61        release explicitly 
if you want to.
 
   63        Currently only kwargs[
"output_iov"] 
is used. This 
is the output IoV range that your payloads should
 
   64        correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
 
   67      list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
 
   75    file_to_iov_physics = input_data[
"bhabha_all_calib"]
 
   80    max_files_per_run = 26
 
   87    reduced_file_to_iov_physics = filter_by_max_files_per_run(file_to_iov_physics, max_files_per_run)
 
   88    input_files_physics = list(reduced_file_to_iov_physics.keys())
 
   89    basf2.B2INFO(f
"Total number of files actually used as input = {len(input_files_physics)}")
 
   92    from basf2 
import register_module, create_path
 
   93    from ROOT 
import Belle2
 
   94    from caf.framework 
import Collection
 
   98    root_input = register_module(
'RootInput')
 
   99    rec_path_bhabha = create_path()
 
  100    rec_path_bhabha.add_module(root_input)
 
  101    if 'Gearbox' not in rec_path_bhabha:
 
  102        rec_path_bhabha.add_module(
'Gearbox')
 
  103    if 'Geometry' not in rec_path_bhabha:
 
  104        rec_path_bhabha.add_module(
'Geometry', useDB=
True)
 
  106    prepare_cdst_analysis(rec_path_bhabha)  
 
  109    t0BiasCorrection = -0.9  
 
  112    col_bhabha = register_module(
'ECLBhabhaTCollector')
 
  113    col_bhabha.param(
'timeAbsMax', 250)
 
  114    col_bhabha.param(
'minCrystal', 1)
 
  115    col_bhabha.param(
'maxCrystal', 8736)
 
  116    col_bhabha.param(
'saveTree', 
False)
 
  117    col_bhabha.param(
'hadronEventT0_TO_bhabhaEventT0_correction', t0BiasCorrection)
 
  120                         input_files=input_files_physics,
 
  121                         pre_collector_path=rec_path_bhabha,
 
  134    eclTAlg.debugOutput = 
True 
  135    eclTAlg.meanCleanRebinFactor = 3
 
  136    eclTAlg.meanCleanCutMinFactor = 0.3
 
  137    eclTAlg.debugFilenameBase = 
"eclBhabhaTAlgorithm" 
  142    from caf.framework 
import Calibration
 
  144    cal_test = 
Calibration(
"ECLcrateTimeCalibration_physics")
 
  145    cal_test.add_collection(name=
"bhabha", collection=eclTCol)
 
  146    cal_test.algorithms = [eclTAlg]
 
  149    from caf.strategies 
import SimpleRunByRun
 
  157    cal_test.strategies = SimpleRunByRun
 
Calibrate ecl crystals using bhabha events.