def _calculatePoolingActivity(self, predictedActiveCells, learn):
    """
    Determines each column's overlap with predicted active cell input.
    If learning, overlap is calculated between predicted active input cells and
    potential synapses. Otherwise, connected synapses are used.
    The overlap of a TP cell that was previously active and has one or more
    active synapse due to predicted active input is set to (_numInputs + 1).
    This guarantees that such a cell wins the inhibition competition.

    TODO: check with Jeff, what happens in biology if a cell was not previously
    active but receives metabotropic input?  Does it turn on, or does the met.
    input just extend the activity of already active cells? Does it matter
    whether the synapses are connected or not? Currently we are assuming no
    because most connected synapses become disconnected in the previous time
    step. If column i at time t is bursting and performs learning, the synapses
    from t+1 aren't active at time t, so their permanence will decrease.

    Parameters:
    ----------------------------
    predictedActiveCells: a numpy array with numInputs elements. A 1 indicates
                          that this cell switched from a predicted state in
                          the previous time step to active state in the current
                          timestep
    returns:              an array of overlap values due to predicted
                          active TM cells
    """


    overlaps = numpy.zeros(self._numColumns).astype(realDType)

    # If no pooling columns or no predicted active inputs, return all zeros
    if (sum(self._poolingActivation) == 0 or
       len(predictedActiveCells.nonzero()[0]) == 0):
      return overlaps

    if learn:
      # During learning, overlap is calculated based on potential synapses.
      self._potentialPools.rightVecSumAtNZ_fast(predictedActiveCells, overlaps)
    else:
      # At inference stage, overlap is calculated based on connected synapses.
      self._connectedSynapses.rightVecSumAtNZ_fast(predictedActiveCells, overlaps)

    poolingColumns = self._poolingColumns

    # Only consider columns that are in pooling state
    mask = numpy.zeros(self._numColumns).astype(realDType)
    mask[poolingColumns] = 1
    overlaps = overlaps * mask
    # Pooling TP cells that receive predicted input
    # will have their overlap boosted by a large factor so that they are likely
    # to win the inhibition competition
    boostFactorPooling = self._boostStrength * self._numInputs
    overlaps = boostFactorPooling * overlaps

    if self._spVerbosity > 3:
      print "\n============== In _calculatePoolingActivity ======"
      print "Received predicted cell inputs from following indices:"
      print "   ", predictedActiveCells.nonzero()[0]
      print "The following column indices are in pooling state:"
      print "   ", poolingColumns
      print "Overlap score of pooling columns:"
      print "   ", overlaps[poolingColumns]
      print "============== Leaving _calculatePoolingActivity  ======\n"

    return overlaps
Determines each column's overlap with predicted active cell input.
    If learning, overlap is calculated between predicted active input cells and
    potential synapses. Otherwise, connected synapses are used.
    The overlap of a TP cell that was previously active and has one or more
    active synapse due to predicted active input is set to (_numInputs + 1).
    This guarantees that such a cell wins the inhibition competition.

    TODO: check with Jeff, what happens in biology if a cell was not previously
    active but receives metabotropic input?  Does it turn on, or does the met.
    input just extend the activity of already active cells? Does it matter
    whether the synapses are connected or not? Currently we are assuming no
    because most connected synapses become disconnected in the previous time
    step. If column i at time t is bursting and performs learning, the synapses
    from t+1 aren't active at time t, so their permanence will decrease.

    Parameters:
    ----------------------------
    predictedActiveCells: a numpy array with numInputs elements. A 1 indicates
                          that this cell switched from a predicted state in
                          the previous time step to active state in the current
                          timestep
    returns:              an array of overlap values due to predicted
                          active TM cells