Brewers dictionary of phrase and fable says:-
'The expression may derive from the phrase to the set the cock a hopp, a hoop being a full measure of grain so therefore living well. Equally, the word could derive from the fact that when the 'spigot' or 'cock' is removed from the beer barrel and laid on a hoop of the barrel, the beer flows freely.