Study of the conditions of forming a dense plasma on injecting an electron beam into a magnetic trap