In mid-war all major industrial facilities, cities and railroads formed local guard units. The idea for most was to protect local infrastructure from destruction by small cavalry raiding parties. They elected officers, were given arms and drilled frequently. Most units that saw service were used in conjunction with home guard, militias and the recovering sick/wounded and furloughed soldiers in the local area.
For the railroad units, the Superintendent was usually the Company Commander. There was frequent friction between the railroads, especially the main lines, and the officers that called out the guards, since a non-operating railroad stopped all food, troop and munitions movement -- how serious did the threat have to be to shut down the RRs and their shops?
The summer of '64 saw the most use of the guards -- the defense of Macon against Sherman, the Richmond guards (including the government clerks) against several cavalry raids, etc. The scheme did not cost much and did provide additional point defense manpower without drawing troops from the field armies.