def n_critical(detector_diameter: float, detector_gap: float) ->int:
    """
    This function computes the smallest even integer value for the number of
    cells, n_crit, is such that no more than 2 complete cells fall within the
    detector gap width δ (i.e. Δ = δ/2 yielding N = 2 d0/δ)
    The code makes sure that N is even.

    Parameters
    ----------
    detector_diameter : float
        The diameter of the quadrant cell photo diode (in mm)
    detector_gap: float
        The gap distance between the quadrants of the photo diode (in mm)

    Returns
    -------
    n_crit : int
        The critical number of cells (an even number)

    """
    critical = int(2 * detector_diameter / detector_gap)
    if critical % 2 != 0:
        critical += 1
    return critical
