9"""ECL timing validation with an hadronic event selection.""" 
   11from prompt 
import CalibrationSettings
 
   12from reconstruction 
import prepare_user_cdst_analysis
 
   26settings = CalibrationSettings(
 
   27    name=
"ECL time validations - hadronic",
 
   28    expert_username=
"ehill",
 
   30    input_data_formats=[
"cdst"],
 
   31    input_data_names=[
"hadron_calib"],
 
   56def get_calibrations(input_data, **kwargs):
 
   59      input_data (dict): Should contain every name from the 
'input_data_names' variable 
as a key.
 
   60        Each value 
is a dictionary 
with {
"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful 
for 
   61        assigning to calibration.files_to_iov
 
   63      **kwargs: Configuration options to be sent 
in. Since this may change we use kwargs 
as a way to help prevent
 
   64        backwards compatibility problems. But you could use the correct arguments 
in b2caf-prompt-run 
for this
 
   65        release explicitly 
if you want to.
 
   67        Currently only kwargs[
"output_iov"] 
is used. This 
is the output IoV range that your payloads should
 
   68        correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
 
   71      list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
 
   79    file_to_iov_physics = input_data[
"hadron_calib"]
 
   81    max_events_per_run = 3000
 
   88    reduced_file_to_iov_physics = filter_by_max_events_per_run(file_to_iov_physics, max_events_per_run)
 
   89    input_files_physics = list(reduced_file_to_iov_physics.keys())
 
   90    basf2.B2INFO(f
"Total number of files actually used as input = {len(input_files_physics)}")
 
   93    from basf2 
import register_module, create_path
 
   94    from ROOT 
import Belle2
 
   95    from caf.framework 
import Collection
 
   99    root_input = register_module(
'RootInput')
 
  100    rec_path_hadron = create_path()
 
  101    rec_path_hadron.add_module(root_input)
 
  102    if 'Gearbox' not in rec_path_hadron:
 
  103        rec_path_hadron.add_module(
'Gearbox')
 
  104    if 'Geometry' not in rec_path_hadron:
 
  105        rec_path_hadron.add_module(
'Geometry', useDB=
True)
 
  107    prepare_user_cdst_analysis(rec_path_hadron)    
 
  109    col_hadron = register_module(
'eclHadronTimeCalibrationValidationCollector')
 
  110    col_hadron.param(
'timeAbsMax', 70)
 
  111    col_hadron.param(
'saveTree', 
False)
 
  114                            input_files=input_files_physics,
 
  115                            pre_collector_path=rec_path_hadron)
 
  127    eclValTAlgHadronic.meanCleanRebinFactor = 3
 
  128    eclValTAlgHadronic.meanCleanCutMinFactor = 0.4
 
  129    eclValTAlgHadronic.debugFilenameBase = 
"eclHadronTValidationAlgorithm" 
  134    from caf.framework 
import Calibration
 
  136    valid_cal_hadron = 
Calibration(
"ECLcrystalTimeCalValidation_hadronPhysics")
 
  137    valid_cal_hadron.add_collection(name=
"hadron", collection=eclValTCol)
 
  138    valid_cal_hadron.algorithms = [eclValTAlgHadronic]
 
  141    from caf.strategies 
import SingleIOV
 
  147    valid_cal_hadron.strategies = SingleIOV
 
  153    return [valid_cal_hadron]
 
Validate the ecl timing calibrations using a hadronic event selection.