Design of a carbon nanotubes based electron gun for THz device