Use of TKDTree

Dear all,
I would like to calculate the 2-point autocorrelation function using the TKDTree class, but I cannot understand well how to proper use such class.
Following the class documentation I did a very simple macro (see attachment), which builds a kd tree from 2D data and stores the points associated to each node in graphs.
If I draw the points of the first two nodes (after the root node) I get the plot attached. I cannot understand the obtained partition (the points are mixed instead of being separated into two region with respect to some axis) so probably I’m getting the node points in a wrong way.
Any help would be very appreciated,



PS: I’m using ROOT v5.32.01 version
Partition.pdf (13.4 KB)
TestKDTree.C (2.66 KB)