One of the keys to a good nights sleep is to, arrive and, get set up early enough in the evening to become familiar with your surroundings. Then when the freight train comes thru, at least you have seen the track and expect that rumble and shaking.
We once boon docked near Revelstoke, BC, arriving about midnight, and thought we had found a quiet spot. Did not see the CN mailine that was on a high burm just behind us and a row of trees. Needless to say, as the first train approached and passed, I was up and looking to see if we had parked on the darn tracks.
Each train every 30 minutes after that became easier to ignore.
Dave