I want to find the charge density of a line charge of length $L$ in cylindrical coordinates. I suppose charge density is independent of $\phi$. The line charge is only defined for coordinates of $z$ between $L/2$ and $-L/2$. So I suppose we can express the charge density as:
$$\rho(r,\phi,z)=f(r,z)\delta(r)\theta(L/2-|z|)$$
I want to find $f(r,z)$, so I can try to use the volume integral to find it. However, something must be wrong in my definition, as this integral integrates to zero: $$Q=\int^{\infty}_{-\infty} \int^{2\pi}_{0} \int^{\infty}_{-\infty}f(r,z)\delta(r)\theta(L/2-|z|)~r~dz~d\phi~dr\\=\int^{\infty}_{-\infty} \int^{2\pi}_{0} f(r,z)\theta(L/2-|z|)~0~dz~d\phi=0$$
I can't find my mistake, and I would really appreciate your help.
By the way, I already know that $\rho=\frac{Q}{L}$, but I want to prove it with the cylindrical coordinates and delta function that I mentioned.
$\theta$ is the step function.