I'm not sure on the train but Spain has security scans at railway departures for long distance rail. Not as stringent as for an international aeroplane flight but, given the investment, in theory it could be.
Security theatre for trains? Then it's not a train no more, but just an airplane that doesn't fly.