  We develop a Bayesian hierarchical modelling approach for cosmic shear power
spectrum inference, jointly sampling from the posterior distribution of the
cosmic shear field and its (tomographic) power spectra. Inference of the shear
power spectrum is a powerful intermediate product for a cosmic shear analysis,
since it requires very few model assumptions and can be used to perform
inference on a wide range of cosmological models \emph{a posteriori} without
loss of information. We show that joint posterior for the shear map and power
spectrum can be sampled effectively by Gibbs sampling, iteratively drawing
samples from the map and power spectrum, each conditional on the other. This
approach neatly circumvents difficulties associated with complicated survey
geometry and masks that plague frequentist power spectrum estimators, since the
power spectrum inference provides prior information about the field in masked
regions at every sampling step. We demonstrate this approach for inference of
tomographic shear $E$-mode, $B$-mode and $EB$-cross power spectra from a
simulated galaxy shear catalogue with a number of important features; galaxies
distributed on the sky and in redshift with photometric redshift uncertainties,
realistic random ellipticity noise for every galaxy and a complicated survey
mask. The obtained posterior distributions for the tomographic power spectrum
coefficients recover the underlying simulated power spectra for both $E$- and
$B$-modes.
