Laser wakefield accelerator in a plasma pipe with self-modulation of the laser pulse