Reconstruction of critical current density profiles from AC loss measurements