System for the detection of trains