I had thought that you would be using a time of flight sensor, but I believe that what you have is just going to be able to sense a broken beam. It could still work though - raise the laser and detector until they can see each other over the pipe and then lower until they can't.