Q:

Why $\rho=\cos \phi$ in $x^2+y^2+(z-\frac{1}{2})^2=\frac{1}{4}$ and $0 \le \phi \le \pi/4$?

I need to calculate the volume of cone $z=\sqrt{x^2+y^2}$ inside the sphere $x^2+y^2+(z-\frac{1}{2})^2=\frac{1}{4}$ using spherical coordinates, triple integral and $f(\rho, \phi, \theta)$ notation.
Intuitively, I'd like to say that the radius of the sphere is $0.5$ and this should be the upper bound of $\rho$. However, we need to use $\rho \le \cos\phi$. The algebraical explanation for this is:
$$
x^2+y^2+z^2-z+\frac{1}{4}=\frac{1}{4} \Rightarrow x^2+y^2+z^2=z\\
z=\rho\cos\phi \Rightarrow \rho=z=\rho\cos\phi
$$
I don't understand the reasoning behind this though. 
Is it because $\rho$ doesn't start in the origin so we need to make the adjustment?
And secondly, aren't we interested in the angle $\pi/4 \le \phi \le \pi/2$ because this is actually where the cone is situated?
This is the illustration:

A:

You would have to let $\rho$ run to $\tfrac{1}{2}$, the radius of the sphere, if the sphere was centered in the origin. But that's not the case, the center of the sphere is at $(0,0,\tfrac{1}{2})$. A decent sketch helps a lot, I think.
Because the radius is $\tfrac{1}{2}$, the sphere does touch the origin so $\rho$ in fact starts at $\rho = 0$ and you have to let it run until it arrives at the top of the sphere (but within the cone). Because of the shifting of the sphere, this is not at a constant distance from the origin but it depends on the angle $\phi$. To find out how it depends on it, you use the equation of the sphere and solve for $\rho$, arriving at $\rho = \cos\phi$.

And secondly, aren't we interested in the angle $\pi/4 \le \phi \le \pi/2$ because this is actually where the cone is situated?

I don't understand how you arrived at these angles; $\phi$ is the angle with the positive $z$-axis? Then you should start at $\phi=0$ and let $\phi$ run until you arrive at the boundary of the cone.

