LDMX-Software / SimCore

Integration of Geant4 simulation framework into a more generalized event processing framework.
2 stars 0 forks source link

get process manager from particle singleton #102

Closed tomeichlersmith closed 1 year ago

tomeichlersmith commented 1 year ago

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.

EinarElen commented 1 year ago

Thanks for fulfilling my comment from a whole back :)

tomeichlersmith commented 1 year ago

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.