I would use an IR beam for the cars to break. Or a reflective optical sensor under the track pointing up through a hole.