Belle II Software development
caf_ecl_gg_expected.py
1
8
9"""Find expected energies for ECL e+e- --> gamma gamma single crystal
10energy calibration. Requires e+e- --> gamma gamma mc in mdst format."""
11
12from prompt import CalibrationSettings
13
14# --------------------------------------------------------------
15# ..Tell the automated script some required details
16settings = CalibrationSettings(
17 name="ecl_gg_expected",
18 expert_username="hearty",
19 description=__doc__,
20 input_data_formats=["mdst"],
21 input_data_names=["gamma_gamma_mc"],
22 depends_on=[])
23
24# --------------------------------------------------------------
25# ..The calibration functions
26
27
28def 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 # ..gamma gamma
36
37 # ..Input data
38 file_to_iov_gamma_gamma = input_data["gamma_gamma_mc"]
39 input_files_gamma_gamma = list(file_to_iov_gamma_gamma.keys())
40
41 # ..Algorithm
42 algo_gamma_gamma = Belle2.ECL.eclGammaGammaEAlgorithm()
43 algo_gamma_gamma.setOutputName("eclGammaGammaE_algorithm.root")
44 algo_gamma_gamma.setCellIDLo(1)
45 algo_gamma_gamma.setCellIDHi(8736)
46 algo_gamma_gamma.setMinEntries(150)
47 algo_gamma_gamma.setMaxIterations(10)
48 algo_gamma_gamma.setTRatioMin(0.45)
49 algo_gamma_gamma.setTRatioMax(0.70)
50 algo_gamma_gamma.setTRatioMinHiStat(0.70)
51 algo_gamma_gamma.setTRatioMaxHiStat(0.95)
52 algo_gamma_gamma.setUpperEdgeThresh(0.02)
53 algo_gamma_gamma.setPerformFits(True)
54 algo_gamma_gamma.setFindExpValues(True)
55 algo_gamma_gamma.setStoreConst(0)
56
57 # ..The calibration
58 eclGammaGamma_collector = basf2.register_module("eclGammaGammaECollector")
59 eclGammaGamma_collector.param("granularity", "all")
60 eclGammaGamma_collector.param("thetaLabMinDeg", 0.)
61 eclGammaGamma_collector.param("thetaLabMaxDeg", 180.)
62 eclGammaGamma_collector.param("minPairMass", 9.)
63 eclGammaGamma_collector.param("mindPhi", 179.)
64 eclGammaGamma_collector.param("maxTime", 999.)
65 eclGammaGamma_collector.param("measureTrueEnergy", True)
66 eclGammaGamma_collector.param("requireL1", False)
67 cal_ecl_gamma_gamma = Calibration("ecl_gg_expected",
68 collector=eclGammaGamma_collector,
69 algorithms=[algo_gamma_gamma],
70 input_files=input_files_gamma_gamma
71 )
72
73 # ..Add prepare_cdst_analysis to pre_collector_path
74 gamma_gamma_pre_path = basf2.create_path()
75 cal_ecl_gamma_gamma.pre_collector_path = gamma_gamma_pre_path
76
77 # --------------------------------------------------------------
78 # ..Force the output iovs to be open
79 requested_iov = kwargs.get("requested_iov", None)
80 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
81 for algorithm in cal_ecl_gamma_gamma.algorithms:
82 algorithm.params = {"apply_iov": output_iov}
83
84 # --------------------------------------------------------------
85 # ..Return the calibrations
86 return [cal_ecl_gamma_gamma]
Calibrate ecl crystals using gamma pair events.