Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

get process manager from particle singleton #102

Merged
merged 4 commits into from
Oct 27, 2023

Conversation

tomeichlersmith
Copy link
Member

@tomeichlersmith tomeichlersmith commented Oct 23, 2023

In my adventures with Geant4 developing the G4DarkBreM package, I found that recent versions (at least all since our tag of 10.2) have a method for accessing a particle's process manager from the particle itself. Since the particle is a singleton created when requested, we can always access it and ask for the process manager. If we call the function too early in processing (perhaps if we were to manually call GammaPhysics::ConstructProcess at the wrong time during initialization), then the manager would not be created and attached yet, but this will work if we allow G4 to call ConstructProcess at the right time.

To Do

I just copied this in-browser so I haven't even tried compiling it yet.

  • get compiling and running
  • check tests in ldmx-sw specifically focused on gamma conversion ones

In my adventures with Geant4 developing the G4DarkBreM package, I found that recent versions (at least all since our tag of 10.2) have a method for accessing a particle's process manager from the particle itself. Since the particle is a singleton created when requested, we can always access it and ask for the process manager. If we call the function too early in processing (perhaps if we were to manually call `GammaPhysics::ConstructProcess` at the wrong time during initialization), then the manager would not be created and attached yet, but this will work if we allow G4 to call `ConstructProcess` at the right time.
@EinarElen
Copy link
Contributor

Thanks for fulfilling my comment from a whole back :)

@tomeichlersmith
Copy link
Member Author

I ran Biasing/test/target_mumu.py with this branch and with the SimCore v1.7.0 which is what is on ldmx-sw trunk right now and I got no difference (besides the timestamps) in the output files.

[ldmx] tom@appa:~/code/ldmx/ldmx-sw$ ldmx tree-diff -i timestamp -t LDMX_Events target_mumu.root dev-target_mumu.root
Warning in <TClass::Init>: no dictionary for class ldmx::EventHeader is available
Warning in <TClass::Init>: no dictionary for class pair<int,ldmx::SimParticle> is available
Warning in <TClass::Init>: no dictionary for class ldmx::SimParticle is available
Warning in <TClass::Init>: no dictionary for class ldmx::SimTrackerHit is available
Warning in <TClass::Init>: no dictionary for class ldmx::SimCalorimeterHit is available
Warning in <TClass::Init>: no dictionary for class ldmx::RunHeader is available
[ldmx] tom@appa:~/code/ldmx/ldmx-sw$ echo $?
0

tree-diff is a comparison tool I've worked on off-and-on over the years. https://github.com/tomeichlersmith/root-diff/
It is very helpful to double checking small developments since it checks the content of the TTree without constructing the branches in memory allowing it to scan very efficiently.

Copy link
Contributor

@EinarElen EinarElen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Nice to see this TU cleaner :)

include/SimCore/GammaPhysics.h Outdated Show resolved Hide resolved
src/SimCore/GammaPhysics.cxx Outdated Show resolved Hide resolved
@tomeichlersmith tomeichlersmith merged commit f1988b5 into trunk Oct 27, 2023
1 check passed
@tomeichlersmith tomeichlersmith deleted the simplify-get-process-manager branch October 27, 2023 14:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants