Really, how is this any different from airplanes? Just use equivalent security measures.
Also, I wonder if it would be possible to have more frequent, smaller trains, e.g. airplane-sized. Then it doesn't seem like terrorism should be any "extra" consideration at all.