<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calc_eff(self):
 """Calculate the efficiency."""


        hists = self.hists
        hists_out = self._hists_eff

        cth_axis_idx = dict(evclass=2, evtype=3)
        for k in ['evclass', 'evtype']:

            if k == 'evclass':
                ns0 = hists['evclass_on'][4][None, ...]
                nb0 = hists['evclass_off'][4][None, ...]
            else:
                ns0 = hists['evclass_on'][4][None, None, ...]
                nb0 = hists['evclass_off'][4][None, None, ...]

            eff, eff_var = calc_eff(ns0, nb0,
                                    hists['%s_on' % k], hists['%s_off' % k],
                                    hists['%s_alpha' % k])
            hists_out['%s_cth_eff' % k] = eff
            hists_out['%s_cth_eff_var' % k] = eff_var

            eff, eff_var = calc_eff(ns0, nb0,
                                    hists['%s_on' % k], hists['%s_off' % k],
                                    hists['%s_alpha' % k],
                                    sum_axes=[cth_axis_idx[k]])
            hists_out['%s_eff' % k] = np.squeeze(eff)
            hists_out['%s_eff_var' % k] = np.squeeze(eff_var)