Compute how well a laser scan matches or overlaps with its environment given a map of the environment and location of the robot is known

If I knew the exact location of my robot and have an accurate map (for eg. an occupancy grid map) of the environment beforehand, how can I compute a measure of how well the laser scan data agree with the given map ?