Add x, y, z, t0 (and du, floor if DataFrame) columns to the hits.

def apply(self, hits, no_copy=False):
        """Add x, y, z, t0 (and du, floor if DataFrame) columns to the hits.

        """
        if not no_copy:
            hits = hits.copy()
        if istype(hits, 'DataFrame'):
            # do we ever see McHits here?
            hits = Table.from_template(hits, 'Hits')
        if hasattr(hits, 'dom_id') and hasattr(hits, 'channel_id'):
            dir_x, dir_y, dir_z, du, floor, pos_x, pos_y, pos_z, t0 = _get_calibration_for_hits(
                hits, self._calib_by_dom_and_channel
            )

            if hasattr(hits, 'time'):
                if hits.time.dtype != t0.dtype:
                    time = hits.time.astype('f4') + t0.astype('f4')
                    hits = hits.drop_columns(['time'])
                    hits = hits.append_columns(['time'], [time])
                else:
                    hits.time += t0

            hits_data = {}
            for colname in hits.dtype.names:
                hits_data[colname] = hits[colname]
            calib = {
                'dir_x': dir_x,
                'dir_y': dir_y,
                'dir_z': dir_z,
                'du': du.astype(np.uint8),
                'floor': du.astype(np.uint8),
                'pos_x': pos_x,
                'pos_y': pos_y,
                'pos_z': pos_z,
                't0': t0,
            }
            hits_data.update(calib)
            return Table(
                hits_data,
                h5loc=hits.h5loc,
                split_h5=hits.split_h5,
                name=hits.name
            )

        elif hasattr(hits, 'pmt_id'):
            dir_x, dir_y, dir_z, du, floor, pos_x, pos_y, pos_z, t0 = _get_calibration_for_mchits(
                hits, self._calib_by_pmt_id
            )
            if hasattr(hits, 'time'):
                if hits.time.dtype != t0.dtype:
                    time = hits.time.astype('f4') + t0.astype('f4')
                    hits = hits.drop_columns(['time'])
                    hits = hits.append_columns(['time'], [time])
                else:
                    hits.time += t0

            hits_data = {}
            for colname in hits.dtype.names:
                hits_data[colname] = hits[colname]
            calib = {
                'dir_x': dir_x,
                'dir_y': dir_y,
                'dir_z': dir_z,
                'du': du.astype(np.uint8),
                'floor': du.astype(np.uint8),
                'pos_x': pos_x,
                'pos_y': pos_y,
                'pos_z': pos_z,
                't0': t0,
            }
            hits_data.update(calib)
            return Table(
                hits_data,
                h5loc=hits.h5loc,
                split_h5=hits.split_h5,
                name=hits.name
            )
        else:
            raise TypeError(
                "Don't know how to apply calibration to '{0}'. "
                "We need at least 'dom_id' and 'channel_id', or "
                "'pmt_id'.".format(hits.name)
            )