Anisotropic 3D XY model and vortex loops: layered 3D high Tc superconductors and 2D quantum capacitive josephson junction arrays