Calculate a normalising constant