What to use for a Light Barrier ?

What is the purpose of this barrier? How likely is it that people will try to get around it without triggering it?

If you use a narrow angle ultrasonic sensor (yes, they are available in different angle ranges), and the distance it measures is less than the distance to the far wall, then something is between the sensor and the far wall.

Note that ultrasonic sensors work best with hard objects, like walls and furniture, and not so good with soft objects like people and pets.