Help with using a text file as an input for ParticleGun

Hello, I am having trouble with trying to use a text file with information about muons as an input for ParticleGun. Basically what I am trying to do is as follows. Every column on the text file represents a diferent quantity of the particle, like energy and direction, and every line represents a diferent muon with diferent quantities. What I do to read the file is to use a while condition to read each line and assign every caracteristic of each column to the differents particlegun functions. The problems is that when I run my code and try to extract individual information of each particle like its deposited energy what i get instead is the overall sum of every event. I dont have any clue what to do.

I am not sure your description of the problem is sufficient. Can you post some code? Your particle gun implementation plus how/where do you check that the problem occurs.