Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
+4 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 1999/02/15 15:11:10 japost Exp $
# $Id: GNUmakefile,v 1.4 2001/10/24 15:33:47 gcosmo Exp $
# --------------------------------------------------------------------
# GNUmakefile for geometry/volumes library. Gabriele Cosmo, 16/11/96.
# --------------------------------------------------------------------
@@ -12,10 +12,12 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/magneticfield/include \
-I$(G4BASE)/geometry/verification/include \
-I$(G4BASE)/geometry/management/include
include $(G4INSTALL)/config/common.gmk
@@ -23,7 +25,7 @@ include $(G4INSTALL)/config/common.gmk
CXXFLAGS_WITHOUT_O := $(filter-out -O% , $(CXXFLAGS))
CXXFLAGS_WITHOUT_O := $(filter-out +O% , $(CXXFLAGS_WITHOUT_O))
ifeq ($(G4SYSTEM),SUN-CC)
ifeq ($(G4SYSTEM),SUN-CC4)
$(G4TMP)/$(G4SYSTEM)/$(name)/G4VoxelNavigation.o: src/G4VoxelNavigation.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4VoxelNavigation.cc
endif
+86 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.48 2001/05/31 17:33:20 gcosmo Exp $
$Id: History,v 1.63 2001/12/11 17:56:54 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,91 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Dec 11th, 2001 G. Cosmo - geomvol-V03-02-08
- G4Navigator:
o Added kNormal and Copy Number to NewLevel (Navigation Level) for
Normal Navigation
Now all TouchableHistory objects should have a valid entry in ReplicaNumber:
- in the case of a placement volume it will be the copy number
- in replicated volumes it will be the replica number
o Commented out fix introduced in geomvol-V03-02-05.
Dec 11th, 2001 J. Apostolakis - geomvol-V03-02-07
- G4Navigator:
o Undoing the fix in geomvol-V03-02-05 -- because of problems in
several tests (mostly large N tests).
----> Must resolve these !! <----
Dec 8th, 2001 J. Apostolakis - geomvol-V03-02-06
- G4PropagatorInField:
o additional thresholds for No of steps, + get/Set methods
o Modified choice of subsequent step size in case of Zero step
- decrease quickly at first to try to ensure that the first/second
"re-steps" are enough in most cases.
- utilise addition threshold parameters (for # of steps)
to slow down the rate of decrease of the step size
for the 'difficult' cases which do not converse after
a few steps.
Dec 6th, 2001 J. Apostolakis - geomvol-V03-02-05
- G4Navigator:
Fix for Locate Global Point Within Volume: clear state
variables (that had erroneously been forgotten).
Dec 6th, 2001 R. Chytracek - geomvol-V03-02-04
- G4Navigator:
o Fixed mirroring of the input argument for global direction into
local variable in LocateGlobalPointAndSetup().
o Cosmetics for the Software Reference Manual in .hh file.
Dec 4th, 2001 J. Apostolakis - geomvol-V03-02-03
- G4Navigator:
o Modified the interface
- creating a new ResetState method (that only reset state - not stack)
- adding a new optional argument to LocateGlobalPointAndSetup method
- adding direction argument to LGPAS w/ touchable history
o Modified the implementation
- to reset its state when touchable history is used to re-initialise it
- to use the direction in LocateGlobalPointAndSetup methods!
- G4PropagatorInField:
o Added use of new Largest Acceptable Step data member.
o Protected, in reseting of Proposed Step length, against
making it bigger in cases where several zero steps seen.
o Several debugging prints added. (only in G4Verbose, ...)
Nov 28th, 2001 J. Apostolakis - geomvol-V03-02-02
- Added GetCurrentFieldManager method to PropagatorInField
- Incorporates additions seen in "geomvol-V03-02-00a/b/c"
and in "geomvol-V03-02-01".
- This tag is required by the new tag "transport-V03-02-06" in Transportation.
Oct 18th, 2001 J. Apostolakis - geomvol-V03-02-01
- Added a new 'maximum' epsilon value in G4PropagatorInField,
as some ill-conditions appear to be due to large proposed relative errors.
NOTE: does NOT include changes in "geomvol-V03-02-00a/b/c".
Nov 8th, 2001 G. Cosmo - geomvol-V03-02-00c
- Added handles for reference counting: G4GRSSolidHandle, G4GRSVolumeHandle,
G4TouchableHistoryHandle.
- Modified G4Navigator for reference counted touchables. Introduced new methods
CreateTouchableHistoryHandle() and LocateGlobalPointAndUpdateTouchableHandle(...).
- New unit tests testG4ParameterisedMaterial.cc and testG4TouchableHandle.cc.
Nov 1st, 2001 G. Cosmo - geomvol-V03-02-00b
- G4GeometryMessenger.cc: fixed definition of unit category for tolerance.
Oct 24th, 2001 G. Cosmo - geomvol-V03-02-00a
- Moved G4GeomTestMessenger from geometry/verification to geometry/volumes.
Renamed to G4GeometryMessenger.
- GeometryMessenger: renamed directory to geometry/test. Added directory
geometry/navigator. Added geometry/navigator/reset command
for resetting navigation history and position.
- G4PropagatorInField.icc: fixed warning on Linux-g++....
Oct 18th, 2001 J. Apostolakis - geomvol-V03-02-00
- Corrected the initialisation of fEpsilonMin in G4PropagatorInField
constructor, which was forgotten.
May 31st, 2001 G. Cosmo - geomvol-V03-01-08
- Fixed usage of 'fabs', which belongs to global scope, NOT in std
namespace. Detected by compilation error on DEC ISO/ANSI setup.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4AuxiliaryNavServices.hh,v 1.3.4.1 2001/06/28 19:09:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4AuxiliaryNavServices.hh,v 1.4 2001/07/11 10:00:27 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4NormalNavigation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4AuxiliaryNavServices.icc,v 1.3.2.1 2001/06/28 19:09:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4AuxiliaryNavServices.icc,v 1.4 2001/07/11 10:00:27 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4AuxiliaryNavServices Inline implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BlockingList.hh,v 1.5.2.1 2001/06/28 19:09:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4BlockingList.hh,v 1.6 2001/07/11 10:00:27 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// class G4BlockingList
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BlockingList.icc,v 1.4.2.1 2001/06/28 19:09:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4BlockingList.icc,v 1.5 2001/07/11 10:00:27 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4BlockingList Inlined Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GRSSolid.hh,v 1.4.4.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4GRSSolid.hh,v 1.5 2001/07/11 10:00:27 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4GRSSolid
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GRSSolid.icc,v 1.4.4.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4GRSSolid.icc,v 1.5 2001/07/11 10:00:27 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4GRSSolid inline implementation
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4GRSSolidHandle.hh,v 1.3 2001/11/06 17:08:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// Class G4TouchableHandle
//
// Class description:
//
// Type providing reference counting mechanism for any kind of touchable
// objects.
// The basic rule for the use of this type is that this handle must always
// be exchanged by reference never dinamically allocated (i.e. never
// instantiated using 'new').
//
// For more details see G4ReferenceCountedHandle.
// Author: Radovan Chytracek, CERN (Radovan.Chytracek@cern.ch)
// Version: 1.0
// Date: March 2001
// ----------------------------------------------------------------------
#ifndef _G4GRSSOLIDHANDLE_H_
#define _G4GRSSOLIDHANDLE_H_ 1
#include "G4GRSSolid.hh"
#include "G4ReferenceCountedHandle.hh"
typedef G4ReferenceCountedHandle<G4GRSSolid> G4GRSSolidHandle;
#endif // _G4GRSSOLIDHANDLE_H_
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GRSVolume.hh,v 1.4.4.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4GRSVolume.hh,v 1.5 2001/07/11 10:00:27 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4GRSVolume
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GRSVolume.icc,v 1.5.4.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4GRSVolume.icc,v 1.6 2001/07/11 10:00:27 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4GRSVolume inline implementation
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4GRSVolumeHandle.hh,v 1.3 2001/11/06 17:08:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// Class G4TouchableHandle
//
// Class description:
//
// Type providing reference counting mechanism for any kind of touchable
// objects.
// The basic rule for the use of this type is that this handle must always
// be exchanged by reference never dinamically allocated (i.e. never
// instantiated using 'new').
//
// For more details see G4ReferenceCountedHandle.
// Author: Radovan Chytracek, CERN (Radovan.Chytracek@cern.ch)
// Version: 1.0
// Date: March 2001
// ----------------------------------------------------------------------
#ifndef _G4GRSVOLUMEHANDLE_H_
#define _G4GRSVOLUMEHANDLE_H_ 1
#include "G4GRSVolume.hh"
#include "G4ReferenceCountedHandle.hh"
typedef G4ReferenceCountedHandle<G4GRSVolume> G4GRSVolumeHandle;
#endif // _G4GRSVOLUMEHANDLE_H_
@@ -0,0 +1,90 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4GeometryMessenger.hh,v 1.2 2001/10/24 18:10:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4GeometryMessenger
//
// Class description:
//
// A messenger defining commands for debugging, verifying
// and controlling the detector geometry and navigation.
// Author: G.Cosmo, CERN.
#ifndef G4GeometryMessenger_hh
#define G4GeometryMessenger_hh
#include "globals.hh"
#include "G4UImessenger.hh"
#include "G4ThreeVector.hh"
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWith3Vector;
class G4UIcmdWithoutParameter;
class G4UIcmdWithABool;
class G4UIcmdWithADoubleAndUnit;
class G4TransportationManager;
class G4GeometryMessenger : public G4UImessenger
{
public: // with description
G4GeometryMessenger(G4TransportationManager* tman);
~G4GeometryMessenger();
// Constructor and destructor
void SetNewValue( G4UIcommand* command, G4String newValues );
G4String GetCurrentValue( G4UIcommand* command );
protected:
void ResetNavigator();
void RunTest();
G4UIdirectory *geodir, *navdir, *testdir;
G4UIcmdWith3VectorAndUnit *posCmd, *dirCmd;
G4UIcmdWithoutParameter *runCmd, *resCmd;
G4UIcmdWithABool *addCmd;
G4UIcmdWithADoubleAndUnit *tolCmd;
private:
G4bool geometryOpened;
G4ThreeVector x, p;
G4bool extra, newtol;
G4double tol;
private:
G4TransportationManager* tmanager;
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalBorderSurface.hh,v 1.6.2.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LogicalBorderSurface.hh,v 1.7 2001/07/11 10:00:28 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
////////////////////////////////////////////////////////////////////////
// class G4LogicalBorderSurface
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalBorderSurface.icc,v 1.3.2.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LogicalBorderSurface.icc,v 1.4 2001/07/11 10:00:28 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4LogicalBorderSurface inline implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalSkinSurface.hh,v 1.6.2.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LogicalSkinSurface.hh,v 1.7 2001/07/11 10:00:28 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
////////////////////////////////////////////////////////////////////////
// class G4LogicalSkinSurface
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalSkinSurface.icc,v 1.3.2.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LogicalSkinSurface.icc,v 1.4 2001/07/11 10:00:28 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4LogicalSkinSurface inline implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NavigationHistory.hh,v 1.8.2.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NavigationHistory.hh,v 1.9 2001/07/11 10:00:28 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// class G4NavigationHistory
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NavigationHistory.icc,v 1.4.2.1 2001/06/28 19:09:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NavigationHistory.icc,v 1.5 2001/07/11 10:00:28 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4NavigationHistory Inline implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NavigationLevel.hh,v 1.12.4.1 2001/06/28 19:09:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NavigationLevel.hh,v 1.13 2001/07/11 10:00:28 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// class G4NavigationLevel
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NavigationLevel.icc,v 1.10.4.1 2001/06/28 19:09:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NavigationLevel.icc,v 1.11 2001/07/11 10:00:28 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// 30.09.97 J.Apostolakis Initial version.
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NavigationLevelRep.hh,v 1.5.4.1 2001/06/28 19:09:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NavigationLevelRep.hh,v 1.6 2001/07/11 10:00:29 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// class G4NavigationLevelRep
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NavigationLevelRep.icc,v 1.4.4.1 2001/06/28 19:09:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NavigationLevelRep.icc,v 1.5 2001/07/11 10:00:29 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// 1 October 1997 J.Apostolakis Initial version.
//
+43 -27
View File
@@ -21,10 +21,10 @@
// ********************************************************************
//
//
// $Id: G4Navigator.hh,v 1.6.4.1 2001/06/28 19:09:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Navigator.hh,v 1.15 2001/12/06 09:35:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//
// class G4Navigator
//
// Class description:
@@ -100,7 +100,8 @@
#include "G4GRSVolume.hh"
#include "G4GRSSolid.hh"
#include "G4TouchableHistory.hh"
#include "G4TouchableHandle.hh"
#include "G4TouchableHistoryHandle.hh"
#include "G4NavigationHistory.hh"
#include "G4NormalNavigation.hh"
@@ -139,12 +140,14 @@ class G4Navigator
// is returned together with the computed isotropic safety
// distance. Geometry must be closed.
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector &p,
const G4TouchableHistory &h);
inline G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector &point,
const G4ThreeVector &direction,
const G4TouchableHistory &h);
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
const G4ThreeVector* direction=0,
const G4bool pRelativeSearch=true);
const G4ThreeVector* direction=0,
const G4bool pRelativeSearch=true,
const G4bool ignoreDirection=true);
// Search the geometrical hierarchy for the volumes deepest in the hierarchy
// containing the point in the global coordinate space. Two main cases are:
// i) If pRelativeSearch=false it makes use of no previous/state
@@ -154,10 +157,12 @@ class G4Navigator
// hierarchy at the location of the last located point, or the endpoint of
// the previous Step if SetGeometricallyLimitedStep() has been called
// immediately before.
// The direction is used (to check if a volume is entered) only if
// the Navigator has determined that it is on an edge shared by two or more
// volumes. (This is state information.)
// The geometry must be closed.
// The direction is used (to check if a volume is entered) if either
// - the argument ignoreDirection is false, or
// - the Navigator has determined that it is on an edge shared by two or more
// volumes. (This is state information.)
//
// Important Note: In order to call this the geometry MUST be closed.
void LocateGlobalPointWithinVolume( const G4ThreeVector& position);
// Notify the Navigator that a track has moved to the new Global point
@@ -168,10 +173,10 @@ class G4Navigator
// same volume as the previous position. Usually this can be guaranteed
// only if the point is within safety.
inline void LocateGlobalPointAndUpdateTouchable(
void LocateGlobalPointAndUpdateTouchableHandle(
const G4ThreeVector& position,
const G4ThreeVector& direction,
G4VTouchable* touchableToUpdate,
G4TouchableHandle& oldTouchableToUpdate,
const G4bool RelativeSearch =true);
// First, search the geometrical hierarchy like the above method
// LocateGlobalPointAndSetup(). Then use the volume found and its
@@ -179,7 +184,16 @@ class G4Navigator
inline void LocateGlobalPointAndUpdateTouchable(
const G4ThreeVector& position,
G4VTouchable* touchableToUpdate,
const G4ThreeVector& direction,
G4VTouchable* touchableToUpdate,
const G4bool RelativeSearch =true);
// First, search the geometrical hierarchy like the above method
// LocateGlobalPointAndSetup(). Then use the volume found and its
// navigation history to update the touchable.
inline void LocateGlobalPointAndUpdateTouchable(
const G4ThreeVector& position,
G4VTouchable* touchableToUpdate,
const G4bool RelativeSearch =true);
// Old version (missing direction).
// Not recommended replace with newer version above.
@@ -211,20 +225,23 @@ class G4Navigator
// system of the volume that was found by LocalGlobalPointAndSetup.
// The Local Coordinates of point in world coordinate system.
G4ThreeVector NetTranslation() const;
G4RotationMatrix NetRotation() const;
inline G4ThreeVector NetTranslation() const;
inline G4RotationMatrix NetRotation() const;
// Compute+return the local->global translation/rotation of current volume.
inline G4VPhysicalVolume* GetWorldVolume() const;
// Return the current world (`topmost') volume.
void SetWorldVolume(G4VPhysicalVolume* pWorld);
inline void SetWorldVolume(G4VPhysicalVolume* pWorld);
// Set the world (`topmost') volume. This must be positioned at
// origin (0,0,0) and unrotated.
G4GRSVolume* CreateGRSVolume() const;
G4GRSSolid* CreateGRSSolid() const;
G4TouchableHistory* CreateTouchableHistory() const;
inline G4GRSVolume* CreateGRSVolume() const;
inline G4GRSSolid* CreateGRSSolid() const;
inline G4TouchableHistory* CreateTouchableHistory() const;
// `Touchable' creation methods: caller has deletion responsibility.
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
// `Touchable' creation methods: caller has deletion responsibility.
inline G4bool IsExitNormalValid();
@@ -251,7 +268,7 @@ class G4Navigator
// This function takes full care about how to calculate this normal,
// but if the surfaces are not convex it will return valid=false.
G4bool EnteredDaughterVolume();
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
@@ -261,10 +278,8 @@ class G4Navigator
// This function is not guaranteed to work if SetGeometricallyLimitedStep()
// was not called when it should have been called.
// G4bool ExitedMotherVolume();
G4int GetVerboseLevel();
void SetVerboseLevel(G4int level);
inline G4int GetVerboseLevel();
inline void SetVerboseLevel(G4int level);
// Get/Set Verbose(ness) level.
// [if level>0 && G4VERBOSE, printout can occur]
@@ -273,12 +288,13 @@ class G4Navigator
// The level of detail is according to the verbosity.
inline const G4AffineTransform& GetGlobalToLocalTransform() const;
const G4AffineTransform GetLocalToGlobalTransform() const;
inline const G4AffineTransform GetLocalToGlobalTransform() const;
// Obtain the transformations Global/Local (and inverse).
// Clients of these methods must copy the data if they need to keep it.
protected: // with description
inline void ResetState();
inline void ResetStackAndState();
// Reset stack and minimum or navigator state machine necessary for reset
// as needed by LocalGlobalPointAndSetup.
+166 -5
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Navigator.icc,v 1.3.4.1 2001/06/28 19:09:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Navigator.icc,v 1.8 2001/12/04 16:49:51 radoone Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4Navigator Inline implementation
@@ -61,6 +61,26 @@ G4VPhysicalVolume* G4Navigator::GetWorldVolume() const
return fTopPhysical;
}
// Set the world (`topmost') volume
//
inline
void G4Navigator::SetWorldVolume(G4VPhysicalVolume* pWorld)
{
// Setup the volume
pWorld->Setup(0); // No mother since world volume
if (!(pWorld->GetTranslation()==G4ThreeVector(0,0,0)))
{
G4Exception ("G4Navigator::SetWorldVolume - Must be centred on origin");
}
const G4RotationMatrix* rm=pWorld->GetRotation();
if (rm&&(!rm->isIdentity()))
{
G4Exception ("G4Navigator::SetWorldVolume - Must not be rotated");
}
fTopPhysical=pWorld;
fHistory.SetFirstEntry(pWorld);
}
// Inform the navigator that the previous Step calculated
// by the geometry was taken in its entirety
//
@@ -73,19 +93,35 @@ void G4Navigator::SetGeometricallyLimitedStep()
// Reset stack and minimum of navigator state `machine'
//
inline
void G4Navigator::ResetStackAndState()
void G4Navigator::ResetState()
{
fHistory.Reset();
fWasLimitedByGeometry=false;
fEntering=false;
fExiting=false;
fLocatedOnEdge = false;
fLastStepWasZero= false;
fEnteredDaughter = false;
fExitedMother = false;
fValidExitNormal = false;
fExitNormal = G4ThreeVector(0,0,0);
fPreviousSftOrigin = G4ThreeVector(0,0,0);
fPreviousSafety = 0.0;
fBlockedPhysicalVolume=0;
fBlockedReplicaNo=-1;
}
// Reset stack and minimum of navigator state `machine'
//
inline
void G4Navigator::ResetStackAndState()
{
fHistory.Reset();
ResetState();
}
inline
EVolume G4Navigator::VolumeType(const G4VPhysicalVolume *pVol) const
{
@@ -165,6 +201,92 @@ const G4AffineTransform& G4Navigator::GetGlobalToLocalTransform() const
return fHistory.GetTopTransform();
}
// Return global to local transformation
//
inline
const G4AffineTransform G4Navigator::GetLocalToGlobalTransform() const
{
G4AffineTransform tempTransform;
tempTransform= fHistory.GetTopTransform().Inverse();
return tempTransform;
}
// Compute+return the local->global translation of current volume.
//
inline
G4ThreeVector G4Navigator::NetTranslation() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return tf.NetTranslation();
}
// Compute+return the local->global rotation of current volume.
//
inline
G4RotationMatrix G4Navigator::NetRotation() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return tf.NetRotation();
}
// `Touchable' creation method: caller has deletion responsibility.
//
inline
G4GRSVolume* G4Navigator::CreateGRSVolume() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return new G4GRSVolume(fHistory.GetTopVolume(),
tf.NetRotation(),
tf.NetTranslation());
}
// `Touchable' creation method: caller has deletion responsibility.
//
inline
G4GRSSolid* G4Navigator::CreateGRSSolid() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return new G4GRSSolid(fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(),
tf.NetRotation(),
tf.NetTranslation());
}
// `Touchable' creation method: caller has deletion responsibility.
//
inline
G4TouchableHistory* G4Navigator::CreateTouchableHistory() const
{
return new G4TouchableHistory(fHistory);
}
// To inform the caller if the track is entering a daughter volume.
//
inline
G4bool G4Navigator::EnteredDaughterVolume()
{
return fEnteredDaughter;
}
// inline
// G4bool G4Navigator::ExitedVolume()
// {
// return fExitedCurrent;
// }
inline
G4VPhysicalVolume*
G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector &p,
const G4ThreeVector &direction,
const G4TouchableHistory &h
)
{
ResetState();
fHistory=*h.GetHistory();
SetupHierarchy();
return LocateGlobalPointAndSetup(p, &direction, true, false);
}
inline
void G4Navigator::LocateGlobalPointAndUpdateTouchable(
const G4ThreeVector& position,
@@ -187,3 +309,42 @@ void G4Navigator::LocateGlobalPointAndUpdateTouchable(
pPhysVol= LocateGlobalPointAndSetup( position, &direction, RelativeSearch);
touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
}
inline
void G4Navigator::LocateGlobalPointAndUpdateTouchableHandle(
const G4ThreeVector& position,
const G4ThreeVector& direction,
G4TouchableHandle& oldTouchableToUpdate,
const G4bool RelativeSearch )
{
// G4VPhysicalVolume* pPhysVol=LocateGlobalPointAndSetup( position, 0, RelativeSearch);
G4VPhysicalVolume* 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;
}
inline
G4TouchableHistoryHandle G4Navigator::CreateTouchableHistoryHandle() const
{
return G4TouchableHistoryHandle( CreateTouchableHistory() );
}
inline
G4int G4Navigator::GetVerboseLevel()
{
return fVerbose;
}
inline
void G4Navigator::SetVerboseLevel(G4int level)
{
fVerbose=level;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NormalNavigation.hh,v 1.3.4.1 2001/06/28 19:09:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NormalNavigation.hh,v 1.4 2001/07/11 10:00:30 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4NormalNavigation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NormalNavigation.icc,v 1.3.4.1 2001/06/28 19:09:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NormalNavigation.icc,v 1.4 2001/07/11 10:00:30 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// G4NormalNavigation Inline Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisedNavigation.hh,v 1.3.4.1 2001/06/28 19:09:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ParameterisedNavigation.hh,v 1.4 2001/07/11 10:00:30 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ParameterisedNavigation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisedNavigation.icc,v 1.3.4.1 2001/06/28 19:09:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ParameterisedNavigation.icc,v 1.4 2001/07/11 10:00:30 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ParameterisedNavigation Inline implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PropagatorInField.hh,v 1.15.2.1 2001/06/28 19:09:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PropagatorInField.hh,v 1.20 2001/12/08 00:07:23 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4PropagatorInField
@@ -138,12 +138,22 @@ class G4PropagatorInField
inline G4double GetMinimumEpsilonStep() const;
inline void SetMinimumEpsilonStep(G4double newEpsMin);
inline void SetLargestAcceptableStep(G4double newBigDist);
inline G4double GetLargestAcceptableStep();
public: // without description
// void SetGlobalFieldMgr( G4FieldManager *detectorFieldMgr );
// The Field Manager of the Detector.
private:
inline G4FieldManager* GetCurrentFieldManager();
public: // no description
inline void SetThresholdNoZeroStep(G4int noAct, G4int noHarsh, G4int noAbandon);
inline G4int GetThresholdNoZeroSteps(G4int i);
protected:
G4bool LocateIntersectionPoint(
const G4FieldTrack& CurveStartPointTangent, // A
@@ -155,7 +165,12 @@ class G4PropagatorInField
// with the surface of the current volume (or of one of its daughters).
// (Should use lateral displacement as measure of convergence).
void PrintStepLengthDiagnostic(G4double CurrentProposedStepLength,
G4double decreaseFactor,
G4double stepTrial,
const G4FieldTrack& aFieldTrack);
// ----------------------------------------------------------------------
// DATA Members
// ----------------------------------------------------------------------
@@ -186,19 +201,24 @@ class G4PropagatorInField
// Values for the small possible relative accuracy of a step
// (corresponding to the greatest possible integration accuracy)
// Minimum for Relative accuracy of any Step
// Limits for the Relative accuracy of any Step
G4double fEpsilonMin;
static const G4double fEpsilonMinDefault; // 1.0e-10 ;
G4double fEpsilonMax;
static const G4double fEpsilonMinDefault; // Can be 1.0e-5 to 1.0e-10 ...
static const G4double fEpsilonMaxDefault; // Can be 1.0e-1 to 1.0e-3 ...
G4int fmax_loop_count;
// Variables to keep track of "abnormal" case - which causes loop
//
G4int fNoZeroStep; // Counter of zeroStep
G4int fThresholdNo_ZeroSteps; // Threshold: above this - action
G4int fActionThreshold_NoZeroSteps; // Threshold: above this - act
G4int fSevereActionThreshold_NoZeroSteps; // Threshold to act harshly
G4int fAbandonThreshold_NoZeroSteps; // Threshold to abandon
// G4double fMidPoint_CurveLen_of_LastAttempt= -1;
G4double fFull_CurveLen_of_LastAttempt;
G4double fLast_ProposedStepLength;
G4double fLargestAcceptableStep;
};
// Defines the constructor.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PropagatorInField.icc,v 1.18.2.2 2001/06/28 20:18:53 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PropagatorInField.icc,v 1.25 2001/12/08 00:07:24 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------------------
@@ -48,15 +48,21 @@ G4PropagatorInField::G4PropagatorInField(G4Navigator *theNavigator,
End_PointAndTangent(G4ThreeVector(0.,0.,0.),
G4ThreeVector(0.,0.,0.),0.0,0.0,0.0,0.0,0.0),
fVerboseLevel(0),
fmax_loop_count(10000)
fEpsilonMin(fEpsilonMinDefault),
fEpsilonMax(fEpsilonMaxDefault),
fmax_loop_count(10000),
fNoZeroStep(0)
{
// this->fChordFinder = new G4ChordFinder( (G4MagneticField*)0, 1e-6 );
fNoZeroStep=0;
fThresholdNo_ZeroSteps= 2;
fActionThreshold_NoZeroSteps= 2;
fSevereActionThreshold_NoZeroSteps= 10;
fAbandonThreshold_NoZeroSteps= 50;
// fMidPoint_CurveLen_of_LastAttempt= -1;
fFull_CurveLen_of_LastAttempt= -1;
fLast_ProposedStepLength= -1;
fLargestAcceptableStep= 1000.0 * meter;
}
inline
@@ -186,3 +192,39 @@ void G4PropagatorInField::SetMinimumEpsilonStep(G4double newEpsMin)
if( (newEpsMin > 0.0) && (fabs(1.0+newEpsMin)>1.0) )
fEpsilonMin= newEpsMin;
}
inline void G4PropagatorInField::SetLargestAcceptableStep(G4double newBigDist)
{if(fLargestAcceptableStep>0.0) fLargestAcceptableStep= newBigDist; }
inline G4double G4PropagatorInField::GetLargestAcceptableStep()
{return fLargestAcceptableStep;}
inline G4FieldManager* G4PropagatorInField::GetCurrentFieldManager()
{ return fCurrentFieldMgr; }
inline void G4PropagatorInField::SetThresholdNoZeroStep( G4int noAct, G4int noHarsh, G4int noAbandon)
{
if(noAct>0)
fActionThreshold_NoZeroSteps= noAct;
if( noHarsh > fActionThreshold_NoZeroSteps)
fSevereActionThreshold_NoZeroSteps= noHarsh;
else
fSevereActionThreshold_NoZeroSteps= 2*(fActionThreshold_NoZeroSteps+1);
if( noAbandon > fSevereActionThreshold_NoZeroSteps+5)
fAbandonThreshold_NoZeroSteps= noAbandon;
else
fAbandonThreshold_NoZeroSteps= 2*(fSevereActionThreshold_NoZeroSteps+3);
}
inline G4int G4PropagatorInField::GetThresholdNoZeroSteps(G4int i)
{
G4int t=0;
if( i==0 ) { t = 3; } // No of parameters
else if (i==1) { t = fActionThreshold_NoZeroSteps; }
else if (i==2) { t = fSevereActionThreshold_NoZeroSteps; }
else if (i==3) { t = fAbandonThreshold_NoZeroSteps; }
return t;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ReplicaNavigation.hh,v 1.3.4.1 2001/06/28 19:09:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ReplicaNavigation.hh,v 1.4 2001/07/11 10:00:30 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ReplicaNavigation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ReplicaNavigation.icc,v 1.4.2.1 2001/06/28 19:09:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ReplicaNavigation.icc,v 1.5 2001/07/11 10:00:31 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ReplicaNavigation Inline implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TouchableHistory.hh,v 1.4.4.1 2001/06/28 19:09:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TouchableHistory.hh,v 1.5 2001/07/11 10:00:31 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4TouchableHistory
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TouchableHistory.icc,v 1.5.4.1 2001/06/28 19:09:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TouchableHistory.icc,v 1.6 2001/07/11 10:00:31 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4TouchableHistory inline implementation
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4TouchableHistoryHandle.hh,v 1.3 2001/11/06 17:08:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// Class G4TouchableHandle
//
// Class description:
//
// A type providing reference counting mechanism for any kind of touchable
// history objects.
// The basic rule for the use of this type is that this handle must always
// be exchanged by reference never dinamically allocated (i.e. never
// instantiated using 'new').
//
// For more details see G4ReferenceCountedHandle.
// Author: Radovan Chytracek, CERN (Radovan.Chytracek@cern.ch)
// Version: 1.0
// Date: March 2001
// ----------------------------------------------------------------------
#ifndef _G4TOUCHABLEHISTORYHANDLE_H_
#define _G4TOUCHABLEHISTORYHANDLE_H_ 1
#include "G4TouchableHistory.hh"
#include "G4ReferenceCountedHandle.hh"
typedef G4ReferenceCountedHandle<G4TouchableHistory> G4TouchableHistoryHandle;
#endif // _G4TOUCHABLEHISTORYHANDLE_H_
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TransportationManager.hh,v 1.5.4.1 2001/06/28 19:09:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TransportationManager.hh,v 1.7 2001/10/24 15:33:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// class G4TransportationManager
//
@@ -45,6 +45,7 @@
#include "G4Navigator.hh"
class G4PropagatorInField;
class G4GeometryMessenger;
class G4FieldManager;
class G4TransportationManager
@@ -72,6 +73,7 @@ class G4TransportationManager
G4Navigator* fNavigatorForTracking ;
G4PropagatorInField* fPropagatorInField;
G4FieldManager* fFieldManager;
G4GeometryMessenger* fGeomMessenger;
static G4TransportationManager* fTransportationManager;
};
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TransportationManager.icc,v 1.4.4.1 2001/06/28 19:09:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TransportationManager.icc,v 1.5 2001/07/11 10:00:31 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 inlined function members implementation
// ------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VoxelNavigation.hh,v 1.8.2.1 2001/06/28 19:09:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VoxelNavigation.hh,v 1.9 2001/07/11 10:00:31 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4VoxelNavigation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VoxelNavigation.icc,v 1.7.2.1 2001/06/28 19:09:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VoxelNavigation.icc,v 1.8 2001/07/11 10:00:31 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4VoxelNavigation Inline implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BlockingList.cc,v 1.3.2.1 2001/06/28 19:09:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4BlockingList.cc,v 1.4 2001/07/11 10:00:32 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4BlockingList Implementation
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GRSSolid.cc,v 1.3.4.1 2001/06/28 19:09:43 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4GRSSolid.cc,v 1.4 2001/07/11 10:00:32 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4GRSSolid Implementation
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GRSVolume.cc,v 1.3.4.1 2001/06/28 19:09:43 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4GRSVolume.cc,v 1.4 2001/07/11 10:00:32 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4GRSVolume Implementation
@@ -0,0 +1,244 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4GeometryMessenger.cc,v 1.4 2001/11/01 19:00:11 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
//
// G4GeometryMessenger
//
// Author: G.Cosmo, CERN.
#include "g4std/iomanip"
#include "G4GeometryMessenger.hh"
#include "G4TransportationManager.hh"
#include "G4GeometryManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Navigator.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWith3Vector.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4GeomTestStreamLogger.hh"
#include "G4GeomTestVolume.hh"
//
// Constructor
//
G4GeometryMessenger::G4GeometryMessenger(G4TransportationManager* tman)
: geometryOpened(true), x(0,0,0), p(0,0,1),
extra(false), newtol(false), tol(1E-4*mm),
tmanager(tman)
{
geodir = new G4UIdirectory( "/geometry/" );
geodir->SetGuidance( "Geometry control commands." );
//
// Geometry navigator commands
//
navdir = new G4UIdirectory( "/geometry/navigator/" );
navdir->SetGuidance( "Geometry navigator control setup." );
resCmd = new G4UIcmdWithoutParameter( "/geometry/navigator/reset", this );
resCmd->SetGuidance( "Reset navigator and navigation history." );
//
// Geometry verification test commands
//
testdir = new G4UIdirectory( "/geometry/test/" );
testdir->SetGuidance( "Geometry verification control setup." );
testdir->SetGuidance( "Helps in detecting possible overlapping regions." );
addCmd = new G4UIcmdWithABool( "/geometry/test/line_test",this );
addCmd->SetGuidance( "Test along a single specified direction/position?" );
addCmd->SetGuidance( "Use position and direction commands to change default." );
addCmd->SetGuidance( "Default: position(0,0,0), direction(0,0,1)." );
addCmd->SetParameterName( "Extra", true, true );
tolCmd = new G4UIcmdWithADoubleAndUnit( "/geometry/test/tolerance",this );
tolCmd->SetGuidance( "Set error tolerance value." );
tolCmd->SetGuidance( "Default: 1E-4*mm." );
tolCmd->SetParameterName( "Tolerance", true, true );
tolCmd->SetDefaultUnit( "mm" );
tolCmd->SetUnitCategory( "Length" );
posCmd = new G4UIcmdWith3VectorAndUnit( "/geometry/test/position", this );
posCmd->SetGuidance( "Set starting position." );
posCmd->SetParameterName( "X", "Y", "Z", true, true );
posCmd->SetDefaultUnit( "cm" );
dirCmd = new G4UIcmdWith3VectorAndUnit( "/geometry/test/direction", this );
dirCmd->SetGuidance( "Set momentum direction." );
dirCmd->SetGuidance( "Direction needs not to be a unit vector." );
dirCmd->SetParameterName( "Px", "Py", "Pz", true, true );
dirCmd->SetRange( "Px != 0 || Py != 0 || Pz != 0" );
runCmd = new G4UIcmdWithoutParameter( "/geometry/test/run", this );
runCmd->SetGuidance( "Start running the test." );
}
//
// Destructor
//
G4GeometryMessenger::~G4GeometryMessenger()
{
delete addCmd;
delete posCmd;
delete dirCmd;
delete runCmd;
delete resCmd;
delete tolCmd;
delete geodir;
delete navdir;
delete testdir;
}
//
// SetNewValue
//
void
G4GeometryMessenger::SetNewValue( G4UIcommand* command, G4String newValues )
{
if (command == resCmd) {
ResetNavigator();
}
else if (command == addCmd) {
extra = addCmd->GetNewBoolValue( newValues );
}
else if (command == posCmd) {
x = posCmd->GetNew3VectorValue( newValues );
}
else if (command == dirCmd) {
p = dirCmd->GetNew3VectorValue( newValues );
if (p.mag() < DBL_MIN) {
G4cerr << "Please specify non-zero momentum" << G4endl;
p = G4ThreeVector(0,0,1);
}
}
else if (command == tolCmd) {
tol = tolCmd->GetNewDoubleValue( newValues );
newtol = true;
}
else if (command == runCmd) {
RunTest();
}
}
//
// GetCurrentValue
//
G4String
G4GeometryMessenger::GetCurrentValue(G4UIcommand* command )
{
G4String cv = "";
if (command == addCmd) {
cv = addCmd->ConvertToString( extra );
}
else if (command == posCmd) {
cv = posCmd->ConvertToString( x, "cm" );
}
else if (command == tolCmd) {
cv = tolCmd->ConvertToString( tol, "mm" );
}
else if (command == dirCmd) {
cv = dirCmd->ConvertToString( p, "GeV" );
}
return cv;
}
//
// ResetNavigator
//
void
G4GeometryMessenger::ResetNavigator()
{
// Close geometry if necessary
//
if (geometryOpened) {
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
geomManager->OpenGeometry();
geomManager->CloseGeometry(true);
geometryOpened = false;
}
// Reset navigator's state
//
G4ThreeVector p(0,0,0);
tmanager->GetNavigatorForTracking()->LocateGlobalPointAndSetup(p,0,false);
}
//
// RunTest
//
void
G4GeometryMessenger::RunTest()
{
// Create a logger to send errors/output to cout
//
G4GeomTestStreamLogger logger(G4std::cout);
// Close geometry if necessary
//
if (geometryOpened) {
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
geomManager->OpenGeometry();
geomManager->CloseGeometry(true);
geometryOpened = false;
}
// Get the world volume
//
G4VPhysicalVolume* world =
tmanager->GetNavigatorForTracking()->GetWorldVolume();
// Test the actual detector...
//
G4GeomTestVolume geomTest(world, &logger);
// Verify if error tolerance has changed
//
if (newtol) geomTest.SetTolerance(tol);
// Run the test
//
if (extra) // Make test on single line supplied by user
geomTest.TestOneLine( x, p );
else // Apply default set of trajectories in a 3D grid pattern
geomTest.TestCartGridXYZ();
// Print out any errors, if found
//
geomTest.ReportErrors();
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalBorderSurface.cc,v 1.6.2.1 2001/06/28 19:09:43 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LogicalBorderSurface.cc,v 1.7 2001/07/11 10:00:32 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalBorderSurface Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalSkinSurface.cc,v 1.6.2.1 2001/06/28 19:09:43 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LogicalSkinSurface.cc,v 1.7 2001/07/11 10:00:32 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalSkinSurface Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NavigationHistory.cc,v 1.3.4.1 2001/06/28 19:09:43 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NavigationHistory.cc,v 1.4 2001/07/11 10:00:32 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// G4NavigationHistory Implementation P.Kent August 96
+81 -128
View File
@@ -21,9 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Navigator.cc,v 1.11.4.1 2001/06/28 19:09:43 gunter Exp $
// GEANT4 tag $Name: $
//
// $Id: G4Navigator.cc,v 1.23 2001/12/11 17:46:49 gcosmo Exp $
// GEANT4 tag $ Name: $
//
// class G4Navigator Implementation Paul Kent July 95/96
@@ -42,26 +41,7 @@ G4Navigator::G4Navigator() :
G4Navigator::~G4Navigator()
{;}
// Set the world (`topmost') volume
void G4Navigator::SetWorldVolume(G4VPhysicalVolume* pWorld)
{
// Setup the volume
pWorld->Setup(0); // No mother since world volume
if (!(pWorld->GetTranslation()==G4ThreeVector(0,0,0)))
{
G4Exception ("G4Navigator::SetWorldVolume - Must be centred on origin");
}
const G4RotationMatrix* rm=pWorld->GetRotation();
if (rm&&(!rm->isIdentity()))
{
G4Exception ("G4Navigator::SetWorldVolume - Must not be rotated");
}
fTopPhysical=pWorld;
fHistory.SetFirstEntry(pWorld);
}
// define DEBUG_HIST 1
// define G4DEBUG_NAVIGATION 1
// Locate the point in the hierarchy return 0 if outside
//
@@ -71,16 +51,25 @@ void G4Navigator::SetWorldVolume(G4VPhysicalVolume* pWorld)
G4VPhysicalVolume*
G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
const G4ThreeVector* pGlobalDirection,
const G4bool relativeSearch)
const G4bool relativeSearch,
const G4bool ignoreDirection)
{
G4bool notKnownContained=true,noResult;
G4VPhysicalVolume *targetPhysical;
G4LogicalVolume *targetLogical;
G4VSolid *targetSolid;
G4ThreeVector localPoint;
G4VSolid *targetSolid=0;
G4ThreeVector localPoint, globalDirection;
EInside insideCode;
#ifdef DEBUG_HIST
G4bool considerDirection = (!ignoreDirection) || fLocatedOnEdge;
if( considerDirection && pGlobalDirection != 0 )
{
globalDirection=*pGlobalDirection;
}
#ifdef G4DEBUG_NAVIGATION
G4cerr << "Upon entering LocateGlobalPointAndSetup " << G4endl;
G4cerr << " History = " << G4endl << fHistory << G4endl << G4endl;
#endif
@@ -141,7 +130,9 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
{
case kNormal:
fBlockedPhysicalVolume->Setup(curPhysical);
fHistory.NewLevel(fBlockedPhysicalVolume);
fHistory.NewLevel(fBlockedPhysicalVolume,
kNormal,
fBlockedPhysicalVolume->GetCopyNo());
break;
case kReplica:
freplicaNav.ComputeTransformation(fBlockedReplicaNo,
@@ -237,26 +228,46 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
return 0;
}
}
else if (insideCode==kSurface&&fExiting)
{
if (fHistory.GetDepth())
{
fBlockedPhysicalVolume=fHistory.GetTopVolume();
fBlockedReplicaNo=fHistory.GetTopReplicaNo();
fHistory.BackLevel();
// Still on surface but exited volume not necessarily convex
fValidExitNormal=false;
}
else
{
// Have exited world volume
return 0;
}
}
else if (insideCode==kSurface)
{
G4bool isExiting= fExiting;
if((!fExiting)&&considerDirection){
// Figure out whether we are exiting this level's volume by using the direction
G4bool directionExiting= false;
G4ThreeVector localDirection;
localDirection=fHistory.GetTopTransform().TransformAxis(globalDirection);
if (fHistory.GetTopVolumeType()!=kReplica){
G4ThreeVector normal= targetSolid->SurfaceNormal(localPoint);
directionExiting= normal.dot(localDirection) > 0.0;
isExiting= isExiting || directionExiting;
}
}
if(isExiting)
{
if (fHistory.GetDepth())
{
fBlockedPhysicalVolume=fHistory.GetTopVolume();
fBlockedReplicaNo=fHistory.GetTopReplicaNo();
fHistory.BackLevel();
// Still on surface but exited volume not necessarily convex
fValidExitNormal=false;
}
else
{
// Have exited world volume
return 0;
}
}
else
{
notKnownContained=false;
}
}
else
{
notKnownContained=false;
}
{
notKnownContained=false;
}
}
//
@@ -272,7 +283,8 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
noResult=true; // noResult should be renamed to
// something like enteredLevel, as that is its meaning.
do
do
{
// Determine `type' of current mother volume
@@ -288,7 +300,7 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
fBlockedReplicaNo,
globalPoint,
pGlobalDirection,
fLocatedOnEdge,
considerDirection,
localPoint);
}
else
@@ -298,7 +310,7 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
fBlockedReplicaNo,
globalPoint,
pGlobalDirection,
fLocatedOnEdge,
considerDirection,
localPoint);
}
break;
@@ -308,7 +320,7 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
fBlockedReplicaNo,
globalPoint,
pGlobalDirection,
fLocatedOnEdge,
considerDirection,
localPoint);
break;
case kParameterised:
@@ -317,7 +329,7 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
fBlockedReplicaNo,
globalPoint,
pGlobalDirection,
fLocatedOnEdge,
considerDirection,
localPoint);
break;
}
@@ -350,7 +362,7 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
}
#endif
#ifdef DEBUG_HIST
#ifdef G4DEBUG_NAVIGATION
G4cerr << "Upon exiting LocateGlobalPointAndSetup " << G4endl;
G4cerr << " History = " << G4endl << fHistory << G4endl << G4endl;
#endif
@@ -611,6 +623,7 @@ G4double G4Navigator::ComputeStep(const G4ThreeVector &pGlobalpoint,
// We must calculate the normal anyway (in order to have it if requested)
G4ThreeVector FinalPoint= fLastLocatedPointLocal + localDirection*Step;
fExitNormal= motherLogical->GetSolid()->SurfaceNormal(FinalPoint);
}
#ifdef G4VERBOSE
@@ -624,48 +637,6 @@ G4double G4Navigator::ComputeStep(const G4ThreeVector &pGlobalpoint,
return Step;
}
G4VPhysicalVolume* G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector &p,
const G4TouchableHistory &h)
{
fHistory=*h.GetHistory();
SetupHierarchy();
return LocateGlobalPointAndSetup(p, 0);
}
G4ThreeVector G4Navigator::NetTranslation() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return tf.NetTranslation();
}
G4RotationMatrix G4Navigator::NetRotation() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return tf.NetRotation();
}
G4GRSVolume* G4Navigator::CreateGRSVolume() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return new G4GRSVolume(fHistory.GetTopVolume(),
tf.NetRotation(),
tf.NetTranslation());
}
G4GRSSolid* G4Navigator::CreateGRSSolid() const
{
G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
return new G4GRSSolid(fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(),
tf.NetRotation(),
tf.NetTranslation());
}
G4TouchableHistory* G4Navigator::CreateTouchableHistory() const
{
return new G4TouchableHistory(fHistory);
}
// Renavigate & reset hierarchy described by current history
// o Reset volumes
// o Recompute transforms and/or solids of replicated/parameterised vols
@@ -719,14 +690,6 @@ G4std::ostream& operator << (G4std::ostream &os,const G4Navigator &n)
return os;
}
// Return global to local transformation
const G4AffineTransform G4Navigator::GetLocalToGlobalTransform() const
{
G4AffineTransform tempTransform;
tempTransform= fHistory.GetTopTransform().Inverse();
return tempTransform;
}
// Obtain the Normal vector to a surface (in local coordinates)
// pointing out of previous volume and into current volume
//
@@ -842,23 +805,12 @@ G4double G4Navigator::ComputeSafety(const G4ThreeVector &pGlobalpoint,
return newSafety;
}
G4bool G4Navigator::EnteredDaughterVolume()
{
return fEnteredDaughter;
}
// G4bool G4Navigator::ExitedVolume()
// {
// return fExitedCurrent;
// }
void G4Navigator::PrintState()
{
if( fVerbose >= 4 )
{
G4cout.precision(3);
G4cout << " Upon exiting my state is: " << G4endl;
G4cout << "The current state of G4Navigator is: " << G4endl;
G4cout << " ValidExitNormal= " << fValidExitNormal << G4endl
<< " ExitNormal = " << fExitNormal << G4endl
<< " Exiting = " << fExiting << G4endl
@@ -876,7 +828,7 @@ void G4Navigator::PrintState()
if( ( 1 < fVerbose) && (fVerbose < 4) )
{
G4cout.precision(3);
G4cout << G4std::setw(18) << " ExitNormal " << " "
G4cout << G4std::setw(24) << " ExitNormal " << " "
<< G4std::setw( 5) << " Valid " << " "
<< G4std::setw( 9) << " Exiting " << " "
<< G4std::setw( 9) << " Entering" << " "
@@ -884,7 +836,7 @@ void G4Navigator::PrintState()
<< G4std::setw( 9) << " ReplicaNo" << " "
<< G4std::setw( 8) << " LastStepZero " << " "
<< G4endl;
G4cout << G4std::setw(18) << fExitNormal << " "
G4cout << G4std::setw(24) << fExitNormal << " "
<< G4std::setw( 5) << fValidExitNormal << " "
<< G4std::setw( 9) << fExiting << " "
<< G4std::setw( 9) << fEntering << " ";
@@ -954,6 +906,18 @@ void G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoi
}
}
// Reset the state variables
// - which would have been affected
// by the 'equivalent' call to LocateGlobalPointAndSetup
// - who's values have been invalidated by the 'move'.
//fWasLimitedByGeometry= false;
//fBlockedPhysicalVolume=0;
//fBlockedReplicaNo= -1;
//fEntering=false;
//fEnteredDaughter=false; // Boundary not encountered, did not enter
//fExiting=false;
//fExitedMother=false; // Boundary not encountered, did not exit
#if 0
else
{
@@ -992,14 +956,3 @@ void G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoi
#endif
}
G4int G4Navigator::GetVerboseLevel()
{
return fVerbose;
}
void G4Navigator::SetVerboseLevel(G4int level)
{
fVerbose=level;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NormalNavigation.cc,v 1.3.4.1 2001/06/28 19:09:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NormalNavigation.cc,v 1.4 2001/07/11 10:00:33 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4NormalNavigation Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisedNavigation.cc,v 1.3.4.1 2001/06/28 19:09:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ParameterisedNavigation.cc,v 1.4 2001/07/11 10:00:33 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ParameterisedNavigation Implementation
@@ -21,14 +21,13 @@
// ********************************************************************
//
//
// $Id: G4PropagatorInField.cc,v 1.19.2.1 2001/06/28 19:09:44 gunter Exp $
// GEANT4 tag $Name: $
//
// $Id: G4PropagatorInField.cc,v 1.28 2001/12/08 01:17:04 japost Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// This routine implements an algorithm to track a particle in a //
// non-uniform magnetic field. It utilises an ODE solver (with //
// the Runge - Kutta method) to evolve the particle, and drives it //
// This class implements an algorithm to track a particle in a
// non-uniform magnetic field. It utilises an ODE solver (with
// the Runge - Kutta method) to evolve the particle, and drives it
// until the particle has traveled a set distance or it enters a new
// volume.
//
@@ -39,6 +38,8 @@
// 17.03.97 John Apostolakis, renaming new set functions being added
//
// #define G4DEBUG_FIELD 1
#include "G4PropagatorInField.hh"
#include "G4ios.hh"
#include "g4std/iomanip"
@@ -48,7 +49,8 @@
//const G4double G4PropagatorInField::fDefault_Delta_Intersection_Val= 0.1 * mm;
//const G4double G4PropagatorInField::fDefault_Delta_One_Step_Value = 0.25 * mm;
const G4double G4PropagatorInField::fEpsilonMinDefault = 1.0e-10 ;
const G4double G4PropagatorInField::fEpsilonMinDefault = 5.0e-7;
const G4double G4PropagatorInField::fEpsilonMaxDefault = 0.05;
///////////////////////////////////////////////////////////////////////////
//
@@ -84,53 +86,84 @@ G4double G4PropagatorInField::
G4FieldTrack CurrentState(pFieldTrack);
#if 0
CurrentState.SetVelocity( pFieldTrack.GetMomentumDir() );
// For now, must utilize unit "velocity" J.A. Nov 17, 98
// Problem in setting the energy in this case .... (and in E field)
#endif
G4FieldTrack OriginalState= CurrentState;
// If the Step length is "infinite", then an approximate-maximum Step lenght
// (used to calculate the relative accuracy) must be guessed.
//
if( CurrentProposedStepLength >= kInfinity )
if( CurrentProposedStepLength >= fLargestAcceptableStep )
{
G4ThreeVector StartPointA, VelocityUnit;
StartPointA = pFieldTrack.GetPosition();
VelocityUnit= pFieldTrack.GetMomentumDir();
CurrentProposedStepLength= 1.e3 * ( 10.0 * cm +
G4double trialProposedStep= 1.e2 * ( 10.0 * cm +
fNavigator->GetWorldVolume()->GetLogicalVolume()->
GetSolid()->DistanceToOut(StartPointA, VelocityUnit) ) ;
CurrentProposedStepLength= G4std::min( trialProposedStep, fLargestAcceptableStep);
}
epsilon = GetDeltaOneStep() / CurrentProposedStepLength ;
if( epsilon < fEpsilonMin ) epsilon = fEpsilonMin ;
if( epsilon > fEpsilonMax ) epsilon = fEpsilonMax ;
this->SetEpsilonStep( epsilon );
if( fNoZeroStep > fThresholdNo_ZeroSteps ) {
// Shorten the proposed step in case of earlier problems (zero steps)
//
if( fNoZeroStep > fActionThreshold_NoZeroSteps ) {
G4double stepTrial; // = fMidPoint_CurveLen_of_LastAttempt;
stepTrial= 0.5 * fFull_CurveLen_of_LastAttempt;
stepTrial= fFull_CurveLen_of_LastAttempt;
if( (stepTrial <= 0.0) && (fLast_ProposedStepLength>0.0) )
stepTrial=0.5 * fLast_ProposedStepLength;
if( fNoZeroStep > 2*fThresholdNo_ZeroSteps ){
stepTrial *= 0.5; // Ensure quicker convergence.
if( (stepTrial == 0.0)
|| ( fNoZeroStep > 5*fThresholdNo_ZeroSteps ) ) {
G4cerr << " G4PropagatorInField::ComputeStep "
<< " ERROR : attempting a zero step= " << stepTrial << G4endl
<< " and/or no progress after " << fNoZeroStep
<< " trial steps. ABORTING." << G4endl;
G4Exception("G4PropagatorInField::ComputeStep No progress - Looping with zero steps");
}
stepTrial= fLast_ProposedStepLength;
G4double decreaseFactor=0.9; // Unused default
// G4double thisTolerance= kCarTolerance;
if( (fNoZeroStep < fSevereActionThreshold_NoZeroSteps)
&& (stepTrial > 1000.0*kCarTolerance) ){
// Ensure quicker convergence.
decreaseFactor= 0.1;
} else {
// We are in significant difficulties, probably at a boundary
// that is either geometrically sharp
// or between very different materials.
//
// Careful decreases to cope with tolerance are required.
if(stepTrial > 1000.0*kCarTolerance)
decreaseFactor= 0.25; // Try slow decreases
else if(stepTrial > 100.0*kCarTolerance)
decreaseFactor= 0.5; // Try slower decreases
else if(stepTrial > 10.0*kCarTolerance)
decreaseFactor= 0.75; // Try even slower decreases
else
decreaseFactor= 0.9; // Try very slow decreases
}
CurrentProposedStepLength = stepTrial;
stepTrial *= decreaseFactor;
#ifdef G4DEBUG_FIELD
PrintStepLengthDiagnostic(CurrentProposedStepLength, decreaseFactor,
stepTrial, pFieldTrack);
#endif
if( (stepTrial == 0.0) ) {
// || ( fNoZeroStep > fAbandonThresholdNo_ZeroSteps ) ) {
G4cout << " G4PropagatorInField::ComputeStep "
<< " Particle abandoned due to lack of progress in field."
<< G4endl
<< " Properties : " << pFieldTrack << " "
<< G4endl;
G4cerr << " G4PropagatorInField::ComputeStep "
<< " ERROR : attempting a zero step= " << stepTrial << G4endl
<< " while attempting to progress after " << fNoZeroStep
<< " trial steps. Will abandon step." << G4endl;
// G4Exception("G4PropagatorInField::ComputeStep No progress - Looping with zero steps");
fParticleIsLooping= true;
return 0; // = stepTrial;
}
if( stepTrial < CurrentProposedStepLength)
CurrentProposedStepLength = stepTrial;
}
fLast_ProposedStepLength= CurrentProposedStepLength;
@@ -215,7 +248,7 @@ G4double G4PropagatorInField::
StepTaken =
TruePathLength= IntersectPointVelct_G.GetCurveLength()
- OriginalState.GetCurveLength(); // which is Zero now.
#ifdef G4VERBOSE
#ifdef G4DEBUG_FIELD
if( Verbose() > 0 )
G4cout << " Found intersection after Step of length " <<
StepTaken << G4endl;
@@ -232,21 +265,30 @@ G4double G4PropagatorInField::
StepTaken += s_length_taken;
}
first_substep= false;
#ifdef G4VERBOSE
if( Verbose() > 0 )
printStatus( SubStepStartState, // or OriginalState,
#ifdef G4DEBUG_FIELD
// if( fNoZeroStep )
if( fNoZeroStep > fActionThreshold_NoZeroSteps )
{
// if( Verbose() > 0 )
//if(do_loop_count==0)
// G4cout << "G4PiF: End of Step " << do_loop_count;
printStatus( SubStepStartState, // or OriginalState,
CurrentState,
CurrentProposedStepLength,
NewSafety,
do_loop_count,
pPhysVol);
// G4cout << " Step accepted taken =" << StepTaken << G4endl;
}
#endif
do_loop_count++;
}
while( (!intersects ) && (StepTaken + kCarTolerance < CurrentProposedStepLength)
&& ( do_loop_count < GetMaxLoopCount() ) );
#ifdef G4VERBOSE
if( do_loop_count >= GetMaxLoopCount() ){
@@ -294,6 +336,14 @@ G4double G4PropagatorInField::
}
#endif
#ifdef G4DEBUG_FIELD
if( fNoZeroStep ){
G4cout << " PiF: Step returning=" << StepTaken << G4endl;
G4cout << " ------------------------------------------------------- "
<< G4endl;
}
#endif
// In particular anomalous cases, we can get repeated zero steps
// In order to correct this efficiently, we identify these cases
// and only take corrective action when they occur.
@@ -303,6 +353,14 @@ G4double G4PropagatorInField::
else
fNoZeroStep= 0;
if( fNoZeroStep > fAbandonThreshold_NoZeroSteps ) {
G4cout << " G4PropagatorInField::ComputeStep : Warning :"
<< " no progress after " << fNoZeroStep << " trial steps. "
<< G4endl;
G4cout << " Particle will be abandoned." ;
fParticleIsLooping= true;
}
return TruePathLength;
}
@@ -512,7 +570,7 @@ G4PropagatorInField::LocateIntersectionPoint(
GetChordFinder()->GetIntegrationDriver()
->AccurateAdvance(newEndpoint, curveDist, GetEpsilonStep() );
CurrentB_PointVelocity= newEndpoint;
#ifdef G4DEBUG
#ifdef G4DEBUG_FIELD
static int noInaccuracyWarnings = 0;
const int maxNoWarnings = 10;
if( (noInaccuracyWarnings < maxNoWarnings )
@@ -528,6 +586,10 @@ G4PropagatorInField::LocateIntersectionPoint(
#endif
}
if( curveDist < 0.0 ) {
G4cerr << "G4PropagatorInField::LocateIntersectionPoint: "
<< "Error in advancing " << G4endl;
printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
-1.0, NewSafety, substep_no, 0); // startVolume);
G4Exception("G4PropagatorInField::LocateIntersectionPoint : the final curve point is not further along than the original.");
}
@@ -584,13 +646,13 @@ void G4PropagatorInField::printStatus(
<< G4std::setw( 7) << " N_y " << " "
<< G4std::setw( 7) << " N_z " << " "
<< G4std::setw( 9) << "StepLen" << " "
<< G4std::setw( 9) << "PhsStep" << " "
<< G4std::setw(12) << "PhsStep" << " "
<< G4std::setw(12) << "StartSafety" << " "
<< G4std::setw(18) << "NextVolume" << " "
<< G4endl;
// Recurse to print the start values
printStatus( StartFT, StartFT, //
-1.0, safety, -1, 0); // startVolume);
-1.0, safety, -1, startVolume);
}
if( verboseLevel <= 3 )
@@ -608,9 +670,9 @@ void G4PropagatorInField::printStatus(
<< G4std::setw( 7) << CurrentUnitVelocity.z() << " ";
G4cout << G4std::setw( 9) << step_len << " ";
if( requestStep != -1.0 )
G4cout << G4std::setw( 9) << requestStep << " ";
G4cout << G4std::setw( 12) << requestStep << " ";
else
G4cout << G4std::setw( 9) << " InitialStep " << " ";
G4cout << G4std::setw( 12) << "InitialStep" << " ";
G4cout << G4std::setw(12) << safety << " ";
if( startVolume != 0) {
@@ -639,3 +701,22 @@ void G4PropagatorInField::printStatus(
G4cout << G4endl;
}
}
void
G4PropagatorInField::PrintStepLengthDiagnostic(G4double CurrentProposedStepLength,
G4double decreaseFactor,
G4double stepTrial,
const G4FieldTrack& aFieldTrack)
{
G4cout << " PiF: NoZeroStep= " << fNoZeroStep
<< " CurrentProposedStepLength= " << CurrentProposedStepLength
<< " Full_curvelen_last=" << fFull_CurveLen_of_LastAttempt
<< " last proposed step-length= " << fLast_ProposedStepLength
<< " decreate factor = " << decreaseFactor
<< " step trial = " << stepTrial
<< G4endl;
// printStatus( pFieldTrack, pFieldTrack, CurrentProposedStepLength,
// -1.0, 0, pPhysVol);
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ReplicaNavigation.cc,v 1.9.2.1 2001/06/28 19:09:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ReplicaNavigation.cc,v 1.10 2001/07/11 10:00:33 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4ReplicaNavigation Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TouchableHistory.cc,v 1.4.4.1 2001/06/28 19:09:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TouchableHistory.cc,v 1.5 2001/07/11 10:00:34 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4TouchableHistory Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TransportationManager.cc,v 1.6.2.1 2001/06/28 19:09:45 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TransportationManager.cc,v 1.9 2001/10/24 15:33:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// G4TransportationManager
@@ -32,12 +32,14 @@
// The following inclusions should be left here, as only
// the constructor and destructor require them.
#include "G4GeometryMessenger.hh"
#include "G4PropagatorInField.hh"
#include "G4FieldManager.hh"
// This will ensure correct order of construction and destruption of
// static objects.
#include "G4NavigationLevel.hh"
G4Allocator<G4NavigationLevel> aNavigationLevelAllocator;
G4Allocator<G4NavigationLevelRep> aNavigLevelRepAllocator;
@@ -45,6 +47,9 @@ G4Allocator<G4NavigationLevelRep> aNavigLevelRepAllocator;
const G4double G4FieldManager::fDefault_Delta_Intersection_Val= 0.1 * mm;
const G4double G4FieldManager::fDefault_Delta_One_Step_Value = 0.25 * mm;
// const G4double G4PropagatorInField::fDefault_Delta_Intersection_Val= 0.1 * mm;
// const G4double G4PropagatorInField::fDefault_Delta_One_Step_Value = 0.25 * mm;
// const G4double G4PropagatorInField::fEpsilonMin = 1.0e-10 ;
G4TransportationManager* G4TransportationManager::fTransportationManager=0;
@@ -52,6 +57,7 @@ G4TransportationManager::G4TransportationManager()
{
if (!fTransportationManager)
{
fGeomMessenger= new G4GeometryMessenger(this);
fNavigatorForTracking= new G4Navigator() ;
fFieldManager= new G4FieldManager() ;
fPropagatorInField= new G4PropagatorInField( fNavigatorForTracking,
@@ -66,6 +72,7 @@ G4TransportationManager::G4TransportationManager()
G4TransportationManager::~G4TransportationManager()
{
delete fGeomMessenger;
delete fNavigatorForTracking;
delete fPropagatorInField;
delete fFieldManager;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VoxelNavigation.cc,v 1.7.2.1 2001/06/28 19:09:45 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VoxelNavigation.cc,v 1.8 2001/07/11 10:00:34 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// class G4VoxelNavigation Implementation