  A model of a lossy nonlinear fiber grating with a "hot spot", which combines
a local gain and an attractive perturbation of the refractive index, is
introduced. A family of exact solutions for pinned solitons is found in the
absence of loss and gain. In the presence of the loss and localized gain, an
instability threshold of the zero solution is found. If the loss and gain are
small, it is predicted what soliton is selected by the energy-balance
condition. Direct simulations demonstrate that only one pinned soliton is
stable in the conservative model: solitons with a larger energy relax to it via
emission of radiation, while those with a smaller energy decay. In the model
with the loss and gain, stable pinned pulses demonstrate persistent internal
vibrations and emission of radiation. If these solitons are nearly stationary,
the prediction based on the energy balance underestimates the necessary gain by
10% to 15% (due to radiation loss). If the loss and gain are larger, the
intrinsic vibrations of the pinned soliton become chaotic. The local gain
alone, without the attractive perturbation of the local refractive index,
cannot maintain a stable pinned soliton. For collisions of moving solitons with
the "hot spot", passage and capture regimes are identified, the capture
actually implying splitting of the soliton.
