PKMuon / PKMUON_2024

PKMuon software 2024
0 stars 0 forks source link

Review Geant4 simulation code #3

Closed lyazj closed 3 months ago

lyazj commented 3 months ago

After the complete clean, removing temperately irrelevant codes, after commit b611a46, the number of lines drops to 1266, bringing much less complicated or coupled context to work on.

$ wc -l src/*.cc include/*.hh 
   49 src/ActionInitialization.cc
  375 src/DetectorConstruction.cc
   46 src/EventAction.cc
   47 src/GpsPrimaryGeneratorAction.cc
   49 src/RunAction.cc
  106 src/Run.cc
   33 src/RunMessenger.cc
   89 src/SteppingAction.cc
   43 include/ActionInitialization.hh
  104 include/DetectorConstruction.hh
   43 include/EventAction.hh
   11 include/GetSeedFromTime.hh
   56 include/GpsPrimaryGeneratorAction.hh
   53 include/RunAction.hh
   54 include/Run.hh
   52 include/RunMessenger.hh
   56 include/SteppingAction.hh
 1266 total

Several probably problematic or improvable places are marked with XXX, FIXME, or TODO, let's try to eliminate the markers to make the code nearly 100% reliable.

lyazj commented 3 months ago

See https://github.com/PKMuon/PKMUON_2024/blob/main/src/DetectorConstruction.cc, for example. Declarations of geometrical objects are compacted highlighting their relationships. However, definitions of the constants and the formulas do need to be reviewed and consolidated.

lyazj commented 3 months ago

Commit https://github.com/PKMuon/PKMUON_2024/commit/727f8531c90534a6c6262ebe91f70faacf1f116d is UB-free concluded by valgrind generating 10 events. Memory leaks exist but only tens of megabytes are affected so we can ignore it. More investigations should be focusing on geometry configuration.

lyazj commented 3 months ago

[IMPORTANT] Many components are put into RPC. As now RPC contains vacuum, and most components have a negligibly smaller size than RPC box, so most of RPC is vacuum now. This may lead into no scatter in RPC.

lyazj commented 3 months ago

Even changing the material of RPC box may solve current issues, I strongly recommend a complete review on the geometrical configurations. It is vital to the correctness of our simulation.

lyazj commented 3 months ago

3582757

Now we use the term RPC exclusively, following the history. Mixing use of RPC and GEM always causes confusion. More bugs (e.g., the misuse of cu1 to cu2) are corrected here. I believe there are more to be discovered.

lyazj commented 3 months ago

0cd9045

We have complete yaml files to describe the geometry now. Please check them to help correct any detailed error.

https://github.com/PKMuon/PKMUON_2024/tree/main/config

lyazj commented 3 months ago

https://github.com/PKMuon/PKMUON_2024/commit/a16f528d6e7edbaaad702fcfddcff792489ebbb8

Close with geometry completely checked.