Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -17,44 +17,336 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
Nov 20th, 2012 - G.Cosmo (geomnav-V09-05-45)
|
||||
------------------------
|
||||
- Corrected G4Exceptions tags and text.
|
||||
|
||||
Nov 15th, 2012 - G.Cosmo (geomnav-V09-05-44)
|
||||
------------------------
|
||||
- Code cleanup.
|
||||
|
||||
Nov 6th, 2012 - J.Apostolakis (geomnav-V09-05-43)
|
||||
------------------------------
|
||||
- G4SafetyHelper: fixed ComputeSafety(), to adapt it to use ComputeSafety()
|
||||
with extra argument. It was passing a boolean for this argument.
|
||||
That was correct until the additional argument was added.
|
||||
|
||||
Nov 6th, 2012 - J.Apostolakis (geomnav-V09-05-42)
|
||||
------------------------------
|
||||
- G4Navigator::ComputeSafety(): made the 'old' safety default (the one
|
||||
provided by G4VoxelNavigation.
|
||||
- G4VoxelSafety: in ComputeSafety(), provide the mother safety in the call
|
||||
to SafetyForVoxelHeader() as initial value; optimisation, to reduce number
|
||||
of voxels searched.
|
||||
In SafetyForVoxelHeader(), if point is outside boundaries of voxel 'Min' or
|
||||
'Max' coordinates, then corresponding 'distance' will be negative.
|
||||
Must never consider this direction to move: Reset that distance to DBL_MAX.
|
||||
Cosmetic changes in SafetyForVoxelHeader(): added explanation: why must
|
||||
'pointNodeNo' be normalised; revised asserts, corrected comments and removed
|
||||
old ones; added 'depth' to some diagnostic printouts.
|
||||
|
||||
Nov 9th, 2012 - G.Cosmo (geomnav-V09-05-41)
|
||||
-----------------------
|
||||
- G4RegularNavigationHelper: added newline at the end of file to avoid
|
||||
compilation warnings on clang.
|
||||
|
||||
Nov 9th, 2012 - G.Folger (geomnav-V09-05-40)
|
||||
------------------------
|
||||
- G4RegularNavigationHelper: transform it to real singleton from static
|
||||
utility class, created upon first use; make vector of 'Steplengths' a data
|
||||
member.
|
||||
- Adapted G4RegularNavigation to use G4RegularNavigationHelper singleton calls.
|
||||
- Co-works with procscore-V09-05-05, which requires it.
|
||||
|
||||
Nov 6th, 2012 - J.Apostolakis (geomnav-V09-05-39)
|
||||
------------------------------
|
||||
- Fix for compiler warning from gcc 4.7.
|
||||
|
||||
Nov 6th, 2012 - J.Apostolakis (geomnav-V09-05-38)
|
||||
------------------------------
|
||||
- G4VoxelSafety::SafetyForVoxelNode(): corrected calculation of 'pointNodeNo'
|
||||
to ensure it corresponds to a physical node ( range: 0 to Max-1 ).
|
||||
Reason: it is possible for the Min and Max of a voxel NOT to contain the
|
||||
current location along an axis (at lower levels only, not top level).
|
||||
Interface change: added const pointer to Physical volume (for printing).
|
||||
|
||||
Nov 5th, 2012 - J.Apostolakis (geomnav-V09-05-37)
|
||||
------------------------------
|
||||
- G4VoxelSafety::SafetyForVoxelHeader(): use 'minSafety' and 'maxLength' to
|
||||
prune search tree for optimisation. Pass along 'minSafety' to lower levels.
|
||||
Also keep safety at this level and below (NOT above) as 'ourSafety'
|
||||
Return 'ourSafety', not updated value of 'minSafety'.
|
||||
Arguments: use *squared* distance-to-upper-depth, and add previous
|
||||
minimum safety.
|
||||
Revised calculation of square distance-to-upper-depth, adding square of
|
||||
current level distance (previously, using maximum of previous and current
|
||||
level, to avoid square root).
|
||||
Printing only under the flag 'G4DEBUG_NAVIGATION', not G4VERBOSE.
|
||||
|
||||
Nov 1st, 2012 - J.Apostolakis (geomnav-V09-05-36)
|
||||
------------------------------
|
||||
- G4VoxelSafety: hidden verbose output under G4DEBUG_NAVIGATION.
|
||||
|
||||
Nov 1st, 2012 - J.Apostolakis (geomnav-V09-05-35)
|
||||
------------------------------
|
||||
- G4VoxelSafety: do not check whether 'input' safety position is inside volume
|
||||
except if G4DEBUG_NAVIGATION is set.
|
||||
|
||||
Nov 1st, 2012 - J.Apostolakis (geomnav-V09-05-34)
|
||||
------------------------------
|
||||
- G4VoxelSafety: revised end condition to use distance of previous depths
|
||||
sqr(distAxis) + sqr(distUpperDepth) < sqr(minSafety).
|
||||
Streamlined printing, and move it behind G4DEBUG_NAVIGATION.
|
||||
Added count of nodes checked.
|
||||
- G4Navigator: fix for compilation warning. Small change in printing.
|
||||
Streamlined use of (new) G4VoxelSafety. Check its results only if
|
||||
G4DEBUG_NAVIGATION is set.
|
||||
NOTE: continues to use *new* safety (best safety).
|
||||
|
||||
Nov 1st, 2012 - G.Cosmo (geomnav-V09-05-33)
|
||||
------------------------
|
||||
- G4ReplicaNavigation: fixed compilation warning and some code cleanup...
|
||||
|
||||
Nov 1st, 2012 - J.Apostolakis (geomnav-V09-05-32)
|
||||
------------------------------
|
||||
- G4Navigator: changed to use *new* safety (best safety), as a trial.
|
||||
Added information for problem of 'not calculated' normal in
|
||||
GetGlobalExitNormal().
|
||||
Revised operator << to print all state (adapted from PrintState()),
|
||||
not just history. Hidden unused code in GetLocalExitNormalAndCheck().
|
||||
|
||||
Oct 31st, 2012 - J.Apostolakis (geomnav-V09-05-31)
|
||||
------------------------------
|
||||
- G4VoxelSafety: improved reporting of potential issues, e.g. (nodeNo==0).
|
||||
- G4VoxelNavigation: added a simple check whether point in ComputeSafety()
|
||||
call is inside current volume.
|
||||
|
||||
Oct 30th, 2012 - J.Apostolakis (geomnav-V09-05-30)
|
||||
------------------------------
|
||||
- G4VoxelSafety: use distance to reduce search length.
|
||||
|
||||
Oct 30th, 2012 - J.Apostolakis (geomnav-V09-05-29)
|
||||
------------------------------
|
||||
- G4VoxelSafety: find distance to voxel boundary at current level.
|
||||
Decide next node using distance.
|
||||
|
||||
Oct 30th, 2012 - J.Apostolakis (geomnav-V09-05-28)
|
||||
------------------------------
|
||||
- G4VoxelSafety: fixed logic to find next voxel up and down.
|
||||
|
||||
Oct 29th, 2012 - J.Apostolakis (geomnav-V09-05-27)
|
||||
------------------------------
|
||||
- G4ReplicaNavigation: get additional information in case of 'Out-of-Volume'
|
||||
exception. Hide debug printout with (fVerbose>2).
|
||||
- G4SafetyHelper: introduced check of length for relocation method
|
||||
LocateGlobalPointWithinVolume() to check move against safety.
|
||||
Works if Verbose Level > 0.
|
||||
- G4VoxelSafety: eliminated debug printouts (hidden in 'if fVerbose > 2').
|
||||
Reset 'fCheckMode' in constructor.
|
||||
|
||||
Oct 29th, 2012 - J.Apostolakis (geomnav-V09-05-26)
|
||||
------------------------------
|
||||
- G4ReplicaNavigation: fix for compilation issues (shadowing/unused variables).
|
||||
|
||||
Oct 26th, 2012 - J.Apostolakis (geomnav-V09-05-25)
|
||||
------------------------------
|
||||
- Fix for G4ReplicaNavigation: set 'calculatedExitNormal' flag correctly.
|
||||
|
||||
Oct 26th, 2012 - J.Apostolakis (geomnav-V09-05-24)
|
||||
------------------------------
|
||||
- Revised G4Navigator to use G4VoxelSafety and to check its results
|
||||
against those of G4NormalNavigation::ComputeSafety().
|
||||
NOTE: *SLOW* - Calculates safety 3 times for voxel volumes
|
||||
for checking only, not for production!
|
||||
- G4VoxelSafety: improved to use equivalent nodes (still checks all voxels).
|
||||
Changed arguments and members to make G4SmartVoxelHeader into const.
|
||||
- G4ReplicaNavigation: small cleanup, mostly cosmetic.
|
||||
|
||||
Oct 23rd, 2012 - J.Apostolakis (geomnav-V09-05-23)
|
||||
------------------------------
|
||||
- G4ReplicaNavigation: fixed compiler warning on use of 'perMillion'.
|
||||
|
||||
Oct 23rd, 2012 - J.Apostolakis (geomnav-V09-05-22)
|
||||
------------------------------
|
||||
- Incorporated fixes made for tag "geomnav-V09-05-18" (in Fix-line).
|
||||
- G4Navigator::GetGlobalExitNormal(): corrected use of cached global normal
|
||||
value; use it only when ComputeStep() was last called.
|
||||
- G4Navigator, G4MultiNavigator and G4ErrorPropagationNavigator: changed
|
||||
default of 3rd argument of ComputeSafety to true.
|
||||
- G4Navigator: changed GetSavedState() and RestoreSavedState() methods to
|
||||
protected (from public). Extended the state saved by these methods.
|
||||
- G4ErrorPropagationNavigator: cosmetic change to improve readability of
|
||||
initialisation of a double.
|
||||
|
||||
Oct 15th, 2012 - J.Apostolakis (geomnav-V09-05-21)
|
||||
------------------------------
|
||||
- G4PropagatorInField & G4VIntersectionLocator: changed first two arguments
|
||||
of IntersectChord() to const 3-vec references.
|
||||
- G4VIntersectionLocator: fixed return value of validNormal of
|
||||
GetSurfaceNormal(). Made const the first argument of GetLastSurface() normal.
|
||||
- G4ErrorPropagationNavigator: revised interface of ComputeSafety(), making
|
||||
'true' default value of the 3rd argument.
|
||||
Cosmetic change to improve readability of initialisation of a double.
|
||||
- G4ReplicaNavigation: small revision to printout, to improve end-of-line.
|
||||
|
||||
Oct 15th, 2012 - J.Apostolakis (geomnav-V09-05-20)
|
||||
------------------------------
|
||||
- G4Navigator: enabled code that finds the entering normal for the case of
|
||||
replicas! When entering a volume, the same code can find the entering normal
|
||||
in the case of replicas, as in the case of other types of volumes (normal,
|
||||
parameterised). Improved error message, changing it into an Exception. (#5)
|
||||
- G4ReplicaNavigation: transform exitNormal to Grand-mother reference frame
|
||||
(was current=mother). Fix starting depth for 'while': had made it top-2,
|
||||
not top-1=2nd level.
|
||||
|
||||
Oct 15th, 2012 - J.Apostolakis (geomnav-V09-05-15) - Fix-line
|
||||
------------------------------
|
||||
- G4Navigator: hidden exception with #ifdef for unsupported Exit Normal
|
||||
in Replicas.
|
||||
|
||||
Oct 13th, 2012 - J.Apostolakis (geomnav-V09-05-14) - Develop-line
|
||||
------------------------------
|
||||
- G4ReplicaNavigation: extended it to calculate ExitNormal. First version.
|
||||
Now calculates it at each 'depth', and also for daughter; used to calculate
|
||||
it only for exiting mother, i.e. current.
|
||||
- G4Navigator: GetExitNormal(): set 'fCalculatedExitNormal' in case of 'Valid'
|
||||
(convex) normal. Re-activate printing for missing exit Normal in case of
|
||||
Replica (define G4DEBUG_NAVIGATION 1).
|
||||
|
||||
Oct 11th, 2012 - J.Apostolakis (geomnav-V09-05-13) - Fix-line
|
||||
------------------------------
|
||||
- Ignoring previous tag.
|
||||
|
||||
Oct 11th, 2012 - J.Apostolakis (geomnav-V09-05-12) - Develop-line
|
||||
------------------------------
|
||||
- G4Navigator::GetLocalExitNormal(): hidden exception warning for missing
|
||||
Exit Normal (it remains 'protected' under #ifdef G4DEBUG_NAVIGATION).
|
||||
- G4SafetyHelper::ReLocateWithinVolume(): Added check of relocation.
|
||||
|
||||
Oct 11th, 2012 - J.Apostolakis (geomnav-V09-05-11)
|
||||
------------------------------
|
||||
- G4Navigator::ComputeStep(): fixed condition for transformation of
|
||||
local-normal: had flipped conditions, not corrected it.
|
||||
|
||||
Oct 2nd, 2012 - J.Apostolakis (geomnav-V09-05-10)
|
||||
------------------------------
|
||||
- G4Navigator::GetGlobalExitNormal(): added checks for non-unit surface
|
||||
normals in cases of exiting (existing global) or entering (new local) normal.
|
||||
|
||||
Sep 21st, 2012 - J.Apostolakis (geomnav-V09-05-09)
|
||||
------------------------------
|
||||
- Improved GetLocalExitNormal(). In case GrandMother is correct, it will now
|
||||
supply it.
|
||||
|
||||
Sep 20th, 2012 - J.Apostolakis (geomnav-V09-05-08)
|
||||
------------------------------
|
||||
- G4Navigator: suppressed extra transformations for updating
|
||||
'fGrandMotherExitNormal' in ComputeStep(). This is the only existing way
|
||||
to keep an update 'local' Exit Normal (potential alternative way is not
|
||||
implemented). It also serves as an alternative way (not needed) for the
|
||||
'global' Exit Normal.
|
||||
CHANGE of BEHAVIOR: This changes the results of GetLocalExitNormal(G4bool*)
|
||||
and GetLocalExitNormalAndCheck(const G4ThreeVector&, G4bool*); it now always
|
||||
returns 'valid'=false when Exiting. A simple ERROR (not G4Exception) is
|
||||
generated if this case used.
|
||||
Detailed description of change: previously it was unclear whether the
|
||||
(Grand Mother) normal was correct (due to potential extra changes of
|
||||
coordinates). In the case that the GrandMother was correct (unknown before),
|
||||
it is no longer available (when exiting).
|
||||
The suppressed updating of 'fGrandMotherExitNormal' in ComputeStep()
|
||||
is not needed for the Exit Normal in Global Coordinates, as that is now
|
||||
calculated using the Grand-Mother to Global transform in the case of exiting
|
||||
volume.
|
||||
NOTE: any client that need a normal should convert to using
|
||||
GetGlobalExitNormal() in place of GetLocalExitNormal().
|
||||
- Commented out extra debug printing in ComputeStep().
|
||||
|
||||
Sep 19th, 2012 - J.Apostolakis (geomnav-V09-05-07)
|
||||
------------------------------
|
||||
- G4Navigator: commented out debug printing in ComputeStep() and
|
||||
GetGlobalExitNormal().
|
||||
|
||||
Sep 19th, 2012 - J.Apostolakis (geomnav-V09-05-06)
|
||||
------------------------------
|
||||
- G4Navigator: reverted condition in GetGlobalExitNormal().
|
||||
NOTE: This version contains debug printing (next tag will remove them.)
|
||||
- Extended testG4Navigator1 unit test to check GetGlobalExitNormal()
|
||||
(few rotation for now).
|
||||
|
||||
Aug 15th, 2012 - J.Apostolakis
|
||||
------------------------------
|
||||
- G4Navigator: corrected condition in GetGlobalExitNormal -- the value is
|
||||
precalculated when Locate was just called, not when ComputeStep was last
|
||||
called.
|
||||
|
||||
July 11th, 2012 - J.Apostolakis (geomnav-V09-05-05)
|
||||
-------------------------------
|
||||
- Added data member for improved Exit Normal for optical photons (and
|
||||
potentially more uses, e.g. field )
|
||||
|
||||
June 12th, 2012 - G.Cosmo (geomnav-V09-05-04)
|
||||
-------------------------
|
||||
- Explicitly use inclusion of headers for system of units and physical
|
||||
constants, in plan to remove implicit inclusion from globals.hh.
|
||||
|
||||
May 14th, 2012 - G.Cosmo (geomnav-V09-05-03)
|
||||
------------------------
|
||||
- Fixed spurious cases of hidden variable visibility, detected with
|
||||
'-Wshadow' compilation option on gcc compiler.
|
||||
|
||||
March 9th, 2012 - J.Apostolakis (geomnav-V09-05-02)
|
||||
-------------------------------
|
||||
- G4MultiNavigator: fix for dealing with cases of clashing normals and
|
||||
return Invalid normal. Replaced FatalException with Warning, issued
|
||||
only if fVerbose > 2.
|
||||
|
||||
January 31st, 2012 - J.Apostolakis (geomnav-V09-05-01)
|
||||
----------------------------------
|
||||
- Corrected redundant condition in G4PropagatorInField.
|
||||
Revised threshold for decreaseFactor=0.5 from 100 to 30 times
|
||||
the zero-step threshold.
|
||||
|
||||
December 8th, 2011 - G.Cosmo (geomnav-V09-05-00)
|
||||
----------------------------
|
||||
- Fixed left over debug flags for field check in locator classes.
|
||||
Some code cleanup.
|
||||
|
||||
November 24th, 2011 - J.Apostolakis (geomnav-V09-04-12)
|
||||
-----------------------------------
|
||||
G4VIntersectionLocator: Use only 'last' Normal.
|
||||
Disable fallback of using helper Navigator, as it appears
|
||||
to cause problems in the presence of additional geometries.
|
||||
- G4VIntersectionLocator: Use only 'last' Normal.
|
||||
Disable fallback of using helper Navigator, as it appears
|
||||
to cause problems in the presence of additional geometries.
|
||||
|
||||
November 23rd, 2011 - J.Apostolakis (geomnav-V09-04-11)
|
||||
-----------------------------------
|
||||
G4MultiNavigator: adapt to revisions of intersection logic,
|
||||
to provide Exit Surface Normal for step ending on boundary.
|
||||
First implementation of methods GetGlobalExitNormal,
|
||||
GetLocalExitNormal and GetLocalExitNormalAndCheck.
|
||||
The Local methods are not adapted for this case - they complain:
|
||||
- warn if one navigator limited the step;
|
||||
- G4MultiNavigator: adapt to revisions of intersection logic,
|
||||
to provide Exit Surface Normal for step ending on boundary.
|
||||
First implementation of methods GetGlobalExitNormal(), GetLocalExitNormal()
|
||||
and GetLocalExitNormalAndCheck.
|
||||
The Local methods are not adapted for this case - they complain:
|
||||
- warn if one navigator limited the step;
|
||||
- fail report error if multiple navigators limited the step.
|
||||
|
||||
Added data members to record number of Navigators which limited
|
||||
the step in the last call to ComputeStep ( fNoLimitingStep ),
|
||||
and the id in case of just one having limited it (fIdNavLimiting).
|
||||
Added data members to record number of Navigators which limited
|
||||
the step in the last call to ComputeStep ( fNoLimitingStep ),
|
||||
and the id in case of just one having limited it (fIdNavLimiting).
|
||||
|
||||
November 18th, 2011 - J.Apostolakis (geomnav-V09-04-10)
|
||||
-----------------------------------
|
||||
G4Navigator.cc: fixed valid flag to mean correctly
|
||||
'convexity' and 'have-calculated' in its two use cases.
|
||||
- ComputeStep (G4Navigator)
|
||||
* Undid / corrected change to 'fValidExitNormal' -
|
||||
(meaning= exited solid is convex )
|
||||
when it is recalculated for the case of exiting.
|
||||
- Minor fix to GetLocalExitNormal (G4Navigator)
|
||||
* Always set Valid=calculated for Local Normal
|
||||
- G4Navigator: fixed valid flag to mean correctly
|
||||
'convexity' and 'have-calculated' in its two use cases.
|
||||
- G4Navigator::ComputeStep():
|
||||
* Undid / corrected change to 'fValidExitNormal' (meaning= exited
|
||||
solid is convex ) when it is recalculated for the case of exiting.
|
||||
- Minor fix to G4Navigator::GetLocalExitNormal():
|
||||
* Always set Valid=calculated for Local Normal.
|
||||
|
||||
November 18th, 2011 - J.Apostolakis (geomnav-V09-04-09)
|
||||
-----------------------------------
|
||||
G4SimpleLocator, G4BrentLocator & G4MultiLevelLocator.
|
||||
- Revised all Locator classes to use GetLastSurfaceNormal
|
||||
which first calls the robust GetLastSurfaceNormal
|
||||
instead of calling GetLocalSurfaceNormal
|
||||
*Corrects* ATLAS stuck track issues for hard test cases.
|
||||
- G4SimpleLocator, G4BrentLocator & G4MultiLevelLocator:
|
||||
Revised all Locator classes to use GetLastSurfaceNormal()
|
||||
which first calls the robust GetLastSurfaceNormal()
|
||||
instead of calling GetLocalSurfaceNormal().
|
||||
*Corrects* ATLAS stuck track issues for hard test cases.
|
||||
|
||||
November 11th, 2011 - G.Cosmo (geomnav-V09-04-08)
|
||||
-----------------------------
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.hh,v 1.4 2007-05-22 07:48:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4AuxiliaryNavServices
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.icc,v 1.4 2007-05-22 07:48:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4AuxiliaryNavServices Inline implementation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4BrentLocator.hh,v 1.2 2008-10-29 14:31:55 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// Class G4BrentLocator
|
||||
//
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DrawVoxels.hh,v 1.3 2006-06-29 18:35:36 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4DrawVoxels
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorPropagationNavigator.hh,v 1.2 2008-10-24 14:00:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -64,7 +63,7 @@ class G4ErrorPropagationNavigator : public G4Navigator
|
||||
|
||||
G4double ComputeSafety(const G4ThreeVector &globalpoint,
|
||||
const G4double pProposedMaxLength = DBL_MAX,
|
||||
const G4bool keepState = false);
|
||||
const G4bool keepState = true);
|
||||
// Calls the navigation in the detector geometry and then checks
|
||||
// if the distance to surface is smaller than the proposed safety
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestErrorList.hh,v 1.3 2006-06-29 18:35:38 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestLogger.hh,v 1.3 2006-06-29 18:35:40 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOverlapList.hh,v 1.3 2006-06-29 18:35:43 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOvershootList.hh,v 1.3 2006-06-29 18:35:45 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestPoint.hh,v 1.3 2006-06-29 18:35:48 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestSegment.hh,v 1.4 2007-05-11 13:43:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestStreamLogger.hh,v 1.3 2006-06-29 18:35:52 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolPoint.hh,v 1.3 2006-06-29 18:35:55 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolume.hh,v 1.3 2006-06-29 18:35:57 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
@@ -58,7 +57,7 @@ class G4GeomTestVolume
|
||||
|
||||
G4GeomTestVolume( const G4VPhysicalVolume *theTarget,
|
||||
G4GeomTestLogger *theLogger,
|
||||
G4double theTolerance=1E-4*mm );
|
||||
G4double theTolerance=1E-4 ); // mm
|
||||
~G4GeomTestVolume();
|
||||
// Constructor and destructor
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryMessenger.hh,v 1.5 2010-11-10 14:06:40 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MultiLevelLocator.hh,v 1.3 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Class G4MultiLevelLocator
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MultiNavigator.hh,v 1.5 2008-10-24 14:00:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4MultiNavigator
|
||||
@@ -106,7 +105,7 @@ class G4MultiNavigator : public G4Navigator
|
||||
//
|
||||
// Important Note: In order to call this the geometry MUST be closed.
|
||||
|
||||
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
|
||||
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
|
||||
// Relocate in all geometries for point that has not changed volume
|
||||
// (ie is within safety in all geometries or is distance less that
|
||||
// along the direction of a computed step.
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4NavigationLogger.hh,v 1.1 2010-11-04 08:57:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4NavigationLogger
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.hh,v 1.34 2010-12-15 13:46:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4Navigator
|
||||
@@ -181,14 +180,16 @@ class G4Navigator
|
||||
|
||||
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint,
|
||||
const G4double pProposedMaxLength = DBL_MAX,
|
||||
const G4bool keepState = false);
|
||||
const G4bool keepState = true);
|
||||
// Calculate the isotropic distance to the nearest boundary from the
|
||||
// specified point in the global coordinate system.
|
||||
// The globalpoint utilised must be within the current volume.
|
||||
// The value returned is usually an underestimate.
|
||||
// The proposed maximum length is used to avoid volume safety
|
||||
// calculations. The geometry must be closed.
|
||||
|
||||
// calculations. The geometry must be closed.
|
||||
// To ensure minimum side effects from the call, keepState
|
||||
// must be true.
|
||||
|
||||
inline G4VPhysicalVolume* GetWorldVolume() const;
|
||||
// Return the current world (`topmost') volume.
|
||||
|
||||
@@ -277,13 +278,6 @@ class G4Navigator
|
||||
// Values: 1 (small problem), 5 (correcting),
|
||||
// 9 (ready to abandon), 10 (abandoned)
|
||||
|
||||
void SetSavedState();
|
||||
// ( fValidExitNormal, fExitNormal, fExiting, fEntering,
|
||||
// fBlockedPhysicalVolume, fBlockedReplicaNo, fLastStepWasZero);
|
||||
void RestoreSavedState();
|
||||
// Copy aspects of the state, to enable a non-state changing
|
||||
// call to ComputeStep
|
||||
|
||||
inline G4ThreeVector GetCurrentLocalCoordinate() const;
|
||||
// Return the local coordinate of the point in the reference system
|
||||
// of its containing volume that was found by LocalGlobalPointAndSetup.
|
||||
@@ -298,6 +292,21 @@ class G4Navigator
|
||||
|
||||
protected: // with description
|
||||
|
||||
void SetSavedState();
|
||||
// ( fValidExitNormal, fExitNormal, fExiting, fEntering,
|
||||
// fBlockedPhysicalVolume, fBlockedReplicaNo, fLastStepWasZero);
|
||||
// Extended to include:
|
||||
// ( fLastLocatedPointLocal, fLocatedOutsideWorld;
|
||||
// fEnteredDaughter, fExitedMother
|
||||
// fPreviousSftOrigin, sPreviousSafety) Safety Sphere.
|
||||
|
||||
void RestoreSavedState();
|
||||
// Copy aspects of the state, to enable a non-state changing
|
||||
// call to ComputeStep().
|
||||
|
||||
virtual void ResetState();
|
||||
// Utility method to reset the navigator state machine.
|
||||
|
||||
inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const;
|
||||
// Return position vector in local coordinate system, given a position
|
||||
// vector in world coordinate system.
|
||||
@@ -307,9 +316,6 @@ class G4Navigator
|
||||
// system of the volume that was found by LocalGlobalPointAndSetup.
|
||||
// The Local Coordinates of point in world coordinate system.
|
||||
|
||||
virtual void ResetState();
|
||||
// Utility method to reset the navigator state machine.
|
||||
|
||||
inline EVolume VolumeType(const G4VPhysicalVolume *pVol) const;
|
||||
// Characterise `type' of volume - normal/replicated/parameterised.
|
||||
|
||||
@@ -401,7 +407,14 @@ class G4Navigator
|
||||
// volume's coordinate system
|
||||
G4ThreeVector fGrandMotherExitNormal; // Leaving volume normal, in its
|
||||
// own coordinate system
|
||||
G4bool fChangedGrandMotherRefFrame; // Whether frame is changed
|
||||
|
||||
G4ThreeVector fExitNormalGlobalFrame; // Leaving volume normal, in the
|
||||
// global coordinate system
|
||||
G4bool fCalculatedExitNormal; // Has it been computed since
|
||||
// the last call to ComputeStep
|
||||
// Covers both Global and GrandMother
|
||||
|
||||
// Count zero steps - as one or two can occur due to changing momentum at
|
||||
// a boundary or at an edge common between volumes
|
||||
// - several are likely a problem in the geometry
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.icc,v 1.18 2010-12-15 13:46:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4Navigator Inline implementation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.hh,v 1.6 2010-11-04 08:57:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.icc,v 1.5 2010-11-04 08:57:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// G4NormalNavigation Inline Implementation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.hh,v 1.6 2007-11-09 16:06:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.icc,v 1.7 2007-11-09 16:06:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Inline implementation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PartialPhantomParameterisation.hh,v 1.2 2010-11-10 11:20:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4PartialPhantomParameterisation
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PathFinder.hh,v 1.35 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// class G4PathFinder
|
||||
//
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhantomParameterisation.hh,v 1.6 2010-11-09 15:43:15 arce Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4PhantomParameterisation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhantomParameterisation.icc,v 1.1 2007-10-17 19:13:58 arce Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.hh,v 1.19 2009-11-13 17:34:26 japost Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Class G4PropagatorInField
|
||||
@@ -152,8 +151,8 @@ class G4PropagatorInField
|
||||
inline G4bool GetUseSafetyForOptimization();
|
||||
// Toggle & view parameter for using safety to discard
|
||||
// unneccesary calls to navigator (thus 'optimising' performance)
|
||||
inline G4bool IntersectChord( G4ThreeVector StartPointA,
|
||||
G4ThreeVector EndPointB,
|
||||
inline G4bool IntersectChord( const G4ThreeVector& StartPointA,
|
||||
const G4ThreeVector& EndPointB,
|
||||
G4double &NewSafety,
|
||||
G4double &LinearStepLength,
|
||||
G4ThreeVector &IntersectionPoint);
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.icc,v 1.16 2009-11-13 17:34:26 japost Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -275,8 +274,8 @@ G4VIntersectionLocator* G4PropagatorInField::GetIntersectionLocator()
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4PropagatorInField::IntersectChord( G4ThreeVector StartPointA,
|
||||
G4ThreeVector EndPointB,
|
||||
G4bool G4PropagatorInField::IntersectChord( const G4ThreeVector& StartPointA,
|
||||
const G4ThreeVector& EndPointB,
|
||||
G4double &NewSafety,
|
||||
G4double &LinearStepLength,
|
||||
G4ThreeVector &IntersectionPoint )
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RegularNavigation.hh,v 1.4 2010-09-03 16:29:43 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4RegularNavigation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RegularNavigationHelper.hh,v 1.1 2009-01-27 09:31:29 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
@@ -48,14 +47,18 @@
|
||||
class G4RegularNavigationHelper
|
||||
{
|
||||
public:
|
||||
|
||||
G4RegularNavigationHelper();
|
||||
static G4RegularNavigationHelper * Instance();
|
||||
~G4RegularNavigationHelper();
|
||||
|
||||
static void ClearStepLengths();
|
||||
static void AddStepLength( G4int copyNo, G4double slen );
|
||||
void ClearStepLengths();
|
||||
void AddStepLength( G4int copyNo, G4double slen );
|
||||
const std::vector< std::pair<G4int,G4double> > & GetStepLengths();
|
||||
|
||||
static std::vector< std::pair<G4int,G4double> > theStepLengths;
|
||||
std::vector< std::pair<G4int,G4double> > theStepLengths;
|
||||
|
||||
private:
|
||||
G4RegularNavigationHelper();
|
||||
static G4RegularNavigationHelper * theInstance;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.hh,v 1.6 2007-05-18 07:31:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation
|
||||
@@ -42,6 +41,8 @@
|
||||
#ifndef G4REPLICANAVIGATION_HH
|
||||
#define G4REPLICANAVIGATION_HH
|
||||
|
||||
#include <CLHEP/Units/SystemOfUnits.h>
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4NavigationHistory.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
@@ -55,97 +56,128 @@
|
||||
|
||||
class G4VSolid;
|
||||
|
||||
struct G4ExitNormal
|
||||
{
|
||||
// Bucket to hold value of Normal (3-vector),
|
||||
// bools for calculated and leave-behind or 'validConvex',
|
||||
// and exiting side.
|
||||
|
||||
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPX,kMX,kPY,kMY,kPZ,kMZ,kMother};
|
||||
// Identity of 'Side' of Replicas. Used by DistanceToOut methods.
|
||||
|
||||
G4ThreeVector exitNormal;
|
||||
G4bool calculated; // Normal
|
||||
G4bool validConvex; // Solid locally convex
|
||||
ESide exitSide;
|
||||
|
||||
public:
|
||||
|
||||
G4ExitNormal(G4ThreeVector norm = G4ThreeVector(0.,0.,0.),
|
||||
G4bool calc = false,
|
||||
G4bool valid= false,
|
||||
ESide side = kNull )
|
||||
{ exitNormal= norm; calculated= calc; validConvex=valid; exitSide=side;}
|
||||
};
|
||||
|
||||
class G4ReplicaNavigation
|
||||
{
|
||||
friend class G4ReplicaNavigationTester;
|
||||
public: // with description
|
||||
|
||||
public: // with description
|
||||
G4ReplicaNavigation();
|
||||
~G4ReplicaNavigation();
|
||||
|
||||
G4ReplicaNavigation();
|
||||
~G4ReplicaNavigation();
|
||||
inline G4bool LevelLocate( G4NavigationHistory& history,
|
||||
const G4VPhysicalVolume *blockedVol,
|
||||
const G4int blockedNum,
|
||||
const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector &localPoint );
|
||||
|
||||
inline G4bool LevelLocate( G4NavigationHistory& history,
|
||||
const G4VPhysicalVolume *blockedVol,
|
||||
const G4int blockedNum,
|
||||
const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector &localPoint );
|
||||
|
||||
G4double ComputeStep( const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector &globalDirection,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double &newSafety,
|
||||
G4NavigationHistory &history,
|
||||
G4bool &validExitNormal,
|
||||
G4ThreeVector &exitNormal,
|
||||
G4bool &exiting,
|
||||
G4bool &entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int &blockedReplicaNo );
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector &globalPoint,
|
||||
G4double ComputeStep( const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector &globalDirection,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double &newSafety,
|
||||
G4NavigationHistory &history,
|
||||
const G4double pProposedMaxLength=DBL_MAX );
|
||||
G4bool &validExitNormal,
|
||||
G4bool &calculatedExitNormal,
|
||||
G4ThreeVector &exitNormal,
|
||||
G4bool &exiting,
|
||||
G4bool &entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int &blockedReplicaNo );
|
||||
|
||||
EInside BackLocate( G4NavigationHistory &history,
|
||||
const G4ThreeVector &globalPoint,
|
||||
G4ThreeVector &localPoint,
|
||||
const G4bool &exiting,
|
||||
G4bool ¬KnownInside ) const;
|
||||
|
||||
void ComputeTransformation( const G4int replicaNo,
|
||||
G4VPhysicalVolume *pVol,
|
||||
G4ThreeVector &point ) const;
|
||||
void ComputeTransformation( const G4int replicaNo,
|
||||
G4VPhysicalVolume *pVol ) const;
|
||||
|
||||
EInside Inside( const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint ) const;
|
||||
G4double DistanceToOut( const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint ) const;
|
||||
G4double DistanceToOut( const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection ) const;
|
||||
|
||||
inline G4int GetVerboseLevel() const;
|
||||
inline void SetVerboseLevel(G4int level);
|
||||
// Get/Set Verbose(ness) level.
|
||||
// [if level>0 && G4VERBOSE, printout can occur]
|
||||
|
||||
inline void CheckMode(G4bool mode);
|
||||
// Run navigation in "check-mode", therefore using additional
|
||||
// verifications and more strict correctness conditions.
|
||||
// Is effective only with G4VERBOSE set.
|
||||
|
||||
private:
|
||||
|
||||
inline G4int VoxelLocate( const G4SmartVoxelHeader *pHead,
|
||||
G4double ComputeSafety( const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4int blocked=-1 ) const;
|
||||
G4NavigationHistory &history,
|
||||
const G4double pProposedMaxLength=DBL_MAX );
|
||||
|
||||
G4double DistanceToOutPhi( const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width ) const;
|
||||
EInside BackLocate( G4NavigationHistory &history,
|
||||
const G4ThreeVector &globalPoint,
|
||||
G4ThreeVector &localPoint,
|
||||
const G4bool &exiting,
|
||||
G4bool ¬KnownInside ) const;
|
||||
|
||||
G4double DistanceToOutRad( const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width,
|
||||
const G4double offset,
|
||||
const G4int replicaNo ) const;
|
||||
inline void SetPhiTransformation( const G4double ang,
|
||||
G4VPhysicalVolume *pVol=0 ) const;
|
||||
private:
|
||||
void ComputeTransformation( const G4int replicaNo,
|
||||
G4VPhysicalVolume *pVol,
|
||||
G4ThreeVector &point ) const;
|
||||
void ComputeTransformation( const G4int replicaNo,
|
||||
G4VPhysicalVolume *pVol ) const;
|
||||
|
||||
EInside Inside( const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint ) const;
|
||||
G4double DistanceToOut( const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint ) const;
|
||||
G4double DistanceToOut( const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
G4ExitNormal& candidateNormal ) const;
|
||||
|
||||
inline G4int GetVerboseLevel() const;
|
||||
inline void SetVerboseLevel(G4int level);
|
||||
// Get/Set Verbose(ness) level.
|
||||
// [if level>0 && G4VERBOSE, printout can occur]
|
||||
|
||||
inline void CheckMode(G4bool mode);
|
||||
// Run navigation in "check-mode", therefore using additional
|
||||
// verifications and more strict correctness conditions.
|
||||
// Is effective only with G4VERBOSE set.
|
||||
|
||||
private:
|
||||
|
||||
inline G4int VoxelLocate( const G4SmartVoxelHeader *pHead,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4int blocked=-1 ) const;
|
||||
|
||||
G4double DistanceToOutPhi( const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width,
|
||||
G4ExitNormal& foundNormal ) const;
|
||||
|
||||
G4double DistanceToOutRad( const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width,
|
||||
const G4double offset,
|
||||
const G4int replicaNo,
|
||||
G4ExitNormal& foundNormal ) const;
|
||||
inline void SetPhiTransformation( const G4double ang,
|
||||
G4VPhysicalVolume *pVol=0 ) const;
|
||||
private:
|
||||
|
||||
// Invariants - unaltered during navigation
|
||||
// **********
|
||||
|
||||
G4bool fCheck;
|
||||
G4int fVerbose;
|
||||
// Configuration parameters
|
||||
|
||||
G4double kCarTolerance, kRadTolerance, kAngTolerance;
|
||||
// Local copy of constants
|
||||
};
|
||||
|
||||
#include "G4ReplicaNavigation.icc"
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.icc,v 1.5 2006-06-29 18:36:22 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation Inline implementation
|
||||
@@ -71,7 +70,7 @@ G4ReplicaNavigation::VoxelLocate( const G4SmartVoxelHeader* pHead,
|
||||
break;
|
||||
case kPhi:
|
||||
coord = localPoint.phi();
|
||||
if ( (coord<0) && (coord<targetHeaderMin) ) coord += 2.0*pi;
|
||||
if ( (coord<0) && (coord<targetHeaderMin) ) coord += CLHEP::twopi;
|
||||
break;
|
||||
case kRadial3D:
|
||||
default:
|
||||
@@ -89,12 +88,6 @@ G4ReplicaNavigation::VoxelLocate( const G4SmartVoxelHeader* pHead,
|
||||
// voxel & it is blocked => should have exited mother
|
||||
// (or similar) P.Kent
|
||||
// assert(targetNodeNo>=0&&targetNodeNo<targetHeaderNoSlices);
|
||||
//
|
||||
// The assert above fails for simulation of high energy electrons
|
||||
// It is not clear what is the cause for this failure.
|
||||
// The code below attempts to rectify this problem until a
|
||||
// complete resolution is possible.
|
||||
// J.Apostolakis, June 12, 1998
|
||||
|
||||
if( (targetNodeNo<0) || (targetNodeNo>=targetHeaderNoSlices) )
|
||||
{
|
||||
@@ -111,7 +104,7 @@ G4ReplicaNavigation::VoxelLocate( const G4SmartVoxelHeader* pHead,
|
||||
// the last voxel to the zeroth and vice versa
|
||||
// H.Boie, April 30, 2001
|
||||
if ( (targetHeaderAxis==kPhi)
|
||||
&& (targetHeaderMin==0) && (targetHeaderMax==2*pi) )
|
||||
&& (targetHeaderMin==0) && (targetHeaderMax==CLHEP::twopi) )
|
||||
{
|
||||
if ( targetNodeNo<0 )
|
||||
targetNodeNo = targetHeaderNoSlices-1;
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SafetyHelper.hh,v 1.7 2007-05-02 15:32:13 japost Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4SafetyHelper
|
||||
@@ -67,9 +66,14 @@ public: // with description
|
||||
//
|
||||
// Return linear step for mass geometry
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector& pGlobalPoint );
|
||||
G4double ComputeSafety( const G4ThreeVector& pGlobalPoint,
|
||||
G4double maxRadius=DBL_MAX ); // Radius of interest
|
||||
//
|
||||
// Return safety for all geometries
|
||||
// Return safety for all geometries.
|
||||
//
|
||||
// The 2nd argument is the radius of your interest (e.g. maximum displacement )
|
||||
// Giving this you can reduce the average computational cost.
|
||||
// If the second argument is not given, this is the real isotropic safety
|
||||
|
||||
void Locate(const G4ThreeVector& pGlobalPoint,
|
||||
const G4ThreeVector& direction);
|
||||
@@ -89,6 +93,8 @@ public: // with description
|
||||
//
|
||||
// Check for new navigator for tracking, and reinitialise pointer
|
||||
|
||||
G4int SetVerboseLevel( G4int lev ) { G4int oldlv= fVerbose; fVerbose= lev; return oldlv; }
|
||||
|
||||
inline G4VPhysicalVolume* GetWorldVolume();
|
||||
inline void SetCurrentSafety(G4double val, const G4ThreeVector& pos);
|
||||
|
||||
@@ -106,6 +112,8 @@ private:
|
||||
// Flag whether to use PathFinder or single (mass) Navigator directly
|
||||
G4bool fFirstCall;
|
||||
// Flag of first call
|
||||
G4int fVerbose;
|
||||
// Whether to print warning in case of move outside safety
|
||||
|
||||
// State used during tracking -- for optimisation
|
||||
G4ThreeVector fLastSafetyPosition;
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleLocator.hh,v 1.2 2008-10-29 14:31:55 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Class G4SimpleLocator
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.hh,v 1.12 2007-04-20 15:28:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// class G4TransportationManager
|
||||
//
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.icc,v 1.10 2007-04-20 15:28:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 inlined function members implementation
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VIntersectionLocator.hh,v 1.6 2009-11-30 11:39:15 japost Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Class G4VIntersectionLocator
|
||||
@@ -84,8 +83,8 @@ class G4VIntersectionLocator
|
||||
G4int step);
|
||||
// Print Method, useful mostly for debugging
|
||||
|
||||
inline G4bool IntersectChord( G4ThreeVector StartPointA,
|
||||
G4ThreeVector EndPointB,
|
||||
inline G4bool IntersectChord( const G4ThreeVector& StartPointA,
|
||||
const G4ThreeVector& EndPointB,
|
||||
G4double &NewSafety,
|
||||
G4double &PreviousSafety, // In/Out
|
||||
G4ThreeVector &PreviousSftOrigin, // In/Out
|
||||
@@ -179,7 +178,7 @@ class G4VIntersectionLocator
|
||||
G4bool &validNormal);
|
||||
// Return the SurfaceNormal of Intersecting Solid in local coordinates
|
||||
|
||||
G4ThreeVector GetLastSurfaceNormal( G4ThreeVector intersectPoint,
|
||||
G4ThreeVector GetLastSurfaceNormal( const G4ThreeVector& intersectPoint,
|
||||
G4bool &validNormal) const;
|
||||
// Position *must* be the intersection point from last call
|
||||
// to G4Navigator's ComputeStep (via IntersectChord )
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VIntersectionLocator.icc,v 1.3 2008-11-14 18:26:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Class G4VIntersectionLocator inline methods
|
||||
@@ -101,8 +100,8 @@ inline void G4VIntersectionLocator::SetVerboseFor(G4int fVerbose)
|
||||
}
|
||||
|
||||
inline G4bool
|
||||
G4VIntersectionLocator::IntersectChord( G4ThreeVector StartPointA,
|
||||
G4ThreeVector EndPointB,
|
||||
G4VIntersectionLocator::IntersectChord( const G4ThreeVector& StartPointA,
|
||||
const G4ThreeVector& EndPointB,
|
||||
G4double &NewSafety,
|
||||
G4double &PreviousSafety,
|
||||
G4ThreeVector &PreviousSftOrigin,
|
||||
@@ -138,18 +137,23 @@ G4VIntersectionLocator::IntersectChord( G4ThreeVector StartPointA,
|
||||
LinearStepLength = ChordAB_Length;
|
||||
intersects = false;
|
||||
NewSafety= currentSafety;
|
||||
CalledNavigator= false;
|
||||
CalledNavigator= false;
|
||||
// G4cout << " IntersectChord> Step 'guaranteed' taken: safety= " << currentSafety << " chordAB-len= " << ChordAB_Length << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// G4cout << " IntersectChord> Step asking Navigator: safety= " << currentSafety << " chordAB-len= " << ChordAB_Length << G4endl;
|
||||
|
||||
// Check whether any volumes are encountered by the chord AB
|
||||
|
||||
LinearStepLength = GetNavigatorFor()->ComputeStep( StartPointA,
|
||||
ChordAB_Dir, ChordAB_Length, NewSafety );
|
||||
intersects = (LinearStepLength <= ChordAB_Length);
|
||||
|
||||
// G4Navigator contracts to return k_infinity if len==asked
|
||||
// and it did not find a surface boundary at that length
|
||||
|
||||
// G4cout << "G4VIntersectionLocator: intersect= " << intersects
|
||||
// << " step= " << LinearStepLength << " Chord length= " << ChordAB_Length;
|
||||
|
||||
LinearStepLength = std::min( LinearStepLength, ChordAB_Length);
|
||||
CalledNavigator = true;
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.hh,v 1.8 2010-11-04 12:13:30 japost Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.icc,v 1.7 2010-11-04 17:38:17 japost Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation Inline implementation
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VoxelSafety.hh,v 1.2 2010-11-04 17:32:46 japost Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// class G4VoxelSafety
|
||||
//
|
||||
@@ -49,11 +48,7 @@
|
||||
|
||||
#include "G4BlockingList.hh"
|
||||
|
||||
// #include "G4AuxiliaryNavServices.hh"
|
||||
|
||||
// Required for voxel handling & voxel stack
|
||||
//
|
||||
#include <vector>
|
||||
#include <vector> // Required for voxel handling & voxel stack
|
||||
|
||||
class G4SmartVoxelNode;
|
||||
class G4SmartVoxelHeader;
|
||||
@@ -74,33 +69,35 @@ class G4VoxelSafety
|
||||
|
||||
inline G4int GetVerboseLevel() const { return fVerbose; }
|
||||
inline void SetVerboseLevel(G4int level) { fVerbose= level; }
|
||||
// Get/Set Verbose(ness) level.
|
||||
// [if level>0 && G4VERBOSE, printout can occur]
|
||||
|
||||
// inline void CheckMode(G4bool mode);
|
||||
// Make extra checks
|
||||
//
|
||||
// If level>0 && G4VERBOSE, printout can occur
|
||||
|
||||
protected:
|
||||
G4double SafetyForVoxelHeader( G4SmartVoxelHeader* pHead,
|
||||
const G4ThreeVector& localPoint );
|
||||
|
||||
G4double SafetyForVoxelNode( G4SmartVoxelNode *curVoxelNode,
|
||||
G4double SafetyForVoxelHeader( const G4SmartVoxelHeader* pHead,
|
||||
const G4ThreeVector& localPoint,
|
||||
G4double maxLength,
|
||||
const G4VPhysicalVolume& currentPhysical,
|
||||
G4double distUpperDepth = 0.0,
|
||||
G4double previousMinSafety= DBL_MAX
|
||||
);
|
||||
|
||||
G4double SafetyForVoxelNode( const G4SmartVoxelNode *curVoxelNode,
|
||||
const G4ThreeVector& localPoint );
|
||||
|
||||
G4SmartVoxelNode* VoxelLocateLight( G4SmartVoxelHeader* pHead,
|
||||
const G4ThreeVector& localPoint ) const;
|
||||
private:
|
||||
// BEGIN State
|
||||
// - values used during computation of Safety
|
||||
private:
|
||||
|
||||
// BEGIN State - values used during computation of Safety
|
||||
//
|
||||
G4BlockingList fBlockList;
|
||||
// Blocked volumes
|
||||
|
||||
G4LogicalVolume* fpMotherLogical;
|
||||
|
||||
//
|
||||
// BEGIN Voxel Stack information
|
||||
//
|
||||
|
||||
G4int fVoxelDepth;
|
||||
// Note: fVoxelDepth==0+ => fVoxelAxisStack(0+) contains axes of voxel
|
||||
// fVoxelDepth==-1 -> not in voxel
|
||||
@@ -117,7 +114,7 @@ class G4VoxelSafety
|
||||
std::vector<G4int> fVoxelNodeNoStack;
|
||||
// Node no point is inside at each level
|
||||
|
||||
std::vector<G4SmartVoxelHeader*> fVoxelHeaderStack;
|
||||
std::vector<const G4SmartVoxelHeader*> fVoxelHeaderStack;
|
||||
// Voxel headers at each level
|
||||
|
||||
G4SmartVoxelNode* fVoxelNode;
|
||||
@@ -125,13 +122,10 @@ class G4VoxelSafety
|
||||
|
||||
//
|
||||
// END Voxel Stack information
|
||||
//
|
||||
|
||||
G4bool fCheck;
|
||||
G4int fVerbose;
|
||||
G4double kCarTolerance;
|
||||
};
|
||||
|
||||
// #include "G4VoxelSafety.icc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.cc,v 1.3 2006-06-29 18:36:32 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4BrentLocator.cc,v 1.9 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// Class G4BrentLocator implementation
|
||||
//
|
||||
@@ -261,7 +260,7 @@ G4bool G4BrentLocator::EstimateIntersectionPoint(
|
||||
G4ThreeVector NewMomentumDir= ApproxIntersecPointV.GetMomentumDir();
|
||||
G4double MomDir_dot_Norm= NewMomentumDir.dot( NormalAtEntry ) ;
|
||||
|
||||
#ifdef DEBUG_FIELD
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4ThreeVector ChordAB = Point_B - Point_A;
|
||||
|
||||
G4VIntersectionLocator::ReportTrialStep( substep_no, ChordAB,
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DrawVoxels.cc,v 1.4 2006-06-29 18:36:34 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4DrawVoxels
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorPropagationNavigator.cc,v 1.2 2008-10-24 14:00:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -72,7 +71,7 @@ ComputeStep ( const G4ThreeVector &pGlobalPoint,
|
||||
const G4ErrorTarget* target = g4edata->GetTarget();
|
||||
if( target != 0 )
|
||||
{
|
||||
G4double StepPlane(target->GetDistanceFromPoint(pGlobalPoint,pDirection));
|
||||
G4double StepPlane= target->GetDistanceFromPoint(pGlobalPoint,pDirection);
|
||||
|
||||
if( StepPlane < 0. ) // Negative means target is crossed, will not be found
|
||||
{
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestErrorList.cc,v 1.3 2006-06-29 18:36:36 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOverlapList.cc,v 1.3 2006-06-29 18:36:39 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOvershootList.cc,v 1.3 2006-06-29 18:36:41 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestPoint.cc,v 1.3 2006-06-29 18:36:44 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestSegment.cc,v 1.13 2010-08-20 09:03:54 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -156,8 +155,8 @@ void G4GeomTestSegment::PatchInconsistencies( G4GeomTestLogger *logger )
|
||||
// Point is out of sequence:
|
||||
// Test solid just before this point
|
||||
//
|
||||
G4double s = curr->GetDistance();
|
||||
G4ThreeVector p = p0 + s*v;
|
||||
G4double ds = curr->GetDistance();
|
||||
G4ThreeVector p = p0 + ds*v;
|
||||
|
||||
G4ThreeVector p1 = p - 10*kCarTolerance*v;
|
||||
|
||||
@@ -166,7 +165,7 @@ void G4GeomTestSegment::PatchInconsistencies( G4GeomTestLogger *logger )
|
||||
// We are missing an entrance point near the current
|
||||
// point. Add one.
|
||||
//
|
||||
curr = points.insert(curr, G4GeomTestPoint( p, s, true ) );
|
||||
curr = points.insert(curr, G4GeomTestPoint( p, ds, true ) );
|
||||
++curr;
|
||||
break;
|
||||
}
|
||||
@@ -177,8 +176,8 @@ void G4GeomTestSegment::PatchInconsistencies( G4GeomTestLogger *logger )
|
||||
if (curr != points.begin()) {
|
||||
std::vector<G4GeomTestPoint>::iterator prev = curr - 1;
|
||||
|
||||
s = prev->GetDistance();
|
||||
p = p0 + s*v;
|
||||
ds = prev->GetDistance();
|
||||
p = p0 + ds*v;
|
||||
|
||||
p1 = p + 10*kCarTolerance*v;
|
||||
if ((solid->Inside(p1) == kOutside)||(solid->Inside(p1)== kSurface)) {
|
||||
@@ -187,7 +186,7 @@ void G4GeomTestSegment::PatchInconsistencies( G4GeomTestLogger *logger )
|
||||
// We are missing an entrance point near the previous
|
||||
// point. Add one.
|
||||
//
|
||||
curr = points.insert(curr, G4GeomTestPoint( p, s, true ) );
|
||||
curr = points.insert(curr, G4GeomTestPoint( p, ds, true ) );
|
||||
++curr;
|
||||
break;
|
||||
}
|
||||
@@ -209,8 +208,8 @@ void G4GeomTestSegment::PatchInconsistencies( G4GeomTestLogger *logger )
|
||||
//
|
||||
// But is missing. Check immediately after this point.
|
||||
//
|
||||
G4double s = curr->GetDistance();
|
||||
G4ThreeVector p = p0 + s*v;
|
||||
G4double ds = curr->GetDistance();
|
||||
G4ThreeVector p = p0 + ds*v;
|
||||
G4ThreeVector p1 = p + 10*kCarTolerance*v;
|
||||
|
||||
if (solid->Inside(p1) == kOutside) {
|
||||
@@ -218,7 +217,7 @@ void G4GeomTestSegment::PatchInconsistencies( G4GeomTestLogger *logger )
|
||||
// We are missing an exit point near the current
|
||||
// point. Add one.
|
||||
//
|
||||
curr = points.insert(next, G4GeomTestPoint( p, s, false ) );
|
||||
curr = points.insert(next, G4GeomTestPoint( p, ds, false ) );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -226,15 +225,15 @@ void G4GeomTestSegment::PatchInconsistencies( G4GeomTestLogger *logger )
|
||||
//
|
||||
// Check just before next point
|
||||
//
|
||||
s = next->GetDistance();
|
||||
p = p0 + s*v;
|
||||
ds = next->GetDistance();
|
||||
p = p0 + ds*v;
|
||||
p1 = p - 10*kCarTolerance*v;
|
||||
if (solid->Inside(p1) == kOutside) {
|
||||
//
|
||||
// We are missing an exit point before the next
|
||||
// point. Add one.
|
||||
//
|
||||
curr = points.insert(next, G4GeomTestPoint( p, s, false ) );
|
||||
curr = points.insert(next, G4GeomTestPoint( p, ds, false ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -271,7 +270,7 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
|
||||
|
||||
G4ThreeVector p(p0);
|
||||
G4ThreeVector vSearch(sign*v);
|
||||
G4double s(0);
|
||||
G4double ds(0);
|
||||
G4bool entering;
|
||||
G4double vSurfN;
|
||||
|
||||
@@ -287,13 +286,13 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
|
||||
"DistanceToOut(p,v) = kInfinity for point inside", p );
|
||||
return;
|
||||
}
|
||||
s += sign*dist;
|
||||
ds += sign*dist;
|
||||
entering = false;
|
||||
break;
|
||||
case kOutside:
|
||||
dist = solid->DistanceToIn(p,vSearch);
|
||||
if (dist >= kInfinity) return;
|
||||
s += sign*dist;
|
||||
ds += sign*dist;
|
||||
entering = true;
|
||||
break;
|
||||
case kSurface:
|
||||
@@ -318,7 +317,7 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
|
||||
//
|
||||
// Locate point
|
||||
//
|
||||
p = p0 + s*v;
|
||||
p = p0 + ds*v;
|
||||
|
||||
if (nzero > 2) {
|
||||
//
|
||||
@@ -326,9 +325,9 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
|
||||
// Let's give the tool a little help with a push
|
||||
//
|
||||
G4double push = 1E-6;
|
||||
s += sign*push;
|
||||
ds += sign*push;
|
||||
for(;;) {
|
||||
p = p0 + s*v;
|
||||
p = p0 + ds*v;
|
||||
EInside inside = solid->Inside(p);
|
||||
if (inside == kInside) {
|
||||
entering = true;
|
||||
@@ -345,7 +344,7 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
|
||||
"Push fails to fix geometry inconsistency", p );
|
||||
return;
|
||||
}
|
||||
s += sign*push;
|
||||
ds += sign*push;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -353,7 +352,7 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
|
||||
//
|
||||
// Record point
|
||||
//
|
||||
points.push_back( G4GeomTestPoint( p, s, entering==forward ) );
|
||||
points.push_back( G4GeomTestPoint( p, ds, entering==forward ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -406,14 +405,14 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
|
||||
}
|
||||
|
||||
//
|
||||
// Update s
|
||||
// Update ds
|
||||
//
|
||||
if (dist <= 0) {
|
||||
nzero++;
|
||||
}
|
||||
else {
|
||||
nzero=0;
|
||||
s += sign*dist;
|
||||
ds += sign*dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestStreamLogger.cc,v 1.3 2006-06-29 18:36:49 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -35,11 +34,12 @@
|
||||
// Author: D.C.Williams, UCSC (davidw@scipp.ucsc.edu)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4GeomTestStreamLogger.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4GeomTestOverlapList.hh"
|
||||
#include "G4GeomTestOvershootList.hh"
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolPoint.cc,v 1.3 2006-06-29 18:36:52 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolume.cc,v 1.6 2007-11-16 09:39:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -35,8 +34,14 @@
|
||||
// Author: D.C.Williams, UCSC (davidw@scipp.ucsc.edu)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4GeomTestVolume.hh"
|
||||
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4GeomTestLogger.hh"
|
||||
#include "G4GeomTestVolPoint.hh"
|
||||
#include "G4GeomTestSegment.hh"
|
||||
@@ -45,11 +50,6 @@
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
@@ -597,7 +597,6 @@ void G4GeomTestVolume::TestOneLine( const G4ThreeVector &p,
|
||||
result =
|
||||
overshoots.insert( std::pair<const G4long,G4GeomTestOvershootList>
|
||||
(iDaug,G4GeomTestOvershootList(target,iDaug)) );
|
||||
assert(result.second);
|
||||
overshoot = result.first;
|
||||
}
|
||||
|
||||
@@ -630,7 +629,6 @@ void G4GeomTestVolume::TestOneLine( const G4ThreeVector &p,
|
||||
result =
|
||||
overlaps.insert( std::pair<const G4long,G4GeomTestOverlapList>
|
||||
(key,G4GeomTestOverlapList(target,iDaug,kDaug)) );
|
||||
assert(result.second);
|
||||
overlap = result.first;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryMessenger.cc,v 1.6 2010-11-10 14:06:40 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -62,7 +61,7 @@
|
||||
//
|
||||
G4GeometryMessenger::G4GeometryMessenger(G4TransportationManager* tman)
|
||||
: x(0,0,0), p(0,0,1), grdRes(100,100,100), cylRes(90,50,50),
|
||||
cylfZ(0.8), cylfR(0.8), newtol(false), tol(1E-4*mm),
|
||||
cylfZ(0.8), cylfR(0.8), newtol(false), tol(1E-4), // mm
|
||||
recLevel(0), recDepth(-1), tmanager(tman), tlogger(0), tvolume(0)
|
||||
{
|
||||
geodir = new G4UIdirectory( "/geometry/" );
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MultiLevelLocator.cc,v 1.6 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// Class G4MultiLevelLocator implementation
|
||||
//
|
||||
@@ -234,7 +233,7 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
G4ThreeVector NewMomentumDir= ApproxIntersecPointV.GetMomentumDir();
|
||||
G4double MomDir_dot_Norm= NewMomentumDir.dot( NormalAtEntry ) ;
|
||||
|
||||
#ifdef DEBUG_FIELD
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( VerboseLevel > 3 )
|
||||
{
|
||||
G4ThreeVector ChordAB = Point_B - Point_A;
|
||||
@@ -607,7 +606,7 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
|
||||
if( (Second_half)&&(depth!=0) )
|
||||
{
|
||||
// Second part of curve (InterMed[depth],Intermed[depth-1]) )
|
||||
// Second part of curve (InterMed[depth],Intermed[depth-1]))
|
||||
// On the depth-1 level normally we are on the 'second_half'
|
||||
|
||||
Second_half = true;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MultiNavigator.cc,v 1.11 2010-09-06 09:49:15 gcosmo Exp $
|
||||
// $Id$
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4PathFinder Implementation
|
||||
@@ -32,16 +32,17 @@
|
||||
// Author: John Apostolakis, November 2006
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4MultiNavigator.hh"
|
||||
|
||||
class G4FieldManager;
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
// ********************************************************************
|
||||
// Constructor
|
||||
// ********************************************************************
|
||||
@@ -691,7 +692,7 @@ G4MultiNavigator::ResetHierarchyAndLocate(const G4ThreeVector &point,
|
||||
|
||||
G4ThreeVector
|
||||
G4MultiNavigator::GetGlobalExitNormal(const G4ThreeVector &argPoint,
|
||||
G4bool* argpObtained) // const
|
||||
G4bool* argpObtained) // obtained valid
|
||||
{
|
||||
G4ThreeVector normalGlobalCrd(0.0, 0.0, 0.0);
|
||||
G4bool isObtained= false;
|
||||
@@ -736,7 +737,9 @@ G4MultiNavigator::GetGlobalExitNormal(const G4ThreeVector &argPoint,
|
||||
dotNewPrevious /= productMag; // Normalise
|
||||
if( dotNewPrevious < (1 - perThousand) )
|
||||
{
|
||||
if( dotNewPrevious <= 0.0 )
|
||||
*argpObtained= false;
|
||||
|
||||
if( fVerbose > 2 ) // dotNewPrevious <= 0.0 )
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Clash of Normal from different Navigators!" << G4endl
|
||||
@@ -746,7 +749,7 @@ G4MultiNavigator::GetGlobalExitNormal(const G4ThreeVector &argPoint,
|
||||
message << " Normal (previous) = " << normalGlobalCrd << G4endl;
|
||||
message << " Normal (current) = " << newNormal << G4endl;
|
||||
G4Exception("G4MultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
|
||||
FatalException, message);
|
||||
JustWarning, message);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4NavigationLogger.cc,v 1.1 2010-11-04 08:57:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4NavigationLogger Implementation
|
||||
|
||||
@@ -24,22 +24,27 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.cc,v 1.46 2010-11-15 14:03:27 gcosmo Exp $
|
||||
// $Id: G4Navigator.cc 2012-11-01 japost Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4Navigator Implementation
|
||||
//
|
||||
// Original author: Paul Kent, July 95/96
|
||||
//
|
||||
// Responsible 1996-present: John Apostolakis
|
||||
// Co-maintainer: Gabriele Cosmo
|
||||
// Additional revisions by: Pedro Arce, Vladimir Grichine
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
#include "G4VoxelSafety.hh"
|
||||
|
||||
// ********************************************************************
|
||||
// Constructor
|
||||
// ********************************************************************
|
||||
@@ -50,7 +55,13 @@ G4Navigator::G4Navigator()
|
||||
{
|
||||
fActive= false;
|
||||
fLastTriedStepComputation= false;
|
||||
|
||||
ResetStackAndState();
|
||||
// Initialises also all
|
||||
// - exit / entry flags
|
||||
// - flags & variables for exit normals
|
||||
// - zero step counters
|
||||
// - blocked volume
|
||||
|
||||
fActionThreshold_NoZeroSteps = 10;
|
||||
fAbandonThreshold_NoZeroSteps = 25;
|
||||
@@ -60,9 +71,6 @@ G4Navigator::G4Navigator()
|
||||
|
||||
fStepEndPoint = G4ThreeVector( kInfinity, kInfinity, kInfinity );
|
||||
fLastStepEndPointLocal = G4ThreeVector( kInfinity, kInfinity, kInfinity );
|
||||
|
||||
// this->SetVerboseLevel(3);
|
||||
// this->CheckMode(true);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -118,13 +126,16 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
EInside insideCode;
|
||||
|
||||
G4bool considerDirection = (!ignoreDirection) || fLocatedOnEdge;
|
||||
fLastTriedStepComputation= false;
|
||||
|
||||
fLastTriedStepComputation= false;
|
||||
fChangedGrandMotherRefFrame= false; // For local exit normal
|
||||
|
||||
if( considerDirection && pGlobalDirection != 0 )
|
||||
{
|
||||
globalDirection=*pGlobalDirection;
|
||||
}
|
||||
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
@@ -246,6 +257,8 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
// else
|
||||
// o containing volume found
|
||||
//
|
||||
G4int noLevelsExited=0 ;
|
||||
|
||||
while (notKnownContained)
|
||||
{
|
||||
if ( fHistory.GetTopVolumeType()!=kReplica )
|
||||
@@ -277,19 +290,35 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
// will result in the history being backed up one level, then the
|
||||
// local point returned is the point in the system of this new level
|
||||
}
|
||||
|
||||
|
||||
if ( insideCode==kOutside )
|
||||
{
|
||||
noLevelsExited++;
|
||||
if ( fHistory.GetDepth() )
|
||||
{
|
||||
fBlockedPhysicalVolume = fHistory.GetTopVolume();
|
||||
fBlockedReplicaNo = fHistory.GetTopReplicaNo();
|
||||
fHistory.BackLevel();
|
||||
fExiting = false;
|
||||
|
||||
if( noLevelsExited > 1 )
|
||||
{
|
||||
// The first transformation was done by the sub-navigator
|
||||
//
|
||||
const G4RotationMatrix* mRot = fBlockedPhysicalVolume->GetRotation();
|
||||
if( mRot )
|
||||
{
|
||||
fGrandMotherExitNormal *= (*mRot).inverse();
|
||||
fChangedGrandMotherRefFrame= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fLastLocatedPointLocal = localPoint;
|
||||
fLocatedOutsideWorld = true;
|
||||
// No extra transformation for ExitNormal - is in frame of Top Volume
|
||||
return 0; // Have exited world volume
|
||||
}
|
||||
}
|
||||
@@ -305,6 +334,11 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
G4bool directionExiting = false;
|
||||
G4ThreeVector localDirection =
|
||||
fHistory.GetTopTransform().TransformAxis(globalDirection);
|
||||
|
||||
// Make sure localPoint in correct reference frame
|
||||
// ( Was it already correct ? How ? )
|
||||
//
|
||||
localPoint= fHistory.GetTopTransform().TransformPoint(globalPoint);
|
||||
if ( fHistory.GetTopVolumeType()!=kReplica )
|
||||
{
|
||||
G4ThreeVector normal = targetSolid->SurfaceNormal(localPoint);
|
||||
@@ -314,6 +348,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
}
|
||||
if( isExiting )
|
||||
{
|
||||
noLevelsExited++;
|
||||
if ( fHistory.GetDepth() )
|
||||
{
|
||||
fBlockedPhysicalVolume = fHistory.GetTopVolume();
|
||||
@@ -323,11 +358,24 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
// Still on surface but exited volume not necessarily convex
|
||||
//
|
||||
fValidExitNormal = false;
|
||||
|
||||
if( noLevelsExited > 1 )
|
||||
{
|
||||
// The first transformation was done by the sub-navigator
|
||||
//
|
||||
const G4RotationMatrix* mRot=fBlockedPhysicalVolume->GetRotation();
|
||||
if( mRot )
|
||||
{
|
||||
fGrandMotherExitNormal *= (*mRot).inverse();
|
||||
fChangedGrandMotherRefFrame= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fLastLocatedPointLocal = localPoint;
|
||||
fLocatedOutsideWorld = true;
|
||||
// No extra transformation for ExitNormal, is in frame of Top Vol
|
||||
return 0; // Have exited world volume
|
||||
}
|
||||
}
|
||||
@@ -435,11 +483,22 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
//
|
||||
fEntering = false;
|
||||
fEnteredDaughter = true;
|
||||
|
||||
if( fExitedMother )
|
||||
{
|
||||
G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
|
||||
const G4RotationMatrix* mRot = enteredPhysical->GetRotation();
|
||||
if( mRot )
|
||||
{
|
||||
fGrandMotherExitNormal *= (*mRot).inverse();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
|
||||
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup() ***" << G4endl;
|
||||
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup() ***" << G4endl;
|
||||
G4cout << " Entering volume: " << enteredPhysical->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -450,7 +509,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
fLastLocatedPointLocal = localPoint;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose == 4 )
|
||||
if( fVerbose >= 4 )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(8);
|
||||
G4String curPhysVol_Name("None");
|
||||
@@ -458,10 +517,11 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
G4cout << " Return value = new volume = " << curPhysVol_Name << G4endl;
|
||||
G4cout << " ----- Upon exiting:" << G4endl;
|
||||
PrintState();
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4cout << "Upon exiting LocateGlobalPointAndSetup():" << G4endl;
|
||||
G4cout << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
#endif
|
||||
if( fVerbose == 5 )
|
||||
{
|
||||
G4cout << "Upon exiting LocateGlobalPointAndSetup():" << G4endl;
|
||||
G4cout << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
}
|
||||
G4cout.precision(oldcoutPrec);
|
||||
}
|
||||
#endif
|
||||
@@ -489,6 +549,7 @@ G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoint)
|
||||
{
|
||||
fLastLocatedPointLocal = ComputeLocalPoint(pGlobalpoint);
|
||||
fLastTriedStepComputation= false;
|
||||
fChangedGrandMotherRefFrame= false; // Frame for Exit Normal
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
@@ -557,7 +618,6 @@ G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoint)
|
||||
//
|
||||
void G4Navigator::SetSavedState()
|
||||
{
|
||||
// fSaveExitNormal = fExitNormal;
|
||||
fSaveState.sExitNormal = fExitNormal;
|
||||
fSaveState.sValidExitNormal = fValidExitNormal;
|
||||
fSaveState.sExiting = fExiting;
|
||||
@@ -566,7 +626,17 @@ void G4Navigator::SetSavedState()
|
||||
fSaveState.spBlockedPhysicalVolume = fBlockedPhysicalVolume;
|
||||
fSaveState.sBlockedReplicaNo = fBlockedReplicaNo,
|
||||
|
||||
fSaveState.sLastStepWasZero = fLastStepWasZero;
|
||||
fSaveState.sLastStepWasZero = fLastStepWasZero;
|
||||
|
||||
fSaveState.sLocatedOutsideWorld = fLocatedOutsideWorld;
|
||||
fSaveState.sLastLocatedPointLocal= fLastLocatedPointLocal;
|
||||
fSaveState.sEnteredDaughter= fEnteredDaughter;
|
||||
fSaveState.sExitedMother= fExitedMother;
|
||||
|
||||
// Even the safety sphere - if you want to change it do it explicitly!
|
||||
//
|
||||
fSaveState.sPreviousSftOrigin= fPreviousSftOrigin;
|
||||
fSaveState.sPreviousSafety= fPreviousSafety;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -585,7 +655,14 @@ void G4Navigator::RestoreSavedState()
|
||||
fBlockedPhysicalVolume = fSaveState.spBlockedPhysicalVolume;
|
||||
fBlockedReplicaNo = fSaveState.sBlockedReplicaNo,
|
||||
|
||||
fLastStepWasZero = fSaveState.sLastStepWasZero;
|
||||
fLastStepWasZero = fSaveState.sLastStepWasZero;
|
||||
|
||||
fLocatedOutsideWorld = fSaveState.sLocatedOutsideWorld;
|
||||
fLastLocatedPointLocal= fSaveState.sLastLocatedPointLocal;
|
||||
fEnteredDaughter= fSaveState.sEnteredDaughter;
|
||||
fExitedMother= fSaveState.sExitedMother;
|
||||
fSaveState.sPreviousSftOrigin= fPreviousSftOrigin;
|
||||
fSaveState.sPreviousSafety= fPreviousSafety;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -629,6 +706,16 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
|
||||
G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
|
||||
|
||||
// All state relating to exiting normals must be reset
|
||||
//
|
||||
fExitNormalGlobalFrame= G4ThreeVector( 0., 0., 0.);
|
||||
// Reset value - to erase its memory
|
||||
fChangedGrandMotherRefFrame= false;
|
||||
// Reset - used for local exit normal
|
||||
fGrandMotherExitNormal= G4ThreeVector( 0., 0., 0.);
|
||||
fCalculatedExitNormal = false;
|
||||
// Reset for new step
|
||||
|
||||
static G4int sNavCScalls=0;
|
||||
sNavCScalls++;
|
||||
|
||||
@@ -642,13 +729,16 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
<< " - Proposed step length = " << pCurrentProposedStepLength
|
||||
<< G4endl;
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose >= 4 )
|
||||
if( fVerbose >= 2 )
|
||||
{
|
||||
G4cout << " Called with the arguments: " << G4endl
|
||||
<< " Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
|
||||
<< " Direction = " << std::setw(25) << pDirection << G4endl;
|
||||
G4cout << " ---- Upon entering :" << G4endl;
|
||||
PrintState();
|
||||
if( fVerbose >= 4 )
|
||||
{
|
||||
G4cout << " ---- Upon entering : State" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -712,7 +802,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
else // Regular (non-voxelised) structure
|
||||
{
|
||||
LocateGlobalPointAndSetup( pGlobalpoint, &pDirection, true, true );
|
||||
fLastTriedStepComputation= true; // Ensure that this is set again !!
|
||||
fLastTriedStepComputation= true; // Ensure that this is set again !!
|
||||
//
|
||||
// if physical process limits the step, the voxel will not be the
|
||||
// one given by ComputeStepSkippingEqualMaterials() and the local
|
||||
@@ -801,6 +891,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
// edge/corner problem by itself
|
||||
//
|
||||
G4bool exitingReplica = fExitedMother;
|
||||
G4bool calculatedExitNormal;
|
||||
Step = freplicaNav.ComputeStep(pGlobalpoint,
|
||||
pDirection,
|
||||
fLastLocatedPointLocal,
|
||||
@@ -809,12 +900,14 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
pNewSafety,
|
||||
fHistory,
|
||||
fValidExitNormal,
|
||||
calculatedExitNormal,
|
||||
fExitNormal,
|
||||
exitingReplica,
|
||||
fEntering,
|
||||
&fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo);
|
||||
fExiting= exitingReplica; // still ok to set it ??
|
||||
fExiting= exitingReplica;
|
||||
fCalculatedExitNormal= calculatedExitNormal;
|
||||
}
|
||||
|
||||
// Remember last safety origin & value.
|
||||
@@ -834,7 +927,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
//
|
||||
fLocatedOnEdge = fLastStepWasZero && (Step==0.0);
|
||||
fLastStepWasZero = (Step==0.0);
|
||||
if (fPushed) fPushed = fLastStepWasZero;
|
||||
if (fPushed) { fPushed = fLastStepWasZero; }
|
||||
|
||||
// Handle large number of consecutive zero steps
|
||||
//
|
||||
@@ -915,30 +1008,96 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
}
|
||||
#endif
|
||||
|
||||
if(fValidExitNormal)
|
||||
if(fValidExitNormal || fCalculatedExitNormal)
|
||||
{
|
||||
// Convention: fExitNormal is in the 'grand-mother' coordinate system
|
||||
//
|
||||
fGrandMotherExitNormal= fExitNormal;
|
||||
if ( fHistory.GetTopVolumeType()!=kReplica )
|
||||
{
|
||||
// Convention: fExitNormal is in the 'grand-mother' coordinate system
|
||||
//
|
||||
fGrandMotherExitNormal= fExitNormal;
|
||||
fCalculatedExitNormal= true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fGrandMotherExitNormal = fExitNormal;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We must calculate the normal anyway (in order to have it if requested)
|
||||
//
|
||||
G4ThreeVector finalLocalPoint =
|
||||
fLastLocatedPointLocal + localDirection*Step;
|
||||
fLastLocatedPointLocal + localDirection*Step;
|
||||
|
||||
// Now fGrandMotherExitNormal is in the 'grand-mother' coordinate system
|
||||
//
|
||||
fGrandMotherExitNormal =
|
||||
motherLogical->GetSolid()->SurfaceNormal(finalLocalPoint);
|
||||
if ( fHistory.GetTopVolumeType()!=kReplica )
|
||||
{
|
||||
// Find normal in the 'mother' coordinate system
|
||||
//
|
||||
G4ThreeVector exitNormalMotherFrame=
|
||||
motherLogical->GetSolid()->SurfaceNormal(finalLocalPoint);
|
||||
|
||||
// Transform it to the 'grand-mother' coordinate system
|
||||
//
|
||||
const G4RotationMatrix* mRot = motherPhysical->GetRotation();
|
||||
if( mRot )
|
||||
{
|
||||
fChangedGrandMotherRefFrame= true;
|
||||
fGrandMotherExitNormal = (*mRot).inverse() * exitNormalMotherFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
fGrandMotherExitNormal = exitNormalMotherFrame;
|
||||
}
|
||||
|
||||
const G4RotationMatrix* mRot = motherPhysical->GetRotation();
|
||||
if( mRot )
|
||||
{
|
||||
fGrandMotherExitNormal *= (*mRot).inverse();
|
||||
// Do not set fValidExitNormal -- this signifies
|
||||
// that the solid is convex!
|
||||
//
|
||||
fCalculatedExitNormal= true;
|
||||
}
|
||||
// Do not set fValidExitNormal -- this signifies that the solid is convex!
|
||||
else
|
||||
{
|
||||
fCalculatedExitNormal = false;
|
||||
//
|
||||
// Nothing can be done at this stage currently - to solve this
|
||||
// Replica Navigation must have calculated the normal for this case
|
||||
// already.
|
||||
// Cases: mother is not convex, and exit is at previous replica level
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4ExceptionDescription desc;
|
||||
|
||||
desc << "Problem in ComputeStep: Replica Navigation did not provide"
|
||||
<< " valid exit Normal. " << G4endl;
|
||||
desc << " Do not know how calculate it in this case." << G4endl;
|
||||
desc << " Location = " << finalLocalPoint << G4endl;
|
||||
desc << " Volume name = " << motherPhysical->GetName()
|
||||
<< " copy/replica No = " << motherPhysical->GetCopyNo() << G4endl;
|
||||
G4Exception("G4Navigator::ComputeStep()", "GeomNav0003",
|
||||
JustWarning, desc, "Normal not available for exiting.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Now transform it to the global reference frame !!
|
||||
//
|
||||
if( fValidExitNormal || fCalculatedExitNormal )
|
||||
{
|
||||
G4int depth= fHistory.GetDepth();
|
||||
if( depth > 0 )
|
||||
{
|
||||
G4AffineTransform GrandMotherToGlobalTransf =
|
||||
fHistory.GetTransform(depth-1).Inverse();
|
||||
fExitNormalGlobalFrame =
|
||||
GrandMotherToGlobalTransf.TransformAxis( fGrandMotherExitNormal );
|
||||
}
|
||||
else
|
||||
{
|
||||
fExitNormalGlobalFrame= fGrandMotherExitNormal;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fExitNormalGlobalFrame= G4ThreeVector( 0., 0., 0.);
|
||||
}
|
||||
}
|
||||
fStepEndPoint= pGlobalpoint+Step*pDirection;
|
||||
@@ -959,13 +1118,14 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
G4cout << " ----- Upon exiting :" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
G4cout <<" Returned step = " << Step << G4endl;
|
||||
G4cout << " Returned step= " << Step;
|
||||
if( fVerbose > 5 ) G4cout << G4endl;
|
||||
if( Step == kInfinity )
|
||||
{
|
||||
G4cout << " Original proposed step = "
|
||||
<< pCurrentProposedStepLength << G4endl;
|
||||
G4cout << " Requested step= " << pCurrentProposedStepLength ;
|
||||
if( fVerbose > 5) G4cout << G4endl;
|
||||
}
|
||||
G4cout << " Safety = " << pNewSafety << G4endl;
|
||||
G4cout << " Safety = " << pNewSafety << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1019,7 +1179,12 @@ void G4Navigator::ResetState()
|
||||
fPushed = false;
|
||||
|
||||
fValidExitNormal = false;
|
||||
fChangedGrandMotherRefFrame= false;
|
||||
fCalculatedExitNormal = false;
|
||||
|
||||
fExitNormal = G4ThreeVector(0,0,0);
|
||||
fGrandMotherExitNormal = G4ThreeVector(0,0,0);
|
||||
fExitNormalGlobalFrame = G4ThreeVector(0,0,0);
|
||||
|
||||
fPreviousSftOrigin = G4ThreeVector(0,0,0);
|
||||
fPreviousSafety = 0.0;
|
||||
@@ -1098,8 +1263,8 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
|
||||
G4LogicalVolume *candidateLogical;
|
||||
if ( fLastTriedStepComputation )
|
||||
{
|
||||
// use fLastLocatedPointLocal
|
||||
// and next candidate volume
|
||||
// use fLastLocatedPointLocal and next candidate volume
|
||||
//
|
||||
G4ThreeVector nextSolidExitNormal(0.,0.,0.);
|
||||
|
||||
if( fEntering && (fBlockedPhysicalVolume!=0) )
|
||||
@@ -1110,10 +1275,11 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
|
||||
// fLastStepEndPointLocal is in the coordinates of the mother
|
||||
// we need it in the daughter's coordinate system.
|
||||
|
||||
if( CharacteriseDaughters(candidateLogical) != kReplica )
|
||||
// The following code should also work in case of Replica
|
||||
{
|
||||
// First transform fLastLocatedPointLocal to the new daughter
|
||||
// coordinates
|
||||
//
|
||||
G4AffineTransform MotherToDaughterTransform=
|
||||
GetMotherToDaughterTransform( fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo,
|
||||
@@ -1132,11 +1298,11 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
|
||||
if( ! onSurface )
|
||||
{
|
||||
if( inSideIt == kOutside )
|
||||
{
|
||||
{
|
||||
safety = (currentSolid->DistanceToIn(daughterPointOwnLocal));
|
||||
onSurface = safety < 100.0 * kCarTolerance;
|
||||
}
|
||||
else if (inSideIt == kInside )
|
||||
else if (inSideIt == kInside )
|
||||
{
|
||||
safety = (currentSolid->DistanceToOut(daughterPointOwnLocal));
|
||||
onSurface = safety < 100.0 * kCarTolerance;
|
||||
@@ -1151,6 +1317,7 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
|
||||
// Entering the solid ==> opposite
|
||||
//
|
||||
ExitNormal = -nextSolidExitNormal;
|
||||
fCalculatedExitNormal= true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1186,33 +1353,39 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
|
||||
}
|
||||
*valid = onSurface; // was =true;
|
||||
}
|
||||
else
|
||||
{
|
||||
*valid = false; // TODO: Need Separate code for replica!!!!
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4Exception("G4Navigator::GetLocalExitNormal()", "GeomNav0001",
|
||||
FatalException,
|
||||
"Local normal not (yet) available for replica volumes.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fExiting )
|
||||
{
|
||||
ExitNormal = fGrandMotherExitNormal;
|
||||
*valid = true;
|
||||
ExitNormal = fGrandMotherExitNormal;
|
||||
*valid = true;
|
||||
fCalculatedExitNormal= true; // Should be true already
|
||||
}
|
||||
else // ie ( fBlockedPhysicalVolume == 0 )
|
||||
else // i.e. ( fBlockedPhysicalVolume == 0 )
|
||||
{
|
||||
*valid = false;
|
||||
G4Exception("G4Navigator::GetLocalExitNormal()",
|
||||
"GeomNav0003", JustWarning,
|
||||
"Incorrect call to GetLocalSurfaceNormal." );
|
||||
}
|
||||
}
|
||||
else
|
||||
else // ( ! fLastTriedStepComputation ) ie. last call was to Locate
|
||||
{
|
||||
if ( EnteredDaughterVolume() )
|
||||
{
|
||||
ExitNormal= -(fHistory.GetTopVolume()->GetLogicalVolume()->
|
||||
GetSolid()->SurfaceNormal(fLastLocatedPointLocal));
|
||||
G4VSolid* daughterSolid =fHistory.GetTopVolume()->GetLogicalVolume()
|
||||
->GetSolid();
|
||||
ExitNormal= -(daughterSolid->SurfaceNormal(fLastLocatedPointLocal));
|
||||
if( std::fabs(ExitNormal.mag2()-1.0 ) > CLHEP::perMillion )
|
||||
{
|
||||
G4ExceptionDescription desc;
|
||||
desc << " Parameters of solid: " << *daughterSolid
|
||||
<< " Point for surface = " << fLastLocatedPointLocal << std::endl;
|
||||
G4Exception("G4Navigator::GetLocalExitNormal()",
|
||||
"GeomNav0003", FatalException, desc,
|
||||
"Surface Normal returned by Solid is not a Unit Vector." );
|
||||
}
|
||||
fCalculatedExitNormal= true;
|
||||
*valid = true;
|
||||
}
|
||||
else
|
||||
@@ -1221,10 +1394,16 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
|
||||
{
|
||||
ExitNormal = fGrandMotherExitNormal;
|
||||
*valid = true;
|
||||
fCalculatedExitNormal= true;
|
||||
}
|
||||
else // We are not at a boundary. ExitNormal remains (0,0,0)
|
||||
{
|
||||
{
|
||||
*valid = false;
|
||||
fCalculatedExitNormal= false;
|
||||
G4ExceptionDescription message;
|
||||
message << "Function called when *NOT* at a Boundary." << G4endl;
|
||||
G4Exception("G4Navigator::GetLocalExitNormal()",
|
||||
"GeomNav0003", JustWarning, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1238,7 +1417,7 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
|
||||
// ********************************************************************
|
||||
//
|
||||
G4AffineTransform
|
||||
G4Navigator::GetMotherToDaughterTransform( G4VPhysicalVolume *pEnteringPhysVol, // not Const
|
||||
G4Navigator::GetMotherToDaughterTransform( G4VPhysicalVolume *pEnteringPhysVol,
|
||||
G4int enteringReplicaNo,
|
||||
EVolume enteringVolumeType )
|
||||
{
|
||||
@@ -1284,20 +1463,30 @@ G4Navigator::GetMotherToDaughterTransform( G4VPhysicalVolume *pEnteringPhysVol,
|
||||
// ********************************************************************
|
||||
//
|
||||
G4ThreeVector G4Navigator::
|
||||
GetLocalExitNormalAndCheck(const G4ThreeVector& ExpectedBoundaryPointGlobal,
|
||||
GetLocalExitNormalAndCheck(
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
const G4ThreeVector& ExpectedBoundaryPointGlobal,
|
||||
#else
|
||||
const G4ThreeVector&,
|
||||
#endif
|
||||
G4bool* pValid)
|
||||
{
|
||||
G4ThreeVector ExpectedBoundaryPointLocal;
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
// Check Current point against expected 'local' value
|
||||
//
|
||||
if ( fLastTriedStepComputation )
|
||||
{
|
||||
const G4AffineTransform& GlobalToLocal= GetGlobalToLocalTransform();
|
||||
ExpectedBoundaryPointLocal =
|
||||
GlobalToLocal.TransformPoint( ExpectedBoundaryPointGlobal );
|
||||
}
|
||||
G4ThreeVector ExpectedBoundaryPointLocal;
|
||||
|
||||
const G4AffineTransform& GlobalToLocal= GetGlobalToLocalTransform();
|
||||
ExpectedBoundaryPointLocal =
|
||||
GlobalToLocal.TransformPoint( ExpectedBoundaryPointGlobal );
|
||||
|
||||
// Add here: Comparison against expected position,
|
||||
// i.e. the endpoint of ComputeStep
|
||||
}
|
||||
#endif
|
||||
|
||||
return GetLocalExitNormal( pValid);
|
||||
}
|
||||
|
||||
@@ -1310,19 +1499,98 @@ GetLocalExitNormalAndCheck(const G4ThreeVector& ExpectedBoundaryPointGlobal,
|
||||
//
|
||||
G4ThreeVector
|
||||
G4Navigator::GetGlobalExitNormal(const G4ThreeVector& IntersectPointGlobal,
|
||||
G4bool* pValidNormal)
|
||||
G4bool* pNormalCalculated)
|
||||
{
|
||||
G4bool validNormal;
|
||||
G4ThreeVector localNormal, globalNormal;
|
||||
|
||||
localNormal = GetLocalExitNormalAndCheck( IntersectPointGlobal, &validNormal);
|
||||
*pValidNormal = validNormal;
|
||||
G4AffineTransform localToGlobal = GetLocalToGlobalTransform();
|
||||
globalNormal = localToGlobal.TransformAxis( localNormal );
|
||||
|
||||
if( fLastTriedStepComputation && fExiting )
|
||||
{
|
||||
// This was computed in ComputeStep -- and only on arrival at boundary
|
||||
//
|
||||
globalNormal = fExitNormalGlobalFrame;
|
||||
*pNormalCalculated = true; // ComputeStep always computes it if Exiting
|
||||
// (fExiting==true)
|
||||
}
|
||||
else
|
||||
{
|
||||
localNormal = GetLocalExitNormalAndCheck(IntersectPointGlobal,&validNormal);
|
||||
*pNormalCalculated = fCalculatedExitNormal;
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( (!validNormal) && !fCalculatedExitNormal)
|
||||
{
|
||||
G4ExceptionDescription edN;
|
||||
edN << " Calculated = " << fCalculatedExitNormal << G4endl;
|
||||
edN << " Entering= " << fEntering << G4endl;
|
||||
G4int oldVerbose= this->GetVerboseLevel();
|
||||
this->SetVerboseLevel(4);
|
||||
edN << " State of Navigator: " << G4endl;
|
||||
edN << *this << G4endl;
|
||||
this->SetVerboseLevel( oldVerbose );
|
||||
|
||||
G4Exception("G4Navigator::GetGlobalExitNormal()",
|
||||
"GeomNav0003", JustWarning, edN,
|
||||
"LocalExitNormalAndCheck() did not calculate Normal.");
|
||||
}
|
||||
#endif
|
||||
|
||||
G4double localMag2= localNormal.mag2();
|
||||
if( validNormal && (std::fabs(localMag2-1.0)) > CLHEP::perMillion )
|
||||
{
|
||||
G4ExceptionDescription edN;
|
||||
|
||||
edN << "G4Navigator::GetGlobalExitNormal: "
|
||||
<< " Using Local Normal - from call to GetLocalExitNormalAndCheck. "
|
||||
<< G4endl
|
||||
<< " Local Exit Normal = " << localNormal << " || = "
|
||||
<< std::sqrt(localMag2) << G4endl
|
||||
<< " Global Exit Normal = " << globalNormal << " || = "
|
||||
<< globalNormal.mag() << G4endl;
|
||||
edN << " Calculated It = " << fCalculatedExitNormal << G4endl;
|
||||
|
||||
G4Exception("G4Navigator::GetGlobalExitNormal()",
|
||||
"GeomNav0003",JustWarning, edN,
|
||||
"Value obtained from new local *solid* is incorrect.");
|
||||
localNormal = localNormal.unit(); // Should we correct it ??
|
||||
}
|
||||
G4AffineTransform localToGlobal = GetLocalToGlobalTransform();
|
||||
globalNormal = localToGlobal.TransformAxis( localNormal );
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
// Temporary extra checks
|
||||
if( fLastTriedStepComputation && fExiting)
|
||||
{
|
||||
localNormal = GetLocalExitNormalAndCheck( IntersectPointGlobal, &validNormal);
|
||||
*pNormalCalculated = fCalculatedExitNormal;
|
||||
|
||||
G4AffineTransform localToGlobal = GetLocalToGlobalTransform();
|
||||
globalNormal = localToGlobal.TransformAxis( localNormal );
|
||||
|
||||
// Check the value computed against fExitNormalGlobalFrame
|
||||
G4ThreeVector diffNorm = globalNormal - fExitNormalGlobalFrame;
|
||||
if( diffNorm.mag2() > perMillion*CLHEP::perMillion)
|
||||
{
|
||||
G4ExceptionDescription edDfn;
|
||||
edDfn << "Found difference in normals in case of exiting mother "
|
||||
<< "- when Get is called after ComputingStep " << G4endl;
|
||||
edDfn << " Magnitude of diff = " << diffNorm.mag() << G4endl;
|
||||
edDfn << " Normal stored (Global) = " << fExitNormalGlobalFrame
|
||||
<< G4endl;
|
||||
edDfn << " Global Computed from Local = " << globalNormal << G4endl;
|
||||
G4Exception("G4Navigator::GetGlobalExitNormal()", "GeomNav0003",
|
||||
JustWarning, edDfn);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return globalNormal;
|
||||
}
|
||||
|
||||
// To make the new Voxel Safety the default, uncomment the next line
|
||||
// #define G4NEW_SAFETY 1
|
||||
|
||||
// ********************************************************************
|
||||
// ComputeSafety
|
||||
//
|
||||
@@ -1357,7 +1625,6 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
#endif
|
||||
|
||||
if (keepState) { SetSavedState(); }
|
||||
// fLastTriedStepComputation= true; -- this method is NOT computing the Step size
|
||||
|
||||
G4double distEndpointSq = (pGlobalpoint-fStepEndPoint).mag2();
|
||||
G4bool stayedOnEndpoint = distEndpointSq < kCarTolerance*kCarTolerance;
|
||||
@@ -1367,8 +1634,8 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
{
|
||||
// Pseudo-relocate to this point (updates voxel information only)
|
||||
//
|
||||
LocateGlobalPointWithinVolume( pGlobalpoint );
|
||||
// --->> Danger: Side effects on sub-navigator voxel information <<---
|
||||
LocateGlobalPointWithinVolume( pGlobalpoint );
|
||||
// --->> DANGER: Side effects on sub-navigator voxel information <<---
|
||||
// Could be replaced again by 'granular' calls to sub-navigator
|
||||
// locates (similar side-effects, but faster.
|
||||
// Solutions:
|
||||
@@ -1395,7 +1662,62 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
case kNormal:
|
||||
if ( pVoxelHeader )
|
||||
{
|
||||
newSafety=fvoxelNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
#ifdef G4NEW_SAFETY
|
||||
static G4VoxelSafety sfVoxelSafety;
|
||||
G4double safetyTwo = sfVoxelSafety.ComputeSafety(localPoint,
|
||||
*motherPhysical, pMaxLength);
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4double safetyNormal=
|
||||
fnormalNav.ComputeSafety(localPoint, fHistory, pMaxLength);
|
||||
|
||||
G4double diffSafety= (safetyTwo - safetyNormal);
|
||||
if( std::fabs(diffSafety) > CLHEP::perMillion
|
||||
* std::fabs(safetyNormal) )
|
||||
{
|
||||
G4ExceptionDescription exd;
|
||||
exd << " ERROR in G4Navigator::ComputeStep " << G4endl;
|
||||
exd << " Error> DIFFERENCE in Safety from G4VoxelSafety "
|
||||
<< " - compared to value from Normal. Diff = " << diffSafety << G4endl;
|
||||
exd << " New Voxel Safety= " << safetyTwo
|
||||
<< " Value from Normal= " << safetyNormal << G4endl;
|
||||
exd << " Location: Local coordinates = " << localPoint
|
||||
<< " mother Volume= " << *motherPhysical->GetName()
|
||||
<< " Copy# = " << motherPhysical->GetCopyNo() << G4endl;
|
||||
exd << " : Global coordinates = " << pGlobalpoint
|
||||
<< G4endl;
|
||||
G4Exception("G4Navigator::ComputeSafety()",
|
||||
"GeomNav0003", JustWarning, exd);
|
||||
}
|
||||
G4double safetyOldVoxel;
|
||||
safetyOldVoxel =
|
||||
fvoxelNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
|
||||
G4double diffBetterToApprox= safetyTwo - safetyOldVoxel;
|
||||
if( diffBetterToApprox < 0.0 )
|
||||
{
|
||||
G4ExceptionDescription exd;
|
||||
exd << "SMALLER Safety from call G4VoxelSafety compared to value "
|
||||
<< " from Normal. Diff = " << diffSafety << G4endl;
|
||||
exd << " New Voxel Safety= " << safetyTwo
|
||||
<< " Old value from Normal= " << newSafety << G4endl;
|
||||
exd << " Location: Local coordinates = " << localPoint
|
||||
<< " mother Volume= " << *motherPhysical->GetName()
|
||||
<< " Copy# = " << motherPhysical->GetCopyNo() << G4endl;
|
||||
exd << " : Global coordinates = " << pGlobalpoint
|
||||
<< G4endl;
|
||||
G4Exception("G4Navigator::ComputeSafety()",
|
||||
"GeomNav0003", JustWarning, exd);
|
||||
}
|
||||
#endif
|
||||
|
||||
// newSafety= safetyOldVoxel;
|
||||
newSafety= safetyTwo; // Faster and best available
|
||||
#else
|
||||
G4double safetyOldVoxel;
|
||||
safetyOldVoxel =
|
||||
fvoxelNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
newSafety= safetyOldVoxel;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1405,15 +1727,15 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
case kParameterised:
|
||||
if( GetDaughtersRegularStructureId(motherLogical) != 1 )
|
||||
{
|
||||
newSafety = fparamNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
newSafety=fparamNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
}
|
||||
else // Regular structure
|
||||
{
|
||||
newSafety = fregularNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
newSafety=fregularNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
}
|
||||
break;
|
||||
case kReplica:
|
||||
G4Exception("G4Navigator::ComputeSafety()", "NotApplicable",
|
||||
G4Exception("G4Navigator::ComputeSafety()", "GeomNav0001",
|
||||
FatalException, "Not applicable for replicated volumes.");
|
||||
break;
|
||||
}
|
||||
@@ -1495,7 +1817,8 @@ void G4Navigator::PrintState() const
|
||||
}
|
||||
if( ( 1 < fVerbose) && (fVerbose < 4) )
|
||||
{
|
||||
G4cout << std::setw(30) << " ExitNormal " << " "
|
||||
G4cout << G4endl; // Make sure to line up
|
||||
G4cout << std::setw(30) << " ExitNormal " << " "
|
||||
<< std::setw( 5) << " Valid " << " "
|
||||
<< std::setw( 9) << " Exiting " << " "
|
||||
<< std::setw( 9) << " Entering" << " "
|
||||
@@ -1636,6 +1959,67 @@ void G4Navigator::ComputeStepLog(const G4ThreeVector& pGlobalpoint,
|
||||
//
|
||||
std::ostream& operator << (std::ostream &os,const G4Navigator &n)
|
||||
{
|
||||
os << "Current History: " << G4endl << n.fHistory;
|
||||
// Old version did only the following:
|
||||
// os << "Current History: " << G4endl << n.fHistory;
|
||||
// Old behaviour is recovered for fVerbose = 0
|
||||
|
||||
// Adapted from G4Navigator::PrintState() const
|
||||
|
||||
G4int oldcoutPrec = os.precision(4);
|
||||
if( n.fVerbose >= 4 )
|
||||
{
|
||||
os << "The current state of G4Navigator is: " << G4endl;
|
||||
os << " ValidExitNormal= " << n.fValidExitNormal << G4endl
|
||||
<< " ExitNormal = " << n.fExitNormal << G4endl
|
||||
<< " Exiting = " << n.fExiting << G4endl
|
||||
<< " Entering = " << n.fEntering << G4endl
|
||||
<< " BlockedPhysicalVolume= " ;
|
||||
if (n.fBlockedPhysicalVolume==0)
|
||||
os << "None";
|
||||
else
|
||||
os << n.fBlockedPhysicalVolume->GetName();
|
||||
os << G4endl
|
||||
<< " BlockedReplicaNo = " << n.fBlockedReplicaNo << G4endl
|
||||
<< " LastStepWasZero = " << n.fLastStepWasZero << G4endl
|
||||
<< G4endl;
|
||||
}
|
||||
if( ( 1 < n.fVerbose) && (n.fVerbose < 4) )
|
||||
{
|
||||
os << G4endl; // Make sure to line up
|
||||
os << std::setw(30) << " ExitNormal " << " "
|
||||
<< std::setw( 5) << " Valid " << " "
|
||||
<< std::setw( 9) << " Exiting " << " "
|
||||
<< std::setw( 9) << " Entering" << " "
|
||||
<< std::setw(15) << " Blocked:Volume " << " "
|
||||
<< std::setw( 9) << " ReplicaNo" << " "
|
||||
<< std::setw( 8) << " LastStepZero " << " "
|
||||
<< G4endl;
|
||||
os << "( " << std::setw(7) << n.fExitNormal.x()
|
||||
<< ", " << std::setw(7) << n.fExitNormal.y()
|
||||
<< ", " << std::setw(7) << n.fExitNormal.z() << " ) "
|
||||
<< std::setw( 5) << n.fValidExitNormal << " "
|
||||
<< std::setw( 9) << n.fExiting << " "
|
||||
<< std::setw( 9) << n.fEntering << " ";
|
||||
if ( n.fBlockedPhysicalVolume==0 )
|
||||
{ os << std::setw(15) << "None"; }
|
||||
else
|
||||
{ os << std::setw(15)<< n.fBlockedPhysicalVolume->GetName(); }
|
||||
os << std::setw( 9) << n.fBlockedReplicaNo << " "
|
||||
<< std::setw( 8) << n.fLastStepWasZero << " "
|
||||
<< G4endl;
|
||||
}
|
||||
if( n.fVerbose > 2 )
|
||||
{
|
||||
os.precision(8);
|
||||
os << " Current Localpoint = " << n.fLastLocatedPointLocal << G4endl;
|
||||
os << " PreviousSftOrigin = " << n.fPreviousSftOrigin << G4endl;
|
||||
os << " PreviousSafety = " << n.fPreviousSafety << G4endl;
|
||||
}
|
||||
if( n.fVerbose > 3 || n.fVerbose == 0 )
|
||||
{
|
||||
os << "Current History: " << G4endl << n.fHistory;
|
||||
}
|
||||
|
||||
os.precision(oldcoutPrec);
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.cc,v 1.11 2010-11-04 08:57:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation Implementation
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.13 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Implementation
|
||||
@@ -178,8 +177,6 @@ G4double G4ParameterisedNavigation::
|
||||
{
|
||||
if (localDirection.dot(exitNormal)>=kMinExitingNormalCosine)
|
||||
{
|
||||
assert( (0 <= blockedReplicaNo)&&(blockedReplicaNo<nReplicas) );
|
||||
|
||||
// Block exited daughter replica; Must be on boundary => zero safety
|
||||
//
|
||||
fBList.BlockVolume(blockedReplicaNo);
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PartialPhantomParameterisation.cc,v 1.3 2010-12-15 07:39:00 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4PartialPhantomParameterisation implementation
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PathFinder.cc,v 1.64 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// $Id$
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4PathFinder Implementation
|
||||
@@ -33,10 +33,11 @@
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4PathFinder.hh"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4PathFinder.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
@@ -246,6 +247,7 @@ G4PathFinder::ComputeStep( const G4FieldTrack &InitialFieldTrack,
|
||||
}
|
||||
fLastStepNo= stepNo;
|
||||
|
||||
#ifdef G4DEBUG_PATHFINDER
|
||||
if ( (fNoGeometriesLimiting < 0)
|
||||
|| (fNoGeometriesLimiting > fNoActiveNavigators) )
|
||||
{
|
||||
@@ -256,6 +258,7 @@ G4PathFinder::ComputeStep( const G4FieldTrack &InitialFieldTrack,
|
||||
G4Exception("G4PathFinder::ComputeStep()",
|
||||
"GeomNav0002", FatalException, message);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef G4DEBUG_PATHFINDER
|
||||
else
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhantomParameterisation.cc,v 1.7 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// $Id$
|
||||
// GEANT4 tag $ Name:$
|
||||
//
|
||||
// class G4PhantomParameterisation implementation
|
||||
|
||||
@@ -35,14 +35,15 @@
|
||||
// 14.10.96 John Apostolakis, design and implementation
|
||||
// 17.03.97 John Apostolakis, renaming new set functions being added
|
||||
//
|
||||
// $Id: G4PropagatorInField.cc,v 1.52 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// $Id$
|
||||
// GEANT4 tag $ Name: $
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Navigator.hh"
|
||||
@@ -86,11 +87,14 @@ G4PropagatorInField::G4PropagatorInField( G4Navigator *theNavigator,
|
||||
fPreviousSftOrigin= G4ThreeVector(0.,0.,0.);
|
||||
fPreviousSafety= 0.0;
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
fZeroStepThreshold= std::max( 1.0e5 * kCarTolerance, 1.0e-1 * micrometer ) ;
|
||||
fZeroStepThreshold= std::max( 1.0e5 * kCarTolerance, 1.0e-1 * micrometer );
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4cout << " PiF: Zero Step Threshold set to " << fZeroStepThreshold / millimeter
|
||||
G4cout << " PiF: Zero Step Threshold set to "
|
||||
<< fZeroStepThreshold / millimeter
|
||||
<< " mm." << G4endl;
|
||||
G4cout << " PiF: Value of kCarTolerance = " << kCarTolerance / millimeter
|
||||
G4cout << " PiF: Value of kCarTolerance = "
|
||||
<< kCarTolerance / millimeter
|
||||
<< " mm. " << G4endl;
|
||||
#endif
|
||||
|
||||
@@ -165,7 +169,7 @@ G4PropagatorInField::ComputeStep(
|
||||
// For the next call, the field manager must again be set
|
||||
fSetFieldMgr= false;
|
||||
|
||||
GetChordFinder()->SetChargeMomentumMass(fCharge, fInitialMomentumModulus, fMass);
|
||||
GetChordFinder()->SetChargeMomentumMass(fCharge,fInitialMomentumModulus,fMass);
|
||||
|
||||
// Values for Intersection Locator has to be updated on each call for the
|
||||
// case that CurrentFieldManager has changed from the one of previous step
|
||||
@@ -226,8 +230,8 @@ G4PropagatorInField::ComputeStep(
|
||||
//
|
||||
if( stepTrial > 100.0*fZeroStepThreshold )
|
||||
decreaseFactor = 0.35; // Try decreasing slower
|
||||
else if( stepTrial > 100.0*fZeroStepThreshold )
|
||||
decreaseFactor= 0.5; // Try yet slower decreases
|
||||
else if( stepTrial > 30.0*fZeroStepThreshold )
|
||||
decreaseFactor= 0.5; // Try yet slower decrease
|
||||
else if( stepTrial > 10.0*fZeroStepThreshold )
|
||||
decreaseFactor= 0.75; // Try even slower decreases
|
||||
else
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RegularNavigation.cc,v 1.15 2010-11-19 15:13:39 gcosmo Exp $
|
||||
// $Id$
|
||||
// GEANT4 tag $ Name:$
|
||||
//
|
||||
// class G4RegularNavigation implementation
|
||||
@@ -134,7 +134,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
|
||||
G4int& blockedReplicaNo,
|
||||
G4VPhysicalVolume* pCurrentPhysical)
|
||||
{
|
||||
G4RegularNavigationHelper::ClearStepLengths();
|
||||
G4RegularNavigationHelper::Instance()->ClearStepLengths();
|
||||
|
||||
G4PhantomParameterisation *param =
|
||||
(G4PhantomParameterisation*)(pCurrentPhysical->GetParameterisation());
|
||||
@@ -219,13 +219,13 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
|
||||
}
|
||||
if(totalNewStep > currentProposedStepLength)
|
||||
{
|
||||
G4RegularNavigationHelper::
|
||||
G4RegularNavigationHelper::Instance()->
|
||||
AddStepLength(copyNo, newStep-totalNewStep+currentProposedStepLength);
|
||||
return currentProposedStepLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4RegularNavigationHelper::AddStepLength( copyNo, newStep );
|
||||
G4RegularNavigationHelper::Instance()->AddStepLength( copyNo, newStep );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RegularNavigationHelper.cc,v 1.1 2009-01-27 09:31:29 gcosmo Exp $
|
||||
// $Id$
|
||||
// GEANT4 tag $ Name:$
|
||||
//
|
||||
// class G4RegularNavigationHelper implementation
|
||||
@@ -35,8 +35,17 @@
|
||||
|
||||
#include "G4RegularNavigationHelper.hh"
|
||||
|
||||
std::vector< std::pair<G4int,G4double> >
|
||||
G4RegularNavigationHelper::theStepLengths;
|
||||
G4RegularNavigationHelper * G4RegularNavigationHelper::theInstance = 0;
|
||||
|
||||
G4RegularNavigationHelper* G4RegularNavigationHelper::Instance()
|
||||
{
|
||||
if(theInstance == 0)
|
||||
{
|
||||
static G4RegularNavigationHelper helper;
|
||||
theInstance = &helper;
|
||||
}
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
@@ -63,3 +72,10 @@ void G4RegularNavigationHelper::AddStepLength( G4int copyNo, G4double slen )
|
||||
{
|
||||
theStepLengths.push_back( std::pair<G4int,G4double>(copyNo,slen) );
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
const std::vector< std::pair<G4int,G4double> > & G4RegularNavigationHelper::GetStepLengths()
|
||||
{
|
||||
return theStepLengths;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.20 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation Implementation
|
||||
@@ -42,14 +41,12 @@
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
// ********************************************************************
|
||||
// Constructor
|
||||
// ********************************************************************
|
||||
//
|
||||
G4ReplicaNavigation::G4ReplicaNavigation()
|
||||
: fCheck(false), fVerbose(0)
|
||||
: fCheck(false), fVerbose(0)
|
||||
{
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
kRadTolerance = G4GeometryTolerance::GetInstance()->GetRadialTolerance();
|
||||
@@ -85,7 +82,6 @@ G4ReplicaNavigation::Inside(const G4VPhysicalVolume *pVol,
|
||||
G4double coord, rad2, rmin, tolRMax2, rmax, tolRMin2;
|
||||
|
||||
pVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
|
||||
assert(consuming);
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
@@ -192,7 +188,6 @@ G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
G4double coord, rho, rmin, rmax;
|
||||
|
||||
pVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
|
||||
assert(consuming);
|
||||
switch(axis)
|
||||
{
|
||||
case kXAxis:
|
||||
@@ -246,7 +241,8 @@ G4double
|
||||
G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection) const
|
||||
const G4ThreeVector &localDirection,
|
||||
G4ExitNormal& arExitNormal ) const
|
||||
{
|
||||
// Replication data
|
||||
//
|
||||
@@ -257,9 +253,17 @@ G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
|
||||
G4double Dist=kInfinity;
|
||||
G4double coord, Comp, lindist;
|
||||
G4double signC = 0.0;
|
||||
G4ExitNormal candidateNormal;
|
||||
|
||||
static const G4ThreeVector VecCartAxes[3]=
|
||||
{ G4ThreeVector(1.,0.,0.),G4ThreeVector(0.,1.,0.),G4ThreeVector(0.,0.,1.) };
|
||||
static G4ExitNormal::ESide SideCartAxesPlus [3]=
|
||||
{ G4ExitNormal::kPX, G4ExitNormal::kPY, G4ExitNormal::kPZ };
|
||||
static G4ExitNormal::ESide SideCartAxesMinus[3]=
|
||||
{ G4ExitNormal::kMX, G4ExitNormal::kMY, G4ExitNormal::kMZ };
|
||||
|
||||
pVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
|
||||
assert(consuming);
|
||||
switch(axis)
|
||||
{
|
||||
case kXAxis:
|
||||
@@ -271,28 +275,42 @@ G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
{
|
||||
lindist = width*0.5-coord;
|
||||
Dist = (lindist>0) ? lindist/Comp : 0;
|
||||
signC= 1.0;
|
||||
}
|
||||
else if ( Comp<0 )
|
||||
{
|
||||
lindist = width*0.5+coord;
|
||||
Dist = (lindist>0) ? -lindist/Comp : 0;
|
||||
signC= -1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Dist = kInfinity;
|
||||
}
|
||||
// signC = sign<G4double>(Comp)
|
||||
candidateNormal.exitNormal = ( signC * VecCartAxes[axis]);
|
||||
candidateNormal.calculated = true;
|
||||
candidateNormal.validConvex = true;
|
||||
candidateNormal.exitSide =
|
||||
(Comp>0) ? SideCartAxesPlus[axis] : SideCartAxesMinus[axis];
|
||||
break;
|
||||
case kPhi:
|
||||
Dist = DistanceToOutPhi(localPoint, localDirection, width);
|
||||
Dist = DistanceToOutPhi(localPoint,localDirection,width,candidateNormal);
|
||||
// candidateNormal set in call
|
||||
break;
|
||||
case kRho:
|
||||
Dist=DistanceToOutRad(localPoint,localDirection,width,offset,replicaNo);
|
||||
Dist = DistanceToOutRad(localPoint,localDirection,width,offset,
|
||||
replicaNo,candidateNormal);
|
||||
// candidateNormal set in call
|
||||
break;
|
||||
default:
|
||||
G4Exception("G4ReplicaNavigation::DistanceToOut()", "GeomNav0002",
|
||||
FatalException, "Unknown axis!");
|
||||
break;
|
||||
}
|
||||
|
||||
arExitNormal= candidateNormal; // .exitNormal;
|
||||
|
||||
return Dist;
|
||||
}
|
||||
|
||||
@@ -303,14 +321,18 @@ G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
G4double
|
||||
G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width) const
|
||||
const G4double width,
|
||||
G4ExitNormal& foundNormal ) const
|
||||
{
|
||||
// Phi Intersection
|
||||
// NOTE: width<=pi by definition
|
||||
//
|
||||
G4double sinSPhi, cosSPhi;
|
||||
G4double sinSPhi= -2.0, cosSPhi= -2.0;
|
||||
G4double pDistS, pDistE, compS, compE, Dist, dist2, yi;
|
||||
if ( localPoint.x()||localPoint.y() )
|
||||
G4ExitNormal::ESide sidePhi= G4ExitNormal::kNull;
|
||||
G4ThreeVector candidateNormal;
|
||||
|
||||
if ( (localPoint.x()!=0.0) || (localPoint.y()!=0.0) )
|
||||
{
|
||||
sinSPhi = std::sin(-width*0.5); // SIN of starting phi plane
|
||||
cosSPhi = std::cos(width*0.5); // COS of starting phi plane
|
||||
@@ -318,7 +340,9 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
// pDist -ve when inside
|
||||
//
|
||||
pDistS = localPoint.x()*sinSPhi-localPoint.y()*cosSPhi;
|
||||
// Start plane at phi= -S
|
||||
pDistE = localPoint.x()*sinSPhi+localPoint.y()*cosSPhi;
|
||||
// End plane at phi= +S
|
||||
|
||||
// Comp -ve when in direction of outwards normal
|
||||
//
|
||||
@@ -339,6 +363,7 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
if ( yi<=0 )
|
||||
{
|
||||
Dist = (pDistS<=-kCarTolerance*0.5) ? dist2 : 0;
|
||||
sidePhi= G4ExitNormal::kSPhi; // tbc
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -366,6 +391,7 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
// Leaving via ending phi
|
||||
//
|
||||
Dist = (pDistE<=-kCarTolerance*0.5) ? dist2 : 0;
|
||||
sidePhi = G4ExitNormal::kEPhi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,6 +416,7 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
// (if not -> remain in extent)
|
||||
//
|
||||
Dist = (yi>0) ? dist2 : kInfinity;
|
||||
if( yi> 0 ) { sidePhi = G4ExitNormal::kEPhi; }
|
||||
}
|
||||
else // Leaving immediately by starting phi
|
||||
{
|
||||
@@ -412,6 +439,7 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
// (if not -> remain in extent)
|
||||
//
|
||||
Dist = (yi<0) ? dist2 : kInfinity;
|
||||
if(yi<0) { sidePhi = G4ExitNormal::kSPhi; }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -423,6 +451,7 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
// Leaving immediately by ending phi
|
||||
//
|
||||
Dist = 0;
|
||||
sidePhi= G4ExitNormal::kEPhi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,8 +459,32 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
{
|
||||
// On z axis + travel not || to z axis -> use direction vector
|
||||
//
|
||||
Dist = (std::fabs(localDirection.phi())<=width*0.5) ? kInfinity : 0;
|
||||
if( (std::fabs(localDirection.phi())<=width*0.5) )
|
||||
{
|
||||
Dist= kInfinity;
|
||||
}
|
||||
else
|
||||
{
|
||||
Dist= 0;
|
||||
sidePhi= G4ExitNormal::kMY;
|
||||
}
|
||||
}
|
||||
|
||||
if(sidePhi == G4ExitNormal::kSPhi )
|
||||
{
|
||||
candidateNormal = G4ThreeVector(sinSPhi,-cosSPhi,0.) ;
|
||||
}
|
||||
else if (sidePhi == G4ExitNormal::kEPhi)
|
||||
{
|
||||
candidateNormal = G4ThreeVector(sinSPhi,cosSPhi,0.) ;
|
||||
}
|
||||
else if (sidePhi == G4ExitNormal::kMY )
|
||||
{
|
||||
candidateNormal = G4ThreeVector(0., -1.0, 0.); // Split -S and +S 'phi'
|
||||
}
|
||||
foundNormal.calculated= (sidePhi != G4ExitNormal::kNull );
|
||||
foundNormal.exitNormal= candidateNormal;
|
||||
|
||||
return Dist;
|
||||
}
|
||||
|
||||
@@ -444,11 +497,13 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width,
|
||||
const G4double offset,
|
||||
const G4int replicaNo) const
|
||||
const G4int replicaNo,
|
||||
G4ExitNormal& foundNormal ) const
|
||||
{
|
||||
G4double rmin, rmax, t1, t2, t3, deltaR;
|
||||
G4double b, c, d2, sr;
|
||||
|
||||
G4double b, c, d2, srd;
|
||||
G4ExitNormal::ESide sideR= G4ExitNormal::kNull;
|
||||
|
||||
//
|
||||
// Radial Intersections
|
||||
//
|
||||
@@ -474,7 +529,7 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
|
||||
if ( t1>0 ) // Check not parallel
|
||||
{
|
||||
// Calculate sr, r exit distance
|
||||
// Calculate srd, r exit distance
|
||||
//
|
||||
if ( t2>=0 )
|
||||
{
|
||||
@@ -489,14 +544,16 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
{
|
||||
b = t2/t1;
|
||||
c = deltaR/t1;
|
||||
sr = -b+std::sqrt(b*b-c);
|
||||
srd = -b+std::sqrt(b*b-c);
|
||||
sideR= G4ExitNormal::kRMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On tolerant boundary & heading outwards (or locally
|
||||
// perpendicular to) outer radial surface -> leaving immediately
|
||||
//
|
||||
sr = 0;
|
||||
srd = 0;
|
||||
sideR= G4ExitNormal::kRMax;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -515,7 +572,10 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
// NOTE: Should use
|
||||
// rho-rmin>kRadTolerance*0.5 - [no sqrts for efficiency]
|
||||
//
|
||||
sr = (deltaR>kRadTolerance*0.5) ? -b-std::sqrt(d2) : 0;
|
||||
srd = (deltaR>kRadTolerance*0.5) ? -b-std::sqrt(d2) : 0;
|
||||
// Is the following more accurate ? - called 'issue' below
|
||||
// srd = (deltaR>kRadTolerance*0.5) ? c/( -b - std::sqrt(d2)) : 0.0;
|
||||
sideR= G4ExitNormal::kRMin;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -523,7 +583,8 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
//
|
||||
deltaR = t3-rmax*rmax;
|
||||
c = deltaR/t1;
|
||||
sr = -b+std::sqrt(b*b-c);
|
||||
srd = -b+std::sqrt(b*b-c); // See issue above
|
||||
sideR= G4ExitNormal::kRMax;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -533,15 +594,40 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
deltaR = t3-rmax*rmax;
|
||||
b = t2/t1;
|
||||
c = deltaR/t1;
|
||||
sr = -b+std::sqrt(b*b-c);
|
||||
srd = -b+std::sqrt(b*b-c); // See issue above
|
||||
sideR= G4ExitNormal::kRMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sr=kInfinity;
|
||||
srd=kInfinity;
|
||||
sideR= G4ExitNormal::kNull;
|
||||
}
|
||||
return sr;
|
||||
|
||||
if( sideR != G4ExitNormal::kNull ) // if ((side == kRMax) || (side==kRMin))
|
||||
{
|
||||
// Note: returned vector not explicitly normalised
|
||||
// (divided by fRMax for unit vector)
|
||||
G4double xi, yi;
|
||||
xi = localPoint.x() + srd*localDirection.x() ;
|
||||
yi = localPoint.y() + srd*localDirection.y() ;
|
||||
G4ThreeVector normalR = G4ThreeVector(xi,yi,0.0);
|
||||
|
||||
if( sideR == G4ExitNormal::kRMax ){
|
||||
normalR *= 1.0/rmax;
|
||||
}else{
|
||||
normalR *= (-1.0)/rmin;
|
||||
}
|
||||
foundNormal.exitNormal= normalR;
|
||||
foundNormal.calculated= true;
|
||||
foundNormal.validConvex = (sideR == G4ExitNormal::kRMax);
|
||||
foundNormal.exitSide = sideR;
|
||||
}else{
|
||||
foundNormal.calculated= false;
|
||||
}
|
||||
|
||||
return srd;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -565,7 +651,6 @@ G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
G4bool consuming;
|
||||
|
||||
pVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
|
||||
assert(consuming);
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
@@ -621,7 +706,6 @@ G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
G4bool consuming;
|
||||
|
||||
pVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
|
||||
assert(consuming);
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
@@ -660,8 +744,10 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double &newSafety,
|
||||
G4NavigationHistory &history,
|
||||
// std::pair<G4bool,G4bool> &validAndCalculated
|
||||
G4bool &validExitNormal,
|
||||
G4ThreeVector &exitNormal,
|
||||
G4bool &calculatedExitNormal,
|
||||
G4ThreeVector &exitNormalVector,
|
||||
G4bool &exiting,
|
||||
G4bool &entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
@@ -677,12 +763,16 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
G4double sampleStep, sampleSafety, motherStep, motherSafety;
|
||||
G4int localNoDaughters, sampleNo;
|
||||
G4int depth;
|
||||
G4ExitNormal exitNormalStc;
|
||||
// G4int depthDeterminingStep= -1; // Useful only for debugging - for now
|
||||
|
||||
calculatedExitNormal= false;
|
||||
|
||||
// Exiting normal optimisation
|
||||
//
|
||||
if ( exiting&&validExitNormal )
|
||||
{
|
||||
if ( localDirection.dot(exitNormal)>=kMinExitingNormalCosine )
|
||||
if ( localDirection.dot(exitNormalVector)>=kMinExitingNormalCosine )
|
||||
{
|
||||
// Block exited daughter volume
|
||||
//
|
||||
@@ -703,6 +793,8 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
sampleSafety = DistanceToOut(repPhysical,
|
||||
history.GetTopReplicaNo(),
|
||||
localPoint);
|
||||
G4ExitNormal normalOutStc;
|
||||
const G4int topDepth= history.GetDepth();
|
||||
|
||||
if ( sampleSafety<ourSafety )
|
||||
{
|
||||
@@ -710,54 +802,110 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
}
|
||||
if ( sampleSafety<ourStep )
|
||||
{
|
||||
|
||||
sampleStep = DistanceToOut(repPhysical,
|
||||
history.GetTopReplicaNo(),
|
||||
localPoint,
|
||||
localDirection);
|
||||
localDirection,
|
||||
normalOutStc);
|
||||
if ( sampleStep<ourStep )
|
||||
{
|
||||
ourStep = sampleStep;
|
||||
exiting = true;
|
||||
validExitNormal = false;
|
||||
validExitNormal = normalOutStc.validConvex; // false; -> Old,Conservative
|
||||
|
||||
exitNormalStc= normalOutStc;
|
||||
exitNormalStc.exitNormal= history.GetTopTransform().Inverse().
|
||||
TransformAxis(normalOutStc.exitNormal);
|
||||
calculatedExitNormal= true;
|
||||
}
|
||||
}
|
||||
|
||||
depth = history.GetDepth()-1;
|
||||
const G4int secondDepth= topDepth;
|
||||
depth = secondDepth;
|
||||
|
||||
while ( history.GetVolumeType(depth)==kReplica )
|
||||
{
|
||||
repPoint = history.GetTransform(depth).TransformPoint(globalPoint);
|
||||
const G4AffineTransform& GlobalToLocal= history.GetTransform(depth);
|
||||
repPoint = GlobalToLocal.TransformPoint(globalPoint);
|
||||
// repPoint = history.GetTransform(depth).TransformPoint(globalPoint);
|
||||
|
||||
sampleSafety = DistanceToOut(history.GetVolume(depth),
|
||||
history.GetReplicaNo(depth),
|
||||
repPoint);
|
||||
if ( sampleSafety<ourSafety )
|
||||
if ( sampleSafety < ourSafety )
|
||||
{
|
||||
ourSafety = sampleSafety;
|
||||
}
|
||||
if ( sampleSafety<ourStep )
|
||||
if ( sampleSafety < ourStep )
|
||||
{
|
||||
G4ThreeVector newLocalDirection = GlobalToLocal.TransformAxis(globalDirection);
|
||||
sampleStep = DistanceToOut(history.GetVolume(depth),
|
||||
history.GetReplicaNo(depth),
|
||||
repPoint,
|
||||
history.GetTransform(depth).TransformAxis(globalDirection));
|
||||
if ( sampleStep<ourStep )
|
||||
newLocalDirection,
|
||||
normalOutStc);
|
||||
if ( sampleStep < ourStep )
|
||||
{
|
||||
ourStep = sampleStep;
|
||||
exiting = true;
|
||||
validExitNormal = false;
|
||||
|
||||
// As step is limited by this level, must set Exit Normal
|
||||
//
|
||||
G4ThreeVector localExitNorm= normalOutStc.exitNormal;
|
||||
G4ThreeVector globalExitNorm=
|
||||
GlobalToLocal.Inverse().TransformAxis(localExitNorm);
|
||||
|
||||
exitNormalStc= normalOutStc; // Normal, convex, calculated, side
|
||||
exitNormalStc.exitNormal= globalExitNorm;
|
||||
calculatedExitNormal= true;
|
||||
}
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
|
||||
|
||||
// Compute mother safety & intersection
|
||||
//
|
||||
G4ThreeVector exitVectorMother;
|
||||
G4bool exitConvex= false; // Value obtained in DistanceToOut(p,v) call
|
||||
G4ExitNormal motherNormalStc;
|
||||
|
||||
repPoint = history.GetTransform(depth).TransformPoint(globalPoint);
|
||||
motherPhysical = history.GetVolume(depth);
|
||||
motherSolid = motherPhysical->GetLogicalVolume()->GetSolid();
|
||||
motherSafety = motherSolid->DistanceToOut(repPoint);
|
||||
repDirection = history.GetTransform(depth).TransformAxis(globalDirection);
|
||||
|
||||
motherStep = motherSolid->DistanceToOut(repPoint,repDirection,true,
|
||||
&validExitNormal,&exitNormal);
|
||||
&exitConvex,&exitVectorMother);
|
||||
if( exitConvex )
|
||||
{
|
||||
motherNormalStc = G4ExitNormal( exitVectorMother, true, false,
|
||||
G4ExitNormal::kMother);
|
||||
calculatedExitNormal= true;
|
||||
}
|
||||
const G4AffineTransform& globalToLocalTop = history.GetTopTransform();
|
||||
|
||||
G4bool motherDeterminedStep= (motherStep<ourStep);
|
||||
|
||||
if( (!exitConvex) && motherDeterminedStep )
|
||||
{
|
||||
exitVectorMother= motherSolid->SurfaceNormal( repPoint );
|
||||
motherNormalStc= G4ExitNormal( exitVectorMother, true, false,
|
||||
G4ExitNormal::kMother);
|
||||
// CalculatedExitNormal -> true;
|
||||
// Convex -> false: do not know value
|
||||
// ExitSide -> kMother (or kNull)
|
||||
|
||||
calculatedExitNormal= true;
|
||||
}
|
||||
if( motherDeterminedStep)
|
||||
{
|
||||
G4ThreeVector globalExitNormalTop=
|
||||
globalToLocalTop.Inverse().TransformAxis(exitVectorMother);
|
||||
|
||||
exitNormalStc= motherNormalStc;
|
||||
exitNormalStc.exitNormal= globalExitNormalTop;
|
||||
}
|
||||
|
||||
// Push in principle no longer necessary. G4Navigator now takes care of ...
|
||||
// Removing this will however generate warnings for pushed particles from
|
||||
@@ -789,7 +937,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
<< G4endl;
|
||||
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
|
||||
message << " Estimated isotropic distance to solid (distToIn)= "
|
||||
<< estDistToSolid;
|
||||
<< estDistToSolid << G4endl;
|
||||
if( estDistToSolid > 100.0 * kCarTolerance )
|
||||
{
|
||||
motherSolid->DumpInfo();
|
||||
@@ -805,8 +953,42 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
}
|
||||
#endif
|
||||
|
||||
// May need precision protection
|
||||
// Comparison of steps may need precision protection
|
||||
//
|
||||
#if 1
|
||||
if( motherDeterminedStep)
|
||||
{
|
||||
ourStep = motherStep;
|
||||
exiting = true;
|
||||
}
|
||||
|
||||
// Transform it to the Grand-Mother Reference Frame (current convention)
|
||||
//
|
||||
if ( calculatedExitNormal )
|
||||
{
|
||||
if ( motherDeterminedStep )
|
||||
{
|
||||
exitNormalVector= motherNormalStc.exitNormal;
|
||||
}else{
|
||||
G4ThreeVector exitNormalGlobal= exitNormalStc.exitNormal;
|
||||
exitNormalVector= globalToLocalTop.TransformAxis(exitNormalGlobal);
|
||||
// exitNormalVector= globalToLocal2nd.TransformAxis(exitNormalGlobal);
|
||||
// Alt Make it in one go to Grand-Mother, avoiding transform below
|
||||
}
|
||||
// Transform to Grand-mother reference frame
|
||||
const G4RotationMatrix* rot = motherPhysical->GetRotation();
|
||||
if ( rot )
|
||||
{
|
||||
exitNormalVector *= rot->inverse();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
validExitNormal = false;
|
||||
}
|
||||
|
||||
#else
|
||||
if ( motherSafety<=ourStep )
|
||||
{
|
||||
if ( motherStep<=ourStep )
|
||||
@@ -825,8 +1007,17 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
else
|
||||
{
|
||||
validExitNormal = false;
|
||||
// calculatedExitNormal= false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
G4bool daughterDeterminedStep=false;
|
||||
G4ThreeVector daughtNormRepCrd;
|
||||
// Exit normal of daughter transformed to
|
||||
// the coordinate system of Replica (i.e. last depth)
|
||||
|
||||
//
|
||||
// Compute daughter safeties & intersections
|
||||
//
|
||||
@@ -836,6 +1027,9 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
samplePhysical = repLogical->GetDaughter(sampleNo);
|
||||
if ( samplePhysical!=blockedExitedVol )
|
||||
{
|
||||
G4ThreeVector localExitNorm;
|
||||
G4ThreeVector normReplicaCoord;
|
||||
|
||||
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
|
||||
samplePhysical->GetTranslation());
|
||||
sampleTf.Invert();
|
||||
@@ -856,11 +1050,20 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
sampleSolid->DistanceToIn(samplePoint,sampleDirection);
|
||||
if ( sampleStepDistance<=ourStep )
|
||||
{
|
||||
daughterDeterminedStep= true;
|
||||
|
||||
ourStep = sampleStepDistance;
|
||||
entering = true;
|
||||
exiting = false;
|
||||
*pBlockedPhysical = samplePhysical;
|
||||
blockedReplicaNo = -1;
|
||||
|
||||
#ifdef DAUGHTER_NORMAL_ALSO
|
||||
// This norm can be calculated later, if needed daughter is available
|
||||
localExitNorm = sampleSolid->SurfaceNormal(samplePoint);
|
||||
daughtNormRepCrd = sampleTf.Inverse().TransformAxis(localExitNorm);
|
||||
#endif
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
// Check to see that the resulting point is indeed in/on volume.
|
||||
// This check could eventually be made only for successful candidate.
|
||||
@@ -906,6 +1109,24 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
calculatedExitNormal &= (!daughterDeterminedStep);
|
||||
|
||||
#ifdef DAUGHTER_NORMAL_ALSO
|
||||
if( daughterDeterminedStep )
|
||||
{
|
||||
// G4ThreeVector daughtNormGlobal =
|
||||
// GlobalToLastDepth.Inverse().TransformAxis(daughtNormRepCrd);
|
||||
// ==> Can calculate it, but have no way to transmit it to caller (for now)
|
||||
|
||||
exitNormalVector=globalToLocalTop.Inverse().TransformAxis(daughtNormGlobal);
|
||||
validExitNormal= false; // Entering daughter - never convex for parent
|
||||
|
||||
calculatedExitNormal= true;
|
||||
}
|
||||
// calculatedExitNormal= true; // Force it to true -- dubious
|
||||
#endif
|
||||
|
||||
newSafety = ourSafety;
|
||||
return ourStep;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4SafetyHelper.cc,v 1.16 2008-10-24 14:00:03 gcosmo Exp $
|
||||
// $Id$
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4SafetyHelper Implementation
|
||||
@@ -42,6 +42,7 @@
|
||||
G4SafetyHelper::G4SafetyHelper()
|
||||
: fUseParallelGeometries(false), // By default, one geometry only
|
||||
fFirstCall(true),
|
||||
fVerbose(0),
|
||||
fLastSafetyPosition(0.0,0.0,0.0),
|
||||
fLastSafety(0.0),
|
||||
fRecomputeFactor(0.0)
|
||||
@@ -110,7 +111,7 @@ G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
|
||||
return linstep;
|
||||
}
|
||||
|
||||
G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position )
|
||||
G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double maxLength )
|
||||
{
|
||||
G4double newSafety;
|
||||
|
||||
@@ -127,7 +128,7 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position )
|
||||
if( !fUseParallelGeometries )
|
||||
{
|
||||
// Safety for mass geometry
|
||||
fLastSafety = fpMassNavigator->ComputeSafety(position,true);
|
||||
fLastSafety = fpMassNavigator->ComputeSafety(position, maxLength, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -152,6 +153,24 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position )
|
||||
|
||||
void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector &newPosition )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 0 ) {
|
||||
// There is an opportunity - and need - to check whether the proposed move is safe
|
||||
G4ThreeVector moveVec= newPosition - fLastSafetyPosition;
|
||||
if( moveVec.mag2() > sqr(fLastSafety) )
|
||||
{
|
||||
// A problem exists - we are proposing to move outside 'Safety Sphere'
|
||||
G4ExceptionDescription ed;
|
||||
ed << " Safety Sphere: Radius = " << fLastSafety;
|
||||
ed << " Center = " << fLastSafetyPosition << G4endl;
|
||||
ed << " New Location : Move = " << moveVec.mag2();
|
||||
ed << " Position = " << newPosition << G4endl;
|
||||
G4Exception("G4SafetyHelper::ReLocateWithinVolume", "GeomNav999", JustWarning,
|
||||
"Unsafe Move> Asked to relocate beyond 'Safety sphere'.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( !fUseParallelGeometries )
|
||||
{
|
||||
fpMassNavigator->LocateGlobalPointWithinVolume( newPosition );
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4SimpleLocator.cc,v 1.6 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// Class G4SimpleLocator implementation
|
||||
//
|
||||
@@ -168,7 +167,7 @@ G4bool G4SimpleLocator::EstimateIntersectionPoint(
|
||||
|
||||
G4ThreeVector ChordAB = Point_B - Point_A;
|
||||
|
||||
#ifdef DEBUG_FIELD
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4VIntersectionLocator::
|
||||
ReportTrialStep( substep_no, ChordAB, ChordEF_Vector,
|
||||
NewMomentumDir, NormalAtEntry, validNormalAtE );
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.cc,v 1.16 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// G4TransportationManager
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VIntersectionLocator.cc,v 1.8 2010-07-13 15:59:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// Class G4VIntersectionLocator implementation
|
||||
//
|
||||
@@ -36,6 +35,7 @@
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VIntersectionLocator.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
|
||||
@@ -168,8 +168,8 @@ G4VIntersectionLocator::printStatus( const G4FieldTrack& StartFT,
|
||||
// ReEstimateEndPoint.
|
||||
//
|
||||
G4FieldTrack G4VIntersectionLocator::
|
||||
ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
const G4FieldTrack &EstimatedEndStateB,
|
||||
ReEstimateEndpoint( const G4FieldTrack& CurrentStateA,
|
||||
const G4FieldTrack& EstimatedEndStateB,
|
||||
G4double linearDistSq,
|
||||
G4double curveDist )
|
||||
{
|
||||
@@ -286,7 +286,7 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
// Method for finding SurfaceNormal of Intersecting Solid
|
||||
//
|
||||
G4ThreeVector G4VIntersectionLocator::
|
||||
GetLocalSurfaceNormal(const G4ThreeVector &CurrentE_Point, G4bool &validNormal)
|
||||
GetLocalSurfaceNormal(const G4ThreeVector& CurrentE_Point, G4bool& validNormal)
|
||||
{
|
||||
G4ThreeVector Normal(G4ThreeVector(0.0,0.0,0.0));
|
||||
G4VPhysicalVolume* located;
|
||||
@@ -323,7 +323,7 @@ GetLocalSurfaceNormal(const G4ThreeVector &CurrentE_Point, G4bool &validNormal)
|
||||
Normal = pSolid->SurfaceNormal(localPosition);
|
||||
validNormal = true;
|
||||
|
||||
#ifdef DEBUG_FIELD
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( std::fabs(Normal.mag2() - 1.0 ) > perMille)
|
||||
{
|
||||
G4cerr << "PROBLEM in G4VIntersectionLocator::GetLocalSurfaceNormal."
|
||||
@@ -345,15 +345,15 @@ GetLocalSurfaceNormal(const G4ThreeVector &CurrentE_Point, G4bool &validNormal)
|
||||
// Adjustment of Found Intersection
|
||||
//
|
||||
G4bool G4VIntersectionLocator::
|
||||
AdjustmentOfFoundIntersection( const G4ThreeVector &CurrentA_Point,
|
||||
const G4ThreeVector &CurrentE_Point,
|
||||
const G4ThreeVector &CurrentF_Point,
|
||||
const G4ThreeVector &MomentumDir,
|
||||
AdjustmentOfFoundIntersection( const G4ThreeVector& CurrentA_Point,
|
||||
const G4ThreeVector& CurrentE_Point,
|
||||
const G4ThreeVector& CurrentF_Point,
|
||||
const G4ThreeVector& MomentumDir,
|
||||
const G4bool IntersectAF,
|
||||
G4ThreeVector &IntersectionPoint, // I/O
|
||||
G4double &NewSafety, // I/O
|
||||
G4double &fPreviousSafety, // I/O
|
||||
G4ThreeVector &fPreviousSftOrigin )// I/O
|
||||
G4ThreeVector& IntersectionPoint, // I/O
|
||||
G4double& NewSafety, // I/O
|
||||
G4double& fPreviousSafety, // I/O
|
||||
G4ThreeVector& fPreviousSftOrigin )// I/O
|
||||
{
|
||||
G4double dist,lambda;
|
||||
G4ThreeVector Normal, NewPoint, Point_G;
|
||||
@@ -369,14 +369,15 @@ AdjustmentOfFoundIntersection( const G4ThreeVector &CurrentA_Point,
|
||||
G4double n_d_m = Normal.dot(MomentumDir);
|
||||
if ( std::abs(n_d_m)>kCarTolerance )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel>1 )
|
||||
{
|
||||
G4cerr << "WARNING - "
|
||||
<< "G4VIntersectionLocator::AdjustementOfFoundIntersection()"
|
||||
<< G4endl
|
||||
<< " No intersection. Parallels lines!" << G4endl;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
lambda =- Normal.dot(CurrentF_Point-CurrentE_Point)/n_d_m;
|
||||
|
||||
// New candidate for Intersection
|
||||
@@ -419,51 +420,52 @@ AdjustmentOfFoundIntersection( const G4ThreeVector &CurrentA_Point,
|
||||
return goodAdjust;
|
||||
}
|
||||
|
||||
#define DEBUG_FIELD 1
|
||||
|
||||
G4ThreeVector G4VIntersectionLocator::GetSurfaceNormal(const G4ThreeVector &CurrentInt_Point,
|
||||
G4bool &validNormal) // const
|
||||
G4ThreeVector
|
||||
G4VIntersectionLocator::GetSurfaceNormal(const G4ThreeVector& CurrentInt_Point,
|
||||
G4bool& validNormal) // const
|
||||
{
|
||||
G4ThreeVector NormalAtEntry; // ( -10. , -10., -10. );
|
||||
|
||||
G4ThreeVector NormalAtEntryLast, NormalAtEntryGlobal, diffNormals;
|
||||
G4bool validNormalLast;
|
||||
|
||||
// Relies on a call to Navigator::ComputeStep in IntersectChord before this call
|
||||
NormalAtEntryLast = GetLastSurfaceNormal( CurrentInt_Point, validNormalLast );
|
||||
// May return valid=false in cases, including
|
||||
// - if the candidate volume was not found (eg exiting world), or
|
||||
// - a replica was involved -- determined the step size.
|
||||
// (This list is not complete.)
|
||||
// Relies on a call to Navigator::ComputeStep in IntersectChord before
|
||||
// this call
|
||||
//
|
||||
NormalAtEntryLast = GetLastSurfaceNormal( CurrentInt_Point, validNormalLast );
|
||||
// May return valid=false in cases, including
|
||||
// - if the candidate volume was not found (eg exiting world), or
|
||||
// - a replica was involved -- determined the step size.
|
||||
// (This list is not complete.)
|
||||
|
||||
|
||||
#ifdef DEBUG_FIELD
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if ( validNormalLast
|
||||
&& ( std::fabs(NormalAtEntryLast.mag2() - 1.0) > perThousand ) )
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "G4VIntersectionLocator::GetSurfaceNormal -- identified problem."
|
||||
<< G4endl;
|
||||
message << "PROBLEM: Normal is not unit - magnitude = " << NormalAtEntryLast.mag()
|
||||
<< G4endl;
|
||||
message << "PROBLEM: Normal is not unit - magnitude = "
|
||||
<< NormalAtEntryLast.mag() << G4endl;
|
||||
message << " at trial intersection point " << CurrentInt_Point << G4endl;
|
||||
message << " Obtained from Get *Last* Surface Normal." << G4endl;
|
||||
G4Exception("G4VIntersectionLocator::GetGlobalSurfaceNormal()", "GeomNav1002",
|
||||
JustWarning, message);
|
||||
G4Exception("G4VIntersectionLocator::GetGlobalSurfaceNormal()",
|
||||
"GeomNav1002", JustWarning, message);
|
||||
}
|
||||
#endif
|
||||
|
||||
if( validNormalLast )
|
||||
{
|
||||
NormalAtEntry=NormalAtEntryLast;
|
||||
validNormal = validNormalLast;
|
||||
}
|
||||
return NormalAtEntry;
|
||||
validNormal = validNormalLast;
|
||||
|
||||
return NormalAtEntry;
|
||||
}
|
||||
|
||||
G4ThreeVector G4VIntersectionLocator::
|
||||
GetGlobalSurfaceNormal(const G4ThreeVector &CurrentE_Point,
|
||||
G4bool &validNormal)
|
||||
GetGlobalSurfaceNormal(const G4ThreeVector& CurrentE_Point,
|
||||
G4bool& validNormal)
|
||||
{
|
||||
G4ThreeVector localNormal=
|
||||
GetLocalSurfaceNormal( CurrentE_Point, validNormal );
|
||||
@@ -472,13 +474,13 @@ GetGlobalSurfaceNormal(const G4ThreeVector &CurrentE_Point,
|
||||
G4ThreeVector globalNormal =
|
||||
localToGlobal.TransformAxis( localNormal );
|
||||
|
||||
#ifdef DEBUG_FIELD
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( validNormal && ( std::fabs(globalNormal.mag2() - 1.0) > perThousand ) )
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "****************************************************************"
|
||||
message << "**************************************************************"
|
||||
<< G4endl;
|
||||
message << " Bad Normal in G4VIntersectionLocator::GetGlobalSurfaceNormal"
|
||||
message << " Bad Normal in G4VIntersectionLocator::GetGlobalSurfaceNormal "
|
||||
<< G4endl;
|
||||
message << " * Constituents: " << G4endl;
|
||||
message << " Local Normal= " << localNormal << G4endl;
|
||||
@@ -489,10 +491,10 @@ GetGlobalSurfaceNormal(const G4ThreeVector &CurrentE_Point,
|
||||
<< G4endl;
|
||||
message << " * Result: " << G4endl;
|
||||
message << " Global Normal= " << localNormal << G4endl;
|
||||
message << "****************************************************************"
|
||||
message << "**************************************************************"
|
||||
<< G4endl;
|
||||
G4Exception("G4VIntersectionLocator::GetGlobalSurfaceNormal()", "GeomNav1002",
|
||||
JustWarning, message);
|
||||
G4Exception("G4VIntersectionLocator::GetGlobalSurfaceNormal()",
|
||||
"GeomNav1002", JustWarning, message);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -500,18 +502,17 @@ GetGlobalSurfaceNormal(const G4ThreeVector &CurrentE_Point,
|
||||
}
|
||||
|
||||
G4ThreeVector
|
||||
G4VIntersectionLocator::GetLastSurfaceNormal( G4ThreeVector intersectPoint,
|
||||
G4bool &normalIsValid) const
|
||||
G4VIntersectionLocator::GetLastSurfaceNormal( const G4ThreeVector& intersectPoint,
|
||||
G4bool& normalIsValid) const
|
||||
{
|
||||
G4ThreeVector normalVec;
|
||||
G4bool validNorm;
|
||||
normalVec = fiNavigator->GetGlobalExitNormal( intersectPoint, &validNorm );
|
||||
normalVec = fiNavigator->GetGlobalExitNormal( intersectPoint, &validNorm );
|
||||
normalIsValid= validNorm;
|
||||
|
||||
return normalVec;
|
||||
}
|
||||
|
||||
|
||||
void G4VIntersectionLocator::ReportTrialStep( G4int step_no,
|
||||
const G4ThreeVector& ChordAB_v,
|
||||
const G4ThreeVector& ChordEF_v,
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.cc,v 1.13 2010-11-04 18:18:00 japost Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation Implementation
|
||||
@@ -574,6 +573,52 @@ G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
motherSafety = motherSolid->DistanceToOut(localPoint);
|
||||
ourSafety = motherSafety; // Working isotropic safety
|
||||
|
||||
if( motherSafety == 0.0 )
|
||||
{
|
||||
// Check that point is inside mother volume
|
||||
EInside insideMother= motherSolid->Inside(localPoint);
|
||||
|
||||
#if 1 // def G4DEBUG_NAVIGATION
|
||||
if( insideMother == kOutside )
|
||||
{
|
||||
G4ExceptionDescription message;
|
||||
message << "Safety method called for location outside current Volume." << G4endl
|
||||
<< "Location for safety is Outside this volume. " << G4endl
|
||||
<< "The approximate distance to the solid "
|
||||
<< "(safety from outside) is: "
|
||||
<< motherSolid->DistanceToIn( localPoint ) << G4endl;
|
||||
message << " Problem occurred with physical volume: "
|
||||
<< " Name: " << motherPhysical->GetName()
|
||||
<< " Copy No: " << motherPhysical->GetCopyNo() << G4endl
|
||||
<< " Local Point = " << localPoint << G4endl;
|
||||
message << " Description of solid: " << G4endl
|
||||
<< *motherSolid << G4endl;
|
||||
G4Exception("G4VoxelNavigation::ComputeSafety()", "GeomNav0003",
|
||||
JustWarning, // FatalException,
|
||||
message);
|
||||
}
|
||||
#endif
|
||||
#if 1 // def G4DEBUG_NAVIGATION
|
||||
// Following check is NOT for an issue - it is only for information
|
||||
// It is allowed that a solid gives approximate safety - even zero.
|
||||
if( insideMother == kInside ) // && fVerbose )
|
||||
{
|
||||
G4ExceptionDescription messageIn;
|
||||
|
||||
messageIn << " Point is Inside, but safety is Zero ." << G4endl;
|
||||
messageIn << " Inexact safety for volume " << motherPhysical->GetName() << G4endl
|
||||
<< " Solid: Name= " << motherSolid->GetName()
|
||||
<< " Type= " << motherSolid->GetEntityType() << G4endl;
|
||||
messageIn << " Local point= " << localPoint << G4endl;
|
||||
messageIn << " Solid parameters: " << G4endl << *motherSolid << G4endl;
|
||||
G4Exception("G4VoxelNavigation::ComputeSafety()", "GeomNav0003",
|
||||
JustWarning, messageIn);
|
||||
}
|
||||
#endif
|
||||
// if( insideMother != kInside )
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fCheck )
|
||||
{
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelSafety.cc,v 1.9 2010-11-11 16:15:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id: G4VoxelSafety.cc,v $
|
||||
//
|
||||
// Author: John Apostolakis
|
||||
// First version: 31 May 2010
|
||||
@@ -39,11 +37,11 @@
|
||||
#include "G4SmartVoxelNode.hh"
|
||||
#include "G4SmartVoxelHeader.hh"
|
||||
|
||||
// State
|
||||
// - values used during computation of Safety
|
||||
//
|
||||
// ********************************************************************
|
||||
// Constructor
|
||||
// - copied from G4VoxelNavigation (1st version)
|
||||
// ********************************************************************
|
||||
//
|
||||
G4VoxelSafety::G4VoxelSafety()
|
||||
: fBlockList(),
|
||||
fpMotherLogical(0),
|
||||
@@ -60,6 +58,10 @@ G4VoxelSafety::G4VoxelSafety()
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// Destructor
|
||||
// ********************************************************************
|
||||
//
|
||||
G4VoxelSafety::~G4VoxelSafety()
|
||||
{
|
||||
}
|
||||
@@ -74,17 +76,14 @@ G4VoxelSafety::~G4VoxelSafety()
|
||||
//
|
||||
G4double
|
||||
G4VoxelSafety::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
const G4VPhysicalVolume& currentPhysical,
|
||||
G4double ) // maxLength)
|
||||
const G4VPhysicalVolume& currentPhysical,
|
||||
G4double maxLength)
|
||||
{
|
||||
// G4VPhysicalVolume *samplePhysical;
|
||||
G4LogicalVolume *motherLogical;
|
||||
G4VSolid *motherSolid;
|
||||
G4SmartVoxelHeader *motherVoxelHeader;
|
||||
G4double motherSafety, ourSafety;
|
||||
G4int localNoDaughters; // , sampleNo;
|
||||
// G4SmartVoxelNode *curVoxelNode;
|
||||
// G4int curNoVolumes, contentNo;
|
||||
G4int localNoDaughters;
|
||||
G4double daughterSafety;
|
||||
|
||||
motherLogical = currentPhysical.GetLogicalVolume();
|
||||
@@ -93,35 +92,49 @@ G4VoxelSafety::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
motherVoxelHeader= motherLogical->GetVoxelHeader();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 0 ){
|
||||
if( fVerbose > 0 )
|
||||
{
|
||||
G4cout << "*** G4VoxelSafety::ComputeSafety(): ***" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check that point is inside mother volume
|
||||
//
|
||||
EInside insideMother= motherSolid->Inside(localPoint);
|
||||
if( insideMother != kInside ) {
|
||||
if( insideMother == kOutside ) {
|
||||
if( insideMother != kInside )
|
||||
{
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( insideMother == kOutside )
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Method called for location outside current Volume." << G4endl
|
||||
<< "Location for safety is Outside current volume. " << G4endl
|
||||
<< "The approximate distance to the solid (safety from outside) is: "
|
||||
<< motherSolid->DistanceToIn( localPoint );
|
||||
message << "Safety method called for location outside current Volume."
|
||||
<< G4endl
|
||||
<< "Location for safety is Outside this volume. " << G4endl
|
||||
<< "The approximate distance to the solid "
|
||||
<< "(safety from outside) is: "
|
||||
<< motherSolid->DistanceToIn( localPoint ) << G4endl;
|
||||
message << " Problem occurred with physical volume: "
|
||||
<< " Name: " << currentPhysical.GetName()
|
||||
<< " Copy No: " << currentPhysical.GetCopyNo() << G4endl
|
||||
<< " Local Point = " << localPoint << G4endl;
|
||||
message << " Description of solid: " << G4endl
|
||||
<< *motherSolid << G4endl;
|
||||
G4Exception("G4VoxelSafety::ComputeSafety()", "GeomNav0003",
|
||||
FatalException, message);
|
||||
}
|
||||
#endif
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// First limit: mother safety - distance to outer boundaries
|
||||
//
|
||||
motherSafety = motherSolid->DistanceToOut(localPoint);
|
||||
ourSafety = motherSafety; // Working isotropic safety
|
||||
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if(( fCheck ) && ( fVerbose == 1 ))
|
||||
if(( fCheck ) ) // && ( fVerbose == 1 ))
|
||||
{
|
||||
G4cout << "*** G4VoxelSafety::ComputeSafety(): ***" << G4endl
|
||||
<< " Invoked DistanceToOut(p) for mother solid: "
|
||||
G4cout << " Invoked DistanceToOut(p) for mother solid: "
|
||||
<< motherSolid->GetName()
|
||||
<< ". Solid replied: " << motherSafety << G4endl
|
||||
<< " For local point p: " << localPoint
|
||||
@@ -134,19 +147,22 @@ G4VoxelSafety::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
fBlockList.Reset();
|
||||
|
||||
fVoxelDepth = -1; // Resets the depth -- must be done for next method
|
||||
daughterSafety= SafetyForVoxelHeader( motherVoxelHeader, localPoint );
|
||||
|
||||
daughterSafety= SafetyForVoxelHeader(motherVoxelHeader, localPoint, maxLength,
|
||||
currentPhysical, 0, ourSafety);
|
||||
ourSafety= std::min( motherSafety, daughterSafety );
|
||||
|
||||
return ourSafety;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SafetyForVoxelNode
|
||||
//
|
||||
// Calculate the safety for volumes included in current Voxel Node
|
||||
// ********************************************************************
|
||||
//
|
||||
G4double
|
||||
G4VoxelSafety::
|
||||
SafetyForVoxelNode( G4SmartVoxelNode *curVoxelNode,
|
||||
const G4ThreeVector& localPoint )
|
||||
G4VoxelSafety::SafetyForVoxelNode( const G4SmartVoxelNode *curVoxelNode,
|
||||
const G4ThreeVector& localPoint )
|
||||
{
|
||||
G4double ourSafety= DBL_MAX;
|
||||
|
||||
@@ -164,27 +180,27 @@ SafetyForVoxelNode( G4SmartVoxelNode *curVoxelNode,
|
||||
sampleNo = curVoxelNode->GetVolume(contentNo);
|
||||
if ( !fBlockList.IsBlocked(sampleNo) )
|
||||
{
|
||||
fBlockList.BlockVolume(sampleNo);
|
||||
fBlockList.BlockVolume(sampleNo);
|
||||
|
||||
samplePhysical = fpMotherLogical->GetDaughter(sampleNo);
|
||||
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
|
||||
samplePhysical->GetTranslation());
|
||||
sampleTf.Invert();
|
||||
samplePoint = sampleTf.TransformPoint(localPoint);
|
||||
ptrSolid = samplePhysical->GetLogicalVolume()->GetSolid();
|
||||
samplePhysical = fpMotherLogical->GetDaughter(sampleNo);
|
||||
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
|
||||
samplePhysical->GetTranslation());
|
||||
sampleTf.Invert();
|
||||
samplePoint = sampleTf.TransformPoint(localPoint);
|
||||
ptrSolid = samplePhysical->GetLogicalVolume()->GetSolid();
|
||||
|
||||
sampleSafety = ptrSolid->DistanceToIn(samplePoint);
|
||||
ourSafety = std::min( sampleSafety, ourSafety );
|
||||
sampleSafety = ptrSolid->DistanceToIn(samplePoint);
|
||||
ourSafety = std::min( sampleSafety, ourSafety );
|
||||
#ifdef G4VERBOSE
|
||||
if(( fCheck ) && ( fVerbose == 1 ))
|
||||
{
|
||||
// ReportSolidSafetyToIn( MethodName, solid, value, point );
|
||||
G4cout << "*** G4VoxelSafety::SafetyForVoxelNode(): ***" << G4endl
|
||||
<< " Invoked DistanceToIn(p) for daughter solid: "
|
||||
<< ptrSolid->GetName()
|
||||
<< ". Solid replied: " << sampleSafety << G4endl
|
||||
<< " For local point p: " << samplePoint
|
||||
<< ", to be considered as 'daughter safety'." << G4endl;
|
||||
if(( fCheck ) && ( fVerbose == 1 ))
|
||||
{
|
||||
// ReportSolidSafetyToIn( MethodName, solid, value, point );
|
||||
G4cout << "*** G4VoxelSafety::SafetyForVoxelNode(): ***" << G4endl
|
||||
<< " Invoked DistanceToIn(p) for daughter solid: "
|
||||
<< ptrSolid->GetName()
|
||||
<< ". Solid replied: " << sampleSafety << G4endl
|
||||
<< " For local point p: " << samplePoint
|
||||
<< ", to be considered as 'daughter safety'." << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -193,70 +209,101 @@ SafetyForVoxelNode( G4SmartVoxelNode *curVoxelNode,
|
||||
return ourSafety;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Pseudo-code for Compute Safety
|
||||
//
|
||||
// for each (potential) dimension of depth
|
||||
// iterate through VoxelProxies (Header, Node)
|
||||
// until distanceToVoxel > estimatedSafety
|
||||
//
|
||||
// Better:
|
||||
// iterate through/down the three of VoxelProxies
|
||||
// while distanceToVoxel <= estimatedSafety
|
||||
// Examine one Nodes for which this condition holds.
|
||||
// (version 0 can examine all nodes)
|
||||
|
||||
|
||||
// How to step through voxels ?? Thu 29 April 2010 @ 17:00
|
||||
|
||||
// ********************************************************************
|
||||
// SafetyForVoxelHeader method
|
||||
// - which cycles through levels of headers to process each node level
|
||||
// - Obtained by modifying VoxelLocate (to cycle through Node Headers)
|
||||
// SafetyForVoxelHeader
|
||||
//
|
||||
// Cycles through levels of headers to process each node level
|
||||
// Obtained by modifying VoxelLocate (to cycle through Node Headers)
|
||||
// *********************************************************************
|
||||
//
|
||||
G4double
|
||||
G4VoxelSafety::SafetyForVoxelHeader( G4SmartVoxelHeader* pHeader,
|
||||
const G4ThreeVector& localPoint )
|
||||
G4VoxelSafety::SafetyForVoxelHeader( const G4SmartVoxelHeader* pHeader,
|
||||
const G4ThreeVector& localPoint,
|
||||
G4double maxLength,
|
||||
const G4VPhysicalVolume& currentPhysical, //Debug
|
||||
G4double distUpperDepth_Sq,
|
||||
G4double previousMinSafety
|
||||
)
|
||||
{
|
||||
const G4SmartVoxelHeader *targetVoxelHeader=pHeader;
|
||||
const G4SmartVoxelHeader * const targetVoxelHeader=pHeader;
|
||||
G4SmartVoxelNode *targetVoxelNode=0;
|
||||
|
||||
G4SmartVoxelProxy *sampleProxy;
|
||||
const G4SmartVoxelProxy *sampleProxy;
|
||||
EAxis targetHeaderAxis;
|
||||
G4double targetHeaderMin, targetHeaderNodeWidth;
|
||||
G4double targetHeaderMin, targetHeaderMax, targetHeaderNodeWidth;
|
||||
G4int targetHeaderNoSlices;
|
||||
G4int targetNodeNo; // , pointNodeNo;
|
||||
// G4int minCurNodeNoDelta, maxCurNodeNoDelta;
|
||||
G4int targetNodeNo;
|
||||
|
||||
G4double minSafety= DBL_MAX;
|
||||
|
||||
G4double minSafety= previousMinSafety;
|
||||
G4double ourSafety= DBL_MAX;
|
||||
unsigned int checkedNum= 0;
|
||||
|
||||
fVoxelDepth++;
|
||||
// fVoxelDepth set by ComputeSafety or previous level call
|
||||
|
||||
targetHeaderAxis = targetVoxelHeader->GetAxis();
|
||||
targetHeaderNoSlices = targetVoxelHeader->GetNoSlices();
|
||||
targetHeaderMin = targetVoxelHeader->GetMinExtent();
|
||||
targetHeaderNodeWidth = (targetVoxelHeader->GetMaxExtent()-targetHeaderMin)
|
||||
targetHeaderMax = targetVoxelHeader->GetMaxExtent();
|
||||
|
||||
targetHeaderNodeWidth = (targetHeaderMax-targetHeaderMin)
|
||||
/ targetHeaderNoSlices;
|
||||
|
||||
const G4int pointNodeNo = G4int( (localPoint(targetHeaderAxis)-targetHeaderMin)
|
||||
/ targetHeaderNodeWidth);
|
||||
G4double localCrd= localPoint(targetHeaderAxis);
|
||||
|
||||
const G4int candNodeNo= G4int( (localCrd-targetHeaderMin)
|
||||
/ targetHeaderNodeWidth );
|
||||
// Ensure that it is between 0 and targetHeader->GetMaxExtent() - 1
|
||||
|
||||
#ifdef G4DEBUG_VOXELISATION
|
||||
if( candNodeNo < 0 || candNodeNo > targetHeaderNoSlices-1 )
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << " Potential ERROR."
|
||||
<< " Point is outside range of Voxel in current coordinate" << G4endl;
|
||||
ed << " Node number of point " << localPoint
|
||||
<< "is outside the range. " << G4endl;
|
||||
ed << " Voxel node Num= " << candNodeNo << " versus minimum= " << 0
|
||||
<< " and maximum= " << targetHeaderNoSlices-1 << G4endl;
|
||||
ed << " Axis = " << targetHeaderAxis
|
||||
<< " No of slices = " << targetHeaderNoSlices << G4endl;
|
||||
ed << " Local coord = " << localCrd
|
||||
<< " Voxel Min = " << targetHeaderMin
|
||||
<< " Max = " << targetHeaderMax << G4endl;
|
||||
G4LogicalVolume *pLogical= currentPhysical.GetLogicalVolume();
|
||||
ed << " Current volume (physical) = " << currentPhysical.GetName()
|
||||
<< " (logical) = " << pLogical->GetName() << G4endl;
|
||||
G4VSolid* pSolid= pLogical->GetSolid();
|
||||
ed << " Solid type = " << pSolid->GetEntityType() << G4endl;
|
||||
ed << *pSolid << G4endl;
|
||||
G4Exception("G4VoxelSafety::SafetyForVoxelHeader()", "GeomNav1003",
|
||||
JustWarning, ed,
|
||||
"Point is outside range of Voxel in current coordinate");
|
||||
}
|
||||
#endif
|
||||
|
||||
const G4int pointNodeNo =
|
||||
std::max( 0, std::min( candNodeNo, targetHeaderNoSlices-1 ) );
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "**** G4VoxelSafety::SafetyForVoxelHeader " << G4endl;
|
||||
G4cout << " Called at Depth = " << fVoxelDepth;
|
||||
G4cout << " Calculated pointNodeNo= " << pointNodeNo
|
||||
<< " from position= " << localPoint(targetHeaderAxis)
|
||||
<< " min= " << targetHeaderMin
|
||||
<< " max= " << targetVoxelHeader->GetMaxExtent()
|
||||
<< " width= " << targetHeaderNodeWidth
|
||||
<< " no-slices= " << targetHeaderNoSlices
|
||||
<< " axis= " << targetHeaderAxis
|
||||
<< G4endl;
|
||||
<< " from position= " << localPoint(targetHeaderAxis)
|
||||
<< " min= " << targetHeaderMin
|
||||
<< " max= " << targetHeaderMax
|
||||
<< " width= " << targetHeaderNodeWidth
|
||||
<< " no-slices= " << targetHeaderNoSlices
|
||||
<< " axis= " << targetHeaderAxis << G4endl;
|
||||
}
|
||||
else if (fVerbose == 1)
|
||||
{
|
||||
G4cout << " VoxelSafety: Depth = " << fVoxelDepth
|
||||
<< " Number of Slices = " << targetHeaderNoSlices
|
||||
<< " Header (address) = " << targetVoxelHeader << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -266,135 +313,254 @@ G4VoxelSafety::SafetyForVoxelHeader( G4SmartVoxelHeader* pHeader,
|
||||
fVoxelNoSlicesStack[fVoxelDepth] = targetHeaderNoSlices;
|
||||
fVoxelSliceWidthStack[fVoxelDepth] = targetHeaderNodeWidth;
|
||||
|
||||
|
||||
fVoxelHeaderStack[fVoxelDepth] = pHeader;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
G4cout << " Depth = " << fVoxelDepth ; // << G4endl;
|
||||
G4cout << " Number of Slices = " << targetHeaderNoSlices ; // << G4endl;
|
||||
G4cout << " Header (address) = " << targetVoxelHeader << G4endl;
|
||||
}
|
||||
#endif
|
||||
// G4int numSlicesCheck= targetHeaderNoSlices;
|
||||
|
||||
// G4cout << "---> Current Voxel Header has " << *targetVoxelHeader << G4endl;
|
||||
|
||||
// targetVoxelHeader->GetMaxEquivalentSliceNo()+1;
|
||||
// targetVoxelHeader->GetMinEquivalentSliceNo()-1;
|
||||
G4int trialUp= -1, trialDown= -1;
|
||||
G4double distUp= DBL_MAX, distDown= DBL_MAX;
|
||||
|
||||
// Using Equivalent voxels - this is pre-initialisation only
|
||||
//
|
||||
G4int nextUp= pointNodeNo+1;
|
||||
G4int nextDown= pointNodeNo-1;
|
||||
// Ignore equivalents for now
|
||||
G4int nextNode= pointNodeNo;
|
||||
G4int nextDown= pointNodeNo-1;
|
||||
|
||||
for( targetNodeNo= pointNodeNo;
|
||||
// (targetNodeNo<targetHeaderNoSlices) &&
|
||||
(targetNodeNo>=0);
|
||||
targetNodeNo= nextNode
|
||||
)
|
||||
G4int nextNodeNo= pointNodeNo;
|
||||
G4double distAxis; // Distance in current Axis
|
||||
distAxis= 0.0; // Starting in node containing local Coordinate
|
||||
|
||||
G4bool nextIsInside= false;
|
||||
|
||||
G4double distMaxInterest= std::min( previousMinSafety, maxLength);
|
||||
// We will not look beyond this distance.
|
||||
// This distance will be updated to reflect the
|
||||
// max ( minSafety, maxLength ) at each step
|
||||
|
||||
targetNodeNo= pointNodeNo;
|
||||
do
|
||||
{
|
||||
G4double nodeSafety= DBL_MAX, levelSafety= DBL_MAX;
|
||||
G4double nodeSafety= DBL_MAX, headerSafety= DBL_MAX;
|
||||
fVoxelNodeNoStack[fVoxelDepth] = targetNodeNo;
|
||||
|
||||
|
||||
checkedNum++;
|
||||
|
||||
sampleProxy = targetVoxelHeader->GetSlice(targetNodeNo);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
G4cout << " -Checking node " << targetNodeNo
|
||||
<< " is proxy with address " << sampleProxy << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( sampleProxy->IsNode() )
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
targetVoxelNode = sampleProxy->GetNode();
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
G4cout << " -- It is a Node " << G4endl;
|
||||
G4cout << " -Checking node " << targetNodeNo
|
||||
<< " is proxy with address " << sampleProxy << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Deal with the node here [ i.e. the last level ]
|
||||
nodeSafety= SafetyForVoxelNode( targetVoxelNode, localPoint);
|
||||
// if( targetHeaderNoSlices != numSlicesCheck )
|
||||
// G4cerr << "Number of slices changed - to " << targetHeaderNoSlices << G4endl;
|
||||
minSafety= std::min( minSafety, nodeSafety );
|
||||
if ( sampleProxy == 0 )
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << " Problem for node number= " << targetNodeNo
|
||||
<< " Number of slides = " << targetHeaderNoSlices
|
||||
<< G4endl;
|
||||
G4Exception( "G4VoxelSafety::SafetyForVoxelHeader()", "GeomNav0003",
|
||||
FatalException, ed,
|
||||
"Problem sampleProxy is Zero. Failure in loop.");
|
||||
}
|
||||
else if ( sampleProxy->IsNode() )
|
||||
{
|
||||
targetVoxelNode = sampleProxy->GetNode();
|
||||
|
||||
// Deal with the node here [ i.e. the last level ]
|
||||
//
|
||||
nodeSafety= SafetyForVoxelNode( targetVoxelNode, localPoint);
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " -- It is a Node ";
|
||||
G4cout << " its safety= " << nodeSafety
|
||||
<< " our level Saf = " << ourSafety
|
||||
<< " MinSaf= " << minSafety << G4endl;
|
||||
}
|
||||
#endif
|
||||
ourSafety= std::min( ourSafety, nodeSafety );
|
||||
|
||||
trialUp = targetVoxelNode->GetMaxEquivalentSliceNo()+1;
|
||||
trialDown = targetVoxelNode->GetMinEquivalentSliceNo()-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4SmartVoxelHeader *pNewVoxelHeader = sampleProxy->GetHeader();
|
||||
// fVoxelDepth++;
|
||||
const G4SmartVoxelHeader *pNewVoxelHeader = sampleProxy->GetHeader();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
G4cout << " -- It is a Header " << G4endl;
|
||||
G4cout << " Recurse to deal with next level, fVoxelDepth= "
|
||||
<< fVoxelDepth+1 << G4endl;
|
||||
G4double distCombined_Sq;
|
||||
distCombined_Sq = distUpperDepth_Sq + distAxis*distAxis;
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4double distCombined= std::sqrt( distCombined_Sq );
|
||||
G4double distUpperDepth= std::sqrt ( distUpperDepth_Sq );
|
||||
G4cout << " -- It is a Header " << G4endl;
|
||||
G4cout << " Recurse to deal with next level, fVoxelDepth= "
|
||||
<< fVoxelDepth+1 << G4endl;
|
||||
G4cout << " Distances: Upper= " << distUpperDepth
|
||||
<< " Axis= " << distAxis
|
||||
<< " Combined= " << distCombined << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Recurse to deal with lower levels
|
||||
levelSafety= SafetyForVoxelHeader( pNewVoxelHeader, localPoint);
|
||||
// fVoxelDepth--;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
// G4cout << " Returned from SafetyForVoxelHeader. Depth= "
|
||||
// << fVoxelDepth << G4endl;
|
||||
//--G4cout << " Decreased fVoxelDepth to " << fVoxelDepth << G4endl;
|
||||
//--G4cout << " Header (address)= " << targetVoxelHeader << G4endl;
|
||||
G4cout << " Level safety = " << levelSafety << G4endl;
|
||||
}
|
||||
#endif
|
||||
minSafety= std::min( minSafety, levelSafety );
|
||||
#endif
|
||||
|
||||
// Recurse to deal with lower levels
|
||||
//
|
||||
headerSafety= SafetyForVoxelHeader( pNewVoxelHeader, localPoint,
|
||||
maxLength, currentPhysical,
|
||||
distCombined_Sq, minSafety);
|
||||
ourSafety= std::min( ourSafety, headerSafety );
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " >> Header safety = " << headerSafety
|
||||
<< " our level Saf = " << ourSafety << G4endl;
|
||||
}
|
||||
#endif
|
||||
trialUp = pNewVoxelHeader->GetMaxEquivalentSliceNo()+1;
|
||||
trialDown = pNewVoxelHeader->GetMinEquivalentSliceNo()-1;
|
||||
}
|
||||
minSafety= std::min( minSafety, ourSafety );
|
||||
|
||||
// Find next closest Voxel
|
||||
// Find next closest Voxel
|
||||
// - first try: by simple subtraction
|
||||
// - later: using distance (TODO - tbc)
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
G4cout << " Next: up " << nextUp << " d= " << nextUp - pointNodeNo
|
||||
<< " down " << nextDown << " d= " << pointNodeNo - nextDown
|
||||
<< " cond " << ( nextUp < targetHeaderNoSlices )
|
||||
<< " pointNodeNo= " << pointNodeNo
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
if( ((nextUp - pointNodeNo) < (pointNodeNo - nextDown))
|
||||
&& (nextUp < targetHeaderNoSlices) )
|
||||
//
|
||||
if( targetNodeNo >= pointNodeNo )
|
||||
{
|
||||
nextNode=nextUp;
|
||||
++nextUp;
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
G4cout << " Chose Up: next= " << nextNode << " new= " << nextUp << G4endl;
|
||||
nextUp = trialUp;
|
||||
distUp = targetHeaderMax-localCrd ;
|
||||
if( distUp < 0.0 )
|
||||
{
|
||||
distUp = DBL_MAX; // On the wrong side - must not be considered
|
||||
}
|
||||
#endif
|
||||
}else{
|
||||
nextNode=nextDown;
|
||||
--nextDown;
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 ){
|
||||
G4cout << " Chose Down: next= " << nextNode << " new= " << nextDown << G4endl;
|
||||
}
|
||||
#endif
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " > Updated nextUp= " << nextUp << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if( targetNodeNo <= pointNodeNo )
|
||||
{
|
||||
nextDown = trialDown;
|
||||
distDown = localCrd-targetHeaderMin;
|
||||
if( distDown < 0.0 )
|
||||
{
|
||||
distDown= DBL_MAX; // On the wrong side - must not be considered
|
||||
}
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " > Updated nextDown= " << nextDown << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " Node= " << pointNodeNo
|
||||
<< " Up: next= " << nextUp << " d# "
|
||||
<< nextUp - pointNodeNo
|
||||
<< " trialUp= " << trialUp << " d# "
|
||||
<< trialUp - pointNodeNo
|
||||
<< " Down: next= " << nextDown << " d# "
|
||||
<< targetNodeNo - nextDown
|
||||
<< " trialDwn= " << trialDown << " d# "
|
||||
<< targetNodeNo - trialDown
|
||||
<< " condition (next is Inside)= " << nextIsInside
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4bool UpIsClosest;
|
||||
UpIsClosest= distUp < distDown;
|
||||
|
||||
if( UpIsClosest || (nextDown < 0) )
|
||||
{
|
||||
nextNodeNo=nextUp;
|
||||
distAxis = distUp;
|
||||
++nextUp; // Default
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " > Chose Up. Depth= " << fVoxelDepth
|
||||
<< " Nodes: next= " << nextNodeNo
|
||||
<< " new nextUp= " << nextUp
|
||||
<< " Dist = " << distAxis << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
nextNodeNo=nextDown;
|
||||
distAxis = distDown;
|
||||
--nextDown; // A default value
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " > Chose Down. Depth= " << fVoxelDepth
|
||||
<< " Nodes: next= " << nextNodeNo
|
||||
<< " new nextDown= " << nextDown
|
||||
<< " Dist = " << distAxis << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
nextIsInside = (nextNodeNo >= 0) && (nextNodeNo < targetHeaderNoSlices);
|
||||
if( nextIsInside )
|
||||
{
|
||||
targetNodeNo= nextNodeNo;
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4bool bContinue= (distAxis<minSafety);
|
||||
if( !bContinue )
|
||||
{
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " Can skip remaining at depth " << targetHeaderAxis
|
||||
<< " >> distAxis= " << distAxis
|
||||
<< " minSafety= " << minSafety << G4endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2)
|
||||
{
|
||||
G4cout << " VoxSaf> depth= " << fVoxelDepth << G4endl;
|
||||
G4cout << " VoxSaf> No more candidates: nodeDown= " << nextDown
|
||||
<< " nodeUp= " << nextUp
|
||||
<< " lastSlice= " << targetHeaderNoSlices << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// This calculation can be 'hauled'-up to where minSafety is calculated
|
||||
//
|
||||
distMaxInterest = std::min( minSafety, maxLength );
|
||||
|
||||
} while ( nextIsInside && ( distAxis*distAxis + distUpperDepth_Sq
|
||||
< distMaxInterest*distMaxInterest ) );
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 0 ) {
|
||||
G4cout << " Ended for targetNodeNo -- checked "
|
||||
<< targetHeaderNoSlices << " slices" << G4endl;
|
||||
if( fVerbose > 0 )
|
||||
{
|
||||
G4cout << " Ended for targetNodeNo -- checked " << checkedNum << " out of "
|
||||
<< targetHeaderNoSlices << " slices." << G4endl;
|
||||
G4cout << " ===== Returning from SafetyForVoxelHeader "
|
||||
<< " Depth= " << fVoxelDepth << G4endl
|
||||
<< G4endl;
|
||||
<< " Depth= " << fVoxelDepth << G4endl
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Go back one level
|
||||
fVoxelDepth--;
|
||||
|
||||
return minSafety;
|
||||
return ourSafety;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user