Add support for displaced solid#34
Conversation
agheata
left a comment
There was a problem hiding this comment.
I suggest to use a box instead an orb, other than that I think this is good to be merged
|
Doesn't a box have more data and use more conditionals to test "is inside"? Also can you please provide an example of the failing geometry so I can test? 😊 |
Yes but what matters most is the distance computation
We only found it in he full ATLAS, and we cannot have a GDML version of that, because GDML does not support displaced solids. To test, you can modify a line in whatever G4 example, e.g. at https://gitlab.cern.ch/geant4/geant4-dev/-/blob/master/examples/extended/persistency/gdml/G02/src/G02DetectorConstruction.cc#L460 and run G4VG on that geometry, but you can do it with even simpler examples by replacing any of the solids with |
|
I'm confused about the example: is that a reflection of a reflection, with an empty transform occupying the original space? :\ I've just added a test with a raw displaced solid. I also am using a union with a zero-size unplaced box, since the intersection capacity returned nan. |
I'm not sure what the example does, but it does not matter as long as it gives the same output when replacing with a zero-displaced solid. Probably the example replacing a reflection is not the best, indeed. The capacity can only be estimated by sampling, and this gives nan because there are no points sampled inside due to the very big box. Union is problematic because it generates a bounding box that contains the origin, even if the displaced solid is located far away. You can still use the intersection, but you don't need to use an infinity box; just use one with a size equal to the magnitude of the displaced solid translation components plus the diagonal of the undisplaced solid extent. |
We can't really test whether our implementation is correct unless the displaced and non-displaced solids are distinguishable. But anyway, I think the implementation is complete and working: give it a try! |
|
@agheata @SeverinDiederichs @drbenmorgan If you can test this with ATLAS, please let me know if it works! |
|
Thanks for this important addition @sethrj, greatly appreciated! |
SeverinDiederichs
left a comment
There was a problem hiding this comment.
Thanks for the addition!
This models a displaced solid as an intersection of a regular solid with an infinite sphere. It'll obviously be less efficient than directly transforming a solid but it's at least a way of giving the capability now and waiting for optimization later.