I have 3D position data of particles. I need to calculate g(r, $\theta$). Where g(r, $\theta$) is defined as:
$$ g(r, \theta) = \frac{H(r, \theta)}{N \cdot n(r,\theta)} $$
r is a Euclidean distance between particles and theta is the polar angle from particle moving direction to r (Explained in attached picture). H(r,theta) is the histogram for all N pairs.
Usually normalization will be performed by dividing H by N. But I also need to normalize by Volume around the particle. As further will go away from the particle more chances there are to find a particle there. I have found normalization function of the form of n(r, theta): $$ n(r,\theta) = \frac{2}{3} \pi [(r + \delta r)^{3} - r^{3}][cos(\theta) - cos(\theta + \delta\theta)] $$
First of all I do not understand how this function have come into be. Secondly, is this even correct?. Ideally it should be equal to 1 for particles moving in random direction.