Import Geant4 8.2.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.46 2006/05/22 08:25:12 gcosmo Exp $
|
||||
$Id: History,v 1.69 2006/11/23 18:54:27 japost Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,162 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
November 23rd, 2006 - J.Apostolakis (geomnav-V08-01-08)
|
||||
-----------------------------------
|
||||
- G4PathFinder:
|
||||
o Fix when report a problem - only if move > safety (additional check) *Key change*
|
||||
o Revised condition for extra checking against safety
|
||||
o Many small and cosmetic changes in debug printing.
|
||||
|
||||
November 18th, 2006 - J.Apostolakis (geomnav-V08-01-07)
|
||||
-----------------------------------
|
||||
- G4PathFinder:
|
||||
o Fix for problem when step is fully taken
|
||||
-- Note: this occurs due to optimisation in PiF that avoids calling G4(Multi)Navigator!!
|
||||
o Function LimitedString( ELimited lim ) enables printing this enum
|
||||
|
||||
Small/cosmetic
|
||||
- G4PathFinder:
|
||||
o Improved printing in IntersectChord. Deleted/simplified few prints in ComputeStep
|
||||
- G4MultiNavigator - cleanup, cosmetics
|
||||
|
||||
November 13th, 2006 - G.Cosmo (geomnav-V08-01-06)
|
||||
-----------------------------
|
||||
- Fixed compilation warnings and some cleanup ...
|
||||
|
||||
November 11th, 2006 - J.Apostolakis (geomnav-V08-01-05)
|
||||
-----------------------------------
|
||||
G4PathFinder improvements for parallel Navigation
|
||||
- ComputeStep method signature extended to add volume
|
||||
- Use G4MultiNavigator for tracking in field.
|
||||
G4MultiNavigator: several fixes, primarily for
|
||||
taking care of condition of geometry limited step.
|
||||
|
||||
November 11th, 2006 - J.Apostolakis (geomnav-V08-01-04)
|
||||
-----------------------------------
|
||||
- G4PropagatorInField:
|
||||
o Refined fix in LocateIntersectionPoint(), to subdivide
|
||||
in case it cannot find intersection point quickly (T.Nikitina).
|
||||
Second version, with several levels of cutting.
|
||||
o NOTE: Special tags made (later) not including the Developments in
|
||||
G4TransportationManager, G4PathFinder, G4SafetyHelper for parallel
|
||||
navigation. i.e. - based on tag "geomnav-V08-01-03".
|
||||
|
||||
November 11th, 2006 - J.Apostolakis
|
||||
-----------------------------------
|
||||
- Created G4MultiNavigator class and utilised it from G4PathFinder
|
||||
to implement curved trajectory parallel navigation.
|
||||
|
||||
November 10th, 2006 - J.Apostolakis (geomnav-V08-01-03)
|
||||
-----------------------------------
|
||||
- G4PropagatorInField:
|
||||
o Fix in LocateIntersectionPoint(), to subdivide in case it cannot find
|
||||
intersection point quickly (T.Nikitina).
|
||||
First version, only one level of cutting
|
||||
o NOTE: Special tags made (later) not including the Developments in
|
||||
G4TransportationManager, G4PathFinder, G4SafetyHelper for parallel
|
||||
navigation. i.e. - based on tag "geomnav-V08-01-02".
|
||||
|
||||
November 9th, 2006 - J.Apostolakis
|
||||
-----------------------------------
|
||||
- G4SafetyHelper:
|
||||
o Changed default value of 'fUseParallelGeometries' to 'false'.
|
||||
This is the default, except when using parallel geometries.
|
||||
Value 'true' will become the default.
|
||||
|
||||
November 4th, 2006 - M.Asai
|
||||
---------------------------
|
||||
- G4TransportationManager:
|
||||
o added new method SetWorldForTracking() to enable change of world from
|
||||
the RunManager.
|
||||
|
||||
October 31st, 2006 - J.Apostolakis
|
||||
----------------------------------
|
||||
- G4SafetyHelper
|
||||
o Added new class variable 'fUseParallelGeometries', to enable
|
||||
it to work call G4Navigator of Mass geometry directly, in
|
||||
the case of single geometry (when G4PathFinder is disabled).
|
||||
o Default value is currently 'true' --> for parallel navigation development.
|
||||
- G4PathFinder
|
||||
o Improved the code that checks within relocation whether position
|
||||
is proposed to be moved outside safety sphere from endpoint.
|
||||
|
||||
October 26th, 2006 - G.Cosmo (geomnav-V08-01-02)
|
||||
----------------------------
|
||||
- G4Navigator:
|
||||
o Added inline methods EnteredDaughterVolume() and ExitedMotherVolume() to
|
||||
allow for verification of a point entering a daughter volume or exiting
|
||||
the mother volume.
|
||||
o Made LocateGlobalPointAndSetup() method virtual. Moved to non virtual
|
||||
and inline LocateGlobalPointAndUpdateTouchableHandle() method.
|
||||
o Moved 'fHistory' data member to protected to aloow for more complete
|
||||
subclassing.
|
||||
o Minor cosmetics to recently introduced printout diagnostics in
|
||||
ComputeSafety() method.
|
||||
- G4TransportationManager:
|
||||
o Added methods to access the list of the registered worlds.
|
||||
- NOTE: this tag does NOT include the recent developments introduced for
|
||||
G4PathFinder. It resumes from tag "geomnav-V08-00-01"; anything else
|
||||
introduced after it, except for changes in G4Navigator, is NOT included !
|
||||
|
||||
October 25th, 2006 - J.Apostolakis
|
||||
----------------------------------
|
||||
- G4PathFinder: fixed initialisation of cached value for the
|
||||
G4TransportationManager to cope with singletons.
|
||||
|
||||
October 16th, 2006 - J.Apostolakis (geomnav-V08-01-01)
|
||||
----------------------------------
|
||||
- G4Navigator: moved debug printing behind fVerbose conditions
|
||||
|
||||
October 12th, 2006 - J.Apostolakis (geomnav-V08-01-00)
|
||||
----------------------------------
|
||||
- New class G4SafetyHelper to aid multiple scattering inn
|
||||
determining the correct Mass geometry step (via PathFinder)
|
||||
and all-geometry safety.
|
||||
- Several revisions, fixes to G4PathFinder.
|
||||
|
||||
June 8th, 2006 - J.Apostolakis (geomnav-V08-00-06)
|
||||
------------------------------
|
||||
- G4PathFinder:
|
||||
o New method 'ComputeSafety' to compute safety at endpoint of last step.
|
||||
|
||||
June 2nd, 2006 - J.Apostolakis (geomnav-V08-00-05)
|
||||
------------------------------
|
||||
- G4PathFinder:
|
||||
o New method ReLocate() for non-Transportation classes to call when moving
|
||||
the endpoint of a particle. Uses LocateGlobalPointWithinVolume() method
|
||||
of the navigators.
|
||||
o Small fixes and protection of debug printing with Verbose flag.
|
||||
o Default verbose level is now 0.
|
||||
|
||||
May 28th, 2006 - J.Apostolakis (geomnav-V08-00-04)
|
||||
------------------------------
|
||||
- G4PathFinder:
|
||||
o Check whether a process shifted the position since the last step.
|
||||
o Corrected checking for 'Unique', i.e. one process limiting step.
|
||||
o Revised printing (more information, some protected by verbose flag).
|
||||
|
||||
May 27th, 2006 - J.Apostolakis (geomnav-V08-00-03)
|
||||
------------------------------
|
||||
- G4PathFinder revised significantly:
|
||||
o Workaround for problem of CreateHistory() when outside world.
|
||||
o Revised for new counting of Navigator IDs (M.Asai).
|
||||
o Added MovePoint() method that signals if it moved.
|
||||
o Added state to cope with cases where a full step is taken,
|
||||
i.e. to cope with steps that return kInfinity:
|
||||
New state:
|
||||
RelocatedPoint - to show if it is moved;
|
||||
TrueMinStep - finite whereas reported can be kInfinity.
|
||||
and to aid in clarifying the state of the (singleton) object:
|
||||
LastStepNo - already kept in one method (static), now exposed;
|
||||
CurrentStepNo - mostly for debugging and printing out.
|
||||
o Small improvements in tests.
|
||||
|
||||
May 23rd, 2006 - J.Apostolakis (geomnav-V08-00-02)
|
||||
------------------------------
|
||||
- Added new prototype class G4PathFinder to coupled navigation
|
||||
in parallel geometries.
|
||||
|
||||
May 22nd, 2006 - G.Cosmo (geomnav-V08-00-01)
|
||||
------------------------
|
||||
- Extended G4TransportationManager to handle multiple navigators.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.hh,v 1.3 2006/06/29 18:35:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.icc,v 1.3 2006/06/29 18:35:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4DrawVoxels
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestErrorList.hh,v 1.3 2006/06/29 18:35:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestSegment.hh,v 1.3 2006/06/29 18:35:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4MultiNavigator.hh,v 1.3 2006/11/13 17:34:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4MultiNavigator
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Utility class for polling the navigators of several geometries to
|
||||
// identify the next boundary.
|
||||
|
||||
// History:
|
||||
// - Created. John Apostolakis, November 2006
|
||||
// *********************************************************************
|
||||
|
||||
#ifndef G4MULTINAVIGATOR_HH
|
||||
#define G4MULTINAVIGATOR_HH
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "geomdefs.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Navigator.hh"
|
||||
|
||||
#include "G4TouchableHistoryHandle.hh"
|
||||
|
||||
#include "G4NavigationHistory.hh"
|
||||
|
||||
enum ELimited { kDoNot,kUnique,kSharedTransport,kSharedOther,kUndefLimited };
|
||||
|
||||
class G4TransportationManager;
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
class G4MultiNavigator : public G4Navigator
|
||||
{
|
||||
public: // with description
|
||||
|
||||
friend std::ostream& operator << (std::ostream &os, const G4Navigator &n);
|
||||
|
||||
G4MultiNavigator();
|
||||
// Constructor - initialisers and setup.
|
||||
|
||||
~G4MultiNavigator();
|
||||
// Destructor. No actions.
|
||||
|
||||
G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
|
||||
const G4ThreeVector &pDirection,
|
||||
const G4double pCurrentProposedStepLength,
|
||||
G4double &pNewSafety);
|
||||
// Return the distance to the next boundary of any geometry
|
||||
|
||||
G4double ObtainFinalStep( G4int navigatorId,
|
||||
G4double &pNewSafety, // for this geom
|
||||
G4double &minStepLast,
|
||||
ELimited &limitedStep);
|
||||
// Get values for a single geometry
|
||||
|
||||
void PrepareNavigators();
|
||||
// Find which geometries are registered for this particles - and keep info
|
||||
void PrepareNewTrack( const G4ThreeVector position,
|
||||
const G4ThreeVector direction );
|
||||
// Prepare Navigators and locate
|
||||
|
||||
G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector &point,
|
||||
const G4ThreeVector &direction,
|
||||
const G4TouchableHistory &h);
|
||||
// Reset the geometrical hierarchy for all geometries.
|
||||
// Use the touchable history for the first (mass) geometry.
|
||||
// Return the volume in the first (mass) geometry.
|
||||
//
|
||||
// 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);
|
||||
// Locate in all geometries.
|
||||
// Return the volume in the first (mass) geometry
|
||||
// Maintain vector of other volumes, to be returned separately
|
||||
//
|
||||
// Important Note: In order to call this the geometry MUST be closed.
|
||||
|
||||
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
|
||||
// Relocate in all geometries for point that has not changed volume
|
||||
// (ie is within safety in all geometries or is distance less that
|
||||
// along the direction of a computed step.
|
||||
|
||||
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.
|
||||
|
||||
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
|
||||
// Returns a reference counted handle to a touchable history.
|
||||
|
||||
public: // without description
|
||||
|
||||
G4Navigator* GetNavigator(G4int n) const
|
||||
{
|
||||
if( (n>fNoActiveNavigators)||(n<0)){ n=0; }
|
||||
return fpNavigator[n];
|
||||
}
|
||||
|
||||
protected: // with description
|
||||
|
||||
void ResetState();
|
||||
// Utility method to reset the navigator state machine.
|
||||
|
||||
void SetupHierarchy();
|
||||
// Renavigate & reset hierarchy described by current history
|
||||
// o Reset volumes
|
||||
// o Recompute transforms and/or solids of replicated/parameterised
|
||||
// volumes.
|
||||
|
||||
void WhichLimited(); // Flag which processes limited the step
|
||||
void PrintLimited(); // Auxiliary, debugging printing
|
||||
void CheckMassWorld();
|
||||
|
||||
private:
|
||||
|
||||
// STATE Information
|
||||
|
||||
G4int fNoActiveNavigators;
|
||||
static const G4int fMaxNav = 8; // rename to kMaxNoNav ??
|
||||
G4VPhysicalVolume* fLastMassWorld;
|
||||
|
||||
// Global state (retained during stepping for one track
|
||||
G4Navigator* fpNavigator[fMaxNav]; // G4Navigator** fpNavigator;
|
||||
|
||||
// State after a step computation
|
||||
ELimited fLimitedStep[fMaxNav];
|
||||
G4bool fLimitTruth[fMaxNav];
|
||||
G4double fCurrentStepSize[fMaxNav];
|
||||
G4double fNewSafety[ fMaxNav ]; // Safety for starting point
|
||||
|
||||
// Lowest values - determine step length, and safety
|
||||
G4double fMinStep; // As reported by Navigators -- can be kInfinity
|
||||
G4double fMinSafety;
|
||||
G4double fTrueMinStep; // Corrected in case fMinStep >= proposed
|
||||
|
||||
// State after calling 'locate'
|
||||
G4VPhysicalVolume* fLocatedVolume[fMaxNav];
|
||||
G4ThreeVector fLastLocatedPosition;
|
||||
|
||||
// cache of safety information
|
||||
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
|
||||
|
||||
// STATE Auxiliary variables
|
||||
G4int fVerboseLevel;
|
||||
G4TransportationManager* pTransportManager; // Cache for frequent use
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.hh,v 1.14 2006/06/29 18:36:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4Navigator.hh,v 1.18 2006/11/11 01:17:49 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4Navigator
|
||||
@@ -113,6 +113,7 @@ class G4Navigator
|
||||
//
|
||||
// Important Note: In order to call this the geometry MUST be closed.
|
||||
|
||||
virtual
|
||||
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
|
||||
const G4ThreeVector* direction=0,
|
||||
const G4bool pRelativeSearch=true,
|
||||
@@ -133,7 +134,8 @@ class G4Navigator
|
||||
//
|
||||
// Important Note: In order to call this the geometry MUST be closed.
|
||||
|
||||
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
|
||||
virtual
|
||||
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
|
||||
// Notify the Navigator that a track has moved to the new Global point
|
||||
// 'position', that is known to be within the current safety.
|
||||
// No check is performed to ensure that it is within the volume.
|
||||
@@ -142,7 +144,7 @@ class G4Navigator
|
||||
// same volume as the previous position. Usually this can be guaranteed
|
||||
// only if the point is within safety.
|
||||
|
||||
virtual void LocateGlobalPointAndUpdateTouchableHandle(
|
||||
inline void LocateGlobalPointAndUpdateTouchableHandle(
|
||||
const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4TouchableHandle& oldTouchableToUpdate,
|
||||
@@ -164,8 +166,7 @@ class G4Navigator
|
||||
const G4ThreeVector& position,
|
||||
G4VTouchable* touchableToUpdate,
|
||||
const G4bool RelativeSearch = true);
|
||||
// Old version (missing direction).
|
||||
// Not recommended replace with newer version above.
|
||||
// Same as the method above but missing direction.
|
||||
|
||||
inline void SetGeometricallyLimitedStep();
|
||||
// Inform the navigator that the previous Step calculated
|
||||
@@ -215,6 +216,18 @@ class G4Navigator
|
||||
inline void Activate(G4bool flag);
|
||||
// Activate/inactivate the navigator.
|
||||
|
||||
inline G4bool EnteredDaughterVolume() const;
|
||||
// The purpose of this function is to inform the caller if the track is
|
||||
// entering a daughter volume while exiting from the current volume.
|
||||
// This method returns
|
||||
// - True only in case 1) above, that is when the Step has caused
|
||||
// the track to arrive at a boundary of a daughter.
|
||||
// - False in cases 2), 3) and 4), i.e. in all other cases.
|
||||
// This function is not guaranteed to work if SetGeometricallyLimitedStep()
|
||||
// was not called when it should have been called.
|
||||
inline G4bool ExitedMotherVolume() const;
|
||||
// Verify if the step has exited the mother volume.
|
||||
|
||||
inline void CheckMode(G4bool mode);
|
||||
// Run navigation in "check-mode", therefore using additional
|
||||
// verifications and more strict correctness conditions.
|
||||
@@ -240,13 +253,18 @@ class G4Navigator
|
||||
// Values: 1 (small problem), 5 (correcting),
|
||||
// 9 (ready to abandon), 10 (abandoned)
|
||||
|
||||
protected: // with description
|
||||
public: // with description
|
||||
|
||||
inline G4ThreeVector GetCurrentLocalCoordinate() const;
|
||||
// Return the local coordinate of the point in the reference system
|
||||
// of its containing volume that was found by LocalGlobalPointAndSetup.
|
||||
// The local coordinate of the last located track.
|
||||
|
||||
inline G4ThreeVector NetTranslation() const;
|
||||
inline G4RotationMatrix NetRotation() const;
|
||||
// Compute+return the local->global translation/rotation of current volume.
|
||||
|
||||
protected: // with description
|
||||
inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const;
|
||||
// Return position vector in local coordinate system, given a position
|
||||
// vector in world coordinate system.
|
||||
@@ -256,20 +274,6 @@ class G4Navigator
|
||||
// system of the volume that was found by LocalGlobalPointAndSetup.
|
||||
// The Local Coordinates of point in world coordinate system.
|
||||
|
||||
inline G4ThreeVector NetTranslation() const;
|
||||
inline G4RotationMatrix NetRotation() const;
|
||||
// Compute+return the local->global translation/rotation of current volume.
|
||||
|
||||
inline G4bool EnteredDaughterVolume();
|
||||
// The purpose of this function is to inform the caller if the track is
|
||||
// entering a daughter volume while exiting from the current volume.
|
||||
// This method returns
|
||||
// - True only in case 1) above, that is when the Step has caused
|
||||
// the track to arrive at a boundary of a daughter.
|
||||
// - False in cases 2), 3) and 4), i.e. in all other cases.
|
||||
// This function is not guaranteed to work if SetGeometricallyLimitedStep()
|
||||
// was not called when it should have been called.
|
||||
|
||||
virtual void ResetState();
|
||||
// Utility method to reset the navigator state machine.
|
||||
|
||||
@@ -285,20 +289,36 @@ class G4Navigator
|
||||
// o Recompute transforms and/or solids of replicated/parameterised
|
||||
// volumes.
|
||||
|
||||
private:
|
||||
protected: // without description
|
||||
|
||||
//
|
||||
// BEGIN State information
|
||||
//
|
||||
|
||||
G4NavigationHistory fHistory;
|
||||
// Transformation and history of the current path
|
||||
// through the geometrical hierarchy.
|
||||
|
||||
G4bool fEnteredDaughter;
|
||||
// A memory of whether in this Step a daughter volume is entered
|
||||
// (set in Compute & Locate).
|
||||
// After Compute: it expects to enter a daughter
|
||||
// After Locate: it has entered a daughter
|
||||
|
||||
G4bool fExitedMother;
|
||||
// A similar memory whether the Step exited current "mother" volume
|
||||
// completely, not entering daughter.
|
||||
|
||||
G4bool fWasLimitedByGeometry;
|
||||
// Set true if last Step was limited by geometry.
|
||||
|
||||
private:
|
||||
|
||||
G4bool fActive;
|
||||
// States if the navigator is activated or not.
|
||||
|
||||
G4ThreeVector fLastLocatedPointLocal;
|
||||
// Position of the last located point relative to its containing volume.
|
||||
|
||||
G4bool fWasLimitedByGeometry;
|
||||
// Set true if last Step was limited by geometry.
|
||||
G4bool fEntering,fExiting;
|
||||
// Entering/Exiting volumes blocking/setup
|
||||
// o If exiting
|
||||
@@ -314,23 +334,12 @@ class G4Navigator
|
||||
G4VPhysicalVolume *fCandidatePhysicalVolume;
|
||||
G4int fCandidateReplicaNo;
|
||||
|
||||
G4bool fEnteredDaughter; // A memory of whether in this Step a daughter
|
||||
// volume is entered (set in Compute & Locate)
|
||||
// After Compute: it expects to enter a daughter
|
||||
// After Locate: it has entered a daughter
|
||||
G4bool fExitedMother; // A similar memory whether the Step exited
|
||||
// current "mother" volume completely,
|
||||
// not entering daughter.
|
||||
|
||||
G4bool fValidExitNormal; // Set true if have leaving volume normal
|
||||
G4ThreeVector fExitNormal; // Leaving volume normal, in the
|
||||
// volume containing the exited
|
||||
// volume's coordinate system
|
||||
G4ThreeVector fGrandMotherExitNormal; // Leaving volume normal, in its
|
||||
// own coordinate system
|
||||
G4NavigationHistory fHistory;
|
||||
// Transformation & `path' history of current path
|
||||
// through geomtrical hierarchy
|
||||
|
||||
// Count zero steps - as one or two can occur due to changing momentum at
|
||||
// a boundary or at an edge common between volumes
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.icc,v 1.10 2006/06/29 18:36:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4Navigator.icc,v 1.12 2006/10/27 09:13:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4Navigator Inline implementation
|
||||
@@ -287,15 +287,30 @@ G4TouchableHistory* G4Navigator::CreateTouchableHistory() const
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// EnteredDaughterVolume
|
||||
//
|
||||
// To inform the caller if the track is entering a daughter volume
|
||||
// LocateGlobalPointAndUpdateTouchableHandle
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4bool G4Navigator::EnteredDaughterVolume()
|
||||
void G4Navigator::LocateGlobalPointAndUpdateTouchableHandle(
|
||||
const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4TouchableHandle& oldTouchableToUpdate,
|
||||
const G4bool RelativeSearch )
|
||||
{
|
||||
return fEnteredDaughter;
|
||||
G4VPhysicalVolume* pPhysVol;
|
||||
pPhysVol = LocateGlobalPointAndSetup( position,&direction,RelativeSearch );
|
||||
if( fEnteredDaughter || fExitedMother )
|
||||
{
|
||||
oldTouchableToUpdate = CreateTouchableHistory();
|
||||
if( pPhysVol == 0 )
|
||||
{
|
||||
// We want to ensure that the touchable is correct in this case.
|
||||
// The method below should do this and recalculate a lot more ....
|
||||
//
|
||||
oldTouchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -346,7 +361,7 @@ G4int G4Navigator::GetVerboseLevel() const
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
void G4Navigator::SetVerboseLevel(G4int level)
|
||||
void G4Navigator::SetVerboseLevel(G4int level)
|
||||
{
|
||||
fVerbose = level;
|
||||
fnormalNav.SetVerboseLevel(level);
|
||||
@@ -370,11 +385,33 @@ G4bool G4Navigator::IsActive() const
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
void G4Navigator::Activate(G4bool flag)
|
||||
void G4Navigator::Activate(G4bool flag)
|
||||
{
|
||||
fActive = flag;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// EnteredDaughterVolume
|
||||
//
|
||||
// To inform the caller if the track is entering a daughter volume
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4bool G4Navigator::EnteredDaughterVolume() const
|
||||
{
|
||||
return fEnteredDaughter;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// ExitedMotherVolume
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4bool G4Navigator::ExitedMotherVolume() const
|
||||
{
|
||||
return fExitedMother;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// CheckMode
|
||||
// ********************************************************************
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.hh,v 1.4 2006/06/29 18:36:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.icc,v 1.4 2006/06/29 18:36:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// G4NormalNavigation Inline Implementation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.hh,v 1.5 2006/06/29 18:36:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.icc,v 1.6 2006/06/29 18:36:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Inline implementation
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4PathFinder.hh,v 1.20 2006/11/11 01:23:35 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// class G4PathFinder
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This class directs the lock-stepped propagation of a track in the
|
||||
// 'mass' and other parallel geometries. It ensures that tracking
|
||||
// in a magnetic field sees these parallel geometries at each trial step,
|
||||
// and that the earliest boundary limits the step.
|
||||
//
|
||||
// For the movement in field, it relies on the class G4PropagatorInField
|
||||
//
|
||||
// History:
|
||||
// -------
|
||||
// 7.10.05 John Apostolakis, Draft design
|
||||
// 26.04.06 John Apostolakis, Revised design and first implementation
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef G4PATHFINDER_HH
|
||||
#define G4PATHFINDER_HH 1
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include <vector>
|
||||
|
||||
#include "G4FieldTrack.hh"
|
||||
// class G4FieldManager; // #include "G4FieldManager.hh"
|
||||
// class G4Navigator;
|
||||
// class G4VPhysicalVolume;
|
||||
// class G4VCurvedTrajectoryFilter;
|
||||
class G4TransportationManager;
|
||||
class G4Navigator;
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4FieldTrack.hh"
|
||||
|
||||
// enum ELimited { kDoNot, kUnique, kSharedTransport, kSharedOther, kUndefLimited };
|
||||
// #include "G4Elimited.hh"
|
||||
|
||||
// class G4MultiNavigator; // --> Moved Elimited to G4MultiNavigator
|
||||
#include "G4MultiNavigator.hh"
|
||||
class G4PropagatorInField;
|
||||
|
||||
class G4PathFinder
|
||||
{
|
||||
|
||||
public: // with description
|
||||
|
||||
static G4PathFinder* GetInstance(); // Singleton
|
||||
~G4PathFinder();
|
||||
|
||||
|
||||
// Attempt next step
|
||||
//
|
||||
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,
|
||||
G4FieldTrack &EndState,
|
||||
G4VPhysicalVolume* currentVolume
|
||||
);
|
||||
// Compute the next geometric Step -- Curved or linear
|
||||
|
||||
void Locate( const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4bool relativeSearch= true);
|
||||
// Make primary relocation of global point in all navigators, and update them.
|
||||
|
||||
void ReLocate( const G4ThreeVector& position );
|
||||
// Make secondary relocation of global point (within safety only)
|
||||
// in all navigators, and update them.
|
||||
|
||||
void PrepareNewTrack( G4ThreeVector position, G4ThreeVector direction);
|
||||
// Check and cache set of active navigators
|
||||
|
||||
G4TouchableHandle CreateTouchableHandle( G4int navId) const;
|
||||
// Also? G4TouchableCreator& GetTouchableCreator( G4int navId ) const;
|
||||
inline G4VPhysicalVolume* GetLocatedVolume( G4int navId ) const;
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
inline void SetChargeMomentumMass( G4double charge, // in e+ units
|
||||
G4double momentum, // in Geant4 units
|
||||
G4double pMass );
|
||||
|
||||
inline G4bool IsParticleLooping() const;
|
||||
|
||||
G4double GetCurrentSafety() const { return fMinSafety; }
|
||||
// Minimum value of safety after last ComputeStep
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector& pGlobalPoint );
|
||||
// Recompute safety for the relevant point - the endpoint of the last step!!
|
||||
|
||||
void EnableParallelNavigation(G4bool enableChoice= true);
|
||||
// Must call it to ensure that PathFinder is prepared,
|
||||
// especially for curved tracks
|
||||
// --> if true it switches PropagatorInField to use MultiNavigator.
|
||||
// Must call it with false to undo (=PiF use Navigator for tracking!)
|
||||
|
||||
inline G4int SetVerboseLevel(G4int lev=-1);
|
||||
// inline G4int GetVerboseLevel() const;
|
||||
|
||||
public: // with description
|
||||
|
||||
inline G4int GetMaxLoopCount() const;
|
||||
inline void SetMaxLoopCount( G4int new_max );
|
||||
// A maximum for the number of steps that a (looping) particle can take.
|
||||
|
||||
public: // without description
|
||||
void MovePoint(){ fRelocatedPoint= true; }
|
||||
// Signal that location will be moved -- internal use primarily
|
||||
|
||||
protected: // without description
|
||||
G4double DoNextLinearStep( const G4FieldTrack &FieldTrack,
|
||||
G4double proposedStepLength);
|
||||
|
||||
G4double DoNextCurvedStep( const G4FieldTrack &FieldTrack,
|
||||
G4double proposedStepLength,
|
||||
G4VPhysicalVolume* pCurrentPhysVolume);
|
||||
|
||||
void WhichLimited();
|
||||
void PrintLimited(); // Print key details out - for debugging
|
||||
//
|
||||
// void SetTrajectoryFilter(G4VCurvedTrajectoryFilter* filter);
|
||||
// Set the filter that examines & stores 'intermediate'
|
||||
// curved trajectory points. Currently only position is stored.
|
||||
|
||||
void ClearState();
|
||||
// Clear all the State of this class and its current associates
|
||||
|
||||
inline G4bool UseSafetyForOptimization( G4bool );
|
||||
// Whether to safety to discard
|
||||
// unneccesary calls to navigator (thus 'optimising' performance)
|
||||
|
||||
protected:
|
||||
G4Navigator* GetNavigator(G4int n) const {
|
||||
if( (n>fNoActiveNavigators)||(n<0)){ n=0; }
|
||||
return fpNavigator[n];
|
||||
}
|
||||
|
||||
private:
|
||||
G4PathFinder(); // Singleton
|
||||
|
||||
private:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// DATA Members
|
||||
// ----------------------------------------------------------------------
|
||||
// std::vector<G4Navigator*> fActiveNavigators;
|
||||
//
|
||||
G4MultiNavigator *fpMultiNavigator;
|
||||
// Object that enables G4PropagatorInField to see many geometries
|
||||
|
||||
G4int fNoActiveNavigators;
|
||||
// G4int fNoNavigators;
|
||||
G4bool fNewTrack; // Flag a new track (ensure first step)
|
||||
|
||||
static const G4int fMaxNav = 8; // rename to kMaxNoNav ??
|
||||
// enum EMaximumNavs { fMaxNav = 8; }
|
||||
|
||||
// Global state (retained during stepping for one track
|
||||
G4Navigator* fpNavigator[fMaxNav]; // G4Navigator** fpNavigator;
|
||||
// State after a step computation
|
||||
ELimited fLimitedStep[fMaxNav];
|
||||
G4bool fLimitTruth[fMaxNav];
|
||||
G4double fCurrentStepSize[fMaxNav];
|
||||
G4double fNewSafety[ fMaxNav ]; // Safety for starting point
|
||||
G4double fMinSafety;
|
||||
|
||||
G4double fMinStep; // As reported by Navigators -- can be kInfinity
|
||||
G4double fTrueMinStep; // Corrected in case >= proposed
|
||||
// State after calling 'locate'
|
||||
G4VPhysicalVolume* fLocatedVolume[fMaxNav];
|
||||
G4ThreeVector fLastLocatedPosition;
|
||||
// G4ThreeVector fLastLocatedDirection;
|
||||
|
||||
G4FieldTrack fEndState;
|
||||
// End point storage
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
// ********************************************************************
|
||||
// Inline methods.
|
||||
// ********************************************************************
|
||||
inline G4VPhysicalVolume* G4PathFinder::GetLocatedVolume( G4int navId ) const
|
||||
{ G4VPhysicalVolume* vol=0;
|
||||
if( (navId < fMaxNav) && (navId >=0) ) { vol= fLocatedVolume[navId]; }
|
||||
return vol;
|
||||
}
|
||||
|
||||
inline G4int G4PathFinder::SetVerboseLevel(G4int newLevel)
|
||||
{ G4int old= fVerboseLevel; fVerboseLevel= newLevel; return old;
|
||||
}
|
||||
// #include "G4PathFinder.icc"
|
||||
|
||||
#endif
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.hh,v 1.9 2006/06/29 18:36:15 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4PropagatorInField.hh,v 1.10 2006/11/11 01:25:29 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// class G4PropagatorInField
|
||||
//
|
||||
@@ -143,6 +143,8 @@ class G4PropagatorInField
|
||||
public: // without description
|
||||
|
||||
inline G4FieldManager* GetCurrentFieldManager();
|
||||
inline void SetNavigatorForPropagating( G4Navigator *SimpleOrMultiNavigator );
|
||||
inline G4Navigator* GetNavigatorForPropagating();
|
||||
|
||||
public: // no description
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.icc,v 1.8 2006/06/29 18:36:17 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4PropagatorInField.icc,v 1.10 2006/11/13 17:34:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -255,4 +255,15 @@ G4bool G4PropagatorInField::GetUseSafetyForOptimization()
|
||||
return fUseSafetyForOptimisation;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4PropagatorInField::
|
||||
SetNavigatorForPropagating( G4Navigator *SimpleOrMultiNavigator )
|
||||
{
|
||||
if(SimpleOrMultiNavigator) { fNavigator= SimpleOrMultiNavigator; }
|
||||
}
|
||||
|
||||
inline
|
||||
G4Navigator* G4PropagatorInField::GetNavigatorForPropagating()
|
||||
{
|
||||
return fNavigator;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.hh,v 1.4 2006/06/29 18:36:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.icc,v 1.5 2006/06/29 18:36:22 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation Inline implementation
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4SafetyHelper.hh,v 1.3 2006/10/31 16:53:06 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4SafetyHelper
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This class is a helper for physics processes which require
|
||||
// knowledge of the safety, and the step size for the 'mass' geometry
|
||||
|
||||
// First version: J. Apostolakis, July 5th, 2006
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef G4SAFETYHELPER_HH
|
||||
#define G4SAFETYHELPER_HH 1
|
||||
|
||||
#include <vector>
|
||||
#include "G4Types.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4Navigator;
|
||||
class G4PathFinder;
|
||||
|
||||
class G4SafetyHelper
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4SafetyHelper();
|
||||
~G4SafetyHelper();
|
||||
//
|
||||
// Constructor and destructor
|
||||
|
||||
G4double ComputeMassStep( const G4ThreeVector &position,
|
||||
const G4ThreeVector &direction,
|
||||
G4double &newSafety );
|
||||
//
|
||||
// Return step for mass geometry
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector& pGlobalPoint );
|
||||
//
|
||||
// Return safety for all geometries
|
||||
|
||||
void ReLocateWithinVolume(const G4ThreeVector& pGlobalPoint );
|
||||
//
|
||||
// Relocate the point in the volume of interest
|
||||
|
||||
public: // with description
|
||||
static void EnableParallelNavigation(G4bool parallel)
|
||||
{ fUseParallelGeometries= parallel; }
|
||||
//
|
||||
// To have parallel worlds considered, must be true.
|
||||
// Alternative is to use single (mass) Navigator directly
|
||||
|
||||
void InitialiseNavigator();
|
||||
//
|
||||
// Check for new navigator for tracking, and reinitialise pointer
|
||||
|
||||
private:
|
||||
|
||||
G4PathFinder* fpPathFinder;
|
||||
G4Navigator* fpMassNavigator;
|
||||
G4int fMassNavigatorId;
|
||||
|
||||
static G4bool fUseParallelGeometries;
|
||||
// Flag whether to use PathFinder or single (mass) Navigator directly
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.hh,v 1.8 2006/06/29 18:36:24 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4TransportationManager.hh,v 1.10 2006/11/03 20:03:26 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// class G4TransportationManager
|
||||
//
|
||||
@@ -71,10 +71,18 @@ class G4TransportationManager
|
||||
inline void SetNavigatorForTracking( G4Navigator* newNavigator );
|
||||
// Accessors for the navigator for tracking
|
||||
|
||||
inline void SetWorldForTracking(G4VPhysicalVolume* theWorld);
|
||||
// Set the world volume for tracking
|
||||
// This method is to be invoked by G4RunManagerKernel.
|
||||
|
||||
inline size_t GetNoActiveNavigators() const;
|
||||
inline std::vector<G4Navigator*>::iterator GetActiveNavigatorsIterator();
|
||||
// Return an iterator to the list of active navigators
|
||||
|
||||
inline size_t GetNoWorlds() const;
|
||||
inline std::vector<G4VPhysicalVolume*>::iterator GetWorldsIterator();
|
||||
// Return an iterator to the list of registered worlds
|
||||
|
||||
G4VPhysicalVolume* GetParallelWorld ( const G4String& worldName );
|
||||
// Return an exact copy of the tracking world volume. If already
|
||||
// existing just return the pointer
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.icc,v 1.6 2006/06/29 18:36:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4TransportationManager.icc,v 1.9 2006/11/03 20:16:50 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 inlined function members implementation
|
||||
// ------------------------------------------------------------
|
||||
@@ -47,6 +47,18 @@ G4Navigator* G4TransportationManager::GetNavigatorForTracking() const
|
||||
return fNavigators[0];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetWorldForTracking()
|
||||
//
|
||||
// Set the tracking world volume. This method is to be invoked by G4RunManagerKernel.
|
||||
//
|
||||
inline
|
||||
void G4TransportationManager::SetWorldForTracking(G4VPhysicalVolume* theWorld)
|
||||
{
|
||||
fWorlds[0] = theWorld;
|
||||
fNavigators[0]->SetWorldVolume(theWorld);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetNavigatorForTracking()
|
||||
//
|
||||
@@ -96,7 +108,7 @@ G4FieldManager* G4TransportationManager::GetFieldManager() const
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetNoActiveNavigators()
|
||||
//
|
||||
// Return an iterator to the list of active navigators.
|
||||
// Return the number of active navigators.
|
||||
//
|
||||
inline
|
||||
size_t G4TransportationManager::GetNoActiveNavigators() const
|
||||
@@ -117,3 +129,28 @@ G4TransportationManager::GetActiveNavigatorsIterator()
|
||||
= std::vector<G4Navigator*>::iterator(fActiveNavigators.begin());
|
||||
return iterator;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetNoWorlds()
|
||||
//
|
||||
// Return the number of registerd worlds.
|
||||
//
|
||||
inline
|
||||
size_t G4TransportationManager::GetNoWorlds() const
|
||||
{
|
||||
return fWorlds.size();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetWorldsIterator()
|
||||
//
|
||||
// Return an iterator to the list of registered worlds.
|
||||
//
|
||||
inline
|
||||
std::vector<G4VPhysicalVolume*>::iterator
|
||||
G4TransportationManager::GetWorldsIterator()
|
||||
{
|
||||
std::vector<G4VPhysicalVolume*>::iterator iterator
|
||||
= std::vector<G4VPhysicalVolume*>::iterator(fWorlds.begin());
|
||||
return iterator;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.hh,v 1.4 2006/06/29 18:36:28 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.icc,v 1.4 2006/06/29 18:36:30 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DrawVoxels.cc,v 1.4 2006/06/29 18:36:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4DrawVoxels
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestErrorList.cc,v 1.3 2006/06/29 18:36:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestSegment.cc,v 1.5 2006/06/29 18:36:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestStreamLogger.cc,v 1.3 2006/06/29 18:36:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// 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-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolume.cc,v 1.5 2006/06/29 18:36:55 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryMessenger.cc,v 1.5 2006/06/29 18:36:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -0,0 +1,700 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4MultiNavigator.cc,v 1.4 2006/11/14 15:41:56 japost Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4PathFinder Implementation
|
||||
//
|
||||
// Author: John Apostolakis, November 2006
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4MultiNavigator.hh"
|
||||
|
||||
class G4FieldManager;
|
||||
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
// ********************************************************************
|
||||
// Constructor
|
||||
// ********************************************************************
|
||||
//
|
||||
G4MultiNavigator::G4MultiNavigator()
|
||||
// : fpActiveNavigators()
|
||||
: G4Navigator(),
|
||||
fVerboseLevel(1)
|
||||
{
|
||||
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;
|
||||
|
||||
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*);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
G4double safety= 0.0, step=0.0;
|
||||
G4double minSafety= DBL_MAX, minStep= DBL_MAX;
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << " G4MultiNavigator::ComputeStep : entered " << G4endl;
|
||||
G4cout << " Input position= " << pGlobalPoint
|
||||
<< " direction= " << pDirection << G4endl;
|
||||
G4cout << " Requested step= " << proposedStepLength << G4endl;
|
||||
}
|
||||
|
||||
std::vector<G4Navigator*>::iterator pNavigatorIter;
|
||||
|
||||
pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
|
||||
|
||||
G4ThreeVector initialPosition= pGlobalPoint;
|
||||
G4ThreeVector initialDirection= pDirection;
|
||||
|
||||
G4int num=0;
|
||||
for( num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num ) {
|
||||
safety= DBL_MAX;
|
||||
|
||||
step= (*pNavigatorIter)->ComputeStep( initialPosition,
|
||||
initialDirection,
|
||||
proposedStepLength,
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
fMinStep= minStep;
|
||||
|
||||
G4double trueMinStep= minStep;
|
||||
if( fMinStep == kInfinity ){
|
||||
trueMinStep = proposedStepLength; // Use this below for endpoint !!
|
||||
}
|
||||
fTrueMinStep = trueMinStep;
|
||||
|
||||
if( fVerboseLevel > 1 ){
|
||||
G4ThreeVector endPosition;
|
||||
endPosition= initialPosition + trueMinStep * initialDirection ;
|
||||
|
||||
int oldPrec= G4cout.precision(8);
|
||||
G4cout << "G4MultiNavigator::ComputeStep : "
|
||||
<< " initialPosition = " << initialPosition
|
||||
<< " and endPosition = " << endPosition<< G4endl;
|
||||
G4cout.precision( oldPrec );
|
||||
}
|
||||
|
||||
pNewSafety= minSafety;
|
||||
// Set the EndState
|
||||
// fEndState= initialState;
|
||||
// fEndState.SetPosition( endPosition );
|
||||
// fEndState.SetProperTimeOfFlight( -1.000 ); // Not defined YET
|
||||
// fEndState.SetMomentum( initialState.GetMomentum );
|
||||
|
||||
this->WhichLimited();
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << " G4MultiNavigator::ComputeStep : exits returning " << minStep << G4endl;
|
||||
}
|
||||
|
||||
return minStep; // must return kInfinity if do not limit step
|
||||
}
|
||||
|
||||
G4double
|
||||
G4MultiNavigator::ObtainFinalStep( G4int navigatorId,
|
||||
G4double &pNewSafety, // for this geom
|
||||
G4double &minStep,
|
||||
ELimited &limitedStep)
|
||||
{
|
||||
G4int navigatorNo=-1;
|
||||
|
||||
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"); }
|
||||
|
||||
// Prepare the information to return
|
||||
pNewSafety = fNewSafety[ navigatorNo ];
|
||||
limitedStep = fLimitedStep[ navigatorNo ];
|
||||
minStep= fMinStep;
|
||||
|
||||
// if( (minStep==kInfinity) || (fVerboseLevel > 1) ){
|
||||
if( fVerboseLevel > 1 ){
|
||||
G4cout << " G4MultiNavigator::ComputeStep returns " << fCurrentStepSize[ navigatorNo ]
|
||||
<< " for Navigator " << navigatorNo << " Limited step = " << limitedStep
|
||||
<< " Safety(mm) = " << pNewSafety / mm << G4endl;
|
||||
}
|
||||
|
||||
return fCurrentStepSize[ navigatorNo ];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4MultiNavigator::PrepareNewTrack( const G4ThreeVector position,
|
||||
const G4ThreeVector direction )
|
||||
{
|
||||
if( fVerboseLevel > 1 )
|
||||
G4cout << " Entered G4MultiNavigator::PrepareNewTrack() " << G4endl;
|
||||
|
||||
G4MultiNavigator::PrepareNavigators();
|
||||
//***********************************
|
||||
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << " Calling MultiNavigator::Locate() from G4MultiNavigator::PrepareNewTrack() "
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
this->LocateGlobalPointAndSetup( position, &direction, false, false );
|
||||
// =========================
|
||||
// The first location for each Navigator must be non-relative
|
||||
// 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()
|
||||
{
|
||||
// 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();
|
||||
|
||||
// fNavigators= true;
|
||||
// this->MovePoint(); // Signal further that the last status is wiped
|
||||
|
||||
// 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");
|
||||
}
|
||||
|
||||
pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
|
||||
for( num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num ) {
|
||||
|
||||
// Keep information in carray ... for returning information stored
|
||||
fpNavigator[num] = *pNavigatorIter;
|
||||
fLimitTruth[num] = false;
|
||||
fLimitedStep[num] = kDoNot;
|
||||
fCurrentStepSize[num] = 0.0;
|
||||
fLocatedVolume[num] = 0;
|
||||
}
|
||||
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) ) {
|
||||
// Pass along change to Mass Navigator
|
||||
fpNavigator[0] -> SetWorldVolume( massWorld );
|
||||
if( fVerboseLevel > 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;
|
||||
}
|
||||
}
|
||||
|
||||
if( fVerboseLevel > 2 ) {
|
||||
G4cout << " G4MultiNavigator::PrepareNavigators : exiting. " << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
G4VPhysicalVolume*
|
||||
G4MultiNavigator::LocateGlobalPointAndSetup(const G4ThreeVector& position,
|
||||
const G4ThreeVector* pDirection,
|
||||
const G4bool pRelativeSearch,
|
||||
const G4bool ignoreDirection )
|
||||
{
|
||||
// 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;
|
||||
|
||||
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.");
|
||||
}
|
||||
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] ) {
|
||||
(*pNavIter)->SetGeometricallyLimitedStep();
|
||||
}
|
||||
|
||||
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 ){
|
||||
G4cout << pLocated->GetName() << "'";
|
||||
G4cout << " - CopyNo= " << pLocated->GetCopyNo();
|
||||
} else {
|
||||
G4cout << "Null' Id: Not-Set ";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
} // ending for (num= ....
|
||||
fWasLimitedByGeometry= false; // Clear on locating
|
||||
|
||||
if( fVerboseLevel > 2 ){
|
||||
G4cout << " G4MultiNavigator::Locate : exiting. " << G4endl << G4endl;
|
||||
}
|
||||
// fRelocatedPoint= false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
for ( num=0; num< fNoActiveNavigators ; ++pNavIter,++num ) {
|
||||
// ... none limited the step
|
||||
|
||||
// G4VPhysicalVolume physVolume=
|
||||
(*pNavIter)->LocateGlobalPointWithinVolume( position );
|
||||
//*************************************//
|
||||
|
||||
// Clear state related to the step
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
G4double G4MultiNavigator::ComputeSafety( const G4ThreeVector& position,
|
||||
G4double maxDistance)
|
||||
// Recompute safety for the relevant point
|
||||
{
|
||||
G4double minSafety= DBL_MAX;
|
||||
// G4cout << " G4MultiNavigator::ComputeSafety - called at " << position << G4endl;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
fSafetyLocation= position;
|
||||
fMinSafety_atSafLocation = minSafety;
|
||||
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << " G4MultiNavigator::ComputeSafety - returns "
|
||||
<< minSafety << " at location " << position
|
||||
<< G4endl;
|
||||
}
|
||||
return minSafety;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
G4TouchableHistoryHandle
|
||||
G4MultiNavigator::CreateTouchableHistoryHandle() const
|
||||
{
|
||||
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() );
|
||||
}
|
||||
|
||||
return G4TouchableHistoryHandle(touchHist);
|
||||
}
|
||||
|
||||
void
|
||||
G4MultiNavigator::WhichLimited() // Flag which processes limited the step
|
||||
{
|
||||
G4int num=-1, last=-1;
|
||||
const G4int IdTransport= 0; // Id of Mass Navigator !!
|
||||
G4int noLimited=0;
|
||||
ELimited shared= kSharedOther;
|
||||
|
||||
if( fVerboseLevel > 2 )
|
||||
G4cout << " G4MultiNavigator::WhichLimited - entered " << G4endl;
|
||||
|
||||
// Assume that [IdTransport] is Mass / Transport
|
||||
// G4bool transportLimited = (fCurrentStepSize[IdTransport] == fMinStep);
|
||||
G4bool transportLimited = (fCurrentStepSize[IdTransport] == fMinStep)
|
||||
&& ( fMinStep!= kInfinity) ;
|
||||
if( transportLimited ){
|
||||
shared= kSharedTransport;
|
||||
}
|
||||
|
||||
for ( 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 ) {
|
||||
noLimited++;
|
||||
fLimitedStep[num] = shared;
|
||||
last= num;
|
||||
}else{
|
||||
fLimitedStep[num] = kDoNot;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
int num;
|
||||
for ( num= 0; num < fNoActiveNavigators; num++ ) {
|
||||
G4double rawStep = fCurrentStepSize[num];
|
||||
G4double stepLen = fCurrentStepSize[num];
|
||||
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 << " "
|
||||
<< 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;
|
||||
}
|
||||
G4cout << " " << std::setw(15) << limitedStr << " ";
|
||||
G4cout.precision(oldPrec);
|
||||
|
||||
G4Navigator *pNav= fpNavigator[ num ];
|
||||
G4String WorldName( "Not-Set" );
|
||||
if (pNav) {
|
||||
G4VPhysicalVolume *pWorld= pNav->GetWorldVolume();
|
||||
if( pWorld ) {
|
||||
WorldName = pWorld->GetName();
|
||||
}
|
||||
}
|
||||
G4cout << " " << WorldName ;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
if( fVerboseLevel > 2 )
|
||||
G4cout << " G4MultiNavigator::PrintLimited - exiting. " << G4endl;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
G4MultiNavigator::ResetState()
|
||||
{
|
||||
G4int num;
|
||||
fWasLimitedByGeometry= false;
|
||||
|
||||
G4Exception( "G4MultiNavigator::ResetState",
|
||||
"217-CannotImplement",
|
||||
FatalException,
|
||||
"Cannot call ResetState for active navigators of G4MultiNavigator.");
|
||||
std::vector<G4Navigator*>::iterator pNavigatorIter;
|
||||
pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
|
||||
for( num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num ) {
|
||||
// (*pNavigatorIter)->ResetState(); // KEEP THIS comment !!!
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
G4MultiNavigator::SetupHierarchy()
|
||||
{
|
||||
// G4Navigator::SetupHierarchy();
|
||||
G4Exception( "G4MultiNavigator::SetupHierarchy",
|
||||
"217-CannotImplement",
|
||||
FatalException,
|
||||
"Cannot call SetupHierarchy for active navigators of G4MultiNavigator.");
|
||||
}
|
||||
|
||||
void
|
||||
G4MultiNavigator::CheckMassWorld()
|
||||
{
|
||||
//
|
||||
G4VPhysicalVolume* navTrackWorld= pTransportManager->GetNavigatorForTracking()
|
||||
->GetWorldVolume();
|
||||
if( navTrackWorld != fLastMassWorld ) {
|
||||
G4Exception( "G4MultiNavigator::CheckMassWorld", "MultiNav-220", 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* 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" );
|
||||
}
|
||||
|
||||
std::vector<G4Navigator*>::iterator pNavIter=
|
||||
pTransportManager->GetActiveNavigatorsIterator();
|
||||
|
||||
for ( num=0; num< fNoActiveNavigators ; ++pNavIter,++num ) {
|
||||
G4bool relativeSearch, ignoreDirection;
|
||||
|
||||
(*pNavIter)-> LocateGlobalPointAndSetup( point,
|
||||
&direction,
|
||||
relativeSearch=false,
|
||||
ignoreDirection=false);
|
||||
}
|
||||
return massVolume;
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.cc,v 1.21 2006/06/29 18:36:59 gunter Exp $
|
||||
// $Id: G4Navigator.cc,v 1.25 2006/11/11 01:28:23 japost Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4Navigator Implementation
|
||||
@@ -44,9 +44,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
G4Navigator::G4Navigator()
|
||||
: fActive(false), fWasLimitedByGeometry(false), fTopPhysical(0),
|
||||
: fWasLimitedByGeometry(false), fTopPhysical(0),
|
||||
fCheck(false), fPushed(false), fVerbose(0)
|
||||
{
|
||||
fActive= false;
|
||||
ResetStackAndState();
|
||||
|
||||
fActionThreshold_NoZeroSteps = 10;
|
||||
@@ -185,7 +186,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
case kParameterised:
|
||||
G4VSolid *pSolid;
|
||||
G4VPVParameterisation *pParam;
|
||||
G4TouchableHistory parentTouchable( fHistory );
|
||||
G4TouchableHistory parentTouchable( fHistory );
|
||||
pParam = fBlockedPhysicalVolume->GetParameterisation();
|
||||
pSolid = pParam->ComputeSolid(fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume);
|
||||
@@ -202,10 +203,10 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
G4LogicalVolume *pLogical;
|
||||
pLogical = fBlockedPhysicalVolume->GetLogicalVolume();
|
||||
pLogical->SetSolid( pSolid );
|
||||
pLogical->UpdateMaterial(pParam->ComputeMaterial(
|
||||
fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume,
|
||||
&parentTouchable));
|
||||
pLogical->UpdateMaterial(pParam ->
|
||||
ComputeMaterial(fBlockedReplicaNo,
|
||||
fBlockedPhysicalVolume,
|
||||
&parentTouchable));
|
||||
break;
|
||||
}
|
||||
fEntering = false;
|
||||
@@ -507,32 +508,6 @@ G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoint)
|
||||
fExitedMother = false; // Boundary not encountered, did not exit
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// LocateGlobalPointAndUpdateTouchableHandle
|
||||
// ********************************************************************
|
||||
//
|
||||
void G4Navigator::LocateGlobalPointAndUpdateTouchableHandle(
|
||||
const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4TouchableHandle& oldTouchableToUpdate,
|
||||
const G4bool RelativeSearch )
|
||||
{
|
||||
G4VPhysicalVolume* pPhysVol;
|
||||
pPhysVol = LocateGlobalPointAndSetup( position,&direction,RelativeSearch );
|
||||
if( fEnteredDaughter || fExitedMother )
|
||||
{
|
||||
oldTouchableToUpdate = CreateTouchableHistory();
|
||||
if( pPhysVol == 0 )
|
||||
{
|
||||
// We want to ensure that the touchable is correct in this case.
|
||||
// The method below should do this and recalculate a lot more ....
|
||||
//
|
||||
oldTouchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// ComputeStep
|
||||
//
|
||||
@@ -993,15 +968,15 @@ void G4Navigator::SetupHierarchy()
|
||||
pSolid->ComputeDimensions(pParam, replicaNo, current);
|
||||
pParam->ComputeTransformation(replicaNo, current);
|
||||
|
||||
G4TouchableHistory touchable( fHistory );
|
||||
touchable.MoveUpHistory(); // move up to the parent level
|
||||
G4TouchableHistory touchable( fHistory );
|
||||
touchable.MoveUpHistory(); // move up to the parent level
|
||||
|
||||
// Set up the correct solid and material in Logical Volume
|
||||
//
|
||||
G4LogicalVolume *pLogical = current->GetLogicalVolume();
|
||||
pLogical->SetSolid( pSolid );
|
||||
pLogical->UpdateMaterial( pParam->ComputeMaterial(replicaNo, current,
|
||||
&touchable) );
|
||||
pLogical->UpdateMaterial( pParam ->
|
||||
ComputeMaterial(replicaNo, current, &touchable) );
|
||||
break;
|
||||
}
|
||||
mother = current;
|
||||
@@ -1061,8 +1036,12 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
G4int oldcoutPrec = G4cout.precision(8);
|
||||
if( fVerbose > 0 )
|
||||
{
|
||||
G4cout << "*** G4Navigator::ComputeSafety: ***" << G4endl
|
||||
<< " Called at point: "
|
||||
<< pGlobalpoint << G4endl
|
||||
<< " for Navigator: " << this << G4endl;
|
||||
|
||||
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
|
||||
G4cout << "*** G4Navigator::ComputeSafety: ***" << G4endl;
|
||||
G4cout << " Volume = " << motherPhysical->GetName()
|
||||
<< " - Maximum length = " << pMaxLength << G4endl;
|
||||
if( fVerbose == 4 )
|
||||
@@ -1081,6 +1060,12 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
//
|
||||
LocateGlobalPointWithinVolume( pGlobalpoint );
|
||||
|
||||
if( fVerbose >= 2 )
|
||||
{
|
||||
G4cout << " ComputeSafety() relocates-in-volume to point: "
|
||||
<< pGlobalpoint << G4endl;
|
||||
}
|
||||
|
||||
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
|
||||
G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
|
||||
G4ThreeVector localPoint = ComputeLocalPoint(pGlobalpoint);
|
||||
@@ -1114,6 +1099,23 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
fHistory, pMaxLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( fVerbose >= 2 )
|
||||
{
|
||||
G4cout << " ComputeSafety() finds that point - "
|
||||
<< pGlobalpoint << " - is on surface " << G4endl;
|
||||
if( fEnteredDaughter )
|
||||
{
|
||||
G4cout << " entered new daughter volume" << G4endl;
|
||||
}
|
||||
if( fExitedMother )
|
||||
{
|
||||
G4cout << " and exited previous volume.";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Remember last safety origin & value
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.cc,v 1.8 2006/06/29 18:37:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation Implementation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.10 2006/06/29 18:37:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Implementation
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.cc,v 1.23 2006/06/29 18:37:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4PropagatorInField.cc,v 1.29 2006/11/17 16:53:45 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// This class implements an algorithm to track a particle in a
|
||||
@@ -80,12 +80,15 @@ G4PropagatorInField::G4PropagatorInField( G4Navigator *theNavigator,
|
||||
|
||||
fPreviousSftOrigin= G4ThreeVector(0.,0.,0.);
|
||||
fPreviousSafety= 0.0;
|
||||
|
||||
}
|
||||
|
||||
G4PropagatorInField::~G4PropagatorInField()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Compute the next geometric Step
|
||||
@@ -248,8 +251,8 @@ G4PropagatorInField::ComputeStep(
|
||||
|
||||
// Intersect chord AB with geometry
|
||||
intersects= IntersectChord( SubStartPoint, EndPointB,
|
||||
NewSafety, LinearStepLength,
|
||||
InterSectionPointE );
|
||||
NewSafety, LinearStepLength,
|
||||
InterSectionPointE );
|
||||
// E <- Intersection Point of chord AB and either volume A's surface
|
||||
// or a daughter volume's surface ..
|
||||
|
||||
@@ -267,17 +270,18 @@ G4PropagatorInField::ComputeStep(
|
||||
G4bool found_intersection =
|
||||
LocateIntersectionPoint( SubStepStartState, CurrentState,
|
||||
InterSectionPointE, IntersectPointVelct_G,
|
||||
recalculatedEndPt);
|
||||
recalculatedEndPt);
|
||||
//G4cout<<"In Locate"<<recalculatedEndPt<<" and V"<<IntersectPointVelct_G.GetPosition()<<G4endl;
|
||||
intersects = intersects && found_intersection;
|
||||
if( found_intersection ) {
|
||||
End_PointAndTangent= IntersectPointVelct_G; // G is our EndPoint ...
|
||||
StepTaken = TruePathLength = IntersectPointVelct_G.GetCurveLength()
|
||||
- OriginalState.GetCurveLength();
|
||||
} else {
|
||||
// intersects= false; // "Minor" chords do not intersect
|
||||
if( recalculatedEndPt ){
|
||||
CurrentState= IntersectPointVelct_G;
|
||||
}
|
||||
// intersects= false; // "Minor" chords do not intersect
|
||||
if( recalculatedEndPt ){
|
||||
CurrentState= IntersectPointVelct_G;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( !intersects )
|
||||
@@ -300,11 +304,11 @@ G4PropagatorInField::ComputeStep(
|
||||
#ifdef G4VERBOSE
|
||||
if( (fVerboseLevel > 1) && (do_loop_count > fMax_loop_count-10 )) {
|
||||
if( do_loop_count == fMax_loop_count-9 ){
|
||||
G4cout << "G4PropagatorInField::ComputeStep "
|
||||
<< " Difficult track - taking many sub steps." << G4endl;
|
||||
G4cout << "G4PropagatorInField::ComputeStep "
|
||||
<< " Difficult track - taking many sub steps." << G4endl;
|
||||
}
|
||||
printStatus( SubStepStartState, CurrentState, CurrentProposedStepLength,
|
||||
NewSafety, do_loop_count, pPhysVol );
|
||||
NewSafety, do_loop_count, pPhysVol );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -360,22 +364,10 @@ G4PropagatorInField::ComputeStep(
|
||||
<< OriginalState.GetCurveLength() + TruePathLength
|
||||
- End_PointAndTangent.GetCurveLength() << G4endl;
|
||||
G4cerr << " Original state= " << OriginalState << G4endl
|
||||
<< " Proposed state= " << End_PointAndTangent << G4endl;
|
||||
<< " Proposed state= " << End_PointAndTangent << G4endl;
|
||||
G4Exception("G4PropagatorInField::ComputeStep()", "IncorrectProposedEndPoint",
|
||||
FatalException,
|
||||
"Curve length mis-match between original state and proposed endpoint of propagation.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
// static G4std::vector<G4int> ZeroStepNumberHist(fAbandonThreshold+1);
|
||||
if( fNoZeroStep ){
|
||||
// ZeroStepNumberHist[fNoZeroStep]++;
|
||||
if( fNoZeroStep > fActionThreshold_NoZeroSteps ){
|
||||
G4cout << " PiF: Step returning=" << StepTaken << G4endl;
|
||||
G4cout << " ------------------------------------------------------- "
|
||||
<< G4endl;
|
||||
}
|
||||
FatalException,
|
||||
"Curve length mis-match between original state and proposed endpoint of propagation.");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -393,19 +385,11 @@ G4PropagatorInField::ComputeStep(
|
||||
G4cout << " WARNING - G4PropagatorInField::ComputeStep():" << G4endl
|
||||
<< " Zero progress for " << fNoZeroStep << " attempted steps."
|
||||
<< G4endl;
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 2 )
|
||||
G4cout << " Particle that is stuck will be killed." << G4endl;
|
||||
#endif
|
||||
fNoZeroStep = 0;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fVerboseLevel > 3 ){
|
||||
G4cout << "G4PropagatorInField returns " << TruePathLength << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// G4cout << "G4PropagatorInField returns " << TruePathLength << G4endl;
|
||||
return TruePathLength;
|
||||
}
|
||||
|
||||
@@ -446,181 +430,273 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
const G4FieldTrack& CurveStartPointVelocity, // A
|
||||
const G4FieldTrack& CurveEndPointVelocity, // B
|
||||
const G4ThreeVector& TrialPoint, // E
|
||||
G4FieldTrack& IntersectedOrRecalculatedFT, // Out: point found
|
||||
G4bool& recalculatedEndPoint) // Out:
|
||||
G4FieldTrack& IntersectedOrRecalculatedFT, // Out: point found
|
||||
G4bool& recalculatedEndPoint) // Out:
|
||||
{
|
||||
// Find Intersection Point ( A, B, E ) of true path AB - start at E.
|
||||
|
||||
G4bool found_approximate_intersection = false;
|
||||
G4bool there_is_no_intersection = false;
|
||||
|
||||
|
||||
G4FieldTrack CurrentA_PointVelocity = CurveStartPointVelocity;
|
||||
G4FieldTrack CurrentB_PointVelocity = CurveEndPointVelocity;
|
||||
G4ThreeVector CurrentE_Point = TrialPoint;
|
||||
|
||||
G4FieldTrack ApproxIntersecPointV(CurveEndPointVelocity); // FT-Def-Construct
|
||||
G4double NewSafety= -0.0;
|
||||
G4bool final_section= true; // Shows whether current section is last (ie B=full end)
|
||||
G4double NewSafety= -0.0;
|
||||
|
||||
G4bool final_section= true; // Shows whether current section is last
|
||||
// (i.e. B=full end)
|
||||
G4bool first_section=true;
|
||||
recalculatedEndPoint= false;
|
||||
|
||||
G4bool restoredFullEndpoint= false;
|
||||
|
||||
G4int substep_no = 0;
|
||||
|
||||
G4int substep_no = 0;
|
||||
|
||||
// Limits for substep number
|
||||
//
|
||||
const G4int max_substeps= 10000; // Test 120 (old value 100 )
|
||||
const G4int warn_substeps= 1000; // 100
|
||||
// Statistics for substeps
|
||||
|
||||
// Statistics for substeps
|
||||
//
|
||||
static G4int max_no_seen= -1;
|
||||
static G4int trigger_substepno_print= warn_substeps - 20 ;
|
||||
static G4int trigger_substepno_print= warn_substeps - 20 ;
|
||||
|
||||
do{ // REPEAT
|
||||
//--------------------------------------------------------------------------
|
||||
// Algoritm for the case if progress in founding intersection is too slow.
|
||||
// Process is defined too slow if after N=param_substeps advances on the
|
||||
// path, it will be only 'fraction_done' of the total length.
|
||||
// In this case the remaining length is divided in two half and
|
||||
// the loop is restarted for each half.
|
||||
// If progress is still too slow, the division in two halfs continue
|
||||
// until 'max_depth'.
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
G4ThreeVector Point_A = CurrentA_PointVelocity.GetPosition();
|
||||
G4ThreeVector Point_B = CurrentB_PointVelocity.GetPosition();
|
||||
const G4int param_substeps=10; // Test value for the maximum number
|
||||
// of substeps
|
||||
const G4double fraction_done=0.3;
|
||||
|
||||
// F = a point on true AB path close to point E (the closest if possible)
|
||||
//
|
||||
ApproxIntersecPointV =
|
||||
GetChordFinder()->ApproxCurvePointV( CurrentA_PointVelocity,
|
||||
CurrentB_PointVelocity,
|
||||
CurrentE_Point,
|
||||
fEpsilonStep );
|
||||
// The above method is the key & most intuitive part ...
|
||||
G4bool Second_half=false; // First half or second half of divided step
|
||||
|
||||
// We need to know this for the 'final_section':
|
||||
// real 'final_section' or first half 'final_section'
|
||||
// In algorithm it is considered that the 'Second_half' is true
|
||||
// and it becomes false only if we are in the first-half of level
|
||||
// depthness or if we are in the first section
|
||||
|
||||
G4int depth=0; // Depth counts how many subdivisions of initial step made
|
||||
|
||||
const G4int max_depth=4; // Max allowed depth, test parameter
|
||||
|
||||
// Intermediates Points on the Track = Subdivided Points must be stored.
|
||||
// Use array of Pointers [max_depth+1] to do this
|
||||
// Array of pointers to the Intermediate G4FieldTrack
|
||||
|
||||
G4FieldTrack* ptrInterMedFT[max_depth+1];
|
||||
G4ThreeVector zeroV(0.0,0.0,0.0);
|
||||
for (G4int idepth=0; idepth<max_depth+1; idepth++ )
|
||||
{
|
||||
ptrInterMedFT[ idepth ] = new G4FieldTrack( zeroV, zeroV, 0., 0., 0., 0.);
|
||||
}
|
||||
|
||||
// Give the initial values to 'InterMedFt'
|
||||
// Important is 'ptrInterMedFT[0]', it saves the 'EndCurvePoint'
|
||||
//
|
||||
*ptrInterMedFT[0] = CurveEndPointVelocity;
|
||||
for (G4int idepth=1; idepth<max_depth+1; idepth++ )
|
||||
{
|
||||
*ptrInterMedFT[idepth]=CurveStartPointVelocity;
|
||||
}
|
||||
|
||||
// 'SubStartPoint' is needed to calculate the length of the divided step
|
||||
//
|
||||
G4FieldTrack SubStart_PointVelocity = CurveStartPointVelocity;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
G4int substep_no_p = 0;
|
||||
G4bool sub_final_section = false; // the same as final_section,
|
||||
// but for 'sub_section'
|
||||
do // REPEAT param
|
||||
{
|
||||
G4ThreeVector Point_A = CurrentA_PointVelocity.GetPosition();
|
||||
G4ThreeVector Point_B = CurrentB_PointVelocity.GetPosition();
|
||||
|
||||
// F = a point on true AB path close to point E
|
||||
// (the closest if possible)
|
||||
//
|
||||
ApproxIntersecPointV = GetChordFinder()
|
||||
->ApproxCurvePointV( CurrentA_PointVelocity,
|
||||
CurrentB_PointVelocity,
|
||||
CurrentE_Point,
|
||||
fEpsilonStep );
|
||||
// The above method is the key & most intuitive part ...
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( ApproxIntersecPointV.GetCurveLength() >
|
||||
CurrentB_PointVelocity.GetCurveLength() * (1.0 + kAngTolerance) ) {
|
||||
G4cerr << "Error - Intermediate F point is more advanced than endpoint B."
|
||||
<< G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()",
|
||||
"IntermediatePointConfusion",
|
||||
FatalException, "Intermediate F point is past end B point" );
|
||||
}
|
||||
`` if( ApproxIntersecPointV.GetCurveLength() >
|
||||
CurrentB_PointVelocity.GetCurveLength() * (1.0 + kAngTolerance) )
|
||||
{
|
||||
G4cerr << "Error - Intermediate F point is more advanced than endpoint B."
|
||||
<< G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()",
|
||||
"IntermediatePointConfusion", FatalException,
|
||||
"Intermediate F point is past end B point" );
|
||||
}
|
||||
#endif
|
||||
|
||||
G4ThreeVector CurrentF_Point= ApproxIntersecPointV.GetPosition();
|
||||
G4ThreeVector CurrentF_Point= ApproxIntersecPointV.GetPosition();
|
||||
|
||||
// First check whether EF is small - then F is a good approx. point
|
||||
// Calculate the length and direction of the chord AF
|
||||
//
|
||||
G4ThreeVector ChordEF_Vector = CurrentF_Point - CurrentE_Point;
|
||||
|
||||
if ( ChordEF_Vector.mag2() <= sqr(GetDeltaIntersection()) )
|
||||
{
|
||||
found_approximate_intersection = true;
|
||||
|
||||
// Create the "point" return value
|
||||
// First check whether EF is small - then F is a good approx. point
|
||||
// Calculate the length and direction of the chord AF
|
||||
//
|
||||
IntersectedOrRecalculatedFT = ApproxIntersecPointV;
|
||||
IntersectedOrRecalculatedFT.SetPosition( CurrentE_Point );
|
||||
G4ThreeVector ChordEF_Vector = CurrentF_Point - CurrentE_Point;
|
||||
|
||||
// Note: in order to return a point on the boundary,
|
||||
// we must return E. But it is F on the curve.
|
||||
// So we must "cheat": we are using the position at point E
|
||||
// and the velocity at point F !!!
|
||||
//
|
||||
// This must limit the length we can allow for displacement!
|
||||
|
||||
}
|
||||
else // E is NOT close enough to the curve (ie point F)
|
||||
{
|
||||
// Check whether any volumes are encountered by the chord AF
|
||||
// ---------------------------------------------------------
|
||||
// First relocate to restore any Voxel etc information in the Navigator
|
||||
// before calling ComputeStep
|
||||
fNavigator->LocateGlobalPointWithinVolume( Point_A );
|
||||
|
||||
G4ThreeVector PointG; // Candidate intersection point
|
||||
G4double stepLengthAF;
|
||||
G4bool Intersects_AF = IntersectChord( Point_A, CurrentF_Point,
|
||||
NewSafety, stepLengthAF,
|
||||
PointG
|
||||
);
|
||||
if( Intersects_AF )
|
||||
if ( ChordEF_Vector.mag2() <= sqr(GetDeltaIntersection()) )
|
||||
{
|
||||
// G is our new Candidate for the intersection point.
|
||||
// It replaces "E" and we will repeat the test to see if
|
||||
// it is a good enough approximate point for us.
|
||||
// B <- F
|
||||
// E <- G
|
||||
CurrentB_PointVelocity = ApproxIntersecPointV;
|
||||
CurrentE_Point = PointG;
|
||||
found_approximate_intersection = true;
|
||||
|
||||
// By moving point B, must take care if current AF has no intersection
|
||||
// to try current FB!!
|
||||
final_section= false;
|
||||
// Create the "point" return value
|
||||
//
|
||||
IntersectedOrRecalculatedFT = ApproxIntersecPointV;
|
||||
IntersectedOrRecalculatedFT.SetPosition( CurrentE_Point );
|
||||
|
||||
// Note: in order to return a point on the boundary,
|
||||
// we must return E. But it is F on the curve.
|
||||
// So we must "cheat": we are using the position at point E
|
||||
// and the velocity at point F !!!
|
||||
//
|
||||
// This must limit the length we can allow for displacement!
|
||||
}
|
||||
else // E is NOT close enough to the curve (ie point F)
|
||||
{
|
||||
// Check whether any volumes are encountered by the chord AF
|
||||
// ---------------------------------------------------------
|
||||
// First relocate to restore any Voxel etc information
|
||||
// in the Navigator before calling ComputeStep()
|
||||
//
|
||||
fNavigator->LocateGlobalPointWithinVolume( Point_A );
|
||||
|
||||
G4ThreeVector PointG; // Candidate intersection point
|
||||
G4double stepLengthAF;
|
||||
G4bool Intersects_AF = IntersectChord( Point_A, CurrentF_Point,
|
||||
NewSafety, stepLengthAF,
|
||||
PointG );
|
||||
if( Intersects_AF )
|
||||
{
|
||||
// G is our new Candidate for the intersection point.
|
||||
// It replaces "E" and we will repeat the test to see if
|
||||
// it is a good enough approximate point for us.
|
||||
// B <- F
|
||||
// E <- G
|
||||
|
||||
CurrentB_PointVelocity = ApproxIntersecPointV;
|
||||
CurrentE_Point = PointG;
|
||||
|
||||
// By moving point B, must take care if current
|
||||
// AF has no intersection to try current FB!!
|
||||
//
|
||||
final_section= false;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerboseLevel > 3 ){
|
||||
G4cout << "G4PiF::LI> Investigating intermediate point"
|
||||
<< " at s=" << ApproxIntersecPointV.GetCurveLength()
|
||||
<< " on way to full s=" << CurveEndPointVelocity.GetCurveLength()
|
||||
<< G4endl;
|
||||
}
|
||||
if( fVerboseLevel > 3 )
|
||||
{
|
||||
G4cout << "G4PiF::LI> Investigating intermediate point"
|
||||
<< " at s=" << ApproxIntersecPointV.GetCurveLength()
|
||||
<< " on way to full s="
|
||||
<< CurveEndPointVelocity.GetCurveLength() << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else // not Intersects_AF
|
||||
{
|
||||
// In this case:
|
||||
// There is NO intersection of AF with a volume boundary.
|
||||
// We must continue the search in the segment FB!
|
||||
fNavigator->LocateGlobalPointWithinVolume( CurrentF_Point );
|
||||
}
|
||||
else // not Intersects_AF
|
||||
{
|
||||
// In this case:
|
||||
// There is NO intersection of AF with a volume boundary.
|
||||
// We must continue the search in the segment FB!
|
||||
//
|
||||
fNavigator->LocateGlobalPointWithinVolume( CurrentF_Point );
|
||||
|
||||
G4double stepLengthFB;
|
||||
G4ThreeVector PointH;
|
||||
// Check whether any volumes are encountered by the chord FB
|
||||
// ---------------------------------------------------------
|
||||
G4bool Intersects_FB =
|
||||
IntersectChord( CurrentF_Point, Point_B,
|
||||
NewSafety, stepLengthFB, PointH );
|
||||
if( Intersects_FB )
|
||||
{
|
||||
// There is an intersection of FB with a volume boundary
|
||||
// H <- First Intersection of Chord FB
|
||||
G4double stepLengthFB;
|
||||
G4ThreeVector PointH;
|
||||
|
||||
// H is our new Candidate for the intersection point.
|
||||
// It replaces "E" and we will repeat the test to see if
|
||||
// it is a good enough approximate point for us.
|
||||
// Check whether any volumes are encountered by the chord FB
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// Note that F must be in volume volA (the same as A)
|
||||
// (otherwise AF would meet a volume boundary!)
|
||||
// A <- F
|
||||
// E <- H
|
||||
CurrentA_PointVelocity = ApproxIntersecPointV;
|
||||
CurrentE_Point = PointH;
|
||||
}
|
||||
else // not Intersects_FB
|
||||
{
|
||||
// There is NO intersection of FB with a volume boundary
|
||||
if( final_section ){
|
||||
// If B is the original endpoint, this means that whatever volume(s)
|
||||
// intersected the original chord, none touch the smaller chords
|
||||
// we have used.
|
||||
// The value of IntersectedOrRecalculatedFT returned is likely not valid
|
||||
//
|
||||
there_is_no_intersection = true;
|
||||
}else{
|
||||
// We must restore the original endpoint
|
||||
CurrentA_PointVelocity= CurrentB_PointVelocity; // We have got to B
|
||||
CurrentB_PointVelocity= CurveEndPointVelocity;
|
||||
restoredFullEndpoint = true;
|
||||
}
|
||||
G4bool Intersects_FB = IntersectChord( CurrentF_Point, Point_B,
|
||||
NewSafety, stepLengthFB,
|
||||
PointH );
|
||||
if( Intersects_FB )
|
||||
{
|
||||
// There is an intersection of FB with a volume boundary
|
||||
// H <- First Intersection of Chord FB
|
||||
|
||||
} // Endif (Intersects_FB)
|
||||
} // Endif (Intersects_AF)
|
||||
// H is our new Candidate for the intersection point.
|
||||
// It replaces "E" and we will repeat the test to see if
|
||||
// it is a good enough approximate point for us.
|
||||
|
||||
// Ensure that the new endpoints are not further apart in space
|
||||
// than on the curve due to different errors in the integration
|
||||
//
|
||||
G4double linDistSq, curveDist;
|
||||
linDistSq = ( CurrentB_PointVelocity.GetPosition()
|
||||
- CurrentA_PointVelocity.GetPosition() ).mag2();
|
||||
curveDist = CurrentB_PointVelocity.GetCurveLength()
|
||||
- CurrentA_PointVelocity.GetCurveLength();
|
||||
if( curveDist*(curveDist+2*perMillion ) < linDistSq )
|
||||
{
|
||||
// Note that F must be in volume volA (the same as A)
|
||||
// (otherwise AF would meet a volume boundary!)
|
||||
// A <- F
|
||||
// E <- H
|
||||
|
||||
CurrentA_PointVelocity = ApproxIntersecPointV;
|
||||
CurrentE_Point = PointH;
|
||||
}
|
||||
else // not Intersects_FB
|
||||
{
|
||||
// There is NO intersection of FB with a volume boundary
|
||||
|
||||
if( final_section )
|
||||
{
|
||||
// If B is the original endpoint, this means that whatever
|
||||
// volume(s) intersected the original chord, none touch the
|
||||
// smaller chords we have used.
|
||||
// The value of 'IntersectedOrRecalculatedFT' returned is
|
||||
// likely not valid
|
||||
|
||||
// Check on real final_section or SubEndSection
|
||||
//
|
||||
if( ((Second_half)&&(depth==0)) || (first_section) )
|
||||
{
|
||||
there_is_no_intersection = true; // real final_section
|
||||
}
|
||||
else
|
||||
{
|
||||
// end of subsection, not real final section
|
||||
// exit from the and go to the depth-1 level
|
||||
|
||||
substep_no_p = param_substeps+2; // exit from the loop
|
||||
|
||||
// but 'Second_half' is still true because we need to find
|
||||
// the 'CurrentE_point' for the next loop
|
||||
//
|
||||
Second_half = true;
|
||||
sub_final_section = true;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We must restore the original endpoint
|
||||
|
||||
CurrentA_PointVelocity = CurrentB_PointVelocity; // Got to B
|
||||
CurrentB_PointVelocity = CurveEndPointVelocity;
|
||||
restoredFullEndpoint = true;
|
||||
}
|
||||
} // Endif (Intersects_FB)
|
||||
} // Endif (Intersects_AF)
|
||||
|
||||
// Ensure that the new endpoints are not further apart in space
|
||||
// than on the curve due to different errors in the integration
|
||||
//
|
||||
G4double linDistSq, curveDist;
|
||||
linDistSq = ( CurrentB_PointVelocity.GetPosition()
|
||||
- CurrentA_PointVelocity.GetPosition() ).mag2();
|
||||
curveDist = CurrentB_PointVelocity.GetCurveLength()
|
||||
- CurrentA_PointVelocity.GetCurveLength();
|
||||
if( curveDist*(curveDist+2*perMillion ) < linDistSq )
|
||||
{
|
||||
// Re-integrate to obtain a new B
|
||||
//
|
||||
G4FieldTrack newEndPointFT=
|
||||
@@ -628,141 +704,251 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
CurrentB_PointVelocity,
|
||||
linDistSq, // to avoid recalculation
|
||||
curveDist );
|
||||
G4FieldTrack oldPointVelB = CurrentB_PointVelocity;
|
||||
CurrentB_PointVelocity = newEndPointFT;
|
||||
G4FieldTrack oldPointVelB = CurrentB_PointVelocity;
|
||||
CurrentB_PointVelocity = newEndPointFT;
|
||||
|
||||
if( final_section ){
|
||||
recalculatedEndPoint= true;
|
||||
IntersectedOrRecalculatedFT= newEndPointFT; // So that we can return it,
|
||||
// if it is the endpoint!
|
||||
}
|
||||
}
|
||||
if( curveDist < 0.0 )
|
||||
{
|
||||
G4cerr << "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 << G4endl
|
||||
<< "The final curve point is not further along"
|
||||
<< " than the original!" << G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()", "FatalError",
|
||||
FatalException, "Error in advancing propagation.");
|
||||
}
|
||||
if( (final_section)&&(Second_half)&&(depth==0) ) // real final section
|
||||
{
|
||||
recalculatedEndPoint = true;
|
||||
IntersectedOrRecalculatedFT = newEndPointFT;
|
||||
// So that we can return it, if it is the endpoint!
|
||||
}
|
||||
}
|
||||
if( curveDist < 0.0 )
|
||||
{
|
||||
G4cerr << "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 << G4endl
|
||||
<< "The final curve point is not further along"
|
||||
<< " than the original!" << G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()",
|
||||
"FatalError", FatalException,
|
||||
"Error in advancing propagation.");
|
||||
}
|
||||
|
||||
if(restoredFullEndpoint) {
|
||||
final_section= restoredFullEndpoint;
|
||||
restoredFullEndpoint=false;
|
||||
}
|
||||
|
||||
} // EndIf ( E is close enough to the curve, ie point F. )
|
||||
// tests ChordAF_Vector.mag() <= maximum_lateral_displacement
|
||||
if(restoredFullEndpoint)
|
||||
{
|
||||
final_section = restoredFullEndpoint;
|
||||
restoredFullEndpoint = false;
|
||||
}
|
||||
} // EndIf ( E is close enough to the curve, ie point F. )
|
||||
// tests ChordAF_Vector.mag() <= maximum_lateral_displacement
|
||||
|
||||
#ifdef G4DEBUG_LOCATE_INTERSECTION
|
||||
// #ifdef G4VERBOSE
|
||||
if( substep_no >= trigger_substepno_print ) {
|
||||
G4cout << "Difficulty in converging in G4PropagatorInField::LocateIntersectionPoint:"
|
||||
<< " Substep no = " << substep_no << G4endl;
|
||||
if( substep_no == trigger_substepno_print ){
|
||||
printStatus( CurveStartPointVelocity, CurveEndPointVelocity,
|
||||
-1.0, NewSafety, 0, 0);
|
||||
}
|
||||
G4cout << " State of point A: ";
|
||||
printStatus( CurrentA_PointVelocity, CurrentA_PointVelocity,
|
||||
-1.0, NewSafety, substep_no-1, 0);
|
||||
G4cout << " State of point B: ";
|
||||
printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
|
||||
-1.0, NewSafety, substep_no, 0);
|
||||
}
|
||||
if( substep_no >= trigger_substepno_print )
|
||||
{
|
||||
G4cout << "Difficulty in converging in "
|
||||
<< "G4PropagatorInField::LocateIntersectionPoint():"
|
||||
<< G4endl
|
||||
<< " Substep no = " << substep_no << G4endl;
|
||||
if( substep_no == trigger_substepno_print )
|
||||
{
|
||||
printStatus( CurveStartPointVelocity, CurveEndPointVelocity,
|
||||
-1.0, NewSafety, 0, 0);
|
||||
}
|
||||
G4cout << " State of point A: ";
|
||||
printStatus( CurrentA_PointVelocity, CurrentA_PointVelocity,
|
||||
-1.0, NewSafety, substep_no-1, 0);
|
||||
G4cout << " State of point B: ";
|
||||
printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
|
||||
-1.0, NewSafety, substep_no, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
substep_no++;
|
||||
substep_no++;
|
||||
substep_no_p++;
|
||||
|
||||
} while ( ( ! found_approximate_intersection )
|
||||
&& ( ! there_is_no_intersection )
|
||||
&& ( substep_no <= max_substeps) ); // UNTIL found or failed
|
||||
} while ( ( ! found_approximate_intersection )
|
||||
&& ( ! there_is_no_intersection )
|
||||
&& ( substep_no_p <= param_substeps) ); // UNTIL found or
|
||||
// failed param substep
|
||||
first_section = false;
|
||||
|
||||
if( substep_no > max_no_seen ) {
|
||||
if( (!found_approximate_intersection) && (!there_is_no_intersection) )
|
||||
{
|
||||
G4double did_len = std::abs( CurrentA_PointVelocity.GetCurveLength()
|
||||
- SubStart_PointVelocity.GetCurveLength());
|
||||
G4double all_len = std::abs( CurrentB_PointVelocity.GetCurveLength()
|
||||
- SubStart_PointVelocity.GetCurveLength());
|
||||
|
||||
G4double stepLengthAB;
|
||||
G4ThreeVector PointGe;
|
||||
|
||||
// Check if progress is too slow and if it possible to go deeper,
|
||||
// then halve the step if so
|
||||
//
|
||||
if( ( ( did_len )<fraction_done*all_len)
|
||||
&& (depth<max_depth) && (!sub_final_section) )
|
||||
{
|
||||
|
||||
Second_half=false;
|
||||
depth++;
|
||||
|
||||
G4double Sub_len = (all_len-did_len)/(2.);
|
||||
G4FieldTrack start = CurrentA_PointVelocity;
|
||||
G4MagInt_Driver* integrDriver=GetChordFinder()->GetIntegrationDriver();
|
||||
integrDriver->AccurateAdvance(start, Sub_len, fEpsilonStep);
|
||||
*ptrInterMedFT[depth] = start;
|
||||
CurrentB_PointVelocity = *ptrInterMedFT[depth];
|
||||
|
||||
// Adjust 'SubStartPoint' to calculate the 'did_length' in next loop
|
||||
//
|
||||
SubStart_PointVelocity = CurrentA_PointVelocity;
|
||||
|
||||
// Find new trial intersection point needed at start of the loop
|
||||
//
|
||||
G4ThreeVector Point_A = CurrentA_PointVelocity.GetPosition();
|
||||
G4ThreeVector SubE_point = CurrentB_PointVelocity.GetPosition();
|
||||
|
||||
fNavigator->LocateGlobalPointWithinVolume(Point_A);
|
||||
G4bool Intersects_AB = IntersectChord(Point_A, SubE_point,
|
||||
NewSafety, stepLengthAB, PointGe);
|
||||
if(Intersects_AB)
|
||||
{
|
||||
CurrentE_Point = PointGe;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No intersection found for first part of curve
|
||||
// (CurrentA,InterMedPoint[depth]). Go to the second part
|
||||
//
|
||||
Second_half = true;
|
||||
}
|
||||
} // if did_len
|
||||
|
||||
if( (Second_half)&&(depth!=0) )
|
||||
{
|
||||
// Second part of curve (InterMed[depth],Intermed[depth-1]) )
|
||||
// On the depth-1 level normally we are on the 'second_half'
|
||||
|
||||
Second_half = true;
|
||||
|
||||
// Find new trial intersection point needed at start of the loop
|
||||
//
|
||||
SubStart_PointVelocity = *ptrInterMedFT[depth];
|
||||
CurrentA_PointVelocity = *ptrInterMedFT[depth];
|
||||
CurrentB_PointVelocity = *ptrInterMedFT[depth-1];
|
||||
G4ThreeVector Point_A = CurrentA_PointVelocity.GetPosition();
|
||||
G4ThreeVector SubE_point = CurrentB_PointVelocity.GetPosition();
|
||||
fNavigator->LocateGlobalPointWithinVolume(Point_A);
|
||||
G4bool Intersects_AB = IntersectChord(Point_A, SubE_point, NewSafety,
|
||||
stepLengthAB, PointGe);
|
||||
if(Intersects_AB)
|
||||
{
|
||||
CurrentE_Point = PointGe;
|
||||
}
|
||||
else
|
||||
{
|
||||
final_section = true;
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
} // if(!found_aproximate_intersection)
|
||||
|
||||
} while ( ( ! found_approximate_intersection )
|
||||
&& ( ! there_is_no_intersection )
|
||||
&& ( substep_no <= max_substeps) ); // UNTIL found or failed
|
||||
|
||||
if( substep_no > max_no_seen )
|
||||
{
|
||||
max_no_seen = substep_no;
|
||||
if( max_no_seen > warn_substeps ) {
|
||||
trigger_substepno_print= max_no_seen - 20; // Want to see that last 20 steps
|
||||
if( max_no_seen > warn_substeps )
|
||||
{
|
||||
trigger_substepno_print = max_no_seen-20; // Want to see last 20 steps
|
||||
}
|
||||
}
|
||||
|
||||
if( ( substep_no >= max_substeps) && !there_is_no_intersection && !found_approximate_intersection ) {
|
||||
|
||||
G4cerr << "Problem in G4PropagatorInField::LocateIntersectionPoint:"
|
||||
<< " Convergence is requiring too many substeps: " << substep_no;
|
||||
G4cerr << " Abandoning effort to intersect. " << G4endl;
|
||||
G4cerr << " Information on start & current step follows in cout: " << G4endl;
|
||||
G4cout << "Problem in G4PropagatorInField::LocateIntersectionPoint:"
|
||||
<< " Convergence is requiring too many substeps: " << substep_no << G4endl;
|
||||
G4cout << " found intersection= " << found_approximate_intersection
|
||||
<< " intersection exists = " << ! there_is_no_intersection << G4endl;
|
||||
|
||||
if( ( substep_no >= max_substeps)
|
||||
&& !there_is_no_intersection
|
||||
&& !found_approximate_intersection )
|
||||
{
|
||||
G4cerr << "WARNING - G4PropagatorInField::LocateIntersectionPoint()"
|
||||
<< G4endl
|
||||
<< " Convergence is requiring too many substeps: "
|
||||
<< substep_no << G4endl;
|
||||
G4cerr << " Abandoning effort to intersect. " << G4endl;
|
||||
G4cerr << " Information on start & current step follows in cout."
|
||||
<< G4endl;
|
||||
G4cout << "WARNING - G4PropagatorInField::LocateIntersectionPoint()"
|
||||
<< G4endl
|
||||
<< " Convergence is requiring too many substeps: "
|
||||
<< substep_no << G4endl;
|
||||
G4cout << " Found intersection = "
|
||||
<< found_approximate_intersection << G4endl
|
||||
<< " Intersection exists = "
|
||||
<< !there_is_no_intersection << G4endl;
|
||||
G4cout << " Start and Endpoint of Requested Step:" << G4endl;
|
||||
printStatus( CurveStartPointVelocity, CurveEndPointVelocity,
|
||||
-1.0, NewSafety, 0, 0);
|
||||
G4cout << G4endl;
|
||||
G4cout << " Start and Endpoint of Requested Step " << G4endl;
|
||||
printStatus( CurveStartPointVelocity, CurveEndPointVelocity,
|
||||
-1.0, NewSafety, 0, 0);
|
||||
|
||||
G4cout << G4endl;
|
||||
G4cout << " 'Bracketing' starting and endpoint of current Sub-Step " << G4endl;
|
||||
printStatus( CurrentA_PointVelocity, CurrentA_PointVelocity,
|
||||
-1.0, NewSafety, substep_no-1, 0);
|
||||
printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
|
||||
-1.0, NewSafety, substep_no, 0);
|
||||
|
||||
G4cout << " 'Bracketing' starting and endpoint of current Sub-Step"
|
||||
<< G4endl;
|
||||
printStatus( CurrentA_PointVelocity, CurrentA_PointVelocity,
|
||||
-1.0, NewSafety, substep_no-1, 0);
|
||||
printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
|
||||
-1.0, NewSafety, substep_no, 0);
|
||||
G4cout << G4endl;
|
||||
|
||||
// #ifdef G4DEBUG_LOCATE_INTERSECTION
|
||||
// #ifdef G4VERBOSE
|
||||
// #endif
|
||||
|
||||
// G4Exception("G4PropagatorInField::LocateIntersectionPoint()", "UnableToLocateIntersection",
|
||||
// FatalException, "Too many substeps while trying to locate intersection.");
|
||||
|
||||
#ifdef FUTURE_CORRECTION
|
||||
// Attempt to correct the results of the method // FIX - TODO
|
||||
if ( ! found_approximate_intersection ){
|
||||
recalculatedEndPoint= true;
|
||||
// Return the further valid intersection point -- potentially A ?? JA/19 Jan 2006
|
||||
|
||||
if ( ! found_approximate_intersection )
|
||||
{
|
||||
recalculatedEndPoint = true;
|
||||
// Return the further valid intersection point -- potentially A ??
|
||||
// JA/19 Jan 2006
|
||||
IntersectedOrRecalculatedFT = CurrentA_PointVelocity;
|
||||
|
||||
G4cout << "G4PropagatorInField::LocateIntersectionPoint:"
|
||||
<< " did not convergence after " << substep_no << " substeps." << G4endl;
|
||||
G4cout << " The endpoint was adjused to pointA resulting from the last substep: "
|
||||
<< CurrentA_PointVelocity
|
||||
<< G4endl;
|
||||
G4cout << "WARNING - G4PropagatorInField::LocateIntersectionPoint()"
|
||||
<< G4endl
|
||||
<< " Did not convergence after " << substep_no
|
||||
<< " substeps." << G4endl;
|
||||
G4cout << " The endpoint was adjused to pointA resulting"
|
||||
<< G4endl
|
||||
<< " from the last substep: " << CurrentA_PointVelocity
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4cout.precision( 10 );
|
||||
G4double done_len= CurrentA_PointVelocity.GetCurveLength();
|
||||
G4double full_len= CurveEndPointVelocity.GetCurveLength();
|
||||
G4cout << " G4PropagatorInField::LocateIntersectionPoint(): " << G4endl
|
||||
<< " Undertaken only length " << done_len
|
||||
<< " out of " << full_len << " required." << G4endl;
|
||||
G4cout << " Remaining length = " << full_len - done_len << " " << G4endl;
|
||||
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()", "UnableToLocateIntersection",
|
||||
FatalException, "Too many substeps while trying to locate intersection.");
|
||||
G4double done_len = CurrentA_PointVelocity.GetCurveLength();
|
||||
G4double full_len = CurveEndPointVelocity.GetCurveLength();
|
||||
G4cout << "ERROR - G4PropagatorInField::LocateIntersectionPoint()"
|
||||
<< G4endl
|
||||
<< " Undertaken only length: " << done_len
|
||||
<< " out of " << full_len << " required." << G4endl;
|
||||
G4cout << " Remaining length = " << full_len - done_len << G4endl;
|
||||
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()",
|
||||
"UnableToLocateIntersection", FatalException,
|
||||
"Too many substeps while trying to locate intersection.");
|
||||
}
|
||||
else if( substep_no >= warn_substeps ) {
|
||||
else if( substep_no >= warn_substeps )
|
||||
{
|
||||
int oldprc= G4cout.precision( 10 );
|
||||
G4cout << " G4PropagatorInField::LocateIntersectionPoint(): Undertaken length "
|
||||
<< CurrentB_PointVelocity.GetCurveLength();
|
||||
G4cout << " Needed " << substep_no << " substeps. Warning level= " << warn_substeps
|
||||
<< " and maximum substeps= " << max_substeps << G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()", "DifficultyToLocateIntersection",
|
||||
JustWarning, "Many substeps while trying to locate intersection.");
|
||||
G4cout << "WARNING - G4PropagatorInField::LocateIntersectionPoint()"
|
||||
<< G4endl
|
||||
<< " Undertaken length: "
|
||||
<< CurrentB_PointVelocity.GetCurveLength();
|
||||
G4cout << " - Needed: " << substep_no << " substeps." << G4endl
|
||||
<< " Warning level = " << warn_substeps
|
||||
<< " and maximum substeps = " << max_substeps << G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()",
|
||||
"DifficultyToLocateIntersection", JustWarning,
|
||||
"Many substeps while trying to locate intersection.");
|
||||
G4cout.precision( oldprc );
|
||||
}
|
||||
|
||||
for ( G4int idepth=0; idepth<max_depth+1; idepth++)
|
||||
{
|
||||
delete ptrInterMedFT[idepth];
|
||||
}
|
||||
return !there_is_no_intersection; // Success or failure
|
||||
}
|
||||
|
||||
@@ -796,16 +982,16 @@ G4PropagatorInField::printStatus( const G4FieldTrack& StartFT,
|
||||
<< std::setw( 25) << " Current Position and Direction" << " "
|
||||
<< G4endl;
|
||||
G4cout << std::setw( 5) << "Step#"
|
||||
<< std::setw(10) << " s " << " "
|
||||
<< std::setw(10) << " s " << " "
|
||||
<< std::setw(10) << "X(mm)" << " "
|
||||
<< std::setw(10) << "Y(mm)" << " "
|
||||
<< std::setw(10) << "Z(mm)" << " "
|
||||
<< std::setw( 7) << " N_x " << " "
|
||||
<< std::setw( 7) << " N_y " << " "
|
||||
<< std::setw( 7) << " N_z " << " " ;
|
||||
// << G4endl;
|
||||
// << G4endl;
|
||||
G4cout // << " >>> "
|
||||
<< std::setw( 7) << " Delta|N|" << " "
|
||||
<< std::setw( 7) << " Delta|N|" << " "
|
||||
// << std::setw( 7) << " Delta(N_z) " << " "
|
||||
<< std::setw( 9) << "StepLen" << " "
|
||||
<< std::setw(12) << "StartSafety" << " "
|
||||
@@ -960,14 +1146,17 @@ G4PropagatorInField::IntersectChord( G4ThreeVector StartPointA,
|
||||
// printIntersection(
|
||||
// StartPointA, EndPointB, LinearStepLength, IntersectionPoint, NewSafety
|
||||
|
||||
G4cout << "Start=" << std::setw(12) << StartPointA << " "
|
||||
G4cout << " G4PropagatorInField::IntersectChord reports " << G4endl;
|
||||
G4cout << " PiF-IC> "
|
||||
<< "Start=" << std::setw(12) << StartPointA << " "
|
||||
<< "End= " << std::setw(8) << EndPointB << " "
|
||||
<< "StepIn=" << std::setw(8) << LinearStepLength << " "
|
||||
<< "NewSft=" << std::setw(8) << NewSafety
|
||||
<< "NavCall" << doCallNav << " "
|
||||
<< "In T/F " << intersects << " "
|
||||
<< "IntrPt=" << std::setw(8) << IntersectionPoint << " "
|
||||
<< G4endl;
|
||||
<< "NewSft=" << std::setw(8) << NewSafety << " "
|
||||
<< "CallNav=" << doCallNav << " "
|
||||
<< "Intersects " << intersects << " ";
|
||||
if( intersects )
|
||||
G4cout << "IntrPt=" << std::setw(8) << IntersectionPoint << " " ;
|
||||
G4cout << G4endl;
|
||||
#endif
|
||||
|
||||
return intersects;
|
||||
@@ -985,7 +1174,7 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
// G4double checkCurveDist= EstimatedEndStateB.GetCurveLength()
|
||||
// - CurrentStateA.GetCurveLength();
|
||||
// G4double checkLinDistSq= (EstimatedEndStateB.GetPosition()
|
||||
// - CurrentStateA.GetPosition() ).mag2();
|
||||
// - CurrentStateA.GetPosition() ).mag2();
|
||||
|
||||
G4FieldTrack newEndPoint( CurrentStateA );
|
||||
G4MagInt_Driver* integrDriver= GetChordFinder()->GetIntegrationDriver();
|
||||
@@ -1022,8 +1211,8 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
if( itrial > 1) {
|
||||
if( fVerboseLevel > 0 ) {
|
||||
G4cout << MethodName << " called - goodAdv= " << goodAdvance
|
||||
<< " trials = " << itrial << " previous good= " << latest_good_trials
|
||||
<< G4endl;
|
||||
<< " trials = " << itrial << " previous good= " << latest_good_trials
|
||||
<< G4endl;
|
||||
}
|
||||
latest_good_trials=0;
|
||||
}else{
|
||||
@@ -1039,7 +1228,7 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
G4cout << MethodName << "> AccurateAdvance failed " ;
|
||||
G4cout << " in " << itrial << " integration trials/steps. " << G4endl
|
||||
G4cout << " It went only " << lengthDone << " instead of " << curveDist
|
||||
<< " -- a difference of " << curveDist - lengthDone << G4endl;
|
||||
<< " -- a difference of " << curveDist - lengthDone << G4endl;
|
||||
G4cout << " ReEstimateEndpoint> Reset endPoint to original value!" << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -1068,7 +1257,7 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
noCorrections++;
|
||||
if( goodAdvance ){
|
||||
sumCorrectionsSq += (EstimatedEndStateB.GetPosition() -
|
||||
newEndPoint.GetPosition()).mag2();
|
||||
newEndPoint.GetPosition()).mag2();
|
||||
}
|
||||
linearDistSq -= curveDist; // To use linearDistSq ... !
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.11 2006/06/29 18:37:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation Implementation
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4SafetyHelper.cc,v 1.7 2006/11/14 10:22:12 japost Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
|
||||
|
||||
#include "G4SafetyHelper.hh"
|
||||
#include "G4PathFinder.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4Navigator.hh"
|
||||
|
||||
// #include "G4Exception.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
G4bool G4SafetyHelper::fUseParallelGeometries= false;
|
||||
// By default, one geometry only
|
||||
|
||||
G4SafetyHelper::G4SafetyHelper()
|
||||
{
|
||||
fpPathFinder= G4PathFinder::GetInstance();
|
||||
|
||||
InitialiseNavigator();
|
||||
}
|
||||
|
||||
void G4SafetyHelper::InitialiseNavigator()
|
||||
{
|
||||
// G4Navigator*
|
||||
static G4TransportationManager* pTransportMgr=
|
||||
G4TransportationManager::GetTransportationManager();
|
||||
|
||||
fpMassNavigator = pTransportMgr->GetNavigatorForTracking();
|
||||
|
||||
fMassNavigatorId = pTransportMgr->ActivateNavigator( fpMassNavigator );
|
||||
}
|
||||
|
||||
G4SafetyHelper::~G4SafetyHelper()
|
||||
{}
|
||||
|
||||
G4double
|
||||
G4SafetyHelper::ComputeMassStep( const G4ThreeVector &position,
|
||||
const G4ThreeVector &direction,
|
||||
G4double &newSafety )
|
||||
{
|
||||
// Step for mass geometry
|
||||
G4double linearStep;
|
||||
const G4double proposedStep = DBL_MAX;
|
||||
|
||||
// Check
|
||||
G4VPhysicalVolume* worldPV= fpMassNavigator->GetWorldVolume();
|
||||
if( worldPV == 0 ) {
|
||||
G4Exception("G4SafetyHelper::ComputeMassStep",
|
||||
"InvalidNavigatorWorld",
|
||||
FatalException,
|
||||
"Found that existing mass Navigator has null world");
|
||||
}
|
||||
|
||||
fpMassNavigator->LocateGlobalPointWithinVolume(position);
|
||||
// Potentially dangerous to relocate the point.
|
||||
// Safe in PostStepDoIt -- and possibly in AlongStepGPIL
|
||||
|
||||
G4cout << "G4SafetyHelper::ComputeMassStep "
|
||||
<< " trial step size = " << proposedStep << " ." << G4endl;
|
||||
|
||||
// Distance in the Mass geometry
|
||||
linearStep = fpMassNavigator->ComputeStep( position,
|
||||
direction,
|
||||
proposedStep,
|
||||
newSafety);
|
||||
|
||||
fpMassNavigator->LocateGlobalPointWithinVolume(position);
|
||||
G4cout << "G4UrbanMscModel relocates mass Navigator back to "
|
||||
<< position << G4endl;
|
||||
|
||||
// TO-DO: Can replace this with a call to PathFinder
|
||||
// giving id of Mass Geometry --> this avoid doing the work twice
|
||||
|
||||
return linearStep;
|
||||
}
|
||||
|
||||
G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position )
|
||||
{
|
||||
// Safety for all geometries
|
||||
G4double newsafety= 0.0;
|
||||
|
||||
if( !fUseParallelGeometries) {
|
||||
// Old code: safety for mass geometry
|
||||
fpMassNavigator->LocateGlobalPointWithinVolume(position);
|
||||
newsafety = fpMassNavigator->ComputeSafety(position);
|
||||
}else{
|
||||
|
||||
// fpPathFinder->ReLocate( position ); // Safe in PostStepDoIt only ??
|
||||
newsafety= fpPathFinder->ComputeSafety( position );
|
||||
|
||||
#ifdef CHECK_WITH_ONE_GEOM
|
||||
// Check against mass safety
|
||||
fpMassNavigator->LocateGlobalPointWithinVolume(position);
|
||||
G4double mass_safety = fpMassNavigator->ComputeSafety(position);
|
||||
|
||||
// For initial tests check assume that mass is only geometry
|
||||
if( (mass_safety - newsafety) > 1e-4 * newsafety ){
|
||||
G4cerr << " ERROR in G4SafetyHelper " << G4endl
|
||||
<< " Safety from PathFinder is " << newsafety << " "
|
||||
<< " not equal to " << mass_safety << " " << G4endl;
|
||||
G4Exception("G4SafetyHelper::ComputeSafety", "SafetyError",
|
||||
FatalException,
|
||||
"Incompatible safeties between navigator and pathfinder" );
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return newsafety;
|
||||
}
|
||||
|
||||
|
||||
void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector &newPosition )
|
||||
{
|
||||
|
||||
#ifdef G4VERBOSE_HELPER
|
||||
G4int oldPrec= G4cout.precision( 10 );
|
||||
G4cout << " G4SafetyHelper::ReLocateWithinVolume "
|
||||
<< " calling PathFinder->ReLocating at position " << newPosition << G4endl;
|
||||
G4cout.precision( oldPrec );
|
||||
#endif
|
||||
|
||||
if( !fUseParallelGeometries) {
|
||||
fpMassNavigator->LocateGlobalPointWithinVolume( newPosition );
|
||||
}else{
|
||||
fpPathFinder->ReLocate( newPosition );
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.cc,v 1.14 2006/06/29 18:37:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// G4TransportationManager
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.cc,v 1.6 2006/06/29 18:37:13 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation Implementation
|
||||
|
||||
Reference in New Issue
Block a user