  The measurement of a reaction cross section from a pulse height spectrum is a
ubiquitous problem in experimental nuclear physics. In $\gamma$-ray
spectroscopy, this is accomplished frequently by measuring the intensity of
full-energy primary transition peaks and correcting the intensities for
experimental artifacts, such as detection efficiencies and angular
correlations. Implicit in this procedure is the assumption that full-energy
peaks do not overlap with any secondary peaks, escape peaks, or environmental
backgrounds. However, for complex $\gamma$-ray cascades, this is often not the
case. Furthermore, this technique is difficult to adapt for coincidence
spectroscopy, where intensities depend not only on the detection efficiency,
but also the detailed decay scheme. We present a method that incorporates the
intensities of the entire spectrum (e.g., primary and secondary transition
peaks, escape peaks, Compton continua, etc.) into a statistical model, where
the transition intensities and branching ratios can be determined using
Bayesian statistical inference. This new method provides an elegant solution to
the difficulties associated with analyzing coincidence spectra. We describe it
in detail and examine its efficacy in the analysis of
$^{18}$O(p,$\gamma$)$^{19}$F and $^{25}$Mg(p,$\gamma$)$^{26}$Al resonance data.
For the $^{18}$O(p,$\gamma$)$^{19}$F reaction, the measured branching ratios
improve upon the literature values, with a factor of 4 reduction in the
uncertainties.
