"The sensor is a self-contained unit consisting of an IR emitter, IR detector, and logic circuitry. When a train passes over the sensor, the detector picks up the reflected IR from the underside of the train, and the output of the detector circuit goes low, signalling to the controller that a train is present."
Did you think about ID'ing the engine also?