Hi all,
For my purposes i will need to record step by step the track of electrons generated from Compton interactions in the detector. My idea was to increase the verbosity to get in the output the position of such particles before each Geant4 step, together with their energy, step length and other details.
So far, i tried modifying the .conf file for GeometryBuilderGeant4 and DepositionGeant4 as below to increase verbosity:
[GeometryBuilderGeant4]
world_material = "vacuum"
log_level_g4cout = INFO
[DepositionGeant4]
record_all_tracks= true
physics_list = FTFP_BERT_PEN
geant4_tracking_verbosity = 1
source_type = "macro"
file_name = "Source_test.mac"
As result i manage to see the desired verbosity on every particle simulated (with position before each step, step lenght, deposited energy and so on) but it is only outputted in the terminal after running allpix -c file_name.conf
. Is there any easy way to have all these information as simulation outputs (txt or root)? Or perhaps to store it in an existing or a new object?
If not yet i would be happy to help implementing such feature, and i would appreciate any idea on what would be a good point to start
Bests
Luca
Hi @luca_tero ,
I see a couple of possibilities to do that.
The poor man’s solution would obviously be to parse this information to a text file. Not so nice, though…
Geant4 also has the option to store the full trajectory (see here), but I haven’t used this yet. It’s stored to Geant4 objects and I don’t know how to access them (yet). One could certainly find that out.
A good solution I assume would be to enhance the ProcessHits
function implemented here. Here, all information on each step of the Geant4 tracking is available and can be used. Hence, one could either implement a direct file output at this position, or blow up the DepositedCharge
object to hold more information on the corresponding tracking step.
I guess a file output would be better in order not to increase the size of each object too much.
Let me know if you need more help!
Cheers
Paul
Hi @pschutze ,
After having a look at the option i might try the last you mentioned, i am having a look at the “step” and “track” classes(?) mentioned in the code to understand what functions i might call to get what from them and save potentially useful information in an output file.
Question is for the output file generated this way which format would you say is best in the general case? Cause for me also txt would work but maybe not the best for everyone?
Bests
Luca