Belle II Software  release-06-02-00
caf_ecl_edge.py
1 # -*- coding: utf-8 -*-
2 
3 
10 
11 """ECL calibration to specify edges of each crystal."""
12 
13 from prompt import CalibrationSettings, INPUT_DATA_FILTERS
14 
15 # --------------------------------------------------------------
16 # ..Tell the automated script some required details
17 settings = CalibrationSettings(
18  name="ecl_edge",
19  expert_username="hearty",
20  description=__doc__,
21  input_data_formats=["cdst"],
22  input_data_names=["mumu_tight_or_highm_calib"],
23  input_data_filters={
24  "mumu_tight_or_highm_calib": [
25  INPUT_DATA_FILTERS["Data Tag"]["mumu_tight_or_highm_calib"],
26  INPUT_DATA_FILTERS["Data Quality Tag"]["Good"]]},
27  depends_on=[])
28 
29 # --------------------------------------------------------------
30 # ..The calibration functions
31 
32 
33 def get_calibrations(input_data, **kwargs):
34  import basf2
35  from ROOT import Belle2
36  from caf.utils import IoV
37  from caf.framework import Calibration
38 
39  # --------------------------------------------------------------
40  # ..Input data
41  file_to_iov_mu_mu = input_data["mumu_tight_or_highm_calib"]
42  input_files_mu_mu = list(file_to_iov_mu_mu.keys())
43 
44  # ..Algorithm
45  algo_edge = Belle2.ECL.eclEdgeAlgorithm()
46 
47  # ..The calibration
48  ecledge_collector = basf2.register_module("eclEdgeCollector")
49  cal_ecl_edge = Calibration(name="ecl_edge", collector=ecledge_collector, algorithms=algo_edge,
50  input_files=input_files_mu_mu[:1], max_collector_jobs=1)
51 
52  # ..pre_path to include geometry
53  ecl_edge_pre_path = basf2.create_path()
54  ecl_edge_pre_path.add_module("Gearbox")
55  ecl_edge_pre_path.add_module("Geometry")
56  cal_ecl_edge.pre_collector_path = ecl_edge_pre_path
57 
58  # --------------------------------------------------------------
59  # ..Force the output iovs to be open
60  requested_iov = kwargs.get("requested_iov", None)
61  output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
62  for algorithm in cal_ecl_edge.algorithms:
63  algorithm.params = {"apply_iov": output_iov}
64 
65  # --------------------------------------------------------------
66  # ..Return the calibrations
67  return [cal_ecl_edge]
..Obtain payloads specifying the location of the edges of each ECL crystal