Skip to content

Implement nested volumes#141

Merged
AlvaroEzq merged 8 commits intomasterfrom
aezq_implementNestedVolumes
Dec 10, 2025
Merged

Implement nested volumes#141
AlvaroEzq merged 8 commits intomasterfrom
aezq_implementNestedVolumes

Conversation

@AlvaroEzq
Copy link
Contributor

@AlvaroEzq AlvaroEzq commented Nov 18, 2025

AlvaroEzq Ok: 68 Powered by Pull Request Badge

To address issue rest-for-physics/geant4lib#136.
The rest-for-physics/geant4lib#144 of geant4lib needs to be merged before this one.

Changes of this PR are mainly on the TRestGeant4GeometryInfo::PopulateFromGeant4World function, which is implemented in DetectorConstruction.cxx. These changes are:

  • Before, only the direct children of the world were inspected. Now, a recursive function is defined to traverse the geometry from the world down to all the nested volumes defined in the geometry.
  • Before, the volume names from Geant4 and gdml were matched by assuming they were process in the same order in TRestGeant4GeometryInfo::PopulateFromGeant4World and TRestGeant4GeometryInfo::PopulateFromGdml. Now, the path of mother-to-daughter is obtained for each geant4 physical volume and converted to the corresponding gdml physical volumes mother-to-daughter path naming (more details in Implement nested volumes geant4lib#144).
  • The DetectorConstruction::GetPhysicalVolume function has been updated to account for the new nested volumes structure where children volumes share the same geant4 name (and G4VPhysicalVolume object) across all the mother implementations.

@AlvaroEzq AlvaroEzq requested a review from lobis as a code owner November 18, 2025 18:01
Copy link
Member

@lobis lobis left a comment

Choose a reason for hiding this comment

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

LGTM!

@AlvaroEzq
Copy link
Contributor Author

Thanks but I will wait a little bit to do some deeper testing and make sure I don't change the behaviour of simulations with no nested volumes.

@lobis
Copy link
Member

lobis commented Nov 28, 2025

Thanks but I will wait a little bit to do some deeper testing and make sure I don't change the behaviour of simulations with no nested volumes.

Next time open the PR as draft!

@AlvaroEzq AlvaroEzq marked this pull request as ready for review December 1, 2025 16:18
@AlvaroEzq AlvaroEzq merged commit 82c95df into master Dec 10, 2025
64 checks passed
@AlvaroEzq AlvaroEzq deleted the aezq_implementNestedVolumes branch December 10, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants