def _getBestMatchingSegment(self, c, i, activeState):
maxActivity, which = self.minThreshold, -<NUM_LIT:1><EOL>for j, s in enumerate(self.cells[c][i]):<EOL><INDENT>activity = self._getSegmentActivityLevel(s, activeState,<EOL>connectedSynapsesOnly=False)<EOL>if activity >= maxActivity:<EOL><INDENT>maxActivity, which = activity, j<EOL><DEDENT><DEDENT>if which == -<NUM_LIT:1>:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>return self.cells[c][i][which]<EOL><DEDENT>
For the given cell, find the segment with the largest number of active
synapses. This routine is aggressive in finding the best match. The
permanence value of synapses is allowed to be below connectedPerm. The number
of active synapses is allowed to be below activationThreshold, but must be
above minThreshold. The routine returns the segment index. If no segments are
found, then an index of -1 is returned.

:param c TODO: document
:param i TODO: document
:param activeState TODO: document