  Dynamical decoupling is a coherent control technique where the intrinsic and
extrinsic couplings of a quantum system are effectively averaged out by
application of specially designed driving fields (refocusing pulse sequences).
This entails pumping energy into the system, which can be especially dangerous
when it has sharp spectral features like a cavity mode close to resonance. In
this work we show that such an effect can be avoided with properly constructed
refocusing sequences. To this end we construct the average Hamiltonian
expansion for the system evolution operator associated with a single ``soft''
pi-pulse. To second order in the pulse duration, we characterize a symmetric
pulse shape by three parameters, two of which can be turned to zero by shaping.
We express the effective Hamiltonians for several pulse sequences in terms of
these parameters, and use the results to analyze the structure of error
operators for controlled Jaynes-Cummings Hamiltonian. When errors are cancelled
to second order, numerical simulations show excellent qubit fidelity with
strongly-suppressed oscillator heating.
