Space-average electromagnetic fields and electromagnetic anomaly weighted by energy density in heavy-ion collisions