-
Notifications
You must be signed in to change notification settings - Fork 1
Unify output tree for particles/trajectories #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
One possibility that comes to mind is the saving only particles that leave hits + all their ancestors; so basically:
Basically, we would first store all track IDs of interest as we loop over the hits in AnalysisManager. |
|
Thanks @mvicenzi, this sounds like a nice idea! I'll review this as soon as I get some time |
Thanks! Don't worry -- take your time for the review, I will also need to push new updates. |
|
I have pushed the latest changes -- I think this is a good compromise, and the file sizes are now more reasonable. |
This PR closes #18
It includes the following changes:
The
primariesoutput tree is removed; simplified primary particles info is now saved in theeventtree for each vertex, while full information can be found in the newparticlestree.Full particle truth is moved into a general
particlestree. By default, this tree stores the following particles:-- all primaries;
-- all particles leaving hits in any SD;
-- all ancestors of any particle leaving hits in any SD;.
This tree is the last to be filled as particles (and their ancestors) are registered to be saved while looping the hits for the other output trees. It should provide all that's needed to recover the particle hierarchy of interest.
The
particlestree can be forced to save all particles in the event (regardless of whether they left hits or not) by setting the/out/saveAllParticlestotrue. Note that in this case the output file can grow quickly and become quite big.The
particlestree can also be expanded to store the full particle trajectories by setting the/out/saveTrajectoryparameter totrue(needed by FPFDisplay).A custom
FPFTrajectoryclass now replaces the standardG4Trajectory. These trajectories are used to fill the newparticlestree. This new class optionally disables storing individual trajectory points. As a result, if/out/saveTrajectoryisfalse, G4 only stores light-weight tracks, which is better for memory usage.StackingActionnow fills two associations: one mapstrack_idinto itsparent_idand the second mapstrack_idto itsancestor_id(ie, the track id of the primary particle from which it came from). These two associations are used by theAnalysisManagerfor its particle-saving logic.The computation of the ACTS-style barcode/
particle_idis now perfomed by an helper function: to speed things out, values are cached in a map so they can be retrieve by all functions without re-computing. The above associations are used in this function to determine the number of generations of a particle from its ancestor.The ACTS
particlestree is removed in favor of the generic one which now contains the same (and more!) information.Let me know what you think/ if you have suggestions!
EDIT: update description after latest changes.