def make_fit(labels): pileup_bin = labels["pileup"] threshold_bin = labels["threshold"] efficiency = self.efficiencies.get_bin_contents( [pileup_bin, threshold_bin]) params = fit_efficiency( efficiency, self.thresholds.get_bin_center(threshold_bin)) return params
def test_fit_efficiency_symmetric(): in_mean = 35. in_sigma = 10. fake_efficiency = FakeEff(in_mean, in_sigma) params = fit.fit_efficiency(fake_efficiency, 30, 10, False) mu = params["mu"][0] sigma = params["sigma"][0] mu_ratio = mu / in_mean if mu > in_mean else in_mean / mu sigma_ratio = sigma / in_sigma if sigma > in_sigma else in_sigma / sigma assert 1.1 > mu_ratio assert 1.5 > sigma_ratio assert params["success"]
def test_fit_efficiency_asymmetric(): in_mean = 35. in_sigma = 10. fake_efficiency = FakeEff(in_mean, in_sigma) params = fit.fit_efficiency(fake_efficiency, 30, 10, True) mu = params["mu"][0] sigma = params["sigma"][0] lamda = params["lambda"][0] mu_ratio = mu / in_mean if mu > in_mean else in_mean / mu sigma_ratio = sigma / in_sigma if sigma > in_sigma else in_sigma / sigma assert_greater(1.1, mu_ratio) assert_greater(1.5, sigma_ratio) assert_greater(0.5, abs(lamda)) assert_true(params["success"])