Problem 2145 - G4LogicalVolume null FieldManager propagation
Summary: G4LogicalVolume null FieldManager propagation
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/management (show other problems)
Version: 10.5
Hardware: All All
: P4 minor
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2019-03-08 00:39 CET by Jason Brodsky
Modified: 2019-03-08 13:41 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Jason Brodsky 2019-03-08 00:39:38 CET
https://github.com/Geant4/geant4/blame/master/source/geometry/management/src/G4LogicalVolume.cc#L307

At this line, when a daughter volume is added, the daughter recursively inherits the mother's FieldManager.

In a simulation with no FieldManager, every placement will recursively (re)set the FieldManager of every logical volume in the whole tree to 0. But, the FieldManager is 0 by default, and doesn't need to be set to 0 again.

This causes a slowdown during geometry setup when any mother has a large number of daughters. The work-per-daughter is small (setting a single pointer to 0, when it is already 0), but it can be done many times.

Line 307 should be changed to only propagate the FieldManager when the FieldManager is not 0. Alternatively, Line 265 could be changed to the same effect.
Comment 1 Gabriele Cosmo 2019-03-08 13:41:59 CET
Thanks for reporting this. A fix has now been introduced in the development branch and will be made available in the next patch release.