Open jw3126 opened 5 years ago
Hi @jw3126: The geom->isInside(x) function that phase space scoring using the "phase space geometry" method relies on is, unfortunately, subject to roundoff errors, and this is what's happening in your transformed box. For now, I would recommend using the "from regions", "to regions" method of scoring:
:start ausgab object:
name = hello
output format = IAEA
from regions = 0
to regions = 1
particle type = all
output directory = /tmp
library = egs_phsp_scoring
:stop ausgab object:
Of course, this relies on knowledge of the region numbering scheme in the geometry. This is simple in your case above, but can be determined using egs_view in more complex geometries.
Thanks for investigating this! Do I understand these correctly:
The question if a particle hits a boundary is decided by howfar
. This function is consistent with isInside
only up to rounding errors. So when hitting a boundary, region numbers are updated correctly, but isInside
could be true for both/none or one of the geometries.
The issue is not transformed geometry specific, but can easily happen for most kinds of geometry?
Hi @jw3126: Regarding your first point: Yes, the distance to a region boundary is determined by howfar. isInside is an unrelated function and is only used to answer the question of whether the current position is inside the geometry from which it is called. It does not query the region number, which has been set based on howfar. As for your second point: Also, yes, this roundoff error could theoretically happen with any geometry, although this is the first time I've seen it. I think that the inverse transforms required to establish particle position/direction with respect to a transformed geometry may be introducing the errors in this case. Interestingly enough, when tbox is translated in the +Z direction, I don't see the issue. Still, the "phase space geometry" method was intended to work with any geometry (compound, transformed, etc) and so, until an accurate method of determining whether a particle is inside a geometry or not (using an as-yet-uncoded isInside method based on regions, perhaps), I would recommend using the "from/to regions" method just to be on the safe side.
Thanks for answering these!
When use the new egs_phsp_scoring on transformed geometries, I sometimes get strange results. Namely scored particles are not at the boundary of the scoring geometry. Here is an example:
These are the positions of the first few particles of the phsp. I would expect that almost all particles enter from the top e.g. have
z=5.0
. However a lot of the particles are somewhere in the middle of the volume instead.