Beside the tracks on racks would be better?
Lets make rail maintenance an electrocution hazard! What could go wrong? Surely this wouldn't make railwork happen less often if you've got a few hundred volts DC and AC both between the rails. When that results in derailments, I'm sure there is no way whatsoever that 50+ ton railcars could do any damage to the wiring that'd break the jacketing and short a wire to the rail or a car, right? Trains never derail in the rain do they?
Great! For a moment I thought there could be serious downsides to this idea beyond the obvious aiming and dirt/oil issues...
This concept has some really high hurdles to overcome. Placing the panels there, they need to be disposably cheap as they'll be damage and degraded quickly and the sorts of damage are too great to just make them tough enough to withstand. Most railwork would require them to be removed, so you'd need a quick way to pick them back up. You could imagine a car that picks them back up to allow track work & refurb at a depot. The catch though, is you need robust wiring/inverters and grid tie outside the rails that's fixed infrastructure so they can't just be loose laying on the ground. You'd need an auto-cutoff for safety on each panel for derailment safety, but that's the opposite of 'cheap, disposable'. So... do they have a cheap inverter/safety cutoff system? Do they have a setup that can survive the rail area long enough (high heat, vibration, oil, soot, weather - floods, water flow, freezing etc) while not being a hazard? Presumably they'd use lower efficiency panels that work better obstructed, but that cuts into the payout.
I'm failing to see how this beats simple metal racks. If you want it in a rail area, then elevate the racks a bit higher so they shade the tracks. Shade all the passenger stops w/panels, shade all the grade/road crossings - you've got power for the warning lights, grid tie the panel inverters there since you've already got mains lines. Load standard solar rack frames on your train car, you'll only have to put cement footings down. Then you can use properly aimed panels and higher efficiency ones. I'd really need to be convinced that this between the tracks idea beats beside the tracks on racks over 10, 20 yrs.