Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.3 2007/05/18 15:53:15 ahoward Exp $
|
||||
# $Id: GNUmakefile,v 1.5 2007/11/23 13:30:47 gcosmo Exp $
|
||||
# --------------------------------------------------------------------
|
||||
# GNUmakefile for geometry/volumes library. Gabriele Cosmo, 16/11/96.
|
||||
# --------------------------------------------------------------------
|
||||
@@ -14,6 +14,7 @@ include $(G4INSTALL)/config/architecture.gmk
|
||||
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
|
||||
CPPFLAGS += -I$(G4BASE)/graphics_reps/include \
|
||||
-I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
@@ -30,6 +31,9 @@ endif
|
||||
ifdef G4DEBUG_PATHFINDER
|
||||
CPPFLAGS += -DG4DEBUG_PATHFINDER
|
||||
endif
|
||||
ifdef PATHFINDER_OPTIMISATION
|
||||
CPPFLAGS += -DPATHFINDER_OPTIMISATION
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.84.2.2 2007/06/08 10:09:19 gcosmo Exp $
|
||||
$Id: History,v 1.113 2007/11/16 09:39:26 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,24 +17,196 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
June 8th, 2007 - T.Nikitina (geomnav-V08-03-02b)
|
||||
November 16th, 2007 - G.Cosmo (geomnav-V09-00-12)
|
||||
-----------------------------
|
||||
- Cleared compilation warnings for shadowing of variables in classes
|
||||
within the module.
|
||||
|
||||
November 14th, 2007 - G.Cosmo (geomnav-V09-00-11)
|
||||
-----------------------------
|
||||
- Reintroduced artificial push in G4ReplicaNavigation::ComputeStep().
|
||||
Further investigation and eventually reimplementation of LevelLocate()
|
||||
required to take into account point and direction ...
|
||||
|
||||
November 14th, 2007 - G.Cosmo (geomnav-V09-00-10)
|
||||
-----------------------------
|
||||
- Trial to remove artificial push in G4ReplicaNavigation::ComputeStep().
|
||||
- Some minor cleanup.
|
||||
|
||||
November 9th, 2007 - J.Apostolakis (geomnav-V09-00-09)
|
||||
----------------------------------
|
||||
- G4SafetyHelper: Improved ComputeSafety() not to call G4Navigator
|
||||
if exactly on safety 'center'.
|
||||
- G4PathFinder: correction to debug code under #ifdef G4DEBUG_NAVIGATION.
|
||||
|
||||
November 9th, 2007 - G.Cosmo (geomnav-V09-00-08)
|
||||
----------------------------
|
||||
- Fix in G4ReplicaNavigation::DistanceToOut() for exact classification of
|
||||
the linear step for Cartesian case.
|
||||
- Made IdentifyAndPlaceSolid() method inlined in G4ParameterisedNavigation.
|
||||
- Minor cosmetics and cleanup.
|
||||
|
||||
November 6th, 2007 - P.Arce (geomnav-V09-00-07)
|
||||
---------------------------
|
||||
- Optimisation in G4RegularNavigation: use voxelBox->DistanceToOut() instead
|
||||
of ComputeStep() in ComputeStepSkippingEqualMaterials().
|
||||
- Some cleanup and proper formatting of error/warning messages.
|
||||
|
||||
November 2nd, 2007 - J.Apostolakis (geomnav-V09-00-06)
|
||||
----------------------------------
|
||||
- Merging fixes in "geomnav-V09-00-03b" and "geomnav-V09-00-03c" on top
|
||||
of tag "geomnav-V09-00-05".
|
||||
|
||||
November 2nd, 2007 - J.Apostolakis (geomnav-V09-00-03c)
|
||||
----------------------------------
|
||||
- G4PathFinder:
|
||||
o Added setting of 'fNoGeometriesLimiting' in DoNextCurvedStep().
|
||||
o Check to verify that 'fNoGeometriesLimiting' is set by DoNext*Step methods.
|
||||
o Revised data type of 'fNoGeometriesLimiting' to be a int, so that < 0
|
||||
shows 'unset'.
|
||||
- G4PropagatorInField:
|
||||
o Fixes for compilation of code under G4DEBUG_FIELD (problem report #982).
|
||||
o Added extra check of method LocateIntersectionPoint() arguments.
|
||||
- Tag based on "geomnav-V09-00-03b".
|
||||
|
||||
October 29th, 2007 - J.Apostolakis (geomnav-V09-00-03b)
|
||||
----------------------------------
|
||||
- G4PathFinder: first fix for problem of another process shortening steps
|
||||
(between calls to ComputeStep by different processes in same step.)
|
||||
I.e. First call to ComputeStep (geom 1) has proposed Step = 3.0 cm
|
||||
Next call to ComputeStep (geom 2) has proposed Step = 1.0 cm
|
||||
(e.g. Multiple Scattering)
|
||||
- Tag based on "geomnav-V09-00-03a".
|
||||
|
||||
October 24th, 2007 - J.Apostolakis (geomnav-V09-00-05)
|
||||
----------------------------------
|
||||
- Merging fixes introduced in "geomnav-V09-00-03a" on top of
|
||||
"geomnav-V09-00-04".
|
||||
|
||||
October 24th, 2007 - J.Apostolakis (geomnav-V09-00-03a)
|
||||
----------------------------------
|
||||
- G4PathFinder: fix to now set 'fNoGeometriesLimiting' in DoNextLinearStep()
|
||||
when WhichLimited() is not called, i.e. in case of one navigator
|
||||
optimisation.
|
||||
- Tag based on "geomnav-V09-00-03".
|
||||
|
||||
October 18th, 2007 - G.Cosmo (geomnav-V09-00-04)
|
||||
----------------------------
|
||||
- Added new specific navigation for regular structures and phantoms.
|
||||
New classes: G4RegularNavigation, G4PhantomParameterisation (by P.Arce).
|
||||
Added cases to G4Navigator. Added dependency on "materials" module.
|
||||
|
||||
October 12th, 2007 - J.Apostolakis (geomnav-V09-00-03)
|
||||
----------------------------------
|
||||
- G4PathFinder: added new methods GetNumberGeometriesLimitingStep()
|
||||
and GetMinimumStep() needed by G4CoupledTransportation to see whether
|
||||
to relocate.
|
||||
|
||||
September 25th, 2007 - G.Cosmo (geomnav-V09-00-02)
|
||||
------------------------------
|
||||
- Some code cleanup in G4PathFinder. Switch off additional optimisation
|
||||
for safety in method DoNextLinearStep().
|
||||
- Set 'fRecomputeFactor' in G4SafetyHelper to 0.0, to switch off internal
|
||||
optimisation and allow for reproducibility of steps (A.Howard).
|
||||
|
||||
July 12th, 2007 - J.Apostolakis (geomnav-V09-00-01)
|
||||
-------------------------------
|
||||
- Restores fixes/improvements of geomnav-V08-03-07
|
||||
- G4PathFinder: includes fix for result of ObtainSafety(), used in
|
||||
CoupledTransportation.
|
||||
|
||||
July 12th, 2007 - J.Apostolakis (geomnav-V09-00-00)
|
||||
-------------------------------
|
||||
- G4PathFinder:
|
||||
o Include correction to signature of method PrepareNewTrack().
|
||||
(This was done on a branch for this class in order to keep only
|
||||
development of geomnav-V08-03-06)
|
||||
- G4PropagatorInField:
|
||||
o Included revisions and fixes for G4PropagatorInField of June 8th.
|
||||
- This tag is based on "geomnav-V08-03-06" and does NOT include the
|
||||
revisions of "geomnav-V08-03-07".
|
||||
|
||||
July 5th, 2007 - G.Cosmo
|
||||
------------------------
|
||||
- G4PathFinder:
|
||||
o Corrected signature to method PrepareNewTrack().
|
||||
Resolves linking problems detected on SUN-CC platform.
|
||||
- Changes included in tag "geomnav-V08-03-02c", included in relase 9.0.p01.
|
||||
|
||||
June 8th, 2007 - T.Nikitina
|
||||
---------------------------
|
||||
- G4PropagatorInField:
|
||||
o Put in the constructor creation of array of FieldTracks used in
|
||||
LocateInterSectionPoint().
|
||||
o Change in ReEstimateNewPoint() in order to handle cases with zero step
|
||||
caused by diffCurve=0.
|
||||
o In case of proposed step less than tolerance, now return 'kInfinity'
|
||||
as per convention of geometry instead of 'DBL_MAX'.
|
||||
(by J.Apostolakis, May 18th 2007)
|
||||
- Changes included in tag "geomnav-V08-03-02b", included in release 9.0.
|
||||
|
||||
May 18th, 2007 - J.Apostolakis
|
||||
June 5th, 2007 - J.Apostolakis (geomnav-V08-03-07)
|
||||
------------------------------
|
||||
- G4PropagatorInField: in case of proposed step less than tolerance,
|
||||
now return 'kInfinity' as per convention of geometry instead of 'DBL_MAX'.
|
||||
- G4PathFinder:
|
||||
o New method to return the safety sphere last calculated for
|
||||
a PreStep point (it could be a previous one - due to optimasation).
|
||||
>> If last step(s) were smaller than safety, then for a linear
|
||||
track (no field or no charge) Navigator's ComputeSafety is not
|
||||
called. The older PreStep (previous step or some steps back
|
||||
in case of many small steps) is stored for this - and provided.
|
||||
o ComputeStep() still returns current PreStep point's safety (must).
|
||||
o Revisions are to make this (used by CoupledTransportation) more
|
||||
compatible with the old direct use of G4Navigator by G4Transportation.
|
||||
|
||||
May 30th, 2007 - G.Cosmo (geomnav-V08-03-02a)
|
||||
May 29th, 2007 - J.Apostolakis (geomnav-V08-03-06)
|
||||
------------------------------
|
||||
- G4Navigator
|
||||
o Fixed **ComputeSafety**: wrong coordinates used (last tag only).
|
||||
For certainty reinstated LocateGlobalPointWithinVolume (for now).
|
||||
o Corrected calculation of fStepEndPoint (in ComputeStep)
|
||||
for case of step not limited by geometry
|
||||
- G4PathFinder
|
||||
o PrepareNewTrack: calls to re-initialise SafetyHelper (reset safety)
|
||||
o ReLocate: Corrected check of move (avoid one side effect on stored safety)
|
||||
--> ComputeSafety still results individual navigators' values.
|
||||
|
||||
May 24th, 2007 - J.Apostolakis (geomnav-V08-03-05)
|
||||
------------------------------
|
||||
- G4PathFinder: 1 correction and 2 optimisations:
|
||||
o PrepareNewTrack() clear safety - to avoid potential problems in overlaps.
|
||||
o DoNextLinearStep() only calls ComputeStep() for a navigator whose safety
|
||||
greater than the step.
|
||||
o DoNextCurvedStep(), if there's one geometry, no longer calls
|
||||
ComputeSafety() at start.
|
||||
- G4Navigator ComputeSafety:
|
||||
o Corrected it to address use at non-endpoint
|
||||
o Replaced call to LocateGlobalPointWithinVolume() with calls to
|
||||
sub-navigators.
|
||||
|
||||
May 21st, 2007 - G.Cosmo
|
||||
------------------------
|
||||
- Made 'fVerbose' protected in G4Navigator, reused in G4MultipleNavigator.
|
||||
- Some cleanup in G4MultipleNavigator implementation.
|
||||
- Make G4PathFinder singleton definition canonical.
|
||||
- Added method CheckPointExiting() in G4AuxiliaryNavServices utility
|
||||
class (by P.Arce).
|
||||
- Added G4DEBUG_PATHFINDER flag to GNUmakefile.
|
||||
|
||||
May 19th, 2007 - J.Apostolakis (geomnav-V08-03-04)
|
||||
------------------------------
|
||||
- Corrections and additions in G4PathFinder:
|
||||
1) Added calculation of start-point safety in DoNextCurvedStep
|
||||
2) Corrected GetCurrentSafety() - uses mininum of 1)
|
||||
3) Added method to obtain safety of one navigator (after call to all).
|
||||
4) Deleted obsolete data member 'fMinSafety'.
|
||||
5) If only one geometry, do not call WhichLimited in DoNextLinearStep (optimisation)
|
||||
6) ComputeSafety: save the values of isotropic safety for each navigator
|
||||
|
||||
May 18th, 2007 - A.Howard (geomnav-V08-03-03)
|
||||
------------------------
|
||||
- Fixed return value for G4PathFinder::ComputeStep in case of
|
||||
step smaller than tolerance (now kInfinity): fixes one PathFinder issue (JA).
|
||||
- Added compiler flags for verbosity in G4PathFinder.cc
|
||||
- Added compiler flags for verbosity in G4MultiNavigator.cc
|
||||
|
||||
May 18th, 2007 - G.Cosmo (geomnav-V08-03-02)
|
||||
------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.hh,v 1.4 2007/05/22 07:48:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4AuxiliaryNavServices
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.icc,v 1.4 2007/05/22 07:48:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4AuxiliaryNavServices Inline implementation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DrawVoxels.hh,v 1.3 2006/06/29 18:35:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4DrawVoxels
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorPropagationNavigator.hh,v 1.1 2007/05/16 12:49:18 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestErrorList.hh,v 1.3 2006/06/29 18:35:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestLogger.hh,v 1.3 2006/06/29 18:35:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOverlapList.hh,v 1.3 2006/06/29 18:35:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOvershootList.hh,v 1.3 2006/06/29 18:35:45 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestPoint.hh,v 1.3 2006/06/29 18:35:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestSegment.hh,v 1.4 2007/05/11 13:43:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestStreamLogger.hh,v 1.3 2006/06/29 18:35:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolPoint.hh,v 1.3 2006/06/29 18:35:55 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolume.hh,v 1.3 2006/06/29 18:35:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryMessenger.hh,v 1.4 2006/06/29 18:35:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MultiNavigator.hh,v 1.3 2006/11/13 17:34:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4MultiNavigator.hh,v 1.4 2007/05/21 15:36:25 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4MultiNavigator
|
||||
@@ -82,7 +82,7 @@ class G4MultiNavigator : public G4Navigator
|
||||
// Get values for a single geometry
|
||||
|
||||
void PrepareNavigators();
|
||||
// Find which geometries are registered for this particles - and keep info
|
||||
// Find which geometries are registered for this particles, and keep info
|
||||
void PrepareNewTrack( const G4ThreeVector position,
|
||||
const G4ThreeVector direction );
|
||||
// Prepare Navigators and locate
|
||||
@@ -97,9 +97,9 @@ class G4MultiNavigator : public G4Navigator
|
||||
// Important Note: In order to call this the geometries MUST be closed.
|
||||
|
||||
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
|
||||
const G4ThreeVector* direction=0,
|
||||
const G4bool pRelativeSearch=true,
|
||||
const G4bool ignoreDirection=true);
|
||||
const G4ThreeVector* direction=0,
|
||||
const G4bool pRelativeSearch=true,
|
||||
const G4bool ignoreDirection=true);
|
||||
// Locate in all geometries.
|
||||
// Return the volume in the first (mass) geometry
|
||||
// Maintain vector of other volumes, to be returned separately
|
||||
@@ -114,8 +114,8 @@ class G4MultiNavigator : public G4Navigator
|
||||
G4double ComputeSafety(const G4ThreeVector &globalpoint,
|
||||
const G4double pProposedMaxLength = DBL_MAX);
|
||||
// Calculate the isotropic distance to the nearest boundary
|
||||
// in any geometry from the specified point in the global coordinate system.
|
||||
// The geometry must be closed.
|
||||
// in any geometry from the specified point in the global coordinate
|
||||
// system. The geometry must be closed.
|
||||
|
||||
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
|
||||
// Returns a reference counted handle to a touchable history.
|
||||
@@ -161,7 +161,7 @@ class G4MultiNavigator : public G4Navigator
|
||||
G4double fNewSafety[ fMaxNav ]; // Safety for starting point
|
||||
|
||||
// Lowest values - determine step length, and safety
|
||||
G4double fMinStep; // As reported by Navigators -- can be kInfinity
|
||||
G4double fMinStep; // As reported by Navigators. Can be kInfinity
|
||||
G4double fMinSafety;
|
||||
G4double fTrueMinStep; // Corrected in case fMinStep >= proposed
|
||||
|
||||
@@ -175,8 +175,6 @@ class G4MultiNavigator : public G4Navigator
|
||||
G4ThreeVector fPreStepLocation; // point where last ComputeStep called
|
||||
G4double fMinSafety_PreStepPt; // /\ corresponding value of safety
|
||||
|
||||
// STATE Auxiliary variables
|
||||
G4int fVerboseLevel;
|
||||
G4TransportationManager* pTransportManager; // Cache for frequent use
|
||||
};
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.hh,v 1.23 2007/05/11 13:43:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4Navigator.hh,v 1.26 2007/10/18 14:18:36 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4Navigator
|
||||
@@ -65,6 +65,7 @@
|
||||
#include "G4VoxelNavigation.hh"
|
||||
#include "G4ParameterisedNavigation.hh"
|
||||
#include "G4ReplicaNavigation.hh"
|
||||
#include "G4RegularNavigation.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -298,6 +299,9 @@ class G4Navigator
|
||||
inline EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const;
|
||||
// Characterise daughter of logical volume.
|
||||
|
||||
inline G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const;
|
||||
// Get regular structure ID of first daughter
|
||||
|
||||
virtual void SetupHierarchy();
|
||||
// Renavigate & reset hierarchy described by current history
|
||||
// o Reset volumes
|
||||
@@ -330,6 +334,13 @@ class G4Navigator
|
||||
G4bool fWasLimitedByGeometry;
|
||||
// Set true if last Step was limited by geometry.
|
||||
|
||||
G4ThreeVector fStepEndPoint;
|
||||
// Endpoint of last ComputeStep
|
||||
// - can be used for optimisation (eg when computing safety)
|
||||
|
||||
G4int fVerbose;
|
||||
// Verbose(ness) level [if > 0, printout can occur].
|
||||
|
||||
private:
|
||||
|
||||
G4bool fActive;
|
||||
@@ -422,8 +433,6 @@ class G4Navigator
|
||||
// Check-mode flag [if true, more strict checks are performed].
|
||||
G4bool fPushed;
|
||||
// Push flag [if true, means a stuck particle has been pushed].
|
||||
G4int fVerbose;
|
||||
// Verbose(ness) level [if > 0, printout can occur].
|
||||
|
||||
// Helpers/Utility classes
|
||||
//
|
||||
@@ -431,6 +440,7 @@ class G4Navigator
|
||||
G4VoxelNavigation fvoxelNav;
|
||||
G4ParameterisedNavigation fparamNav;
|
||||
G4ReplicaNavigation freplicaNav;
|
||||
G4RegularNavigation fregularNav;
|
||||
};
|
||||
|
||||
#include "G4Navigator.icc"
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.icc,v 1.12 2006/10/27 09:13:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4Navigator.icc,v 1.15 2007/10/18 14:18:36 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4Navigator Inline implementation
|
||||
@@ -157,7 +157,7 @@ EVolume G4Navigator::VolumeType(const G4VPhysicalVolume *pVol) const
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// CharacteriseDahghters
|
||||
// CharacteriseDaughters
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
@@ -190,6 +190,26 @@ EVolume G4Navigator::CharacteriseDaughters(const G4LogicalVolume *pLog) const
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
// GetDaughtersRegularStructureId
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4int G4Navigator::
|
||||
GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
|
||||
{
|
||||
G4int regId = 0;
|
||||
G4VPhysicalVolume *pVol;
|
||||
|
||||
if ( pLog->GetNoDaughters()==1 )
|
||||
{
|
||||
pVol = pLog->GetDaughter(0);
|
||||
regId = pVol->GetRegularStructureId();
|
||||
}
|
||||
return regId;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// GetGlobalToLocalTransform
|
||||
//
|
||||
@@ -368,6 +388,7 @@ void G4Navigator::SetVerboseLevel(G4int level)
|
||||
fvoxelNav.SetVerboseLevel(level);
|
||||
fparamNav.SetVerboseLevel(level);
|
||||
freplicaNav.SetVerboseLevel(level);
|
||||
fregularNav.SetVerboseLevel(level);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -424,6 +445,7 @@ void G4Navigator::CheckMode(G4bool mode)
|
||||
fvoxelNav.CheckMode(mode);
|
||||
fparamNav.CheckMode(mode);
|
||||
freplicaNav.CheckMode(mode);
|
||||
fregularNav.CheckMode(mode);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.hh,v 1.4 2006/06/29 18:36:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.icc,v 1.4 2006/06/29 18:36:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// G4NormalNavigation Inline Implementation
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.hh,v 1.5 2006/06/29 18:36:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4ParameterisedNavigation.hh,v 1.6 2007/11/09 16:06:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation
|
||||
@@ -63,8 +63,8 @@ class G4ParameterisedNavigation : public G4VoxelNavigation
|
||||
G4ParameterisedNavigation();
|
||||
~G4ParameterisedNavigation();
|
||||
|
||||
G4SmartVoxelNode* ParamVoxelLocate( G4SmartVoxelHeader* pHead,
|
||||
const G4ThreeVector& localPoint );
|
||||
inline G4SmartVoxelNode* ParamVoxelLocate( G4SmartVoxelHeader* pHead,
|
||||
const G4ThreeVector& localPoint );
|
||||
|
||||
G4bool LevelLocate( G4NavigationHistory& history,
|
||||
const G4VPhysicalVolume* blockedVol,
|
||||
@@ -102,7 +102,7 @@ class G4ParameterisedNavigation : public G4VoxelNavigation
|
||||
|
||||
// Necessary to resolve cases with nested parameterisations
|
||||
|
||||
G4VSolid* IdentifyAndPlaceSolid( G4int num,
|
||||
inline G4VSolid* IdentifyAndPlaceSolid( G4int num,
|
||||
G4VPhysicalVolume* apparentPhys,
|
||||
G4VPVParameterisation* curParam );
|
||||
// Call virtual 'Compute' methods, and copy information if nested.
|
||||
|
||||
@@ -24,14 +24,33 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.icc,v 1.6 2006/06/29 18:36:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4ParameterisedNavigation.icc,v 1.7 2007/11/09 16:06:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Inline implementation
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// ********************************************************************
|
||||
// IdentifyAndPlaceSolid
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4VSolid* G4ParameterisedNavigation::
|
||||
IdentifyAndPlaceSolid( G4int num,
|
||||
G4VPhysicalVolume *apparentPhys, // PhysV or PhysT
|
||||
G4VPVParameterisation *curParam )
|
||||
{
|
||||
G4VSolid *sampleSolid;
|
||||
|
||||
sampleSolid = curParam->ComputeSolid(num, apparentPhys);
|
||||
sampleSolid->ComputeDimensions(curParam, num, apparentPhys);
|
||||
curParam->ComputeTransformation(num, apparentPhys);
|
||||
|
||||
return sampleSolid;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// ParamVoxelLocate
|
||||
// ********************************************************************
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PathFinder.hh,v 1.23 2007/05/16 15:59:06 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4PathFinder.hh,v 1.34 2007/11/02 12:28:31 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// class G4PathFinder
|
||||
//
|
||||
@@ -68,16 +68,19 @@ class G4PathFinder
|
||||
//
|
||||
// Retrieve singleton instance
|
||||
|
||||
G4double ComputeStep( const G4FieldTrack &pFieldTrack,// Or update non-c
|
||||
G4double pCurrentProposedStepLength,
|
||||
G4int navigatorId,
|
||||
G4int stepNo, // See next step/check
|
||||
G4double &pNewSafety, // for this geom
|
||||
ELimited &limitedStep,
|
||||
G4double ComputeStep( const G4FieldTrack &pFieldTrack,
|
||||
G4double pCurrentProposedStepLength,
|
||||
G4int navigatorId, // Identifies the geometry
|
||||
G4int stepNo, // See next step/check
|
||||
G4double &pNewSafety, // Only for this geometry
|
||||
ELimited &limitedStep,
|
||||
G4FieldTrack &EndState,
|
||||
G4VPhysicalVolume* currentVolume );
|
||||
//
|
||||
// Compute the next geometric Step -- Curved or linear
|
||||
// If it is called with a larger 'stepNo' it will execute a new step;
|
||||
// if 'stepNo' is same as last call, then the results for
|
||||
// the geometry with Id. number 'navigatorId' will be returned.
|
||||
|
||||
void Locate( const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
@@ -91,7 +94,9 @@ class G4PathFinder
|
||||
// Make secondary relocation of global point (within safety only)
|
||||
// in all navigators, and update them.
|
||||
|
||||
void PrepareNewTrack( G4ThreeVector position, G4ThreeVector direction);
|
||||
void PrepareNewTrack( const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4VPhysicalVolume* massStartVol=0);
|
||||
//
|
||||
// Check and cache set of active navigators.
|
||||
|
||||
@@ -107,13 +112,20 @@ class G4PathFinder
|
||||
inline G4bool IsParticleLooping() const;
|
||||
|
||||
inline G4double GetCurrentSafety() const;
|
||||
//
|
||||
// Minimum value of safety after last ComputeStep
|
||||
inline G4double GetMinimumStep() const;
|
||||
// Get the minimum step size from the last ComputeStep call
|
||||
// - in case full step is taken, this is kInfinity
|
||||
inline unsigned int GetNumberGeometriesLimitingStep() const;
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector& pGlobalPoint );
|
||||
//
|
||||
// Recompute safety for the relevant point
|
||||
// the endpoint of the last step!!
|
||||
G4double ComputeSafety( const G4ThreeVector& globalPoint);
|
||||
// Recompute safety for the relevant point the endpoint of the last step!!
|
||||
// Maintain vector of individual safety values (for next method)
|
||||
|
||||
G4double ObtainSafety( G4int navId, G4ThreeVector& globalCenterPoint );
|
||||
// Obtain safety for navigator/geometry navId for last point 'computed'
|
||||
// --> last point for which ComputeSafety was called
|
||||
// Returns the point (center) for which this safety is valid
|
||||
|
||||
void EnableParallelNavigation( G4bool enableChoice=true );
|
||||
//
|
||||
@@ -137,6 +149,17 @@ class G4PathFinder
|
||||
//
|
||||
// Signal that location will be moved -- internal use primarily
|
||||
|
||||
// To provide best compatibility between Coupled and Old Transportation
|
||||
// the next two methods are provided:
|
||||
G4double LastPreSafety( G4int navId, G4ThreeVector& globalCenterPoint, G4double& minSafety );
|
||||
// Obtain last safety needed in ComputeStep (for geometry navId)
|
||||
// --> last point at which ComputeStep recalculated safety
|
||||
// Returns the point (center) for which this safety is valid
|
||||
// and also the minimum safety over all navigators (ie full)
|
||||
|
||||
void PushPostSafetyToPreSafety();
|
||||
// Tell PathFinder to copy PostStep Safety to PreSafety (for use at next step)
|
||||
|
||||
G4String& LimitedString( ELimited lim );
|
||||
// Convert ELimited to string
|
||||
|
||||
@@ -154,7 +177,7 @@ class G4PathFinder
|
||||
//
|
||||
// Print key details out - for debugging
|
||||
|
||||
void ClearState();
|
||||
// void ClearState();
|
||||
//
|
||||
// Clear all the State of this class and its current associates
|
||||
|
||||
@@ -162,6 +185,9 @@ class G4PathFinder
|
||||
//
|
||||
// Whether use safety to discard unneccesary calls to navigator
|
||||
|
||||
void ReportMove( const G4ThreeVector& OldV, const G4ThreeVector& NewV, const G4String& Quantity ) const;
|
||||
// Helper method to report movement (likely of initial point)
|
||||
|
||||
protected:
|
||||
|
||||
G4PathFinder(); // Singleton
|
||||
@@ -175,8 +201,9 @@ class G4PathFinder
|
||||
// DATA Members
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
G4MultiNavigator *fpMultiNavigator;
|
||||
// Object that enables G4PropagatorInField to see many geometries
|
||||
G4MultiNavigator *fpMultiNavigator;
|
||||
//
|
||||
// Object that enables G4PropagatorInField to see many geometries
|
||||
|
||||
G4int fNoActiveNavigators;
|
||||
G4bool fNewTrack; // Flag a new track (ensure first step)
|
||||
@@ -187,13 +214,25 @@ class G4PathFinder
|
||||
|
||||
G4Navigator* fpNavigator[fMaxNav];
|
||||
|
||||
// State after a step computation
|
||||
// State changed in a step computation
|
||||
|
||||
ELimited fLimitedStep[fMaxNav];
|
||||
G4bool fLimitTruth[fMaxNav];
|
||||
G4double fCurrentStepSize[fMaxNav];
|
||||
G4double fNewSafety[ fMaxNav ]; // Safety for starting point
|
||||
G4double fMinSafety;
|
||||
G4int fNoGeometriesLimiting; // How many processes contribute to limit
|
||||
|
||||
G4ThreeVector fPreSafetyLocation; // last initial position for which safety evaluated
|
||||
G4double fPreSafetyMinValue; // /\ corresponding value of full safety
|
||||
G4double fPreSafetyValues[ fMaxNav ]; // Safeties for the above point
|
||||
// This part of the state can be retained for severall calls --> CARE
|
||||
|
||||
G4ThreeVector fPreStepLocation; // point where last ComputeStep called
|
||||
G4double fMinSafety_PreStepPt; // /\ corresponding value of full safety
|
||||
G4double fCurrentPreStepSafety[ fMaxNav ]; // Safeties for the above point
|
||||
// This changes at each step,
|
||||
// so it can differ when steps inside min-safety are made
|
||||
|
||||
G4bool fPreStepCenterRenewed; // Whether PreSafety coincides with PreStep point
|
||||
|
||||
G4double fMinStep; // As reported by Navigators -- can be kInfinity
|
||||
G4double fTrueMinStep; // Corrected in case >= proposed
|
||||
@@ -203,29 +242,35 @@ class G4PathFinder
|
||||
G4VPhysicalVolume* fLocatedVolume[fMaxNav];
|
||||
G4ThreeVector fLastLocatedPosition;
|
||||
|
||||
G4FieldTrack fEndState;
|
||||
// End point storage
|
||||
// State after calling 'ComputeStep' (others member variables will be affected)
|
||||
G4FieldTrack fEndState; // Point, velocity, ... at proposed step end
|
||||
G4bool fFieldExertedForce; // In current proposed step
|
||||
|
||||
G4bool fRelocatedPoint; // Signals that point was or is being moved
|
||||
// from the position of the last location
|
||||
// or the endpoint resulting from ComputeStep
|
||||
// -- invalidates fEndState
|
||||
|
||||
// State for 'ComputeSafety' and related methods
|
||||
G4ThreeVector fSafetyLocation; // point where ComputeSafety is called
|
||||
G4double fMinSafety_atSafLocation; // /\ corresponding value of safety
|
||||
G4ThreeVector fPreStepLocation; // point where last ComputeStep called
|
||||
G4double fMinSafety_PreStepPt; // /\ corresponding value of safety
|
||||
G4double fNewSafetyComputed[ fMaxNav ]; // Safeties for last ComputeSafety
|
||||
|
||||
G4int fLastStepNo, fCurrentStepNo;
|
||||
G4bool fParticleIsLooping;
|
||||
G4int fVerboseLevel;
|
||||
// For debuging purposes
|
||||
G4int fMax_loop_count;
|
||||
// State for Step numbers
|
||||
G4int fLastStepNo, fCurrentStepNo;
|
||||
G4bool fParticleIsLooping;
|
||||
|
||||
G4int fVerboseLevel; // For debuging purposes
|
||||
|
||||
G4int fMax_loop_count;
|
||||
// Limit for the number of sub-steps taken in one call to ComputeStep
|
||||
|
||||
G4TransportationManager* fpTransportManager; // Cache for frequent use
|
||||
G4PropagatorInField* fpFieldPropagator;
|
||||
|
||||
G4double kCarTolerance;
|
||||
|
||||
static G4PathFinder* fpPathFinder;
|
||||
};
|
||||
|
||||
// ********************************************************************
|
||||
@@ -244,9 +289,20 @@ inline G4int G4PathFinder::SetVerboseLevel(G4int newLevel)
|
||||
G4int old= fVerboseLevel; fVerboseLevel= newLevel; return old;
|
||||
}
|
||||
|
||||
inline G4double G4PathFinder::GetMinimumStep() const
|
||||
{
|
||||
return fMinStep;
|
||||
}
|
||||
|
||||
inline unsigned int G4PathFinder::GetNumberGeometriesLimitingStep() const
|
||||
{
|
||||
unsigned int noGeometries=fNoGeometriesLimiting;
|
||||
return noGeometries;
|
||||
}
|
||||
|
||||
inline G4double G4PathFinder::GetCurrentSafety() const
|
||||
{
|
||||
return fMinSafety;
|
||||
return fMinSafety_PreStepPt;
|
||||
}
|
||||
|
||||
inline void G4PathFinder::MovePoint()
|
||||
@@ -260,4 +316,20 @@ inline G4Navigator* G4PathFinder::GetNavigator(G4int n) const
|
||||
return fpNavigator[n];
|
||||
}
|
||||
|
||||
inline G4double G4PathFinder::ObtainSafety( G4int navId, G4ThreeVector& globalCenterPoint )
|
||||
{
|
||||
globalCenterPoint= fSafetyLocation;
|
||||
// navId = std::min( navId, fMaxNav-1 );
|
||||
return fNewSafetyComputed[ navId ];
|
||||
}
|
||||
|
||||
inline G4double G4PathFinder::LastPreSafety( G4int navId,
|
||||
G4ThreeVector& globalCenterPoint,
|
||||
G4double& minSafety )
|
||||
{
|
||||
globalCenterPoint= fPreSafetyLocation;
|
||||
minSafety= fPreSafetyMinValue;
|
||||
// navId = std::min( navId, fMaxNav-1 );
|
||||
return fPreSafetyValues[ navId ];
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhantomParameterisation.hh,v 1.2 2007/10/18 14:29:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4PhantomParameterisation
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Describes regular parameterisations: a set of boxes of equal dimension
|
||||
// in the x, y and z dimensions. The G4PVParameterised volume using this
|
||||
// class must be placed inside a volume that is completely filled by these
|
||||
// boxes.
|
||||
|
||||
// History:
|
||||
// - Created. P. Arce, May 2007
|
||||
// *********************************************************************
|
||||
|
||||
#ifndef G4PhantomParameterisation_HH
|
||||
#define G4PhantomParameterisation_HH
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4VPVParameterisation.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4VTouchable;
|
||||
class G4VSolid;
|
||||
class G4Material;
|
||||
|
||||
// Dummy forward declarations ...
|
||||
|
||||
class G4Box;
|
||||
class G4Tubs;
|
||||
class G4Trd;
|
||||
class G4Trap;
|
||||
class G4Cons;
|
||||
class G4Orb;
|
||||
class G4Sphere;
|
||||
class G4Torus;
|
||||
class G4Para;
|
||||
class G4Hype;
|
||||
class G4Polycone;
|
||||
class G4Polyhedra;
|
||||
|
||||
class G4PhantomParameterisation : public G4VPVParameterisation
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4PhantomParameterisation();
|
||||
~G4PhantomParameterisation();
|
||||
|
||||
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const;
|
||||
|
||||
virtual G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *);
|
||||
|
||||
virtual G4Material* ComputeMaterial(const G4int repNo,
|
||||
G4VPhysicalVolume *currentVol,
|
||||
const G4VTouchable *parentTouch=0);
|
||||
// Dummy declarations ...
|
||||
|
||||
void ComputeDimensions (G4Box &, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Tubs&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Trd&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Trap&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Cons&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Orb&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Sphere&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Torus&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Para&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Hype&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Polycone&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
void ComputeDimensions (G4Polyhedra&, const G4int,
|
||||
const G4VPhysicalVolume*) const {}
|
||||
|
||||
void BuildContainerSolid( G4VPhysicalVolume *pPhysicalVol );
|
||||
// Save as container solid the parent of the voxels. Check that the
|
||||
// voxels fill it completely.
|
||||
|
||||
G4int GetReplicaNo( const G4ThreeVector& localPoint,
|
||||
const G4ThreeVector& localDir );
|
||||
// Get the voxel number corresponding to the point in the container
|
||||
// frame. Use 'localDir' to avoid precision problems at the surfaces.
|
||||
|
||||
// Set and Get methods
|
||||
|
||||
inline void SetMaterials(std::vector<G4Material*>& mates );
|
||||
|
||||
inline void SetMaterialIndices( size_t* matInd );
|
||||
|
||||
void SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz );
|
||||
void SetNoVoxel( size_t nx, size_t ny, size_t nz );
|
||||
|
||||
inline G4double GetVoxelHalfX() const;
|
||||
inline G4double GetVoxelHalfY() const;
|
||||
inline G4double GetVoxelHalfZ() const;
|
||||
inline size_t GetNoVoxelX() const;
|
||||
inline size_t GetNoVoxelY() const;
|
||||
inline size_t GetNoVoxelZ() const;
|
||||
inline size_t GetNoVoxel() const;
|
||||
|
||||
inline std::vector<G4Material*> GetMaterials() const;
|
||||
inline size_t* GetMaterialIndices() const;
|
||||
inline G4VSolid* GetContainerSolid() const;
|
||||
|
||||
G4ThreeVector GetTranslation(const G4int copyNo ) const;
|
||||
|
||||
G4bool SkipEqualMaterials() const;
|
||||
void SetSkipEqualMaterials( G4bool skip );
|
||||
|
||||
size_t GetMaterialIndex( size_t nx, size_t ny, size_t nz) const;
|
||||
size_t GetMaterialIndex( size_t copyNo) const;
|
||||
|
||||
G4Material* GetMaterial( size_t nx, size_t ny, size_t nz) const;
|
||||
G4Material* GetMaterial( size_t copyNo ) const;
|
||||
|
||||
private:
|
||||
|
||||
void ComputeVoxelIndices(const G4int copyNo, size_t& nx,
|
||||
size_t& ny, size_t& nz ) const;
|
||||
// Convert the copyNo to voxel numbers in x, y and z.
|
||||
|
||||
void CheckVoxelsFillContainer( G4double contX, G4double contY,
|
||||
G4double contZ ) const;
|
||||
// Check that the voxels fill it completely.
|
||||
|
||||
void CheckCopyNo( const G4int copyNo ) const;
|
||||
// Check that the copy number is within limits.
|
||||
|
||||
private:
|
||||
|
||||
G4double fVoxelHalfX,fVoxelHalfY,fVoxelHalfZ;
|
||||
// Half dimension of voxels (assume they are boxes).
|
||||
size_t fNoVoxelX,fNoVoxelY,fNoVoxelZ;
|
||||
// Number of voxel in x, y and z dimensions.
|
||||
size_t fNoVoxelXY;
|
||||
// Number of voxels in x times number of voxels in y (for speed-up).
|
||||
size_t fNoVoxel;
|
||||
// Total number of voxels (for speed-up).
|
||||
|
||||
std::vector<G4Material*> fMaterials;
|
||||
// List of materials of the voxels.
|
||||
size_t* fMaterialIndices;
|
||||
// Index in fMaterials that correspond to each voxel.
|
||||
|
||||
G4VSolid* fContainerSolid;
|
||||
// Save as container solid the parent of the voxels.
|
||||
// Check that the voxels fill it completely.
|
||||
|
||||
G4double fContainerWallX, fContainerWallY, fContainerWallZ;
|
||||
// Save position of container wall for speed-up.
|
||||
|
||||
G4double kCarTolerance;
|
||||
// Relative surface tolerance.
|
||||
|
||||
G4bool bSkipEqualMaterials;
|
||||
// Flag to skip surface when two voxel have same material or not
|
||||
};
|
||||
|
||||
#include "G4PhantomParameterisation.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhantomParameterisation.icc,v 1.1 2007/10/17 19:13:58 arce Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
void G4PhantomParameterisation::
|
||||
SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz )
|
||||
{
|
||||
fVoxelHalfX = halfx;
|
||||
fVoxelHalfY = halfy;
|
||||
fVoxelHalfZ = halfz;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
void G4PhantomParameterisation::SetNoVoxel( size_t nx, size_t ny, size_t nz )
|
||||
{
|
||||
fNoVoxelX = nx;
|
||||
fNoVoxelY = ny;
|
||||
fNoVoxelZ = nz;
|
||||
fNoVoxelXY = nx*ny;
|
||||
fNoVoxel = nx*ny*nz;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
void G4PhantomParameterisation::SetMaterials(std::vector<G4Material*>& mates )
|
||||
{
|
||||
fMaterials = mates;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
void G4PhantomParameterisation::SetMaterialIndices( size_t* matInd )
|
||||
{
|
||||
fMaterialIndices = matInd;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
G4double G4PhantomParameterisation::GetVoxelHalfX() const
|
||||
{
|
||||
return fVoxelHalfX;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
G4double G4PhantomParameterisation::GetVoxelHalfY() const
|
||||
{
|
||||
return fVoxelHalfY;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
G4double G4PhantomParameterisation::GetVoxelHalfZ() const
|
||||
{
|
||||
return fVoxelHalfZ;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t G4PhantomParameterisation::GetNoVoxelX() const
|
||||
{
|
||||
return fNoVoxelX;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t G4PhantomParameterisation::GetNoVoxelY() const
|
||||
{
|
||||
return fNoVoxelY;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t G4PhantomParameterisation::GetNoVoxelZ() const
|
||||
{
|
||||
return fNoVoxelZ;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t G4PhantomParameterisation::GetNoVoxel() const
|
||||
{
|
||||
return fNoVoxel;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
std::vector<G4Material*> G4PhantomParameterisation::GetMaterials() const
|
||||
{
|
||||
return fMaterials;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t* G4PhantomParameterisation::GetMaterialIndices() const
|
||||
{
|
||||
return fMaterialIndices;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
G4VSolid* G4PhantomParameterisation::GetContainerSolid() const
|
||||
{
|
||||
return fContainerSolid;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
G4bool G4PhantomParameterisation::SkipEqualMaterials() const
|
||||
{
|
||||
return bSkipEqualMaterials;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
void G4PhantomParameterisation::SetSkipEqualMaterials( G4bool skip )
|
||||
{
|
||||
bSkipEqualMaterials = skip;
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.hh,v 1.13 2007/06/08 09:49:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// class G4PropagatorInField
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.icc,v 1.10 2006/11/13 17:34:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RegularNavigation.hh,v 1.2 2007/10/18 14:18:36 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4RegularNavigation
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Utility for fast navigation in volumes containing a regular
|
||||
// parameterisation. If two contiguous voxels have the same material,
|
||||
// navigation does not stop at the surface
|
||||
|
||||
// History:
|
||||
// - Created. P. Arce, May 2007
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4RegularNavigation_HH
|
||||
#define G4RegularNavigation_HH
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4NormalNavigation;
|
||||
class G4VPhysicalVolume;
|
||||
class G4Navigator;
|
||||
class G4NavigationHistory;
|
||||
|
||||
class G4RegularNavigation
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4RegularNavigation();
|
||||
~G4RegularNavigation();
|
||||
|
||||
G4bool LevelLocate( G4NavigationHistory& history,
|
||||
const G4VPhysicalVolume* blockedVol,
|
||||
const G4int blockedNum,
|
||||
const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector& localPoint );
|
||||
// Locate point using its position with respect to regular
|
||||
// parameterisation container volume.
|
||||
|
||||
G4double ComputeStep( const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector& globalDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double& newSafety,
|
||||
G4NavigationHistory& history,
|
||||
G4bool& validExitNormal,
|
||||
G4ThreeVector& exitNormal,
|
||||
G4bool& exiting,
|
||||
G4bool& entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int& blockedReplicaNo );
|
||||
// Method never called because to be called the daughter has to be a
|
||||
// 'regular' volume. This would only happen if the track is in the
|
||||
// mother of voxels volume. But the voxels fill completely their mother,
|
||||
// so when a track enters the mother it automatically enters a voxel.
|
||||
|
||||
G4double ComputeStepSkippingEqualMaterials(
|
||||
const G4ThreeVector localPoint,
|
||||
const G4ThreeVector& globalDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double& newSafety,
|
||||
G4NavigationHistory& history,
|
||||
G4bool& validExitNormal,
|
||||
G4ThreeVector& exitNormal,
|
||||
G4bool& exiting,
|
||||
G4bool& entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int& blockedReplicaNo,
|
||||
G4VPhysicalVolume* pCurrentPhysical);
|
||||
// Compute the step skipping surfaces when they separate voxels with
|
||||
// equal materials. Loop to voxels until a different material is found:
|
||||
// invokes G4NormalNavigation::ComputeStep() in each voxel and move the
|
||||
// point to the next voxel.
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector& localPoint,
|
||||
const G4NavigationHistory& history,
|
||||
const G4double pProposedMaxLength=DBL_MAX );
|
||||
// Method never called because to be called the daughter has to be a
|
||||
// 'regular' volume. This would only happen if the track is in the
|
||||
// mother of voxels volume. But the voxels fill completely their mother,
|
||||
// so when a track enters the mother it automatically enters a voxel.
|
||||
|
||||
public: // without description
|
||||
|
||||
// Set and Get methods
|
||||
|
||||
void SetVerboseLevel(G4int level) { fVerbose = level; }
|
||||
void CheckMode(G4bool mode) { fCheck = mode; }
|
||||
void SetNormalNavigation( G4NormalNavigation* fnormnav )
|
||||
{ fnormalNav = fnormnav; }
|
||||
|
||||
private:
|
||||
|
||||
G4int fVerbose;
|
||||
G4bool fCheck;
|
||||
|
||||
G4NormalNavigation* fnormalNav;
|
||||
G4double kCarTolerance;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.hh,v 1.6 2007/05/18 07:31:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.icc,v 1.5 2006/06/29 18:36:22 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation Inline implementation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SafetyHelper.hh,v 1.7 2007/05/02 15:32:13 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4SafetyHelper
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.hh,v 1.12 2007/04/20 15:28:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// class G4TransportationManager
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.icc,v 1.10 2007/04/20 15:28:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 inlined function members implementation
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.hh,v 1.5 2007/05/11 13:43:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.icc,v 1.4 2006/06/29 18:36:30 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation Inline implementation
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.cc,v 1.3 2006/06/29 18:36:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DrawVoxels.cc,v 1.4 2006/06/29 18:36:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4DrawVoxels
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorPropagationNavigator.cc,v 1.1 2007/05/16 12:49:18 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestErrorList.cc,v 1.3 2006/06/29 18:36:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOverlapList.cc,v 1.3 2006/06/29 18:36:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOvershootList.cc,v 1.3 2006/06/29 18:36:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestPoint.cc,v 1.3 2006/06/29 18:36:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestSegment.cc,v 1.10 2007/05/18 07:30:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4GeomTestSegment.cc,v 1.11 2007/11/16 09:39:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -366,7 +366,6 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
|
||||
//
|
||||
// Find next intersection
|
||||
//
|
||||
G4double dist;
|
||||
if (entering) {
|
||||
dist = solid->DistanceToOut(p,vSearch);
|
||||
//G4cout<<"if entering distToOut="<<dist<<G4endl;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestStreamLogger.cc,v 1.3 2006/06/29 18:36:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolPoint.cc,v 1.3 2006/06/29 18:36:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolume.cc,v 1.5 2006/06/29 18:36:55 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4GeomTestVolume.cc,v 1.6 2007/11/16 09:39:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -274,7 +274,8 @@ void G4GeomTestVolume::TestCylinder( G4int nPhi, G4int nZ, G4int nRho,
|
||||
{
|
||||
G4double cosPhi = std::cos(phi);
|
||||
G4double sinPhi = std::sin(phi);
|
||||
|
||||
G4ThreeVector vPhi1(sinPhi,-cosPhi,0);
|
||||
|
||||
//
|
||||
// Loop over rho
|
||||
//
|
||||
@@ -292,16 +293,14 @@ void G4GeomTestVolume::TestCylinder( G4int nPhi, G4int nZ, G4int nRho,
|
||||
//
|
||||
// Loop over z
|
||||
//
|
||||
G4ThreeVector v(sinPhi,-cosPhi,0);
|
||||
|
||||
G4double zScale = 1.0;
|
||||
G4int iZ=nZ;
|
||||
do
|
||||
{
|
||||
p.setZ( z0 + zScale*zHalfLength );
|
||||
TestOneLine(p,v);
|
||||
TestOneLine(p,vPhi1);
|
||||
p.setZ( z0 - zScale*zHalfLength );
|
||||
TestOneLine(p,v);
|
||||
TestOneLine(p,vPhi1);
|
||||
} while( zScale *= fracZ, --iZ );
|
||||
}
|
||||
} while( rho *= fracRho, --iRho );
|
||||
@@ -310,7 +309,7 @@ void G4GeomTestVolume::TestCylinder( G4int nPhi, G4int nZ, G4int nRho,
|
||||
// Loop over z
|
||||
//
|
||||
G4ThreeVector p(0,0,0);
|
||||
G4ThreeVector v(cosPhi,sinPhi,0);
|
||||
G4ThreeVector vPhi2(cosPhi,sinPhi,0);
|
||||
|
||||
G4double zScale = 1.0;
|
||||
G4int iZ=nZ;
|
||||
@@ -318,11 +317,11 @@ void G4GeomTestVolume::TestCylinder( G4int nPhi, G4int nZ, G4int nRho,
|
||||
{
|
||||
p.setZ( z0 + zScale*zHalfLength );
|
||||
|
||||
TestOneLine(p,v);
|
||||
TestOneLine(p,vPhi2);
|
||||
|
||||
p.setZ( z0 - zScale*zHalfLength );
|
||||
|
||||
TestOneLine(p,v);
|
||||
TestOneLine(p,vPhi2);
|
||||
} while( zScale *= fracZ, --iZ );
|
||||
|
||||
} while( phi += deltaPhi, --iPhi );
|
||||
@@ -499,8 +498,7 @@ void G4GeomTestVolume::TestOneLine( const G4ThreeVector &p,
|
||||
//
|
||||
// Add them to the list
|
||||
//
|
||||
G4int n = daughterSegment.GetNumberPoints();
|
||||
G4int i;
|
||||
n = daughterSegment.GetNumberPoints();
|
||||
for(i=0;i<n;++i)
|
||||
{
|
||||
points.push_back( G4GeomTestVolPoint( daughterSegment.GetPoint(i),
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryMessenger.cc,v 1.5 2006/06/29 18:36:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MultiNavigator.cc,v 1.4 2006/11/14 15:41:56 japost Exp $
|
||||
// $Id: G4MultiNavigator.cc,v 1.7 2007/11/02 13:48:43 japost Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4PathFinder Implementation
|
||||
@@ -47,83 +47,73 @@ class G4FieldManager;
|
||||
// ********************************************************************
|
||||
//
|
||||
G4MultiNavigator::G4MultiNavigator()
|
||||
// : fpActiveNavigators()
|
||||
: G4Navigator(),
|
||||
fVerboseLevel(1)
|
||||
: G4Navigator()
|
||||
{
|
||||
fNoActiveNavigators= 0;
|
||||
G4ThreeVector Big3Vector( DBL_MAX, DBL_MAX, DBL_MAX );
|
||||
fLastLocatedPosition= Big3Vector;
|
||||
fSafetyLocation= Big3Vector;
|
||||
fPreStepLocation= Big3Vector;
|
||||
fNoActiveNavigators= 0;
|
||||
G4ThreeVector Big3Vector( DBL_MAX, DBL_MAX, DBL_MAX );
|
||||
fLastLocatedPosition = Big3Vector;
|
||||
fSafetyLocation = Big3Vector;
|
||||
fPreStepLocation = Big3Vector;
|
||||
|
||||
fMinSafety_PreStepPt= -1.0;
|
||||
fMinSafety_atSafLocation= -1.0;
|
||||
fMinSafety= -DBL_MAX;
|
||||
fMinStep= -DBL_MAX;
|
||||
// fNewTrack= false;
|
||||
fMinSafety_PreStepPt= -1.0;
|
||||
fMinSafety_atSafLocation= -1.0;
|
||||
fMinSafety= -DBL_MAX;
|
||||
fMinStep= -DBL_MAX;
|
||||
|
||||
G4int num;
|
||||
for( num=0; num<= fMaxNav; ++num ) {
|
||||
fpNavigator[num] = 0;
|
||||
fLimitTruth[num] = false;
|
||||
fLimitedStep[num] = kUndefLimited;
|
||||
fCurrentStepSize[num] = -1.0;
|
||||
fLocatedVolume[num] = 0;
|
||||
}
|
||||
// fpNavigator= new[MaxNav] (G4Navigator*);
|
||||
for(register int num=0; num<= fMaxNav; ++num )
|
||||
{
|
||||
fpNavigator[num] = 0;
|
||||
fLimitTruth[num] = false;
|
||||
fLimitedStep[num] = kUndefLimited;
|
||||
fCurrentStepSize[num] = -1.0;
|
||||
fLocatedVolume[num] = 0;
|
||||
}
|
||||
|
||||
pTransportManager= G4TransportationManager::GetTransportationManager();
|
||||
pTransportManager= G4TransportationManager::GetTransportationManager();
|
||||
|
||||
// EndState = G4FieldTrack( G4ThreeVector(), G4ThreeVector(), 0., 0., 0., 0., 0.) );
|
||||
// fRelocatedPoint(
|
||||
// fLastStepNo= -1;
|
||||
|
||||
G4Navigator* massNav= pTransportManager->GetNavigatorForTracking();
|
||||
if( massNav ) {
|
||||
G4VPhysicalVolume* pWorld= massNav->GetWorldVolume();
|
||||
if( pWorld ) {
|
||||
this->SetWorldVolume( pWorld );
|
||||
fLastMassWorld= pWorld;
|
||||
}
|
||||
}
|
||||
G4Navigator* massNav= pTransportManager->GetNavigatorForTracking();
|
||||
if( massNav )
|
||||
{
|
||||
G4VPhysicalVolume* pWorld= massNav->GetWorldVolume();
|
||||
if( pWorld )
|
||||
{
|
||||
SetWorldVolume( pWorld );
|
||||
fLastMassWorld = pWorld;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4MultiNavigator::~G4MultiNavigator()
|
||||
{
|
||||
// delete[] fpNavigator;
|
||||
}
|
||||
|
||||
// static G4int lastStepNo= -1;
|
||||
// To find the field do not forget to call
|
||||
// G4FieldManager* FindAndSetFieldManager(G4VPhysicalVolume* pCurrentPhysVol);
|
||||
// which sets and returns the correct field manager (global or local), if any.
|
||||
// Need to call it before PropagatorInField::ComputeStep is called.
|
||||
|
||||
G4double G4MultiNavigator::ComputeStep(const G4ThreeVector &pGlobalPoint,
|
||||
const G4ThreeVector &pDirection,
|
||||
const G4double proposedStepLength,
|
||||
G4double &pNewSafety)
|
||||
const G4ThreeVector &pDirection,
|
||||
const G4double proposedStepLength,
|
||||
G4double &pNewSafety)
|
||||
{
|
||||
G4double safety= 0.0, step=0.0;
|
||||
G4double minSafety= DBL_MAX, minStep= DBL_MAX;
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " G4MultiNavigator::ComputeStep : entered " << G4endl;
|
||||
G4cout << " Input position= " << pGlobalPoint
|
||||
<< " direction= " << pDirection << G4endl;
|
||||
G4cout << " Requested step= " << proposedStepLength << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<G4Navigator*>::iterator pNavigatorIter;
|
||||
|
||||
pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
|
||||
|
||||
G4ThreeVector initialPosition= pGlobalPoint;
|
||||
G4ThreeVector initialPosition = pGlobalPoint;
|
||||
G4ThreeVector initialDirection= pDirection;
|
||||
|
||||
G4int num=0;
|
||||
for( num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num ) {
|
||||
for( register int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
|
||||
{
|
||||
safety= DBL_MAX;
|
||||
|
||||
step= (*pNavigatorIter)->ComputeStep( initialPosition,
|
||||
@@ -132,191 +122,191 @@ G4double G4MultiNavigator::ComputeStep(const G4ThreeVector &pGlobalPoint,
|
||||
safety );
|
||||
if( safety < minSafety ){ minSafety = safety; }
|
||||
if( step < minStep ) { minStep= step; }
|
||||
// Later could reduce the proposed step to the latest minStep value ?
|
||||
// if( step == kInfinity ) { step = proposedStepLength; }
|
||||
|
||||
fCurrentStepSize[num] = step;
|
||||
fNewSafety[num]= safety;
|
||||
// This is currently the safety from the last sub-step
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << "G4MultiNavigator::ComputeStep : Navigator [" << num << "] -- step size " << step << " safety= " << safety << G4endl;
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << "G4MultiNavigator::ComputeStep : Navigator ["
|
||||
<< num << "] -- step size " << step
|
||||
<< " safety= " << safety << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// fWasLimitedByGeometry= false; // <----- Could reset(?), but navigator leaves it as is
|
||||
// Whether any geometry limited the step
|
||||
// G4bool StepLimited = ( minStep <= proposedStepLength);
|
||||
// G4cout << "G4MultiNavigator::ComputeStep - StepLimited is " << StepLimited
|
||||
// << " given minStep= " << minStep << " and proposed Step= " << proposedStepLength << G4endl;
|
||||
|
||||
// Save safety value, related position
|
||||
fPreStepLocation= initialPosition;
|
||||
fMinSafety_PreStepPt= minSafety;
|
||||
//
|
||||
fPreStepLocation = initialPosition;
|
||||
fMinSafety_PreStepPt = minSafety;
|
||||
fMinStep = minStep;
|
||||
|
||||
fMinStep= minStep;
|
||||
|
||||
G4double trueMinStep= minStep;
|
||||
if( fMinStep == kInfinity ){
|
||||
trueMinStep = proposedStepLength; // Use this below for endpoint !!
|
||||
if( fMinStep == kInfinity )
|
||||
{
|
||||
fTrueMinStep = proposedStepLength; // Use this below for endpoint !!
|
||||
}
|
||||
else
|
||||
{
|
||||
fTrueMinStep = minStep;
|
||||
}
|
||||
fTrueMinStep = trueMinStep;
|
||||
|
||||
if( fVerboseLevel > 1 ){
|
||||
G4ThreeVector endPosition;
|
||||
endPosition= initialPosition + trueMinStep * initialDirection ;
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4ThreeVector endPosition = initialPosition+fTrueMinStep*initialDirection;
|
||||
|
||||
int oldPrec= G4cout.precision(8);
|
||||
G4int oldPrec = G4cout.precision(8);
|
||||
G4cout << "G4MultiNavigator::ComputeStep : "
|
||||
<< " initialPosition = " << initialPosition
|
||||
<< " and endPosition = " << endPosition<< G4endl;
|
||||
<< " and endPosition = " << endPosition << G4endl;
|
||||
G4cout.precision( oldPrec );
|
||||
}
|
||||
#endif
|
||||
|
||||
pNewSafety= minSafety;
|
||||
// Set the EndState
|
||||
// fEndState= initialState;
|
||||
// fEndState.SetPosition( endPosition );
|
||||
// fEndState.SetProperTimeOfFlight( -1.000 ); // Not defined YET
|
||||
// fEndState.SetMomentum( initialState.GetMomentum );
|
||||
pNewSafety = minSafety;
|
||||
|
||||
this->WhichLimited();
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << " G4MultiNavigator::ComputeStep : exits returning " << minStep << G4endl;
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " G4MultiNavigator::ComputeStep : exits returning "
|
||||
<< minStep << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return minStep; // must return kInfinity if do not limit step
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
G4double
|
||||
G4MultiNavigator::ObtainFinalStep( G4int navigatorId,
|
||||
G4double &pNewSafety, // for this geom
|
||||
G4double &minStep,
|
||||
ELimited &limitedStep)
|
||||
G4MultiNavigator::ObtainFinalStep( G4int navigatorId,
|
||||
G4double &pNewSafety, // for this geometry
|
||||
G4double &minStep,
|
||||
ELimited &limitedStep)
|
||||
{
|
||||
G4int navigatorNo=-1;
|
||||
|
||||
if( navigatorId <= fNoActiveNavigators ){
|
||||
if( navigatorId <= fNoActiveNavigators )
|
||||
{
|
||||
navigatorNo= navigatorId;
|
||||
} else {
|
||||
G4cerr << " Navigator Id = " << navigatorId
|
||||
<< " No Active = " << fNoActiveNavigators << " . " << G4endl;
|
||||
G4Exception( "G4MultiNavigator::ObtainFinalStep : Bad Navigator Id" );
|
||||
}
|
||||
// if( ! ){ G4Exception( "G4MultiNavigator::ObtainFinalStep Called without call to ComputeStep"); }
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4MultiNavigator::ObtainFinalStep()"
|
||||
<< " Navigator Id = " << navigatorId
|
||||
<< " No Active = " << fNoActiveNavigators << " . "
|
||||
<< G4endl;
|
||||
G4Exception("G4MultiNavigator::ObtainFinalStep()", "InvalidSetup",
|
||||
FatalException, "Bad Navigator Id" );
|
||||
}
|
||||
|
||||
// Prepare the information to return
|
||||
pNewSafety = fNewSafety[ navigatorNo ];
|
||||
limitedStep = fLimitedStep[ navigatorNo ];
|
||||
minStep= fMinStep;
|
||||
|
||||
// if( (minStep==kInfinity) || (fVerboseLevel > 1) ){
|
||||
if( fVerboseLevel > 1 ){
|
||||
// if( (minStep==kInfinity) || (fVerbose > 1) ){
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 1 ){
|
||||
G4cout << " G4MultiNavigator::ComputeStep returns " << fCurrentStepSize[ navigatorNo ]
|
||||
<< " for Navigator " << navigatorNo << " Limited step = " << limitedStep
|
||||
<< " Safety(mm) = " << pNewSafety / mm << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return fCurrentStepSize[ navigatorNo ];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4MultiNavigator::PrepareNewTrack( const G4ThreeVector position,
|
||||
const G4ThreeVector direction )
|
||||
void G4MultiNavigator::PrepareNewTrack( const G4ThreeVector position,
|
||||
const G4ThreeVector direction )
|
||||
{
|
||||
if( fVerboseLevel > 1 )
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4cout << " Entered G4MultiNavigator::PrepareNewTrack() " << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4MultiNavigator::PrepareNavigators();
|
||||
//***********************************
|
||||
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << " Calling MultiNavigator::Locate() from G4MultiNavigator::PrepareNewTrack() "
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
this->LocateGlobalPointAndSetup( position, &direction, false, false );
|
||||
// =========================
|
||||
LocateGlobalPointAndSetup( position, &direction, false, false );
|
||||
//
|
||||
// The first location for each Navigator must be non-relative
|
||||
// or else call ResetStackAndState() for each Navigator
|
||||
// or else call ResetStackAndState() for each Navigator
|
||||
// Use direction to get correct side of boundary (ignore dir= false)
|
||||
|
||||
// fRelocatedPoint= false;
|
||||
|
||||
if( fVerboseLevel > 0 ) {
|
||||
G4cout << " G4MultiNavigator::PrepareNewTrack : exiting. " << G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
G4MultiNavigator::PrepareNavigators()
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void G4MultiNavigator::PrepareNavigators()
|
||||
{
|
||||
// Key purposes:
|
||||
// - Check and cache set of active navigators
|
||||
// - Reset state for new track
|
||||
G4int num=0;
|
||||
|
||||
if( fVerboseLevel > 1 )
|
||||
G4cout << " G4MultiNavigator::PrepareNavigators - entered " << G4endl;
|
||||
// static G4TransportationManager* pTransportManager=
|
||||
// G4TransportationManager::GetTransportationManager();
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4cout << " Entered G4MultiNavigator::PrepareNavigators() " << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// fNavigators= true;
|
||||
// this->MovePoint(); // Signal further that the last status is wiped
|
||||
// Message the transportation-manager to find active navigators
|
||||
|
||||
// Message the G4NavigatorPanel / Dispatcher to find active navigators
|
||||
std::vector<G4Navigator*>::iterator pNavigatorIter;
|
||||
|
||||
fNoActiveNavigators= pTransportManager-> GetNoActiveNavigators();
|
||||
if( fNoActiveNavigators > fMaxNav ){
|
||||
G4cerr << "Too many active Navigators (worlds). G4MultiNavigator fails."
|
||||
<< G4endl;
|
||||
G4cout << " Fatal error: Transportation Manager reports " << fNoActiveNavigators
|
||||
<< " which is more than the number allowed = " << fMaxNav << G4endl;
|
||||
G4Exception("G4MultiNavigator::PrepareNavigators()", "TooManyNavigators",
|
||||
FatalException, "Too many active Navigators / worlds");
|
||||
|
||||
if( fNoActiveNavigators > fMaxNav )
|
||||
{
|
||||
G4cerr << "ERROR - G4MultiNavigator::PrepareNavigators()"
|
||||
<< " Too many active Navigators (worlds): "
|
||||
<< fNoActiveNavigators << G4endl
|
||||
<< " which is more than the number allowed: "
|
||||
<< fMaxNav << " !" << G4endl;
|
||||
G4Exception("G4MultiNavigator::PrepareNavigators()", "InvalidSetup",
|
||||
FatalException, "Too many active Navigators / worlds !");
|
||||
}
|
||||
|
||||
pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
|
||||
for( num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num ) {
|
||||
|
||||
// Keep information in carray ... for returning information stored
|
||||
for( register int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
|
||||
{
|
||||
fpNavigator[num] = *pNavigatorIter;
|
||||
fLimitTruth[num] = false;
|
||||
fLimitedStep[num] = kDoNot;
|
||||
fCurrentStepSize[num] = 0.0;
|
||||
fLocatedVolume[num] = 0;
|
||||
}
|
||||
fWasLimitedByGeometry= false;
|
||||
fWasLimitedByGeometry = false;
|
||||
|
||||
// Check the world volume of the mass navigator (in case a SetWorldVolume changed it)
|
||||
G4VPhysicalVolume* massWorld = this-> GetWorldVolume();
|
||||
// fpNavigator[0] -> GetWorldVolume();
|
||||
if( (massWorld != fLastMassWorld) && (massWorld!=0) ) {
|
||||
// Check the world volume of the mass navigator
|
||||
// in case a call to SetWorldVolume() changed it
|
||||
|
||||
G4VPhysicalVolume* massWorld = GetWorldVolume();
|
||||
|
||||
if( (massWorld != fLastMassWorld) && (massWorld!=0) )
|
||||
{
|
||||
// Pass along change to Mass Navigator
|
||||
fpNavigator[0] -> SetWorldVolume( massWorld );
|
||||
if( fVerboseLevel > 0 ) {
|
||||
G4cout << "G4MultiNavigator::PrepareNavigators changed world volume "
|
||||
fpNavigator[0] -> SetWorldVolume( massWorld );
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 0 )
|
||||
{
|
||||
G4cout << " G4MultiNavigator::PrepareNavigators() changed world volume "
|
||||
<< " for mass geometry to " << massWorld->GetName() << G4endl;
|
||||
}
|
||||
fLastMassWorld= massWorld;
|
||||
}else{
|
||||
if( fVerboseLevel > 2 ) {
|
||||
G4cout << "G4MultiNavigator::PrepareNavigators retained world volume "
|
||||
<< " Pointer= " << massWorld << G4endl;
|
||||
if( massWorld )
|
||||
G4cout << " Name= " << massWorld->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( fVerboseLevel > 2 ) {
|
||||
G4cout << " G4MultiNavigator::PrepareNavigators : exiting. " << G4endl;
|
||||
fLastMassWorld = massWorld;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
G4VPhysicalVolume*
|
||||
G4MultiNavigator::LocateGlobalPointAndSetup(const G4ThreeVector& position,
|
||||
@@ -327,368 +317,357 @@ G4MultiNavigator::LocateGlobalPointAndSetup(const G4ThreeVector& position,
|
||||
// Locate the point in each geometry
|
||||
|
||||
G4ThreeVector direction(0.0, 0.0, 0.0);
|
||||
G4bool relative= pRelativeSearch;
|
||||
std::vector<G4Navigator*>::iterator pNavIter= pTransportManager->GetActiveNavigatorsIterator();
|
||||
G4int num=0;
|
||||
G4bool relative = pRelativeSearch;
|
||||
std::vector<G4Navigator*>::iterator pNavIter
|
||||
= pTransportManager->GetActiveNavigatorsIterator();
|
||||
|
||||
if( pDirection ) direction = *pDirection;
|
||||
if( pDirection ) { direction = *pDirection; }
|
||||
|
||||
#if 0
|
||||
G4ThreeVector lastEndPosition= fEndState.GetPosition();
|
||||
G4ThreeVector moveVec = (position - lastEndPosition );
|
||||
G4double moveLenSq= moveVec.mag2();
|
||||
if( (!fNewTrack) && (!fRelocatedPoint) && ( moveLenSq> 0.0) ){
|
||||
ReportMove( position, lastEndPosition, "Position" );
|
||||
G4Exception( "G4MultiNavigator::LocateGlobalPointAndSetup",
|
||||
"211-LocateUnexpectedPoint",
|
||||
JustWarning,
|
||||
// FatalException,
|
||||
"Location is not where last ComputeStep ended.");
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " Entered G4MultiNavigator::LocateGlobalPointAndSetup() "
|
||||
<< G4endl;
|
||||
G4cout << " Locating at position: " << position
|
||||
<< ", with direction: " << direction << G4endl
|
||||
<< " Relative: " << relative
|
||||
<< ", ignore direction: " << ignoreDirection << G4endl;
|
||||
G4cout << " Number of active navigators: " << fNoActiveNavigators
|
||||
<< G4endl;
|
||||
}
|
||||
fLastLocatedPosition= position;
|
||||
#endif
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << " G4MultiNavigator::LocateGlobalPointAndSetup : entered " << " ---------------" << G4endl;
|
||||
G4cout << " Locating at position " << position << " with direction " << direction
|
||||
<< " relative= " << relative << " ignore direction= " << ignoreDirection<< G4endl;
|
||||
G4cout << " Number of active navigators= " << fNoActiveNavigators << G4endl;
|
||||
}
|
||||
|
||||
for ( num=0; num< fNoActiveNavigators ; ++pNavIter,++num ) {
|
||||
// ... who limited the step ....
|
||||
|
||||
// G4cout << " -- Navigator id= " << num << " NavigatorPtr " << *pNavIter << G4endl;
|
||||
// G4VPhysicalVolume* world= (*pNavIter)->GetWorldVolume();
|
||||
// if( world ) { G4cout << " Navigator world= " << world->GetName() << G4endl; }
|
||||
// else{ G4cout << " No world set in Navigator. " << G4endl; }
|
||||
|
||||
if( fWasLimitedByGeometry && fLimitTruth[num] ) {
|
||||
for ( register int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
|
||||
{
|
||||
if( fWasLimitedByGeometry && fLimitTruth[num] )
|
||||
{
|
||||
(*pNavIter)->SetGeometricallyLimitedStep();
|
||||
}
|
||||
|
||||
G4VPhysicalVolume *pLocated=
|
||||
(*pNavIter)->LocateGlobalPointAndSetup( position, &direction,
|
||||
//*************************************//
|
||||
relative,
|
||||
ignoreDirection);
|
||||
G4VPhysicalVolume *pLocated
|
||||
= (*pNavIter)->LocateGlobalPointAndSetup( position, &direction,
|
||||
relative, ignoreDirection );
|
||||
// Set the state related to the location
|
||||
//
|
||||
fLocatedVolume[num] = pLocated;
|
||||
|
||||
// Clear state related to the step
|
||||
//
|
||||
fLimitedStep[num] = kDoNot;
|
||||
fCurrentStepSize[num] = 0.0;
|
||||
fLimitTruth[ num ] = false; // Always clear on locating (see Navigator)
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << " Located in world " << num << " at " << position
|
||||
<< " used geomLimStp " << fLimitTruth[num]
|
||||
<< " - found in volume " << pLocated ;
|
||||
G4cout << " name = '" ;
|
||||
if( pLocated ){
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " Located in world: " << num << ", at: " << position << G4endl
|
||||
<< " Used geomLimStp: " << fLimitTruth[num]
|
||||
<< ", found in volume: " << pLocated << G4endl;
|
||||
G4cout << " Name = '" ;
|
||||
if( pLocated )
|
||||
{
|
||||
G4cout << pLocated->GetName() << "'";
|
||||
G4cout << " - CopyNo= " << pLocated->GetCopyNo();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "Null' Id: Not-Set ";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
} // ending for (num= ....
|
||||
fWasLimitedByGeometry= false; // Clear on locating
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << " G4MultiNavigator::Locate : exiting. " << G4endl << G4endl;
|
||||
#endif
|
||||
}
|
||||
// fRelocatedPoint= false;
|
||||
|
||||
fWasLimitedByGeometry = false; // Clear on locating
|
||||
G4VPhysicalVolume* volMassLocated= fLocatedVolume[0];
|
||||
|
||||
return volMassLocated;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4MultiNavigator::LocateGlobalPointWithinVolume(const G4ThreeVector& position)
|
||||
{
|
||||
// Relocate the point in each geometry
|
||||
std::vector<G4Navigator*>::iterator pNavIter= pTransportManager->GetActiveNavigatorsIterator();
|
||||
// const G4double cErrorTolerance=1e-12;
|
||||
// Maximum relative error from roundoff of arithmetic
|
||||
G4int num=0;
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << " G4MultiNavigator::ReLocate : entered " << G4endl;
|
||||
G4cout << " ---------------------- -------" << G4endl;
|
||||
G4cout << " *Re*Locating at position " << position << G4endl;
|
||||
std::vector<G4Navigator*>::iterator pNavIter
|
||||
= pTransportManager->GetActiveNavigatorsIterator();
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " Entered G4MultiNavigator::ReLocate() " << G4endl
|
||||
<< " Re-locating at position: " << position << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( num=0; num< fNoActiveNavigators ; ++pNavIter,++num ) {
|
||||
for ( register int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
|
||||
{
|
||||
// ... none limited the step
|
||||
|
||||
// G4VPhysicalVolume physVolume=
|
||||
(*pNavIter)->LocateGlobalPointWithinVolume( position );
|
||||
//*************************************//
|
||||
|
||||
// Clear state related to the step
|
||||
fLimitedStep[num] = kDoNot;
|
||||
//
|
||||
fLimitedStep[num] = kDoNot;
|
||||
fCurrentStepSize[num] = 0.0;
|
||||
|
||||
fLimitTruth[ num ] = false; // Always clear on locating (see Navigator)
|
||||
// fLocatedVolume[num]= physVolume;
|
||||
|
||||
// G4cout << " ReLocated in world " << num << " at " << position << G4endl;
|
||||
}
|
||||
fWasLimitedByGeometry= false; // Clear on locating
|
||||
|
||||
fLastLocatedPosition= position;
|
||||
// fRelocatedPoint= false;
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << " G4MultiNavigator::LocateGlobalPointWithinVolume : exiting "
|
||||
<< " at position " << position << G4endl;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
fWasLimitedByGeometry = false; // Clear on locating
|
||||
fLastLocatedPosition = position;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
G4double G4MultiNavigator::ComputeSafety( const G4ThreeVector& position,
|
||||
G4double maxDistance)
|
||||
// Recompute safety for the relevant point
|
||||
G4double G4MultiNavigator::ComputeSafety( const G4ThreeVector& position,
|
||||
G4double maxDistance)
|
||||
{
|
||||
G4double minSafety= DBL_MAX;
|
||||
// G4cout << " G4MultiNavigator::ComputeSafety - called at " << position << G4endl;
|
||||
// Recompute safety for the relevant point
|
||||
|
||||
G4double minSafety = DBL_MAX, safety = DBL_MAX;
|
||||
|
||||
std::vector<G4Navigator*>::iterator pNavigatorIter;
|
||||
pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
|
||||
|
||||
G4int num=0;
|
||||
for( num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num ) {
|
||||
|
||||
G4double safety;
|
||||
safety= (*pNavigatorIter)->ComputeSafety( position, maxDistance );
|
||||
|
||||
if( safety < minSafety ){ minSafety = safety; }
|
||||
// fNewSafety[num]= safety;
|
||||
for( register int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
|
||||
{
|
||||
safety = (*pNavigatorIter)->ComputeSafety( position, maxDistance );
|
||||
if( safety < minSafety ) { minSafety = safety; }
|
||||
}
|
||||
|
||||
fSafetyLocation= position;
|
||||
fSafetyLocation = position;
|
||||
fMinSafety_atSafLocation = minSafety;
|
||||
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << " G4MultiNavigator::ComputeSafety - returns "
|
||||
<< minSafety << " at location " << position
|
||||
<< G4endl;
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4cout << " G4MultiNavigator::ComputeSafety - returns: "
|
||||
<< minSafety << ", at location: " << position << G4endl;
|
||||
}
|
||||
#endif
|
||||
return minSafety;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
G4TouchableHistoryHandle
|
||||
G4MultiNavigator::CreateTouchableHistoryHandle() const
|
||||
{
|
||||
G4Exception( "G4MultiNavigator::CreateTouchableHistoryHandle",
|
||||
"215-TouchableFromWrongNavigator",
|
||||
FatalException,
|
||||
G4Exception( "G4MultiNavigator::CreateTouchableHistoryHandle()",
|
||||
"215-TouchableFromWrongNavigator", FatalException,
|
||||
"Getting a touchable from G4MultiNavigator is not defined.");
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << "G4MultiNavigator::CreateTouchableHandle : navId = " << 0 ;
|
||||
// << " -- " << GetNavigator(navId) << G4endl;
|
||||
}
|
||||
|
||||
G4TouchableHistory* touchHist;
|
||||
touchHist= fpNavigator[0] -> CreateTouchableHistory();
|
||||
|
||||
// G4TouchableHistory* touchHist= new G4TouchableHistory();
|
||||
|
||||
G4VPhysicalVolume* locatedVolume= fLocatedVolume[0];
|
||||
if( locatedVolume == 0 )
|
||||
{
|
||||
// Workaround to ensure that the touchable is fixed !! // TODO: fix
|
||||
touchHist->UpdateYourself( locatedVolume,
|
||||
touchHist->GetHistory() );
|
||||
}
|
||||
{
|
||||
// Workaround to ensure that the touchable is fixed !! // TODO: fix
|
||||
//
|
||||
touchHist->UpdateYourself( locatedVolume, touchHist->GetHistory() );
|
||||
}
|
||||
|
||||
return G4TouchableHistoryHandle(touchHist);
|
||||
}
|
||||
|
||||
void
|
||||
G4MultiNavigator::WhichLimited() // Flag which processes limited the step
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void G4MultiNavigator::WhichLimited()
|
||||
{
|
||||
G4int num=-1, last=-1;
|
||||
const G4int IdTransport= 0; // Id of Mass Navigator !!
|
||||
// Flag which processes limited the step
|
||||
|
||||
G4int last=-1;
|
||||
const G4int IdTransport= 0; // Id of Mass Navigator !!
|
||||
G4int noLimited=0;
|
||||
ELimited shared= kSharedOther;
|
||||
|
||||
if( fVerboseLevel > 2 )
|
||||
G4cout << " G4MultiNavigator::WhichLimited - entered " << G4endl;
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " Entered G4MultiNavigator::WhichLimited() " << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Assume that [IdTransport] is Mass / Transport
|
||||
// G4bool transportLimited = (fCurrentStepSize[IdTransport] == fMinStep);
|
||||
//
|
||||
G4bool transportLimited = (fCurrentStepSize[IdTransport] == fMinStep)
|
||||
&& ( fMinStep!= kInfinity) ;
|
||||
if( transportLimited ){
|
||||
&& ( fMinStep!= kInfinity);
|
||||
if( transportLimited )
|
||||
{
|
||||
shared= kSharedTransport;
|
||||
}
|
||||
|
||||
for ( num= 0; num < fNoActiveNavigators; num++ ) {
|
||||
for ( register int num= 0; num < fNoActiveNavigators; num++ )
|
||||
{
|
||||
G4bool limitedStep;
|
||||
|
||||
G4double step= fCurrentStepSize[num];
|
||||
|
||||
limitedStep = ( step == fMinStep ) && ( step != kInfinity);
|
||||
// if( step == kInfinity ) { fCurrentStepSize[num] = proposedStepLength; }
|
||||
|
||||
fLimitTruth[ num ] = limitedStep;
|
||||
if( limitedStep ) {
|
||||
if( limitedStep )
|
||||
{
|
||||
noLimited++;
|
||||
fLimitedStep[num] = shared;
|
||||
last= num;
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
fLimitedStep[num] = kDoNot;
|
||||
}
|
||||
}
|
||||
if( (last > -1) && (noLimited == 1 ) ){
|
||||
if( (last > -1) && (noLimited == 1 ) )
|
||||
{
|
||||
fLimitedStep[ last ] = kUnique;
|
||||
}
|
||||
|
||||
#ifndef G4NO_VERBOSE
|
||||
if( fVerboseLevel > 1 ){
|
||||
this->PrintLimited(); // --> for tracing
|
||||
G4cout << " G4MultiNavigator::WhichLimited - exiting. " << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4MultiNavigator::PrintLimited()
|
||||
{
|
||||
static G4String StrDoNot("DoNot"), StrUnique("Unique"), StrUndefined("Undefined"),
|
||||
StrSharedTransport("SharedTransport"), StrSharedOther("SharedOther");
|
||||
// Report results -- for checking
|
||||
G4cout << "G4MultiNavigator::PrintLimited reports: " ;
|
||||
G4cout << " Minimum step (true)= " << fTrueMinStep
|
||||
<< " reported min = " << fMinStep
|
||||
<< G4endl;
|
||||
if( // (fCurrentStepNo <= 2) ||
|
||||
(fVerboseLevel>=2) ) {
|
||||
G4cout // << std::setw(5) << " Step#" << " "
|
||||
<< std::setw(5) << " NavId" << " "
|
||||
<< std::setw(12) << " step-size " << " "
|
||||
<< std::setw(12) << " raw-size " << " "
|
||||
<< std::setw(12) << " pre-safety " << " "
|
||||
<< std::setw(15) << " Limited / flag" << " "
|
||||
<< std::setw(15) << " World " << " "
|
||||
<< G4endl;
|
||||
|
||||
static G4String StrDoNot("DoNot"), StrUnique("Unique"),
|
||||
StrUndefined("Undefined"),
|
||||
StrSharedTransport("SharedTransport"),
|
||||
StrSharedOther("SharedOther");
|
||||
G4cout << "### G4MultiNavigator::PrintLimited() reports: " << G4endl;
|
||||
G4cout << " Minimum step (true): " << fTrueMinStep
|
||||
<< ", reported min: " << fMinStep << G4endl;
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if(fVerbose>=2)
|
||||
{
|
||||
G4cout << std::setw(5) << " NavId" << " "
|
||||
<< std::setw(12) << " step-size " << " "
|
||||
<< std::setw(12) << " raw-size " << " "
|
||||
<< std::setw(12) << " pre-safety " << " "
|
||||
<< std::setw(15) << " Limited / flag" << " "
|
||||
<< std::setw(15) << " World " << " "
|
||||
<< G4endl;
|
||||
}
|
||||
int num;
|
||||
for ( num= 0; num < fNoActiveNavigators; num++ ) {
|
||||
#endif
|
||||
|
||||
for ( register int num= 0; num < fNoActiveNavigators; num++ )
|
||||
{
|
||||
G4double rawStep = fCurrentStepSize[num];
|
||||
G4double stepLen = fCurrentStepSize[num];
|
||||
if( stepLen > fTrueMinStep ) {
|
||||
if( stepLen > fTrueMinStep )
|
||||
{
|
||||
stepLen = fTrueMinStep; // did not limit (went as far as asked)
|
||||
}
|
||||
G4int oldPrec= G4cout.precision(9);
|
||||
// const char *BooleanValue[2] = { " NO", "YES" } ;
|
||||
G4cout // << std::setw(5) << fCurrentStepNo << " "
|
||||
<< std::setw(5) << num << " "
|
||||
|
||||
G4cout << std::setw(5) << num << " "
|
||||
<< std::setw(12) << stepLen << " "
|
||||
<< std::setw(12) << rawStep << " "
|
||||
<< std::setw(12) << fNewSafety[num] << " "
|
||||
<< std::setw(5) << (fLimitTruth[num] ? "YES" : " NO") << " ";
|
||||
G4String limitedStr;
|
||||
switch ( fLimitedStep[num] ) {
|
||||
case kDoNot: limitedStr= StrDoNot; break;
|
||||
case kUnique: limitedStr = StrUnique; break;
|
||||
case kSharedTransport: limitedStr= StrSharedTransport; break;
|
||||
case kSharedOther: limitedStr = StrSharedOther; break;
|
||||
default: limitedStr = StrUndefined; break;
|
||||
switch ( fLimitedStep[num] )
|
||||
{
|
||||
case kDoNot : limitedStr= StrDoNot; break;
|
||||
case kUnique : limitedStr = StrUnique; break;
|
||||
case kSharedTransport: limitedStr= StrSharedTransport; break;
|
||||
case kSharedOther : limitedStr = StrSharedOther; break;
|
||||
default : limitedStr = StrUndefined; break;
|
||||
}
|
||||
G4cout << " " << std::setw(15) << limitedStr << " ";
|
||||
G4cout.precision(oldPrec);
|
||||
|
||||
G4Navigator *pNav= fpNavigator[ num ];
|
||||
G4String WorldName( "Not-Set" );
|
||||
if (pNav) {
|
||||
if (pNav)
|
||||
{
|
||||
G4VPhysicalVolume *pWorld= pNav->GetWorldVolume();
|
||||
if( pWorld ) {
|
||||
if( pWorld )
|
||||
{
|
||||
WorldName = pWorld->GetName();
|
||||
}
|
||||
}
|
||||
G4cout << " " << WorldName ;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
if( fVerboseLevel > 2 )
|
||||
G4cout << " G4MultiNavigator::PrintLimited - exiting. " << G4endl;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
G4MultiNavigator::ResetState()
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void G4MultiNavigator::ResetState()
|
||||
{
|
||||
G4int num;
|
||||
fWasLimitedByGeometry= false;
|
||||
|
||||
G4Exception( "G4MultiNavigator::ResetState",
|
||||
"217-CannotImplement",
|
||||
G4Exception("G4MultiNavigator::ResetState()", "217-NotImplemented",
|
||||
FatalException,
|
||||
"Cannot call ResetState for active navigators of G4MultiNavigator.");
|
||||
"Cannot call ResetState() for navigators of G4MultiNavigator.");
|
||||
|
||||
std::vector<G4Navigator*>::iterator pNavigatorIter;
|
||||
pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
|
||||
for( num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num ) {
|
||||
for( register int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
|
||||
{
|
||||
// (*pNavigatorIter)->ResetState(); // KEEP THIS comment !!!
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
G4MultiNavigator::SetupHierarchy()
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void G4MultiNavigator::SetupHierarchy()
|
||||
{
|
||||
// G4Navigator::SetupHierarchy();
|
||||
G4Exception( "G4MultiNavigator::SetupHierarchy",
|
||||
"217-CannotImplement",
|
||||
FatalException,
|
||||
"Cannot call SetupHierarchy for active navigators of G4MultiNavigator.");
|
||||
G4Exception( "G4MultiNavigator::SetupHierarchy()",
|
||||
"217-NotImplemented", FatalException,
|
||||
"Cannot call SetupHierarchy() for navigators of G4MultiNavigator.");
|
||||
}
|
||||
|
||||
void
|
||||
G4MultiNavigator::CheckMassWorld()
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void G4MultiNavigator::CheckMassWorld()
|
||||
{
|
||||
//
|
||||
G4VPhysicalVolume* navTrackWorld= pTransportManager->GetNavigatorForTracking()
|
||||
->GetWorldVolume();
|
||||
if( navTrackWorld != fLastMassWorld ) {
|
||||
G4Exception( "G4MultiNavigator::CheckMassWorld", "MultiNav-220", FatalException,
|
||||
G4VPhysicalVolume* navTrackWorld=
|
||||
pTransportManager->GetNavigatorForTracking()->GetWorldVolume();
|
||||
|
||||
if( navTrackWorld != fLastMassWorld )
|
||||
{
|
||||
G4Exception( "G4MultiNavigator::CheckMassWorld()",
|
||||
"220-InvalidSetup", FatalException,
|
||||
"Mass world pointer has been changed." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* G4MultiNavigator::ResetHierarchyAndLocate(const G4ThreeVector &point,
|
||||
const G4ThreeVector &direction,
|
||||
const G4TouchableHistory &MassHistory)
|
||||
// Reset geometry for all -- and use the touchable for the mass history
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
G4VPhysicalVolume*
|
||||
G4MultiNavigator::ResetHierarchyAndLocate(const G4ThreeVector &point,
|
||||
const G4ThreeVector &direction,
|
||||
const G4TouchableHistory &MassHistory)
|
||||
{
|
||||
// Reset geometry for all -- and use the touchable for the mass history
|
||||
|
||||
G4VPhysicalVolume* massVolume=0;
|
||||
G4int num;
|
||||
G4Navigator* pMassNavigator= fpNavigator[0];
|
||||
|
||||
if( pMassNavigator ){
|
||||
massVolume= pMassNavigator->ResetHierarchyAndLocate( point, direction, MassHistory);
|
||||
}else{
|
||||
G4Exception("G4MultiNavigator::ResetHierarchyAndLocate",
|
||||
"218-TooEarlyToReset",
|
||||
FatalException,
|
||||
"Cannot reset hierarchy before object is initialised with valid navigators, including a mass Navigator" );
|
||||
if( pMassNavigator )
|
||||
{
|
||||
massVolume= pMassNavigator->ResetHierarchyAndLocate( point, direction,
|
||||
MassHistory);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4MultiNavigator::ResetHierarchyAndLocate()",
|
||||
"218-TooEarlyToReset", FatalException,
|
||||
"Cannot reset hierarchy before navigators are initialised.");
|
||||
}
|
||||
|
||||
std::vector<G4Navigator*>::iterator pNavIter=
|
||||
pTransportManager->GetActiveNavigatorsIterator();
|
||||
|
||||
for ( num=0; num< fNoActiveNavigators ; ++pNavIter,++num ) {
|
||||
for ( register int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
|
||||
{
|
||||
G4bool relativeSearch, ignoreDirection;
|
||||
|
||||
(*pNavIter)-> LocateGlobalPointAndSetup( point,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.cc,v 1.31 2007/05/11 13:43:59 gcosmo Exp $
|
||||
// $Id: G4Navigator.cc,v 1.37 2007/10/18 14:18:36 gcosmo Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4Navigator Implementation
|
||||
@@ -45,8 +45,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
G4Navigator::G4Navigator()
|
||||
: fWasLimitedByGeometry(false), fTopPhysical(0),
|
||||
fCheck(false), fPushed(false), fVerbose(0)
|
||||
: fWasLimitedByGeometry(false), fVerbose(0),
|
||||
fTopPhysical(0), fCheck(false), fPushed(false)
|
||||
{
|
||||
fActive= false;
|
||||
ResetStackAndState();
|
||||
@@ -55,6 +55,9 @@ G4Navigator::G4Navigator()
|
||||
fAbandonThreshold_NoZeroSteps = 25;
|
||||
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
fregularNav.SetNormalNavigation( &fnormalNav );
|
||||
|
||||
fStepEndPoint = G4ThreeVector( kInfinity, kInfinity, kInfinity );
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -116,8 +119,11 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4cerr << "Upon entering LocateGlobalPointAndSetup():" << G4endl;
|
||||
G4cerr << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << "Upon entering LocateGlobalPointAndSetup():" << G4endl;
|
||||
G4cout << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
@@ -188,29 +194,32 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
fBlockedPhysicalVolume->SetCopyNo(fBlockedReplicaNo);
|
||||
break;
|
||||
case kParameterised:
|
||||
G4VSolid *pSolid;
|
||||
G4VPVParameterisation *pParam;
|
||||
G4TouchableHistory parentTouchable( fHistory );
|
||||
pParam = fBlockedPhysicalVolume->GetParameterisation();
|
||||
pSolid = pParam->ComputeSolid(fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume);
|
||||
pSolid->ComputeDimensions(pParam, fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume);
|
||||
pParam->ComputeTransformation(fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume);
|
||||
fHistory.NewLevel(fBlockedPhysicalVolume, kParameterised,
|
||||
fBlockedReplicaNo);
|
||||
fBlockedPhysicalVolume->SetCopyNo(fBlockedReplicaNo);
|
||||
//
|
||||
// Set the correct solid and material in Logical Volume
|
||||
//
|
||||
G4LogicalVolume *pLogical;
|
||||
pLogical = fBlockedPhysicalVolume->GetLogicalVolume();
|
||||
pLogical->SetSolid( pSolid );
|
||||
pLogical->UpdateMaterial(pParam ->
|
||||
ComputeMaterial(fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume,
|
||||
&parentTouchable));
|
||||
if( fBlockedPhysicalVolume->GetRegularStructureId() != 1 )
|
||||
{
|
||||
G4VSolid *pSolid;
|
||||
G4VPVParameterisation *pParam;
|
||||
G4TouchableHistory parentTouchable( fHistory );
|
||||
pParam = fBlockedPhysicalVolume->GetParameterisation();
|
||||
pSolid = pParam->ComputeSolid(fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume);
|
||||
pSolid->ComputeDimensions(pParam, fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume);
|
||||
pParam->ComputeTransformation(fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume);
|
||||
fHistory.NewLevel(fBlockedPhysicalVolume, kParameterised,
|
||||
fBlockedReplicaNo);
|
||||
fBlockedPhysicalVolume->SetCopyNo(fBlockedReplicaNo);
|
||||
//
|
||||
// Set the correct solid and material in Logical Volume
|
||||
//
|
||||
G4LogicalVolume *pLogical;
|
||||
pLogical = fBlockedPhysicalVolume->GetLogicalVolume();
|
||||
pLogical->SetSolid( pSolid );
|
||||
pLogical->UpdateMaterial(pParam ->
|
||||
ComputeMaterial(fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume,
|
||||
&parentTouchable));
|
||||
}
|
||||
break;
|
||||
}
|
||||
fEntering = false;
|
||||
@@ -385,13 +394,26 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
localPoint);
|
||||
break;
|
||||
case kParameterised:
|
||||
noResult = fparamNav.LevelLocate(fHistory,
|
||||
fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo,
|
||||
globalPoint,
|
||||
pGlobalDirection,
|
||||
considerDirection,
|
||||
localPoint);
|
||||
if( GetDaughtersRegularStructureId(targetLogical) != 1 )
|
||||
{
|
||||
noResult = fparamNav.LevelLocate(fHistory,
|
||||
fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo,
|
||||
globalPoint,
|
||||
pGlobalDirection,
|
||||
considerDirection,
|
||||
localPoint);
|
||||
}
|
||||
else // Regular structure
|
||||
{
|
||||
noResult = fregularNav.LevelLocate(fHistory,
|
||||
fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo,
|
||||
globalPoint,
|
||||
pGlobalDirection,
|
||||
considerDirection,
|
||||
localPoint);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -412,11 +434,11 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
//
|
||||
fEntering = false;
|
||||
fEnteredDaughter = true;
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 )
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
|
||||
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup: ***" << G4endl;
|
||||
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup() ***" << G4endl;
|
||||
G4cout << " Entering volume: " << enteredPhysical->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -432,13 +454,15 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
G4cout.precision(6);
|
||||
G4String curPhysVol_Name("None");
|
||||
if (targetPhysical!=0)
|
||||
{
|
||||
curPhysVol_Name = targetPhysical->GetName();
|
||||
}
|
||||
G4cout << " Return value = new volume = " << curPhysVol_Name << G4endl;
|
||||
G4cout << " ----- Upon exiting:" << G4endl;
|
||||
PrintState();
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4cerr << "Upon exiting LocateGlobalPointAndSetup():" << G4endl;
|
||||
G4cerr << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
G4cout << "Upon exiting LocateGlobalPointAndSetup():" << G4endl;
|
||||
G4cout << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
#endif
|
||||
}
|
||||
G4cout.precision(oldcoutPrec);
|
||||
@@ -467,6 +491,14 @@ G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoint)
|
||||
{
|
||||
fLastLocatedPointLocal = ComputeLocalPoint(pGlobalpoint);
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << "Entering LocateGlobalWithinVolume(): History = " << G4endl;
|
||||
G4cout << fHistory << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// For the case of Voxel (or Parameterised) volume the respective
|
||||
// Navigator must be messaged to update its voxel information etc
|
||||
|
||||
@@ -486,15 +518,15 @@ G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoint)
|
||||
{
|
||||
fvoxelNav.VoxelLocate( pVoxelHeader, fLastLocatedPointLocal );
|
||||
}
|
||||
// else { fnormalNav. nothing !? }
|
||||
break;
|
||||
|
||||
case kParameterised:
|
||||
// Resets state & returns voxel node
|
||||
//
|
||||
fparamNav.ParamVoxelLocate( pVoxelHeader, fLastLocatedPointLocal );
|
||||
if( GetDaughtersRegularStructureId(motherLogical) != 1 )
|
||||
{
|
||||
// Resets state & returns voxel node
|
||||
//
|
||||
fparamNav.ParamVoxelLocate( pVoxelHeader, fLastLocatedPointLocal );
|
||||
}
|
||||
break;
|
||||
|
||||
case kReplica:
|
||||
G4Exception("G4Navigator::LocateGlobalPointWithinVolume()",
|
||||
"NotApplicable", FatalException,
|
||||
@@ -610,16 +642,16 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
G4cout << " Volume = " << motherPhysical->GetName()
|
||||
<< " - Proposed step length = " << pCurrentProposedStepLength
|
||||
<< G4endl;
|
||||
if( fVerbose == 4 )
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose >= 4 )
|
||||
{
|
||||
G4cout << " Called with the arguments: " << G4endl
|
||||
<< " Globalpoint = " << std::setw(25) << pGlobalpoint
|
||||
<< G4endl
|
||||
<< " Direction = " << std::setw(25) << pDirection
|
||||
<< G4endl;
|
||||
G4cout << " ----- Upon entering :" << G4endl;
|
||||
G4cout << " Called with the arguments: " << G4endl
|
||||
<< " Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
|
||||
<< " Direction = " << std::setw(25) << pDirection << G4endl;
|
||||
G4cout << " ---- Upon entering :" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static G4double fAccuracyForWarning = kCarTolerance,
|
||||
@@ -751,31 +783,98 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
}
|
||||
else
|
||||
{
|
||||
Step = fnormalNav.ComputeStep(fLastLocatedPointLocal,
|
||||
localDirection,
|
||||
pCurrentProposedStepLength,
|
||||
pNewSafety,
|
||||
fHistory,
|
||||
fValidExitNormal,
|
||||
fExitNormal,
|
||||
fExiting,
|
||||
fEntering,
|
||||
&fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo);
|
||||
if( motherPhysical->GetRegularStructureId() != 1 )
|
||||
{
|
||||
Step = fnormalNav.ComputeStep(fLastLocatedPointLocal,
|
||||
localDirection,
|
||||
pCurrentProposedStepLength,
|
||||
pNewSafety,
|
||||
fHistory,
|
||||
fValidExitNormal,
|
||||
fExitNormal,
|
||||
fExiting,
|
||||
fEntering,
|
||||
&fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo);
|
||||
}
|
||||
else // Regular (non-voxelised) structure
|
||||
{
|
||||
LocateGlobalPointAndSetup( pGlobalpoint, &pDirection, true, true );
|
||||
//
|
||||
// if physical process limits the step, the voxel will not be the
|
||||
// one given by ComputeStepSkippingEqualMaterials() and the local
|
||||
// point will be wrongly calculated.
|
||||
|
||||
// There is a problem: when msc limits the step and the point is
|
||||
// assigned wrongly to phantom in previous step (while it is out
|
||||
// of the container volume). Then LocateGlobalPointAndSetup() has
|
||||
// reset the history topvolume to world.
|
||||
//
|
||||
if(fHistory.GetTopVolume()->GetRegularStructureId() != 1 )
|
||||
{
|
||||
G4Exception("G4Navigator::ComputeStep()",
|
||||
"Bad-location-of-point", JustWarning,
|
||||
"Point is relocated in voxels, while it should be outside!");
|
||||
Step = fnormalNav.ComputeStep(fLastLocatedPointLocal,
|
||||
localDirection,
|
||||
pCurrentProposedStepLength,
|
||||
pNewSafety,
|
||||
fHistory,
|
||||
fValidExitNormal,
|
||||
fExitNormal,
|
||||
fExiting,
|
||||
fEntering,
|
||||
&fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo);
|
||||
}
|
||||
else
|
||||
{
|
||||
Step = fregularNav.
|
||||
ComputeStepSkippingEqualMaterials(fLastLocatedPointLocal,
|
||||
localDirection,
|
||||
pCurrentProposedStepLength,
|
||||
pNewSafety,
|
||||
fHistory,
|
||||
fValidExitNormal,
|
||||
fExitNormal,
|
||||
fExiting,
|
||||
fEntering,
|
||||
&fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo,
|
||||
motherPhysical);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case kParameterised:
|
||||
Step = fparamNav.ComputeStep(fLastLocatedPointLocal,
|
||||
localDirection,
|
||||
pCurrentProposedStepLength,
|
||||
pNewSafety,
|
||||
fHistory,
|
||||
fValidExitNormal,
|
||||
fExitNormal,
|
||||
fExiting,
|
||||
fEntering,
|
||||
&fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo);
|
||||
if( GetDaughtersRegularStructureId(motherLogical) != 1 )
|
||||
{
|
||||
Step = fparamNav.ComputeStep(fLastLocatedPointLocal,
|
||||
localDirection,
|
||||
pCurrentProposedStepLength,
|
||||
pNewSafety,
|
||||
fHistory,
|
||||
fValidExitNormal,
|
||||
fExitNormal,
|
||||
fExiting,
|
||||
fEntering,
|
||||
&fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo);
|
||||
}
|
||||
else // Regular structure
|
||||
{
|
||||
Step = fregularNav.ComputeStep(fLastLocatedPointLocal,
|
||||
localDirection,
|
||||
pCurrentProposedStepLength,
|
||||
pNewSafety,
|
||||
fHistory,
|
||||
fValidExitNormal,
|
||||
fExitNormal,
|
||||
fExiting,
|
||||
fEntering,
|
||||
&fBlockedPhysicalVolume,
|
||||
fBlockedReplicaNo);
|
||||
}
|
||||
break;
|
||||
case kReplica:
|
||||
G4Exception("G4Navigator::ComputeStep()", "NotApplicable",
|
||||
@@ -832,7 +931,8 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fNumberZeroSteps > 1 )
|
||||
{
|
||||
G4cout << "G4Nav - CompStep: another zero step, # " << fNumberZeroSteps
|
||||
G4cout << "G4Navigator::ComputeStep(): another zero step, # "
|
||||
<< fNumberZeroSteps
|
||||
<< " at " << pGlobalpoint
|
||||
<< " in volume " << motherPhysical->GetName()
|
||||
<< " nav-comp-step calls # " << sNavCScalls
|
||||
@@ -888,9 +988,12 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
if( fExiting )
|
||||
{
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4cout << " At G4Nav CompStep End - if(exiting) - fExiting= " << fExiting
|
||||
<< " fValidExitNormal = " << fValidExitNormal << G4endl;
|
||||
G4cout << " fExitNormal= " << fExitNormal << G4endl;
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " At G4Nav CompStep End - if(exiting) - fExiting= " << fExiting
|
||||
<< " fValidExitNormal = " << fValidExitNormal << G4endl;
|
||||
G4cout << " fExitNormal= " << fExitNormal << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(fValidExitNormal)
|
||||
@@ -917,10 +1020,8 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
fGrandMotherExitNormal *= (*mRot);
|
||||
}
|
||||
}
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4cout << " fGrandMotherExitNormal= " << fGrandMotherExitNormal << G4endl;
|
||||
#endif
|
||||
}
|
||||
fStepEndPoint= pGlobalpoint+Step*pDirection;
|
||||
|
||||
if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
|
||||
{
|
||||
@@ -931,15 +1032,19 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 ) {
|
||||
if( fVerbose >= 4 ) {
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
if( fVerbose >= 4 )
|
||||
{
|
||||
G4cout << " ----- Upon exiting :" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
G4cout <<" Returned step = " << Step << G4endl;
|
||||
if( Step == kInfinity )
|
||||
{
|
||||
G4cout << " Original proposed step = "
|
||||
<< pCurrentProposedStepLength << G4endl;
|
||||
}
|
||||
G4cout << " Safety = " << pNewSafety << G4endl;
|
||||
}
|
||||
G4cout.precision(oldcoutPrec);
|
||||
@@ -1112,42 +1217,51 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
{
|
||||
G4double newSafety = 0.0;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4int oldcoutPrec = G4cout.precision(8);
|
||||
if( fVerbose > 0 )
|
||||
{
|
||||
G4cout << "*** G4Navigator::ComputeSafety: ***" << G4endl
|
||||
<< " Called at point: "
|
||||
<< pGlobalpoint << G4endl
|
||||
<< " for Navigator: " << this << G4endl;
|
||||
<< " Called at point: " << pGlobalpoint << G4endl;
|
||||
|
||||
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
|
||||
G4cout << " Volume = " << motherPhysical->GetName()
|
||||
<< " - Maximum length = " << pMaxLength << G4endl;
|
||||
if( fVerbose == 4 )
|
||||
if( fVerbose >= 4 )
|
||||
{
|
||||
G4cout << " Called with the arguments: " << G4endl
|
||||
<< " Globalpoint = " << pGlobalpoint << G4endl;
|
||||
G4cout << " ----- Upon entering :" << G4endl;
|
||||
PrintState();
|
||||
G4cout << " ----- Upon entering Compute Safety:" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( !(fEnteredDaughter || fExitedMother) )
|
||||
G4double distEndpointSq = (pGlobalpoint-fStepEndPoint).mag2();
|
||||
G4bool stayedOnEndpoint = distEndpointSq < kCarTolerance*kCarTolerance;
|
||||
G4bool endpointOnSurface = fEnteredDaughter || fExitedMother;
|
||||
|
||||
if( !(endpointOnSurface && stayedOnEndpoint) )
|
||||
{
|
||||
// Pseudo-relocate to this point (updates voxel information only)
|
||||
//
|
||||
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:
|
||||
// 1) Re-locate (to where?)
|
||||
// 2) Insure that the methods using (G4ComputeStep?)
|
||||
// does a relocation (if information is disturbed only ?)
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose >= 2 )
|
||||
{
|
||||
G4cout << " ComputeSafety() relocates-in-volume to point: "
|
||||
G4cout << " G4Navigator::ComputeSafety() relocates-in-volume to point: "
|
||||
<< pGlobalpoint << G4endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
|
||||
G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
|
||||
G4SmartVoxelHeader* pVoxelHeader = motherLogical->GetVoxelHeader();
|
||||
G4ThreeVector localPoint = ComputeLocalPoint(pGlobalpoint);
|
||||
|
||||
if ( fHistory.GetTopVolumeType()!=kReplica )
|
||||
@@ -1155,7 +1269,7 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
switch(CharacteriseDaughters(motherLogical))
|
||||
{
|
||||
case kNormal:
|
||||
if ( motherLogical->GetVoxelHeader() )
|
||||
if ( pVoxelHeader )
|
||||
{
|
||||
newSafety=fvoxelNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
}
|
||||
@@ -1165,7 +1279,14 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
}
|
||||
break;
|
||||
case kParameterised:
|
||||
newSafety = fparamNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
if( GetDaughtersRegularStructureId(motherLogical) != 1 )
|
||||
{
|
||||
newSafety = fparamNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
}
|
||||
else // Regular structure
|
||||
{
|
||||
newSafety = fregularNav.ComputeSafety(localPoint,fHistory,pMaxLength);
|
||||
}
|
||||
break;
|
||||
case kReplica:
|
||||
G4Exception("G4Navigator::ComputeSafety()", "NotApplicable",
|
||||
@@ -1179,22 +1300,20 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
fHistory, pMaxLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
else // if( endpointOnSurface && stayedOnEndpoint )
|
||||
{
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose >= 2 )
|
||||
{
|
||||
G4cout << " ComputeSafety() finds that point - "
|
||||
G4cout << " G4Navigator::ComputeSafety() finds that point - "
|
||||
<< pGlobalpoint << " - is on surface " << G4endl;
|
||||
if( fEnteredDaughter )
|
||||
{
|
||||
G4cout << " entered new daughter volume" << G4endl;
|
||||
}
|
||||
if( fExitedMother )
|
||||
{
|
||||
G4cout << " and exited previous volume.";
|
||||
}
|
||||
if( fEnteredDaughter ) { G4cout << " entered new daughter volume"; }
|
||||
if( fExitedMother ) { G4cout << " and exited previous volume."; }
|
||||
G4cout << G4endl;
|
||||
G4cout << " EndPoint was = " << fStepEndPoint << G4endl;
|
||||
}
|
||||
#endif
|
||||
newSafety = 0.0;
|
||||
}
|
||||
|
||||
// Remember last safety origin & value
|
||||
@@ -1202,11 +1321,11 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
fPreviousSftOrigin = pGlobalpoint;
|
||||
fPreviousSafety = newSafety;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 )
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4cout << " ----- Upon exiting :" << G4endl;
|
||||
PrintState();
|
||||
G4cout << " ---- Exiting ComputeSafety " << G4endl;
|
||||
if( fVerbose > 2 ) { PrintState(); }
|
||||
G4cout << " Returned value of Safety = " << newSafety << G4endl;
|
||||
}
|
||||
G4cout.precision(oldcoutPrec);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.cc,v 1.9 2007/05/11 13:43:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation Implementation
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.11 2007/05/11 13:43:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.12 2007/11/09 16:06:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Implementation
|
||||
@@ -34,20 +34,19 @@
|
||||
// Revisions:
|
||||
// J. Apostolakis 24 Nov 2005, Revised/fixed treatment of nested params
|
||||
// J. Apostolakis 4 Feb 2005, Reintroducting multi-level parameterisation
|
||||
// for materials only - see note 1 below
|
||||
// for materials only - see note 1 below
|
||||
// G. Cosmo 11 Mar 2004, Added Check mode
|
||||
// G. Cosmo 15 May 2002, Extended to 3-d voxelisation, made subclass
|
||||
// J. Apostolakis 5 Mar 1998, Enabled parameterisation of material & solid type
|
||||
// J. Apostolakis 5 Mar 1998, Enabled parameterisation of mat & solid type
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Note 1: Design/implementation note for extensions
|
||||
// J. Apostolakis, March 1st, 2005
|
||||
// We cannot make the solid, dimensions and transformation dependant on parent
|
||||
// because the voxelisation will not have access to this.
|
||||
// Note 1: Design/implementation note for extensions - JAp, March 1st, 2005
|
||||
// We cannot make the solid, dimensions and transformation dependent on
|
||||
// parent because the voxelisation will not have access to this.
|
||||
// So the following can NOT be done:
|
||||
// sampleSolid = curParam->ComputeSolid(num, curPhysical, pParentTouch);
|
||||
// sampleSolid->ComputeDimensions(curParam, num, curPhysical, pParentTouch);
|
||||
// curParam->ComputeTransformation(num, curPhysical, pParentTouch);
|
||||
// sampleSolid = curParam->ComputeSolid(num, curPhysical, pParentTouch);
|
||||
// sampleSolid->ComputeDimensions(curParam, num, curPhysical, pParentTouch);
|
||||
// curParam->ComputeTransformation(num, curPhysical, pParentTouch);
|
||||
|
||||
#include "G4ParameterisedNavigation.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
@@ -68,28 +67,6 @@ G4ParameterisedNavigation::G4ParameterisedNavigation()
|
||||
//
|
||||
G4ParameterisedNavigation::~G4ParameterisedNavigation()
|
||||
{
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4cout << "G4ParameterisedNavigation::~G4ParameterisedNavigation() called."
|
||||
<< G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// IdentifyAndPlaceSolid
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4VSolid* G4ParameterisedNavigation::
|
||||
IdentifyAndPlaceSolid( G4int num,
|
||||
G4VPhysicalVolume *apparentPhys, // PhysV or PhysT
|
||||
G4VPVParameterisation *curParam )
|
||||
{
|
||||
G4VSolid *sampleSolid;
|
||||
|
||||
sampleSolid = curParam->ComputeSolid(num, apparentPhys);
|
||||
sampleSolid->ComputeDimensions(curParam, num, apparentPhys);
|
||||
curParam->ComputeTransformation(num, apparentPhys);
|
||||
|
||||
return sampleSolid;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -140,9 +117,6 @@ G4double G4ParameterisedNavigation::
|
||||
motherSafety = motherSolid->DistanceToOut(localPoint);
|
||||
ourSafety = motherSafety; // Working isotropic safety
|
||||
|
||||
// G4cout << "DebugLOG - G4ParameterisedNavigation::ComputeStep()" << G4endl
|
||||
// << " Current solid " << motherSolid->GetName() << G4endl;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fCheck )
|
||||
{
|
||||
@@ -204,7 +178,7 @@ 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);
|
||||
@@ -216,8 +190,6 @@ G4double G4ParameterisedNavigation::
|
||||
|
||||
sampleParam = samplePhysical->GetParameterisation();
|
||||
|
||||
// G4cerr << " Attaching parent touchable information to Phys Volume " << G4endl;
|
||||
|
||||
do
|
||||
{
|
||||
curVoxelNode = fVoxelNode;
|
||||
@@ -229,12 +201,11 @@ G4double G4ParameterisedNavigation::
|
||||
if ( !fBList.IsBlocked(sampleNo) )
|
||||
{
|
||||
fBList.BlockVolume(sampleNo);
|
||||
// sampleSolid = sampleParam->ComputeSolid(sampleNo, samplePhysical);
|
||||
// sampleSolid->ComputeDimensions(sampleParam, sampleNo, samplePhysical);
|
||||
// sampleParam->ComputeTransformation(sampleNo, samplePhysical);
|
||||
|
||||
// Call virtual methods, and copy information if needed
|
||||
sampleSolid= IdentifyAndPlaceSolid( sampleNo, samplePhysical, sampleParam );
|
||||
//
|
||||
sampleSolid = IdentifyAndPlaceSolid( sampleNo, samplePhysical,
|
||||
sampleParam );
|
||||
|
||||
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
|
||||
samplePhysical->GetTranslation());
|
||||
@@ -345,7 +316,8 @@ G4double G4ParameterisedNavigation::
|
||||
<< " Problem in Navigation" << G4endl
|
||||
<< " Point (local coordinates): "
|
||||
<< localPoint << G4endl
|
||||
<< " Local Direction: " << localDirection << G4endl
|
||||
<< " Local Direction: "
|
||||
<< localDirection << G4endl
|
||||
<< " Solid: " << motherSolid->GetName() << G4endl;
|
||||
motherSolid->DumpInfo();
|
||||
G4Exception("G4ParameterisedNavigation::ComputeStep()",
|
||||
@@ -432,13 +404,10 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
// daughter of the mother volume
|
||||
//
|
||||
samplePhysical = motherLogical->GetDaughter(0);
|
||||
samplePhysical->GetReplicationData(axis, nReplicas, width, offset, consuming);
|
||||
samplePhysical->GetReplicationData(axis, nReplicas,
|
||||
width, offset, consuming);
|
||||
sampleParam = samplePhysical->GetParameterisation();
|
||||
|
||||
// Check development
|
||||
// G4cerr << "DebugLOG - G4ParameterisedNavigation::ComputeSafety()" << G4endl
|
||||
// << " Current solid " << motherSolid->GetName() << G4endl;
|
||||
|
||||
// Look inside the current Voxel only at the current point
|
||||
//
|
||||
if ( axis==kUndefined ) // 3D case: current voxel node is retrieved
|
||||
@@ -447,8 +416,8 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
}
|
||||
else // 1D case: current voxel node is computed here.
|
||||
{
|
||||
curVoxelNodeNo = G4int((localPoint(fVoxelAxis)-fVoxelHeader->GetMinExtent())
|
||||
/ fVoxelSliceWidth );
|
||||
curVoxelNodeNo = G4int((localPoint(fVoxelAxis)
|
||||
-fVoxelHeader->GetMinExtent()) / fVoxelSliceWidth );
|
||||
curVoxelNode = fVoxelHeader->GetSlice(curVoxelNodeNo)->GetNode();
|
||||
fVoxelNodeNo = curVoxelNodeNo;
|
||||
fVoxelNode = curVoxelNode;
|
||||
@@ -460,10 +429,8 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
sampleNo = curVoxelNode->GetVolume(contentNo);
|
||||
|
||||
// Call virtual methods, and copy information if needed
|
||||
sampleSolid= IdentifyAndPlaceSolid( sampleNo, samplePhysical, sampleParam );
|
||||
// sampleSolid = sampleParam->ComputeSolid(sampleNo, samplePhysical);
|
||||
// sampleSolid->ComputeDimensions(sampleParam, sampleNo, samplePhysical);
|
||||
// sampleParam->ComputeTransformation(sampleNo, samplePhysical);
|
||||
//
|
||||
sampleSolid= IdentifyAndPlaceSolid( sampleNo,samplePhysical,sampleParam );
|
||||
|
||||
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
|
||||
samplePhysical->GetTranslation());
|
||||
@@ -496,14 +463,13 @@ G4double G4ParameterisedNavigation::
|
||||
ComputeVoxelSafety(const G4ThreeVector& localPoint,
|
||||
const EAxis pAxis) const
|
||||
{
|
||||
// Check development
|
||||
// G4cout << "DebugLOG - G4ParameterisedNavigation::ComputeVoxelSafety()" << G4endl;
|
||||
|
||||
// If no best axis is specified, adopt default
|
||||
// strategy as for placements
|
||||
//
|
||||
if ( pAxis==kUndefined )
|
||||
{
|
||||
return G4VoxelNavigation::ComputeVoxelSafety(localPoint);
|
||||
}
|
||||
|
||||
G4double voxelSafety, plusVoxelSafety, minusVoxelSafety;
|
||||
G4double curNodeOffset, minCurCommonDelta, maxCurCommonDelta;
|
||||
@@ -551,9 +517,12 @@ LocateNextVoxel( const G4ThreeVector& localPoint,
|
||||
// location strategy as for placements
|
||||
//
|
||||
if ( pAxis==kUndefined )
|
||||
{
|
||||
return G4VoxelNavigation::LocateNextVoxel(localPoint,
|
||||
localDirection,
|
||||
currentStep);
|
||||
}
|
||||
|
||||
G4bool isNewVoxel;
|
||||
G4int newNodeNo;
|
||||
G4double minVal, maxVal, curMinExtent, curCoord;
|
||||
@@ -626,20 +595,14 @@ G4ParameterisedNavigation::LevelLocate( G4NavigationHistory& history,
|
||||
motherVoxelNode = ParamVoxelLocate(motherVoxelHeader,localPoint);
|
||||
|
||||
voxelNoDaughters = motherVoxelNode->GetNoContained();
|
||||
if ( voxelNoDaughters==0 ) return false;
|
||||
if ( voxelNoDaughters==0 ) { return false; }
|
||||
|
||||
pPhysical = motherLogical->GetDaughter(0);
|
||||
pParam = pPhysical->GetParameterisation();
|
||||
|
||||
// Check development
|
||||
// G4cerr << "DebugLOG - G4ParameterisedNavigation::LevelLocate() "
|
||||
// << " Current solid "
|
||||
// << motherLogical->GetSolid()->GetName() << G4endl;
|
||||
// G4cerr << " Attaching parent touchable information to Phys Volume "
|
||||
// << G4endl;
|
||||
|
||||
// Save parent history in touchable history
|
||||
// ... for use as parent t-h in ComputeMaterial method of param
|
||||
//
|
||||
G4TouchableHistory parentTouchable( history );
|
||||
|
||||
// Search replicated daughter volume
|
||||
@@ -651,21 +614,14 @@ G4ParameterisedNavigation::LevelLocate( G4NavigationHistory& history,
|
||||
{
|
||||
// Obtain solid (as it can vary) and obtain its parameters
|
||||
//
|
||||
|
||||
// pSolid = pParam->ComputeSolid(replicaNo, pPhysical);
|
||||
// pSolid->ComputeDimensions(pParam, replicaNo, pPhysical);
|
||||
// pParam->ComputeTransformation(replicaNo, pPhysical);
|
||||
|
||||
// Call virtual methods, and copy information if needed
|
||||
pSolid= IdentifyAndPlaceSolid( replicaNo, pPhysical, pParam );
|
||||
pSolid = IdentifyAndPlaceSolid( replicaNo, pPhysical, pParam );
|
||||
|
||||
// Setup history
|
||||
//
|
||||
history.NewLevel(pPhysical, kParameterised, replicaNo);
|
||||
samplePoint = history.GetTopTransform().TransformPoint(globalPoint);
|
||||
if ( !G4AuxiliaryNavServices::CheckPointOnSurface(pSolid,
|
||||
samplePoint, globalDirection,
|
||||
history.GetTopTransform(), pLocatedOnEdge) )
|
||||
if ( !G4AuxiliaryNavServices::CheckPointOnSurface( pSolid, samplePoint,
|
||||
globalDirection, history.GetTopTransform(), pLocatedOnEdge) )
|
||||
{
|
||||
history.BackLevel();
|
||||
}
|
||||
@@ -683,14 +639,11 @@ G4ParameterisedNavigation::LevelLocate( G4NavigationHistory& history,
|
||||
//
|
||||
G4LogicalVolume *pLogical = pPhysical->GetLogicalVolume();
|
||||
pLogical->SetSolid(pSolid);
|
||||
|
||||
pLogical->UpdateMaterial(
|
||||
pParam->ComputeMaterial(replicaNo, pPhysical, &parentTouchable) );
|
||||
|
||||
pLogical->UpdateMaterial(pParam->ComputeMaterial(replicaNo,
|
||||
pPhysical, &parentTouchable) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+378
@@ -0,0 +1,378 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhantomParameterisation.cc,v 1.2 2007/12/10 16:29:59 gunter Exp $
|
||||
// GEANT4 tag $ Name:$
|
||||
//
|
||||
// class G4PhantomParameterisation implementation
|
||||
//
|
||||
// Author: Pedro Arce, May 2007
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4PhantomParameterisation.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VVolumeMaterialScanner.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4PhantomParameterisation::G4PhantomParameterisation()
|
||||
{
|
||||
// Initialise data
|
||||
//
|
||||
fMaterialIndices = 0;
|
||||
fContainerWallX = 0.;
|
||||
fContainerWallY = 0.;
|
||||
fContainerWallZ = 0.;
|
||||
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
|
||||
bSkipEqualMaterials = 1;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4PhantomParameterisation::~G4PhantomParameterisation()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PhantomParameterisation::
|
||||
BuildContainerSolid( G4VPhysicalVolume *pMotherPhysical )
|
||||
{
|
||||
fContainerSolid = pMotherPhysical->GetLogicalVolume()->GetSolid();
|
||||
fContainerWallX = fNoVoxelX * fVoxelHalfX;
|
||||
fContainerWallY = fNoVoxelY * fVoxelHalfY;
|
||||
fContainerWallZ = fNoVoxelZ * fVoxelHalfZ;
|
||||
|
||||
// CheckVoxelsFillContainer();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PhantomParameterisation::
|
||||
ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol ) const
|
||||
{
|
||||
// Voxels cannot be rotated, return translation
|
||||
//
|
||||
G4ThreeVector trans = GetTranslation( copyNo );
|
||||
|
||||
physVol->SetTranslation( trans );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4ThreeVector G4PhantomParameterisation::
|
||||
GetTranslation(const G4int copyNo ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
|
||||
size_t nx;
|
||||
size_t ny;
|
||||
size_t nz;
|
||||
|
||||
ComputeVoxelIndices( copyNo, nx, ny, nz );
|
||||
|
||||
G4ThreeVector trans( (2*nx+1)*fVoxelHalfX - fContainerWallX,
|
||||
(2*ny+1)*fVoxelHalfY - fContainerWallY,
|
||||
(2*nz+1)*fVoxelHalfZ - fContainerWallZ);
|
||||
return trans;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4VSolid* G4PhantomParameterisation::
|
||||
ComputeSolid(const G4int, G4VPhysicalVolume *pPhysicalVol)
|
||||
{
|
||||
return pPhysicalVol->GetLogicalVolume()->GetSolid();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4Material* G4PhantomParameterisation::
|
||||
ComputeMaterial(const G4int copyNo, G4VPhysicalVolume *, const G4VTouchable *)
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
size_t matIndex = GetMaterialIndex(copyNo);
|
||||
|
||||
return fMaterials[ matIndex ];
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
size_t G4PhantomParameterisation::
|
||||
GetMaterialIndex( size_t copyNo ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
|
||||
return *(fMaterialIndices+copyNo);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
size_t G4PhantomParameterisation::
|
||||
GetMaterialIndex( size_t nx, size_t ny, size_t nz ) const
|
||||
{
|
||||
size_t copyNo = nx + fNoVoxelX*ny + fNoVoxelXY*nz;
|
||||
return GetMaterialIndex( copyNo );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4Material* G4PhantomParameterisation::GetMaterial( size_t nx, size_t ny, size_t nz) const
|
||||
{
|
||||
return fMaterials[GetMaterialIndex(nx,ny,nz)];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4Material* G4PhantomParameterisation::GetMaterial( size_t copyNo ) const
|
||||
{
|
||||
return fMaterials[GetMaterialIndex(copyNo)];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PhantomParameterisation::
|
||||
ComputeVoxelIndices(const G4int copyNo, size_t& nx,
|
||||
size_t& ny, size_t& nz ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
nx = size_t(copyNo%fNoVoxelX);
|
||||
ny = size_t( (copyNo/fNoVoxelX)%fNoVoxelY );
|
||||
nz = size_t(copyNo/fNoVoxelXY);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PhantomParameterisation::
|
||||
CheckVoxelsFillContainer( G4double contX, G4double contY, G4double contZ ) const
|
||||
{
|
||||
G4double toleranceForWarning = 0.25*kCarTolerance;
|
||||
|
||||
// Any bigger value than 0.25*kCarTolerance will give a warning in
|
||||
// G4NormalNavigation::ComputeStep(), because the Inverse of a container
|
||||
// translation that is Z+epsilon gives -Z+epsilon (and the maximum tolerance
|
||||
// in G4Box::Inside is 0.5*kCarTolerance
|
||||
//
|
||||
G4double toleranceForError = 1.*kCarTolerance;
|
||||
|
||||
// Any bigger value than kCarTolerance will give an error in GetReplicaNo()
|
||||
//
|
||||
if( std::fabs(contX-fNoVoxelX*fVoxelHalfX) >= toleranceForError
|
||||
|| std::fabs(contY-fNoVoxelY*fVoxelHalfY) >= toleranceForError
|
||||
|| std::fabs(contZ-fNoVoxelZ*fVoxelHalfZ) >= toleranceForError )
|
||||
{
|
||||
G4cerr << "ERROR - G4PhantomParameterisation::CheckVoxelsFillContainer()"
|
||||
<< G4endl
|
||||
<< " Voxels do not fully fill the container: "
|
||||
<< fContainerSolid->GetName() << G4endl
|
||||
<< " DiffX= " << contX-fNoVoxelX*fVoxelHalfX << G4endl
|
||||
<< " DiffY= " << contY-fNoVoxelY*fVoxelHalfY << G4endl
|
||||
<< " DiffZ= " << contZ-fNoVoxelZ*fVoxelHalfZ << G4endl
|
||||
<< " Maximum difference is: " << toleranceForError << G4endl;
|
||||
G4Exception("G4PhantomParameterisation::CheckVoxelsFillContainer()",
|
||||
"InvalidSetup", FatalException,
|
||||
"Voxels do not fully fill the container!");
|
||||
|
||||
}
|
||||
else if( std::fabs(contX-fNoVoxelX*fVoxelHalfX) >= toleranceForWarning
|
||||
|| std::fabs(contY-fNoVoxelY*fVoxelHalfY) >= toleranceForWarning
|
||||
|| std::fabs(contZ-fNoVoxelZ*fVoxelHalfZ) >= toleranceForWarning )
|
||||
{
|
||||
G4cerr << "WARNING - G4PhantomParameterisation::CheckVoxelsFillContainer()"
|
||||
<< G4endl
|
||||
<< " Voxels do not fully fill the container: "
|
||||
<< fContainerSolid->GetName() << G4endl
|
||||
<< " DiffX= " << contX-fNoVoxelX*fVoxelHalfX << G4endl
|
||||
<< " DiffY= " << contY-fNoVoxelY*fVoxelHalfY << G4endl
|
||||
<< " DiffZ= " << contZ-fNoVoxelZ*fVoxelHalfZ << G4endl
|
||||
<< " Maximum difference is: " << toleranceForWarning
|
||||
<< G4endl;
|
||||
G4Exception("G4PhantomParameterisation::CheckVoxelsFillContainer()",
|
||||
"InvalidSetup", JustWarning,
|
||||
"Voxels do not fully fill the container!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4int G4PhantomParameterisation::
|
||||
GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
{
|
||||
|
||||
// Check first that point is really inside voxels
|
||||
//
|
||||
if( fContainerSolid->Inside( localPoint ) == kOutside )
|
||||
{
|
||||
G4cerr << "ERROR - G4PhantomParameterisation::GetReplicaNo()" << G4endl
|
||||
<< " localPoint - " << localPoint
|
||||
<< " - is outside container solid: "
|
||||
<< fContainerSolid->GetName() << G4endl;
|
||||
G4Exception("G4PhantomParameterisation::GetReplicaNo()", "InvalidSetup",
|
||||
FatalErrorInArgument, "Point outside voxels!");
|
||||
}
|
||||
|
||||
// Check the voxel numbers corresponding to localPoint
|
||||
// When a particle is on a surface, it may be between -kCarTolerance and
|
||||
// +kCartolerance. By a simple distance as:
|
||||
// G4int nx = G4int( (localPoint.x()+)/fVoxelHalfX/2.);
|
||||
// those between -kCartolerance and 0 will be placed on voxel N-1 and those
|
||||
// between 0 and kCarTolerance on voxel N.
|
||||
// To avoid precision problems place the tracks that are on the surface on
|
||||
// voxel N-1 if they have negative direction and on voxel N if they have
|
||||
// positive direction.
|
||||
// Add +kCarTolerance so that they are first placed on voxel N, and then
|
||||
// if the direction is negative substract 1
|
||||
|
||||
G4double fx = (localPoint.x()+fContainerWallX+kCarTolerance)/fVoxelHalfX/2.;
|
||||
G4int nx = G4int(fx);
|
||||
|
||||
G4double fy = (localPoint.y()+fContainerWallY+kCarTolerance)/fVoxelHalfY/2.;
|
||||
G4int ny = G4int(fy);
|
||||
|
||||
G4double fz = (localPoint.z()+fContainerWallZ+kCarTolerance)/fVoxelHalfZ/2.;
|
||||
G4int nz = G4int(fz);
|
||||
|
||||
// If it is on the surface side, check the direction: if direction is
|
||||
// negative place it on the previous voxel (if direction is positive it is
|
||||
// already in the next voxel...).
|
||||
// NOTE: Sometimes this algorithm gives nx = -1, it is always traced to be
|
||||
// due to multiple scattering: track is entering a voxel but multiple
|
||||
// scattering changes the angle towards outside
|
||||
//
|
||||
if( fx - nx < kCarTolerance/fVoxelHalfX )
|
||||
{
|
||||
if( localDir.x() < 0 )
|
||||
{
|
||||
if( nx != 0 )
|
||||
{
|
||||
nx -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
if( fy - ny < kCarTolerance/fVoxelHalfY )
|
||||
{
|
||||
if( localDir.y() < 0 )
|
||||
{
|
||||
if( ny != 0 )
|
||||
{
|
||||
ny -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
if( fz - nz < kCarTolerance/fVoxelHalfZ )
|
||||
{
|
||||
if( localDir.z() < 0 )
|
||||
{
|
||||
if( nz != 0 )
|
||||
{
|
||||
nz -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4int copyNo = nx + fNoVoxelX*ny + fNoVoxelXY*nz;
|
||||
|
||||
// Correct precision problems
|
||||
//
|
||||
if( copyNo < 0 || copyNo >= G4int(fNoVoxel) )
|
||||
{
|
||||
G4bool isOK = true;
|
||||
if( nx < 0 )
|
||||
{
|
||||
nx = 0;
|
||||
isOK = false;
|
||||
}
|
||||
else if( nx >= G4int(fNoVoxelX) )
|
||||
{
|
||||
nx = fNoVoxelX-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( ny < 0 )
|
||||
{
|
||||
ny = 0;
|
||||
isOK = false;
|
||||
}
|
||||
else if( ny >= G4int(fNoVoxelY) )
|
||||
{
|
||||
ny = fNoVoxelY-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( nz < 0 )
|
||||
{
|
||||
nz = 0;
|
||||
isOK = false;
|
||||
}
|
||||
else if( nz >= G4int(fNoVoxelZ) )
|
||||
{
|
||||
nz = fNoVoxelZ-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( !isOK )
|
||||
{
|
||||
G4cerr << "WARNING - G4PhantomParameterisation::GetReplicaNo()" << G4endl
|
||||
<< " LocalPoint: " << localPoint << G4endl
|
||||
<< " Voxel container size: " << fContainerWallX
|
||||
<< " " << fContainerWallY << " " << fContainerWallZ << G4endl;
|
||||
G4Exception("G4PhantomParameterisation::GetReplicaNo()",
|
||||
"Wrong-copy-number", JustWarning,
|
||||
"Corrected the copy numbe! It was negative or too big");
|
||||
copyNo = nx + fNoVoxelX*ny + fNoVoxelXY*nz;
|
||||
}
|
||||
}
|
||||
|
||||
CheckCopyNo( copyNo ); // not needed, just for debugging code
|
||||
|
||||
return copyNo;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PhantomParameterisation::CheckCopyNo( const G4int copyNo ) const
|
||||
{
|
||||
if( copyNo < 0 || copyNo >= G4int(fNoVoxel) )
|
||||
{
|
||||
G4cerr << "ERROR - G4PhantomParameterisation::CheckCopyNo()" << G4endl
|
||||
<< " Copy number: " << copyNo << G4endl
|
||||
<< " Total number of voxels: " << fNoVoxel << G4endl;
|
||||
G4Exception("G4PhantomParameterisation::CheckCopyNo()",
|
||||
"Wrong-copy-number", FatalErrorInArgument,
|
||||
"Copy number is negative or too big!");
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.cc,v 1.35 2007/06/08 10:05:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4PropagatorInField.cc,v 1.40 2007/11/16 09:39:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// This class implements an algorithm to track a particle in a
|
||||
@@ -506,6 +506,21 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
|
||||
G4int depth=0; // Depth counts how many subdivisions of initial step made
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
static G4double tolerance= 1.0e-8;
|
||||
G4ThreeVector StartPosition= CurveStartPointVelocity.GetPosition();
|
||||
if( (TrialPoint - StartPosition).mag() < tolerance * mm )
|
||||
{
|
||||
G4cerr << "WARNING - G4PropagatorInField::LocateIntersectionPoint()"
|
||||
<< G4endl
|
||||
<< " Intermediate F point is on top of starting point A."
|
||||
<< G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()",
|
||||
"IntersectionPointIsAtStart", JustWarning,
|
||||
"Intersection point F is exactly at start point A." );
|
||||
}
|
||||
#endif
|
||||
|
||||
// Intermediates Points on the Track = Subdivided Points must be stored.
|
||||
// Give the initial values to 'InterMedFt'
|
||||
// Important is 'ptrInterMedFT[0]', it saves the 'EndCurvePoint'
|
||||
@@ -520,7 +535,6 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
//
|
||||
G4FieldTrack SubStart_PointVelocity = CurveStartPointVelocity;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
G4int substep_no_p = 0;
|
||||
@@ -542,11 +556,13 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
// The above method is the key & most intuitive part ...
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
`` if( ApproxIntersecPointV.GetCurveLength() >
|
||||
CurrentB_PointVelocity.GetCurveLength() * (1.0 + kAngTolerance) )
|
||||
if( ApproxIntersecPointV.GetCurveLength() >
|
||||
CurrentB_PointVelocity.GetCurveLength() * (1.0 + tolerance) )
|
||||
{
|
||||
G4cerr << "Error - Intermediate F point is more advanced than endpoint B."
|
||||
<< G4endl;
|
||||
G4cerr << "ERROR - G4PropagatorInField::LocateIntersectionPoint()"
|
||||
<< G4endl
|
||||
<< " Intermediate F point is more advanced than"
|
||||
<< " endpoint B." << G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()",
|
||||
"IntermediatePointConfusion", FatalException,
|
||||
"Intermediate F point is past end B point" );
|
||||
@@ -723,14 +739,17 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
}
|
||||
if( curveDist < 0.0 )
|
||||
{
|
||||
G4cerr << "G4PropagatorInField::LocateIntersectionPoint():" << G4endl
|
||||
<< "Error in advancing propagation." << G4endl;
|
||||
G4cerr << "ERROR - G4PropagatorInField::LocateIntersectionPoint()"
|
||||
<< G4endl
|
||||
<< " Error in advancing propagation." << G4endl;
|
||||
fVerboseLevel = 5; // Print out a maximum of information
|
||||
printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
|
||||
-1.0, NewSafety, substep_no, 0 );
|
||||
G4cerr << " Point A (start) is " << CurrentA_PointVelocity << G4endl;
|
||||
G4cerr << " Point B (end) is " << CurrentB_PointVelocity << G4endl;
|
||||
G4cerr << " curveDist is " << curveDist << G4endl;
|
||||
G4cerr << " Point A (start) is " << CurrentA_PointVelocity
|
||||
<< G4endl;
|
||||
G4cerr << " Point B (end) is " << CurrentB_PointVelocity
|
||||
<< G4endl;
|
||||
G4cerr << " Curve distance is " << curveDist << G4endl;
|
||||
G4cerr << G4endl
|
||||
<< "The final curve point is not further along"
|
||||
<< " than the original!" << G4endl;
|
||||
@@ -1248,15 +1267,15 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
#endif
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4double lengthDone= newEndPoint.GetCurveLength()
|
||||
- CurrentStateA.GetCurveLength();
|
||||
G4double lengthDone = newEndPoint.GetCurveLength()
|
||||
- CurrentStateA.GetCurveLength();
|
||||
if( !goodAdvance )
|
||||
{
|
||||
if( fVerboseLevel >= 3 )
|
||||
{
|
||||
G4cout << MethodName << "> AccurateAdvance failed " ;
|
||||
G4cout << " in " << itrial << " integration trials/steps. " << G4endl
|
||||
G4cout << " It went only " << lengthDone << " instead of " << curveDist
|
||||
G4cout << " in " << itrial << " integration trials/steps. " << G4endl;
|
||||
G4cout << " It went only " << lengthDone << " instead of " << curveDist
|
||||
<< " -- a difference of " << curveDist - lengthDone << G4endl;
|
||||
G4cout << " ReEstimateEndpoint> Reset endPoint to original value!"
|
||||
<< G4endl;
|
||||
@@ -1366,17 +1385,17 @@ FindAndSetFieldManager( G4VPhysicalVolume* pCurrentPhysicalVolume)
|
||||
return currentFieldMgr;
|
||||
}
|
||||
|
||||
G4int G4PropagatorInField::SetVerboseLevel( G4int Verbose )
|
||||
G4int G4PropagatorInField::SetVerboseLevel( G4int level )
|
||||
{
|
||||
G4int oldval= fVerboseLevel;
|
||||
fVerboseLevel= Verbose;
|
||||
fVerboseLevel= level;
|
||||
|
||||
// Forward the verbose level 'reduced' to ChordFinder,
|
||||
// MagIntegratorDriver ... ?
|
||||
//
|
||||
G4MagInt_Driver* integrDriver= GetChordFinder()->GetIntegrationDriver();
|
||||
integrDriver->SetVerboseLevel( Verbose - 2 );
|
||||
G4cout << "Set Driver verbosity to " << Verbose - 2 << G4endl;
|
||||
integrDriver->SetVerboseLevel( fVerboseLevel - 2 );
|
||||
G4cout << "Set Driver verbosity to " << fVerboseLevel - 2 << G4endl;
|
||||
|
||||
return oldval;
|
||||
}
|
||||
|
||||
+350
@@ -0,0 +1,350 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RegularNavigation.cc,v 1.7 2007/12/10 16:30:01 gunter Exp $
|
||||
// GEANT4 tag $ Name:$
|
||||
//
|
||||
// class G4RegularNavigation implementation
|
||||
//
|
||||
// Author: Pedro Arce, May 2007
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4RegularNavigation.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4PhantomParameterisation.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4NormalNavigation.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4RegularNavigation::G4RegularNavigation()
|
||||
: fVerbose(1), fCheck(true)
|
||||
{
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4RegularNavigation::~G4RegularNavigation()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4double G4RegularNavigation::
|
||||
ComputeStep(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)
|
||||
{
|
||||
// This method is never called because to be called the daughter has to be
|
||||
// a regular structure. This would only happen if the track is in the mother
|
||||
// of voxels volume. But the voxels fill completely their mother, so when a
|
||||
// track enters the mother it automatically enters a voxel. Only precision
|
||||
// problems would make this method to be called
|
||||
|
||||
G4ThreeVector globalPoint =
|
||||
history.GetTopTransform().Inverse().TransformPoint(localPoint);
|
||||
G4ThreeVector globalDirection =
|
||||
history.GetTopTransform().Inverse().TransformAxis(localDirection);
|
||||
|
||||
G4ThreeVector localPoint2 = localPoint; // take away constantness
|
||||
|
||||
LevelLocate( history, *pBlockedPhysical, blockedReplicaNo,
|
||||
globalPoint, &globalDirection, true, localPoint2 );
|
||||
|
||||
|
||||
// Get in which voxel it is
|
||||
//
|
||||
G4VPhysicalVolume *motherPhysical, *daughterPhysical;
|
||||
G4LogicalVolume *motherLogical;
|
||||
motherPhysical = history.GetTopVolume();
|
||||
motherLogical = motherPhysical->GetLogicalVolume();
|
||||
daughterPhysical = motherLogical->GetDaughter(0);
|
||||
|
||||
G4PhantomParameterisation * daughterParam =
|
||||
(G4PhantomParameterisation*)(daughterPhysical->GetParameterisation());
|
||||
G4int copyNo = daughterParam ->GetReplicaNo(localPoint,localDirection);
|
||||
|
||||
G4ThreeVector voxelTranslation = daughterParam->GetTranslation( copyNo );
|
||||
G4ThreeVector daughterPoint = localPoint - voxelTranslation;
|
||||
|
||||
|
||||
// Compute step in voxel
|
||||
//
|
||||
return fnormalNav->ComputeStep(daughterPoint,
|
||||
localDirection,
|
||||
currentProposedStepLength,
|
||||
newSafety,
|
||||
history,
|
||||
validExitNormal,
|
||||
exitNormal,
|
||||
exiting,
|
||||
entering,
|
||||
pBlockedPhysical,
|
||||
blockedReplicaNo);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
|
||||
G4ThreeVector localPoint,
|
||||
const G4ThreeVector& localDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double& newSafety,
|
||||
G4NavigationHistory& history,
|
||||
G4bool& validExitNormal,
|
||||
G4ThreeVector& exitNormal,
|
||||
G4bool& exiting,
|
||||
G4bool& entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int& blockedReplicaNo,
|
||||
G4VPhysicalVolume* pCurrentPhysical)
|
||||
{
|
||||
G4PhantomParameterisation *param =
|
||||
(G4PhantomParameterisation*)(pCurrentPhysical->GetParameterisation());
|
||||
|
||||
if( !param->SkipEqualMaterials() ) {
|
||||
return fnormalNav->ComputeStep(localPoint,
|
||||
localDirection,
|
||||
currentProposedStepLength,
|
||||
newSafety,
|
||||
history,
|
||||
validExitNormal,
|
||||
exitNormal,
|
||||
exiting,
|
||||
entering,
|
||||
pBlockedPhysical,
|
||||
blockedReplicaNo);
|
||||
}
|
||||
|
||||
|
||||
G4double ourStep = 0.;
|
||||
|
||||
// To get replica No: transform local point to the reference system of the
|
||||
// param container volume
|
||||
//
|
||||
G4int ide = history.GetDepth();
|
||||
G4ThreeVector containerPoint = history.GetTransform(ide).Inverse().TransformPoint(localPoint);
|
||||
|
||||
// Point in global frame
|
||||
//
|
||||
containerPoint = history.GetTransform(ide).Inverse().TransformPoint(localPoint);
|
||||
|
||||
// Point in voxel parent volume frame
|
||||
//
|
||||
containerPoint = history.GetTransform(ide-1).TransformPoint(containerPoint);
|
||||
|
||||
// Store previous voxel translation to move localPoint by the difference
|
||||
// with the new one
|
||||
//
|
||||
G4ThreeVector prevVoxelTranslation = containerPoint - localPoint;
|
||||
|
||||
// Do not use the expression below: There are cases where the
|
||||
// fLastLocatedPointLocal does not give the correct answer
|
||||
// (particle reaching a wall and bounced back, particle travelling through
|
||||
// the wall that is deviated in an step, ...; these are pathological cases
|
||||
// that give wrong answers in G4PhantomParameterisation::GetReplicaNo()
|
||||
//
|
||||
// G4ThreeVector prevVoxelTranslation = param->GetTranslation( copyNo );
|
||||
|
||||
G4int copyNo = param->GetReplicaNo(containerPoint,localDirection);
|
||||
|
||||
G4Material* currentMate = param->ComputeMaterial( copyNo, 0, 0 );
|
||||
G4VSolid* voxelBox = pCurrentPhysical->GetLogicalVolume()->GetSolid();
|
||||
|
||||
G4VSolid* containerSolid = param->GetContainerSolid();
|
||||
G4Material* nextMate;
|
||||
G4bool bLocatedOnEdge = false;
|
||||
G4bool bFirstStep = true;
|
||||
G4double newStep;
|
||||
G4double totalNewStep = 0.;
|
||||
|
||||
// Loop while same material is found
|
||||
//
|
||||
for( ;; )
|
||||
{
|
||||
newStep = voxelBox->DistanceToOut( localPoint, localDirection );
|
||||
if( (bFirstStep) && (newStep < currentProposedStepLength) )
|
||||
{
|
||||
exiting = true;
|
||||
}
|
||||
bFirstStep = false;
|
||||
|
||||
newStep += kCarTolerance; // Avoid precision problems
|
||||
ourStep += newStep;
|
||||
totalNewStep += newStep;
|
||||
|
||||
// Physical process is limiting the step, don't continue
|
||||
//
|
||||
if(std::fabs(totalNewStep-currentProposedStepLength) < kCarTolerance)
|
||||
{
|
||||
return currentProposedStepLength;
|
||||
}
|
||||
|
||||
// Move container point until wall of voxel
|
||||
//
|
||||
containerPoint += newStep*localDirection;
|
||||
if( containerSolid->Inside( containerPoint ) != kInside )
|
||||
{
|
||||
bLocatedOnEdge = true; // NEEDED??
|
||||
break;
|
||||
}
|
||||
|
||||
// Get copyNo and translation of new voxel
|
||||
//
|
||||
copyNo = param->GetReplicaNo(containerPoint,localDirection);
|
||||
G4ThreeVector voxelTranslation = param->GetTranslation( copyNo );
|
||||
|
||||
// Move local point until wall of voxel and then put it in the new voxel
|
||||
// local coordinates
|
||||
//
|
||||
localPoint += newStep*localDirection;
|
||||
localPoint += prevVoxelTranslation - voxelTranslation;
|
||||
|
||||
prevVoxelTranslation = voxelTranslation;
|
||||
|
||||
// Check if material of next voxel is the same as that of the current voxel
|
||||
nextMate = param->ComputeMaterial( copyNo, 0, 0 );
|
||||
|
||||
if( currentMate != nextMate ) { break; }
|
||||
}
|
||||
|
||||
return ourStep;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4double
|
||||
G4RegularNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
const G4NavigationHistory& history,
|
||||
const G4double pMaxLength)
|
||||
{
|
||||
// This method is never called because to be called the daughter has to be a
|
||||
// regular structure. This would only happen if the track is in the mother of
|
||||
// voxels volume. But the voxels fill completely their mother, so when a
|
||||
// track enters the mother it automatically enters a voxel. Only precision
|
||||
// problems would make this method to be called
|
||||
|
||||
// Compute step in voxel
|
||||
//
|
||||
return fnormalNav->ComputeSafety(localPoint,
|
||||
history,
|
||||
pMaxLength );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4bool
|
||||
G4RegularNavigation::LevelLocate( G4NavigationHistory& history,
|
||||
const G4VPhysicalVolume* ,
|
||||
const G4int ,
|
||||
const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector& localPoint )
|
||||
{
|
||||
G4SmartVoxelHeader *motherVoxelHeader;
|
||||
G4VPhysicalVolume *motherPhysical, *pPhysical;
|
||||
G4PhantomParameterisation *pParam;
|
||||
G4LogicalVolume *motherLogical;
|
||||
G4VSolid *pSolid;
|
||||
G4ThreeVector localDir;
|
||||
G4int replicaNo;
|
||||
|
||||
motherPhysical = history.GetTopVolume();
|
||||
motherLogical = motherPhysical->GetLogicalVolume();
|
||||
motherVoxelHeader = motherLogical->GetVoxelHeader();
|
||||
|
||||
pPhysical = motherLogical->GetDaughter(0);
|
||||
pParam = (G4PhantomParameterisation*)(pPhysical->GetParameterisation());
|
||||
|
||||
pSolid = pParam->GetContainerSolid();
|
||||
|
||||
// Save parent history in touchable history
|
||||
// ... for use as parent t-h in ComputeMaterial method of param
|
||||
//
|
||||
G4TouchableHistory parentTouchable( history );
|
||||
|
||||
// Get local direction
|
||||
//
|
||||
if( globalDirection )
|
||||
{
|
||||
localDir = history.GetTopTransform().TransformAxis(*globalDirection);
|
||||
}
|
||||
else
|
||||
{
|
||||
localDir = G4ThreeVector(0.,0.,0.);
|
||||
}
|
||||
|
||||
// Check that track is not on the surface and check that track is not
|
||||
// exiting the voxel parent volume
|
||||
//
|
||||
if ( !G4AuxiliaryNavServices::CheckPointOnSurface(pSolid, localPoint,
|
||||
globalDirection, history.GetTopTransform(), pLocatedOnEdge)
|
||||
|| G4AuxiliaryNavServices::CheckPointExiting(pSolid, localPoint,
|
||||
globalDirection, history.GetTopTransform() ) )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enter this daughter
|
||||
//
|
||||
replicaNo = pParam->GetReplicaNo( localPoint, localDir );
|
||||
|
||||
if( replicaNo < 0 || replicaNo >= G4int(pParam->GetNoVoxel()) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the correct copy number in physical
|
||||
//
|
||||
pPhysical->SetCopyNo(replicaNo);
|
||||
pParam->ComputeTransformation(replicaNo,pPhysical);
|
||||
|
||||
history.NewLevel(pPhysical, kParameterised, replicaNo );
|
||||
localPoint = history.GetTopTransform().TransformPoint(globalPoint);
|
||||
|
||||
// Set the correct solid and material in Logical Volume
|
||||
//
|
||||
G4LogicalVolume *pLogical = pPhysical->GetLogicalVolume();
|
||||
|
||||
pLogical->UpdateMaterial(pParam->ComputeMaterial(replicaNo,
|
||||
pPhysical, &parentTouchable) );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.13 2007/05/18 07:31:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.17 2007/11/16 09:39:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation Implementation
|
||||
@@ -206,11 +206,13 @@ G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
case kPhi:
|
||||
if ( localPoint.y()<=0 )
|
||||
{
|
||||
safety = localPoint.x()*std::sin(width*0.5)+localPoint.y()*std::cos(width*0.5);
|
||||
safety = localPoint.x()*std::sin(width*0.5)
|
||||
+ localPoint.y()*std::cos(width*0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
safety = localPoint.x()*std::sin(width*0.5)-localPoint.y()*std::cos(width*0.5);
|
||||
safety = localPoint.x()*std::sin(width*0.5)
|
||||
- localPoint.y()*std::cos(width*0.5);
|
||||
}
|
||||
break;
|
||||
case kRho:
|
||||
@@ -268,12 +270,12 @@ G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
if ( Comp>0 )
|
||||
{
|
||||
lindist = width*0.5-coord;
|
||||
Dist = (lindist>kCarTolerance*0.5) ? lindist/Comp : 0;
|
||||
Dist = (lindist>0) ? lindist/Comp : 0;
|
||||
}
|
||||
else if ( Comp<0 )
|
||||
{
|
||||
lindist = width*0.5+coord;
|
||||
Dist = (lindist>kCarTolerance*0.5) ? -lindist/Comp : 0;
|
||||
Dist = (lindist>0) ? -lindist/Comp : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -757,6 +759,13 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
motherStep = motherSolid->DistanceToOut(repPoint,repDirection,true,
|
||||
&validExitNormal,&exitNormal);
|
||||
|
||||
// Push in principle no longer necessary. G4Navigator now takes care of ...
|
||||
// Removing this will however generate warnings for pushed particles from
|
||||
// G4Navigator, particularly for the case of 3D replicas (Cartesian or
|
||||
// combined Radial/Phi cases).
|
||||
// Requires further investigation and eventually reimplementation of
|
||||
// LevelLocate() to take into account point and direction ...
|
||||
//
|
||||
if ( ( !ourStep && (sampleSafety<0.5*kCarTolerance) )
|
||||
&& ( repLogical->GetSolid()->Inside(localPoint)==kSurface ) )
|
||||
{
|
||||
@@ -833,20 +842,20 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
sampleTf.TransformPoint(localPoint);
|
||||
const G4VSolid* sampleSolid =
|
||||
samplePhysical->GetLogicalVolume()->GetSolid();
|
||||
const G4double sampleSafety =
|
||||
const G4double sampleSafetyDistance =
|
||||
sampleSolid->DistanceToIn(samplePoint);
|
||||
if ( sampleSafety<ourSafety )
|
||||
if ( sampleSafetyDistance<ourSafety )
|
||||
{
|
||||
ourSafety = sampleSafety;
|
||||
ourSafety = sampleSafetyDistance;
|
||||
}
|
||||
if ( sampleSafety<=ourStep )
|
||||
if ( sampleSafetyDistance<=ourStep )
|
||||
{
|
||||
sampleDirection = sampleTf.TransformAxis(localDirection);
|
||||
const G4double sampleStep =
|
||||
const G4double sampleStepDistance =
|
||||
sampleSolid->DistanceToIn(samplePoint,sampleDirection);
|
||||
if ( sampleStep<=ourStep )
|
||||
if ( sampleStepDistance<=ourStep )
|
||||
{
|
||||
ourStep = sampleStep;
|
||||
ourStep = sampleStepDistance;
|
||||
entering = true;
|
||||
exiting = false;
|
||||
*pBlockedPhysical = samplePhysical;
|
||||
@@ -855,10 +864,11 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
// Check to see that the resulting point is indeed in/on volume.
|
||||
// This check could eventually be made only for successful candidate.
|
||||
|
||||
if ( ( fCheck ) && ( sampleStep < kInfinity ) )
|
||||
if ( ( fCheck ) && ( sampleStepDistance < kInfinity ) )
|
||||
{
|
||||
G4ThreeVector intersectionPoint;
|
||||
intersectionPoint= samplePoint + sampleStep * sampleDirection;
|
||||
intersectionPoint= samplePoint
|
||||
+ sampleStepDistance * sampleDirection;
|
||||
EInside insideIntPt= sampleSolid->Inside(intersectionPoint);
|
||||
if ( insideIntPt != kSurface )
|
||||
{
|
||||
@@ -867,8 +877,8 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
<< G4endl
|
||||
<< " Inaccurate DistanceToIn for solid "
|
||||
<< sampleSolid->GetName() << G4endl;
|
||||
G4cout << " Solid gave DistanceToIn = " << sampleStep
|
||||
<< " yet returns " ;
|
||||
G4cout << " Solid gave DistanceToIn = "
|
||||
<< sampleStepDistance << " yet returns " ;
|
||||
if ( insideIntPt == kInside )
|
||||
G4cout << "-kInside-";
|
||||
else if ( insideIntPt == kOutside )
|
||||
@@ -979,11 +989,11 @@ G4ReplicaNavigation::ComputeSafety(const G4ThreeVector &globalPoint,
|
||||
sampleTf.TransformPoint(localPoint);
|
||||
const G4VSolid *sampleSolid =
|
||||
samplePhysical->GetLogicalVolume()->GetSolid();
|
||||
const G4double sampleSafety =
|
||||
const G4double sampleSafetyDistance =
|
||||
sampleSolid->DistanceToIn(samplePoint);
|
||||
if ( sampleSafety<ourSafety )
|
||||
if ( sampleSafetyDistance<ourSafety )
|
||||
{
|
||||
ourSafety = sampleSafety;
|
||||
ourSafety = sampleSafetyDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4SafetyHelper.cc,v 1.12 2007/05/09 12:57:31 japost Exp $
|
||||
// $Id: G4SafetyHelper.cc,v 1.15 2007/11/14 10:04:21 gcosmo Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4SafetyHelper Implementation
|
||||
@@ -39,17 +39,18 @@
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
G4SafetyHelper::G4SafetyHelper() :
|
||||
fUseParallelGeometries(false), // By default, one geometry only
|
||||
fFirstCall(true),
|
||||
fLastSafetyPosition(0.0,0.0,0.0),
|
||||
fLastSafety(0.0),
|
||||
fRecomputeFactor(0.2)
|
||||
G4SafetyHelper::G4SafetyHelper()
|
||||
: fUseParallelGeometries(false), // By default, one geometry only
|
||||
fFirstCall(true),
|
||||
fLastSafetyPosition(0.0,0.0,0.0),
|
||||
fLastSafety(0.0),
|
||||
fRecomputeFactor(0.0)
|
||||
{
|
||||
fpPathFinder= 0; // Cannot initialise this yet - a loop results
|
||||
|
||||
// Initialization of the Navigator pointer is postponed, and must
|
||||
// be undertaken by another class calling InitialiseHelper()
|
||||
// be undertaken by another class calling InitialiseHelper()
|
||||
//
|
||||
fpMassNavigator= 0;
|
||||
fMassNavigatorId= -1;
|
||||
}
|
||||
@@ -64,6 +65,7 @@ void G4SafetyHelper::InitialiseNavigator()
|
||||
fpMassNavigator = pTransportMgr->GetNavigatorForTracking();
|
||||
|
||||
// Check
|
||||
//
|
||||
G4VPhysicalVolume* worldPV = fpMassNavigator->GetWorldVolume();
|
||||
if( worldPV == 0 )
|
||||
{
|
||||
@@ -84,7 +86,8 @@ void G4SafetyHelper::InitialiseHelper()
|
||||
}
|
||||
|
||||
G4SafetyHelper::~G4SafetyHelper()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
G4double
|
||||
G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
|
||||
@@ -103,6 +106,7 @@ G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
|
||||
|
||||
// TO-DO: Can replace this with a call to PathFinder
|
||||
// giving id of Mass Geometry --> this avoid doing the work twice
|
||||
|
||||
return linstep;
|
||||
}
|
||||
|
||||
@@ -110,10 +114,13 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position )
|
||||
{
|
||||
G4double newSafety;
|
||||
|
||||
// return last value if position is not significantly changed
|
||||
// Only recompute (calling Navigator/PathFinder) if 'position'
|
||||
// is *not* the safety location and has moved 'significantly'
|
||||
//
|
||||
G4double moveLen = (position-fLastSafetyPosition).mag();
|
||||
if(moveLen >= fRecomputeFactor*fLastSafety)
|
||||
G4double moveLengthSq = (position-fLastSafetyPosition).mag2();
|
||||
G4double safeDistance = fRecomputeFactor*fLastSafety;
|
||||
if( (moveLengthSq > 0.0 )
|
||||
&& (moveLengthSq >= safeDistance*safeDistance))
|
||||
{
|
||||
fLastSafetyPosition = position;
|
||||
|
||||
@@ -131,7 +138,14 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position )
|
||||
}
|
||||
else
|
||||
{
|
||||
newSafety = fLastSafety-moveLen;
|
||||
// return last value if position is not significantly changed
|
||||
//
|
||||
G4double moveLength = 0;
|
||||
if( moveLengthSq > 0.0 )
|
||||
{
|
||||
moveLength= std::sqrt(moveLengthSq);
|
||||
}
|
||||
newSafety = fLastSafety-moveLength;
|
||||
}
|
||||
return newSafety;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.cc,v 1.15 2007/04/12 11:51:48 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// G4TransportationManager
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.cc,v 1.7 2007/05/11 13:43:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation Implementation
|
||||
|
||||
Reference in New Issue
Block a user