def calculate_mean_total_cn(h, x, l):
    """ Calculate the mean raw copy number.

    Args:
        h (numpy.array): haploid read depths, h[0] for normal
        x (numpy.array): major, minor, and total read counts
        l (numpy.array): segment lengths

    Returns:
        numpy.array: N * L dim array, per segment per allele mean copy number

    """

    depth = x[:, 2] / l

    mean_cn = (depth - h[0]) / h[1:].sum()

    return mean_cn