Advice on interesting train-related things to visit in Japan?

I'll be spending about two weeks in Japan, and am planning to visit: Hiroshima, Osaka, Kyoto, and Tokyo.

Apart from just using the rail system, are there any train museums or interesting rail / rail history exhibits that anyone here can recommend?