Re: Region number from point position.

From: Alfredo Ferrari (
Date: Mon Feb 11 2008 - 11:22:26 CET

  • Next message: Sunil C: "Fluka on Fedora core 8(x86_64)"


    in principle one can call the following subroutine:

        CALL GEOREG ( X, Y, Z, NREG, IDISC )

    where X, Y, Z are the coordinates of the point where you want to know the
    region (returned in NREG) and the lattice (returned in MLATTC in common
    LTCLCM). IDISC is a flag which if different from zero signals you are
    already out or going out of the geometry.

    Actually the situation is slightly more complex:

    a) GEOREG is very CPU ineffective like all "point" like geometry calls: it
        is ok to use it provided this is not done too often (geometry tracking
        based on a sequence of GEOREG calls instead of real tracking calls
        could be thousands of times slower in complex geometries). GEOREG
        loops on all regions/lattices until it finds where the point lies.
        On the contrary real step like calls can exploit many effective
        optimizations which makes them able to check at maximum 2/3 regions
        even in complex geometries
    b) GEOREG should be called with care when X,Y,Z lies on the boundary
        between two regions. This is a very common situation at run time, since
        all steps meeting a boundary end up exactly in that situation.
        The region returned by GEOREG in that case can be (pseudo-randomly)
        any of the two regions separated by that boundary, and there is no
        guarantee that the one returned is coherent with the one returned by
        the last tracking step. More specifically, the last step direction
        cosines are used to decide which region/lattice is returned (the one
        returned is the one the direction is pointing "into" if X,Y,Z lies
        on a boundary, even though the "current" direction referred to a
        step in a completely different position). In case one wants to input
        his own choice of cosines for this purpose (and for this purpose only),
        the call to GEOREG must be preceded by a call to:
               CALL GEOCRS ( TXX, TYY, TZZ )
        where TXX, TYY, TZZ are the direction cosines (properly normalized to
        1 in double precision)
    c) It is safer to save MLATTC/NEWLAT (common LTCLCM) before the call to
        GEOREG and restore them after, if GEOREG is called from unexpected
        situations (ie in the middle of an event). Furthermore in those cases
        the tracking optimization will be destroyed for the next step resulting
        in some CPU penalty

    It would be better to know more about where/why you need this info, in
    order to help better in devising the correct solution.


    On Fri, 8 Feb 2008, Biagio Di Micco wrote:

    > Dear all,
    > I need a function that takes the coordinates of a point in input
    > and returns the region number where the point is (and the lattice number, if
    > it is a lattice replica).
    > Is there any function in the FLUKA library that I can use?
    > Thanks in advance
    > Biagio

    |  Alfredo Ferrari                ||  Tel.: +            |
    |  CERN-AB                        ||  Fax.: +            |
    |  1211 Geneva 23                 ||  e-mail:  |
    |  Switzerland                    ||                                   |

  • Next message: Sunil C: "Fluka on Fedora core 8(x86_64)"

    This archive was generated by hypermail 2.1.6 : Mon Feb 11 2008 - 11:51:47 CET