My dad worked for the Illinois Central RR and he taught all of us NEVER, EVER mess with a train. They WILL ALWAYS WIN. He saw his share of these things. He also told us to, whenever at a crossing, to stay at least two or three carlenghts back. That was to allow an escape distance if, for some reason, the rail cars jumped the track or their doors fell off. I still live by that.
Also a good precaution for the situation where the idiot behind you, while on his cell phone, rear-ends you.