ultrasonic sensors for railway bars

An ultrasonic sensor is not likely to be the best sensor to be using to detect a moving train.