Unfortunately this does happen. I've also met people that have had big rocks drop through the cab when they went under an overpass. I personally had full beer cans thrown at me and a friend of mine took fire from a rifle the other night. No one hurt, but a little unnerving. If at night, we just turn off all the lights we can when we pass through those areas. Oh yeah, I keep my window shut too.
A couple of things to remember:
1) The windows are supposed to be bullet proof. If not, then darn near.
2) Those nuts are trying to hit a moving target. The locomotive is big but the crew isn't. ("Big sky, little bullet" theory)
I'm more scared of driving to and from the terminal within an hour either side of the bars closing than of some nut case shooting at me. Or working in a yard in one of those great neighborhoods they are always located in. A crew manager for the Cal. Div. tried to get me to go to L.A. or Richmond, CA. when I could not hold Needles. Yeah right! I was born at night, but it wasn't last night. Silly boy.
While against the rules, Golden-Arm has a point. What is the guy that is getting shot back at going to do, call the cops or a Special Agent and complain that the train he just shot at returned fire? Just make sure you pick up the spent ammo casings!
I know it is no comfort, but these things do happen. I've heard of more people be injured from accidents than snipers or drunks throwing rocks off bridges. I'll take my chances with a .223 cal. round missing me while I go down the track at 55 mph, than a piece of equipment that has not been maintained breaking and hurting me. That is dangerous. So far in two years of work it is bad equipment 3, snipers 0.