Analyzing X-Ray Pulsar Profiles: Geometry and Beam Pattern of Hercules X-1