Repository navigation
Fix process observables and documentation of TRestGeant4AnalysisProcess - #156
Merged
Merged
Conversation
- Implement <volume><Process>Process observables (energy deposited in the volume by the process, in keV), which were parsed but never filled. - Add an explicit REST <-> Geant4 process name table and replace the hardcoded-length parser with suffix matching against known names. - Implement PerProcess* sensitive volume energy observables (the local fObservables vector was shadowing the member and they never reached the tree). - Generalize containsProcess<Process> to any process requested in the RML. Guard against unregistered processes, whose default id (0) matches "Init". - Clear auxiliary vectors in InitProcess, which is called twice. - Rewrite the class documentation to match the implemented observables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Contributor
Author
|
I did a quick test by myself and seems to work fine. |
Anakintana
approved these changes
Oct 9, 2026
Member
|
Just wondering if one could pass the code of each C++ class to IA with strict instructions to do not modify code, and improve the Doxygen documentation of the class automatically, including REAME files at each directory once the agent understands the context of a given directory. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The class documentation of
TRestGeant4AnalysisProcessdid not match the code, and several documented observables were never computed. This PR implements them and rewrites the documentation.Observables
<volume><Process>Process(e.g.gasComptonProcess): previously parsed inInitProcessbut never filled. They now hold the energy (keV) deposited in that volume by that process, usingTRestGeant4Event::GetEnergyInVolumePerProcessMap(), which is consistent with<volume>VolumeEDep.GetRestToGeant4ProcessNameMap()), and Geant4 names with a capital first letter are accepted (Compt,HadElastic,NCapture...). The hardcoded-length parser is replaced by matching the longest known process name before theProcesssuffix. An unknown name prints a warning listing the valid names. The legacy spellingsBremstralung,RadiactiveDecayandNInelasticare still accepted.PerProcess*(perProcessSensitiveEnergy): a localfObservablesvector was hiding the class member, so these never reached the tree. They are now registered and filled with the energy in the sensitive volume per process, normalized to the sensitive volume energy ifperProcessSensitiveEnergyNormis set.containsProcess<Process>: works for any process.PhotandComptare always filled, as before. Any other process is filled only if requested in the RML, soobservable="all"does not add extra branches.Bug fixes
TRestGeant4PhysicsInfo::GetProcessID()returns0for unknown names, and0is the ID ofInit. As a result,containsProcess<X>returned 1 for processes absent from the simulation. The process is now checked to be registered before testing it.InitProcess()is called twice byTRestThread, which duplicated the auxiliary vectors. They are now cleared first.Known limitation (documented)
restG4 builds process IDs as
type*1000+subtype, soeIoni,hIoni,ionIoniandmuIonishare an ID and only one name is registered.containsProcesscannot distinguish between them. The energy-based observables are keyed by name and are not affected.Documentation
The Doxygen header is rewritten. It now covers:
volume="...") and the active-volume requirementTracksCounter/TracksEDepexamplesfirstTrackInSensitive*,sensitiveVolume*,*PrimaryParticleNameandzenith*DegreesobservablesTesting
Tested on a 10-event 252Cf restG4 simulation:
-Wall -Wextra).containsProcessNCapture,NeutronInelasticandHadElasticmatch an independent hit-by-hit check.shieldingHadElasticProcess(23–284 keV),shieldingComptonProcessandshieldingPhotProcessare non-zero.sensitiveVolumeEnergy.Not tested:
perProcessSensitiveEnergyNorm=true, and the particle-specificPerProcesscategories, which were 0 in the sample.🤖 Generated with Claude Code