def _effective_crossings(fluxdata, nint, end_step):
    """Analyse flux data and obtain effective crossings.

    Parameters
    ----------
    fluxdata : list of tuples of ints
        The list contains the data obtained from a ``md-flux``
        simulation.
    nint : int
        The number of interfaces used.
    end_step : int
        This is the last step done in the simulation.

    Returns
    -------
    eff_cross : list of lists
        `eff_cross[i]` is the effective crossings times for
        interface `i`.
    ncross : list of ints
        `ncross[i]` is the number of crossings for interface `i`.
    neffcross : list of ints
        `neffcross[i]` is the number of effective crossings for
        interface `i`.
    time_in_state : dict
        The time spent in the different states which are labeled with
        the keys 'A', 'B', 'OA', 'OB'. 'O' is taken to mean the
        'overall' state.

    Note
    ----
    We do here `intf - 1`. This is just to be compatible with the old
    FORTRAN code where the interfaces are numbered 1, 2, 3 rather than
    0, 1, 2. If this is to be changed in the future the `-1` can just
    be removed. Such a change will also require changes to the
    formatter for flux data.

    """
    overallstate_a = not (fluxdata[0][1] == 2 and fluxdata[0][2] < 0)
    firstcross = [True] * nint
    ncross = [0] * nint
    neffcross = [0] * nint
    eff_cross = [[] for _ in range(nint)]
    end = {'A': 0, 'B': 0, 'OA': 0, 'OB': 0}
    start = {'A': 0, 'B': 0, 'OA': 0, 'OB': 0}
    time_in_state = {'A': 0, 'B': 0, 'OA': 0, 'OB': 0}
    time, intf, sign = None, None, None
    for time, intf, sign in fluxdata:
        if sign > 0:
            if intf - 1 == 0:
                end['A'] = time
                time_in_state['A'] += end['A'] - start['A']
            elif intf - 1 == 2:
                start['B'] = time
                if overallstate_a:
                    end['OA'] = time
                    start['OB'] = time
                    time_in_state['OA'] += end['OA'] - start['OA']
                    overallstate_a = False
            ncross[intf - 1] += 1
            if firstcross[intf - 1]:
                firstcross[intf - 1] = False
                neffcross[intf - 1] += 1
                eff_cross[intf - 1].append((time - time_in_state['OB'], time))
        elif sign < 0:
            if intf - 1 == 0:
                firstcross = [True] * nint
                start['A'] = time
                if not overallstate_a:
                    end['OB'] = time
                    start['OA'] = time
                    time_in_state['OB'] += end['OB'] - start['OB']
                    overallstate_a = not overallstate_a
            elif intf - 1 == 2:
                end['B'] = time
                time_in_state['B'] += end['B'] - start['B']
    state = 'OA' if overallstate_a else 'OB'
    time_in_state[state] += end_step - start[state]
    if intf - 1 == 0 and sign < 0:
        time_in_state['A'] += end_step - start['A']
    elif intf - 1 == 2 and sign > 0:
        time_in_state['B'] += end_step - start['B']
    return eff_cross, ncross, neffcross, time_in_state
