GDML is preprocessed only once in a line.

Issue #336 resolved
Robin Tesse created an issue

I defined a line with two elements based on the same GDML file. But the GDML is processed only once, and the logical volume's name for the second element is the same as the first element (see screenshot).

I think the GDML must be preprocessed for every element, even if the GDML is the same. I added a minimal working example to reproduce the bug.

Comments (4)

  1. Laurie Nevay

    I wrote a good explanation of this and a proposed solution. Bitbucket’s website just lost the text and didn’t save it when I clicked save. I’ll report in tomorrow’s meeting.

  2. Laurie Nevay

    So this is a bug. There are lots of parameters (e.g. field, region, biasing) that could make an instance of the loaded gdml unique. By just reusing it there effectively is a huge bug where biasing or cuts etc could be wrong. Now, if we reuse an element by name, it by definition should be identical. By definition, elements are uniquely defined by their name, so I’ve changed the code to now use a pair of <geometry file name, component to be used in name> as the key in the registry that caches geometry.

    In the attached example, the GDML is preprocessed twice because of this.

    Preprocessing is relatively slow but I’m afraid there’s no alternative if we have unique fields etc - we must reload the geometry and it must be preprocessed to avoid degenerate names where Geant4 would just return the existing objects.

  3. Laurie Nevay

    Fix Issue #336. Use a pair of <file name, component name> for the cache of external geometry. If it's got a unique component tname, then we should preprocess and load again.

    → <<cset 7ea8725e06d5>>

  4. Log in to comment