Belle II Software  release-08-01-10
caf_ecl_mu_mu_expected.py
1 
8 
9 """Find expected energies for ECL e+e- --> gamma gamma single crystal
10 energy calibration. Requires e+e- --> mu mu mc in mdst format with
11 ECLDigits as additional branch."""
12 
13 from prompt import CalibrationSettings
14 
15 # --------------------------------------------------------------
16 # ..Tell the automated script some required details
17 settings = CalibrationSettings(name="ecl_mu_mu_expected",
18  expert_username="hearty",
19  description=__doc__,
20  input_data_formats=["mdst"],
21  input_data_names=["mu_mu_mc"],
22  depends_on=[])
23 
24 # --------------------------------------------------------------
25 # ..The calibration functions
26 
27 
28 def get_calibrations(input_data, **kwargs):
29  import basf2
30  from ROOT import Belle2
31  from caf.utils import IoV
32  from caf.framework import Calibration
33 
34  # --------------------------------------------------------------
35  # ..Input data
36  file_to_iov_mu_mu = input_data["mu_mu_mc"]
37  input_files_mu_mu = list(file_to_iov_mu_mu.keys())
38 
39  # ..Algorithm
40  algo_mu_mu = Belle2.ECL.eclMuMuEAlgorithm()
41  algo_mu_mu.cellIDLo = 1
42  algo_mu_mu.cellIDHi = 8736
43  algo_mu_mu.minEntries = 150
44  algo_mu_mu.nToRebin = 1000
45  algo_mu_mu.tRatioMin = 0.05
46  algo_mu_mu.tRatioMax = 0.4
47  algo_mu_mu.lowerEdgeThresh = 0.10
48  algo_mu_mu.performFits = True
49  algo_mu_mu.findExpValues = True
50  algo_mu_mu.storeConst = 0
51 
52  # ..The calibration
53  eclmumu_collector = basf2.register_module("eclMuMuECollector")
54  eclmumu_collector.param("granularity", "all")
55  eclmumu_collector.param("minPairMass", 9.0)
56  eclmumu_collector.param("minTrackLength", 30.)
57  eclmumu_collector.param("MaxNeighbourE", 0.010)
58  eclmumu_collector.param("thetaLabMinDeg", 17.)
59  eclmumu_collector.param("thetaLabMaxDeg", 150.)
60  eclmumu_collector.param("measureTrueEnergy", True)
61  eclmumu_collector.param("requireL1", False)
62  cal_ecl_mu_mu = Calibration(
63  name="ecl_mu_mu_expected",
64  collector=eclmumu_collector,
65  algorithms=algo_mu_mu,
66  input_files=input_files_mu_mu)
67 
68  # ..Need to include track extrapolation in the path before collector
69  ext_path = basf2.create_path()
70  ext_path.add_module("Gearbox")
71  ext_path.add_module("Geometry")
72  ext_path.add_module("Ext", pdgCodes=[13])
73  cal_ecl_mu_mu.pre_collector_path = ext_path
74 
75  # --------------------------------------------------------------
76  # ..Force the output iovs to be open
77  requested_iov = kwargs.get("requested_iov", None)
78  output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
79  for algorithm in cal_ecl_mu_mu.algorithms:
80  algorithm.params = {"apply_iov": output_iov}
81 
82  # --------------------------------------------------------------
83  # ..Return the calibrations
84  return [cal_ecl_mu_mu]
Calibrate ecl crystals using muon pair events.