-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name duplicates of materials not always checked #195
Comments
So in general this is the expected behaviour. Not adding the registry to the constructor means there isn't actually a name clash. The issue of this is fundamentally GDML is a global name space file format. The registry exists to check name clashes in a name space. So a registry is a namespace. Not giving the registry is the way of not adding a "name" i.e X to the material name space. So there isn't an easy way to check for name clashes without explicity providing the registry. |
This is essentially a bug I found in our (LEGEND) code, that was just masked for a very long time. The bug in our code is now fixed... So this issue just boils down to some things I noticed; but I am not sure if we should/can fix them:
|
So if I understand correctly. This only punches through with elements/materials? I suppose it could be solids too. I think maybe the best way to proceed is to warn the user the GDML is not valid. I'll take a look and get back to the issue. So the convention around adding or not adding the registry is related to if something should be written out at the top of the gdml. This is particularly relevant for defines, positions etc. Not relevant at all for materials. So it reduces to the case if we want to define something temporarily and not write it. This is definitely the case for variables and potentially solids. So two solutions are
What you you think? |
Yeah, it could also be the case or solids (i.e. regstering a LV with an unregistered solid). One idea I had (somewhat similar to your idea "2"):
In the case of materials the current check is just "too late" to check the recursive relation Material -> Element -> Isotope:
|
Two small test cases, the first checks the name duplicate; the second one does not. The only difference is that no registry is passed in the second element constructor.
output:
Interestingly, the second still produces a GMDL file that Geant4 can read just fine - i.e. elements and materials appear to have different "namespaces"/stores in Geant4?
Maybe pyg4ometry should also split the names to check? (I know, that would be quite a substantial checks)
The text was updated successfully, but these errors were encountered: