A locomotive designated class BP20 would be a Baldwin passenger locomotive with 2000 horsepower. The real class BP20 locomotives were the unique-to-PRR passenger Baldwin Sharknoses.
A locomotive designated class ES12m would be a EMD switcher (shifter, if you prefer) with 1200 horsepower, equipped for multiple-unit control. The real class ES12m units were EMD SW-7 units.
A trickier designation is class ABF18. It does not hold to the above rules; A number of the Baldwin freight Sharknose locomotives were sent to Alco Products for repowering, and were subsequently reclassed ABF18. This indicated Alco/Baldwin freight units with 1800 horsepower. Who would have guessed?
Prior to this system coming into use, first a system used for steam locomotives was in use. Later it changed to a system like the above, excepting that instead of the numbers after the initial letters designating horsepower, they denoted the number of independant units comprising a "locomotive" Thus for example the Baldwin Centipede, being a single unit (actually a permanently married pair), were initially class BP1, and the passenger sharks, acquired in A-B-A configuration, were BP3. The Centipedes, by the way, fit as delivered into class BP60, but after they were run through Altoona and modified for helper service, they finished out their years as class BH50, meaning the units had been derated to 5000 horsepower.
Thanks to Andy Miller for reminding me of this.