Get particles' information and output a ROOT file

Hi, everyone!
I’m trying to do some neutron moderation simulations using Geant4, and I’d like to analysis the data by ROOT. I have checked exampleB4 but I was quite confused. I found the code which creat a ROOT file, open it and then close it after a run. BUT I could not find which part of code works for getting the information and which part works for writing information into ROOT file. Would anyone like to give me some clues?
Thanks in advance!

Lan

Look in B4aEventAction.cc. Filling is done by the analysisManager.

Daer mkelsey,
Thank you very much! And I also found something in guide book, I will try to figure it out.