Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 2.1 1998/12/15 19:54:58 japost Exp $
# $Id: GNUmakefile,v 1.2 1999/02/15 15:11:10 japost Exp $
# --------------------------------------------------------------------
# GNUmakefile for geometry/volumes library. Gabriele Cosmo, 16/11/96.
# --------------------------------------------------------------------
@@ -18,6 +18,8 @@ CPPFLAGS += -I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/geometry/magneticfield/include \
-I$(G4BASE)/geometry/management/include
include $(G4INSTALL)/config/common.gmk
CXXFLAGS_WITHOUT_O := $(filter-out -O% , $(CXXFLAGS))
CXXFLAGS_WITHOUT_O := $(filter-out +O% , $(CXXFLAGS_WITHOUT_O))
@@ -26,4 +28,3 @@ $(G4TMP)/$(G4SYSTEM)/$(name)/G4VoxelNavigation.o: src/G4VoxelNavigation.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4VoxelNavigation.cc
endif
include $(G4INSTALL)/config/common.gmk
+110
View File
@@ -0,0 +1,110 @@
$Id: History,v 1.14 1999/07/01 18:05:46 japost Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
July 1st, 1999 J. Apostolakis - field-01-00-06a
In G4PropagatorInField --> method LocateIntersectionPoint():
Integration inaccuracies cause an internal step's mid-point and endpoint
to be further apart than their curve length difference. (Unphysical)
In order to compensate, we re-compute the step's endpoint. [ This also
requires modification in G4ChordFinder::ApproxCurvePointV ]
A better solution would be to re-start/re-structure the loop to handle this
sort of case. But this would be a more major change ...
May 19, 99 J.Apostolakis, F. Behner
In G4Navigator: Changed cout -> G4cout
Changed protection for printing of Physical volume name:
(because of warning on SUN; same functionality)
In G4NavigationLevel, created an optional operator delete(void *, void *)
this is accepted by DEC, and not accepted by SUN, HP
new flag created in architecture for protection: ~ G4NO_ISO_DELETES
May 17, 99 J. Allison.
In G4NavigationLevel, changed operator new(size_t, G4NavigationLevel *)
to operator new(size_t, void *) because the former is not accepted
by Sun CC 4.2 (with STL Interface.)
May 3, 99 J. Apostolakis
testG4ReplicaNavigation.cc
Changed comparison of doubles, to give it a tolerance.
April 8, 99 (committed & recorded J. Apostolakis May 3rd)
G4NavigationLevel.{hh,icc}: Minor Changes
added const to copy constructor and
new 'new' operator with size_t - for STL use with preallocated containers"
March 19, 99 J. Apostolakis geomvol-01-00-03
New tag for replica fix.
March 18, 99 J. Apostolakis
A fix for looping in Replicas:
In the case where a zero step is done in Replicas, we must allow
ReplicaNavigator to handle the case itself - or else we loop.
March 11, 99 J. Apostolakis
G4GRSVolume.icc: corrected G4Exception messages.
February 18, 99 J. Apostolakis
include/G4VoxelNavigation.hh
src/G4VoxelNavigation.cc : overwrote versions 1.2 with production version
---> when changes are refined and retested, they could be reincorporated
February 17, 99 J. Apostolakis geomvol-01-00-02
Moved G4PropagatorInField here from magneticfield to remove correct
dependency.
February 15, 99 J. Apostolakis geomvol-01-00-01
Only fixes in G4Navigator's incorporated.
GNUmakefile corrected (for SUN-CC).
January 99, J. Apostolakis
Fix for ComputeSafety in Navigator: G4Navigator.cc
the voxel information that was used was incorrect v 1.3
-> it resulted in wrong value of safety
December 98 geant4-00-RandD
include/G4VoxelNavigation.hh
src/G4VoxelNavigation.cc : versions 1.2 are trial versions from beta "head"
December 98
Trial fix for navigation in replicas G4Navigator.cc
v 1.2
(a problem persists with this version)
December 98 geant4-00
Code moved: production tag from beta repository.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4AuxiliaryNavServices.hh,v 2.1 1998/11/02 12:11:50 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4AuxiliaryNavServices.hh,v 1.1 1999/01/07 16:08:40 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4NormalNavigation: Utility for navigation in volumes
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4BlockingList.hh,v 2.1 1998/07/12 02:58:14 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4BlockingList.hh,v 1.1 1999/01/07 16:08:40 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4BlockingList
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4BlockingList.icc,v 2.0 1998/07/02 17:05:28 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4BlockingList.icc,v 1.1 1999/01/07 16:08:41 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4BlockingList Inlined Implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GRSSolid.hh,v 2.3 1998/11/09 17:15:26 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GRSSolid.hh,v 1.1 1999/01/07 16:08:41 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4GRSSolid Paul Kent August 1996
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GRSSolid.icc,v 2.1 1998/07/18 10:11:35 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GRSSolid.icc,v 1.1 1999/01/07 16:08:41 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4GRSSolid inline implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GRSVolume.hh,v 2.1 1998/07/18 10:11:36 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GRSVolume.hh,v 1.1 1999/01/07 16:08:41 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4GRSVolume Paul Kent August 1996
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GRSVolume.icc,v 2.1 1998/07/18 10:11:36 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GRSVolume.icc,v 1.2 1999/03/11 09:58:27 japost Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4GRSVolume inline implementation
@@ -39,7 +39,7 @@ inline G4GRSVolume::G4GRSVolume(G4VPhysicalVolume *pVol,
inline G4VPhysicalVolume* G4GRSVolume::GetVolume(G4int depth) const
{
if( depth != 0 ) {
G4Exception("G4GRSSolid::GetSolid: has no meaning for depth!=0");
G4Exception("G4GRSVolume::GetVolume: has no meaning for depth!=0");
}
return fvol;
}
@@ -47,7 +47,7 @@ inline G4VPhysicalVolume* G4GRSVolume::GetVolume(G4int depth) const
inline G4VSolid* G4GRSVolume::GetSolid(G4int depth) const
{
if( depth != 0 ) {
G4Exception("G4GRSSolid::GetSolid: has no meaning for depth!=0");
G4Exception("G4GRSVolume::GetSolid: has no meaning for depth!=0");
}
return fvol->GetLogicalVolume()->GetSolid();
}
@@ -55,7 +55,7 @@ inline G4VSolid* G4GRSVolume::GetSolid(G4int depth) const
inline const G4ThreeVector& G4GRSVolume::GetTranslation(G4int depth) const
{
if( depth != 0 ) {
G4Exception("G4GRSSolid::GetSolid: has no meaning for depth!=0");
G4Exception("G4GRSVolume::GetTranslation: has no meaning for depth!=0");
}
return ftlate;
}
@@ -63,7 +63,7 @@ inline const G4ThreeVector& G4GRSVolume::GetTranslation(G4int depth) const
inline const G4RotationMatrix* G4GRSVolume::GetRotation(G4int depth) const
{
if( depth != 0 ) {
G4Exception("G4GRSSolid::GetSolid: has no meaning for depth!=0");
G4Exception("G4GRSVolume::GetRotation: has no meaning for depth!=0");
}
return frot;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalBorderSurface.hh,v 2.0 1998/07/02 17:05:38 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4LogicalBorderSurface.hh,v 1.1 1999/01/07 16:08:41 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalBorderSurface Definition
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSkinSurface.hh,v 2.0 1998/07/02 17:05:40 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4LogicalSkinSurface.hh,v 1.1 1999/01/07 16:08:42 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalSkinSurface Definition
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NavigationHistory.hh,v 2.0 1998/07/02 17:05:45 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NavigationHistory.hh,v 1.1 1999/01/07 16:08:42 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4NavigationHistory
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NavigationHistory.icc,v 2.0 1998/07/02 17:05:47 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NavigationHistory.icc,v 1.1 1999/01/07 16:08:42 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4NavigationHistory Inline implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NavigationLevel.hh,v 2.0 1998/07/02 17:05:48 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NavigationLevel.hh,v 1.8 1999/05/17 13:51:51 fbehner Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4NavigationLevel
//
@@ -52,7 +52,7 @@ class G4NavigationLevel
G4int newRepNo= -1);
G4NavigationLevel();
G4NavigationLevel( G4NavigationLevel& );
G4NavigationLevel( const G4NavigationLevel& );
~G4NavigationLevel();
@@ -68,10 +68,16 @@ class G4NavigationLevel
// To try to resolve the possible problem with returning a reference.
const G4AffineTransform* GetPtrTransform() const;
// Override "new" and "delete" to use "G4Allocator".
inline void *operator new(size_t);
// Override "new" to use "G4Allocator".
inline void operator delete(void *aTrack);
// Override "delete" to use "G4Allocator".
inline void operator delete(void *aLevel);
// Pre-allocated 'new' and 'delete' for use with STL
// - do not (directly) use Allocator F.Behner/J.Apostolakis
inline void *operator new(size_t, void *); // void*);
#ifndef G4NOT_ISO_DELETES
inline void operator delete(void *ptr, void*); // Not accepted Sun/HP
#endif
// Data members:
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NavigationLevel.icc,v 2.1 1998/07/12 02:58:16 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NavigationLevel.icc,v 1.8 1999/05/17 13:51:51 fbehner Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// 30.09.97 J.Apostolakis Initial version.
//
@@ -41,7 +41,7 @@ inline G4NavigationLevel::G4NavigationLevel()
fLevelRep= new G4NavigationLevelRep();
}
inline G4NavigationLevel::G4NavigationLevel(G4NavigationLevel& right)
inline G4NavigationLevel::G4NavigationLevel(const G4NavigationLevel& right)
: fLevelRep( right.fLevelRep )
{
fLevelRep->AddAReference();
@@ -108,8 +108,30 @@ inline void* G4NavigationLevel::operator new(size_t)
return (void *) aNavigationLevelAllocator.MallocSingle();
}
// Added for use by STL. F.Behner (used for pre-allocation)
//
inline void* G4NavigationLevel::operator new(size_t,void *a)
{
return a;
}
inline void G4NavigationLevel::operator delete(void *aLevel)
{
aNavigationLevelAllocator.FreeSingle((G4NavigationLevel *) aLevel);
}
// Added for use by STL. J. Apostolakis (used for free-ing pre-allocated?)
#ifndef G4NOT_ISO_DELETES
inline void G4NavigationLevel::operator delete(void *ptr, void *p)
{
;
}
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NavigationLevelRep.hh,v 2.1 1998/07/12 02:58:17 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NavigationLevelRep.hh,v 1.1 1999/01/07 16:08:43 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4NavigationLevelRep
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NavigationLevelRep.icc,v 2.1 1998/07/12 02:58:18 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NavigationLevelRep.icc,v 1.1 1999/01/07 16:08:43 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// 1 October 1997 J.Apostolakis Initial version.
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Navigator.hh,v 2.4 1998/11/27 19:30:59 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Navigator.hh,v 1.1 1999/01/07 16:08:43 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4Navigator Paul Kent July 95/96
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Navigator.icc,v 2.3 1998/11/09 18:59:49 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Navigator.icc,v 1.1 1999/01/07 16:08:43 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4Navigator Inline implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NormalNavigation.hh,v 2.1 1998/11/02 12:11:54 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NormalNavigation.hh,v 1.1 1999/01/07 16:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4NormalNavigation: Utility for navigation in volumes
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NormalNavigation.icc,v 2.4 1998/11/25 16:33:52 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NormalNavigation.icc,v 1.1 1999/01/07 16:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// G4NormalNavigation Inline Implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParameterisedNavigation.hh,v 2.2 1998/11/02 12:11:56 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParameterisedNavigation.hh,v 1.1 1999/01/07 16:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4ParameterisedNavigation: Utility for navigation in volumes
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParameterisedNavigation.icc,v 2.4 1998/11/02 12:11:56 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParameterisedNavigation.icc,v 1.1 1999/01/07 16:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4ParameterisedNavigation Inline implementation
@@ -0,0 +1,171 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PropagatorInField.hh,v 1.3 1999/02/17 17:41:55 japost Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------------------
// GEANT 4 include file implementation
//
// For information related to this code contact:
// CERN, IT Division (formely CN), ASD group
// ------------------------------------------------------------------------
//
// This class performs the navigation/propagation of a particle/track
// in a magnetic field. The field is in general non-uniform.
// For the calculation of the path, it relies on the class G4MagTr.
//
// class G4PropagatorInField
// Methods:
// ComputeStep(..)
// CalculateStepTimeAndAccuracy(..)
// LocateIntersectionPoint(..)
//
// 25.10.96 John Apostolakis, design and implementation
// 25.03.97 John Apostolakis, adaptation for G4Transportation and cleanup
// ------------------------------------------------------------------------
#ifndef G4PropagatorInField_hh
#define G4PropagatorInField_hh 1
#include "globals.hh"
#include "G4FieldTrack.hh"
// #include "G4VPhysicalVolume.hh"
// class G4VPhysicalVolume;
#include "G4Navigator.hh"
#include "G4ChordFinder.hh"
#include "G4FieldManager.hh"
// #include "G4MagIntegratorDriver.hh"
class G4PropagatorInField {
public:
// To create an object, must have an object that calculates the Curved
// paths and also must know the value of the maximum displacement allowed
//
G4PropagatorInField( G4Navigator *theNavigator,
G4FieldManager *detectorFieldMgr);
G4PropagatorInField( G4Navigator *theNavigator );
~G4PropagatorInField(){};
// Compute the next geometric Step
//
G4double ComputeStep(G4FieldTrack &pFieldTrack,
G4double pCurrentProposedStepLength,
G4double &pNewSafety,
G4VPhysicalVolume *pPhysVol=0 );
G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
const G4ThreeVector &pCurveTangent, // Unit vector
G4double pCurrentProposedStepLength,
G4double &pNewSafety,
G4VPhysicalVolume *pPhysVol=0 );
// Current Volume (to check)
// Return the state after the Step
//
G4ThreeVector EndPosition();
G4ThreeVector EndMomentumDir();
G4bool IsParticleLooping();
// The accuracy of finding an intersection
//
G4double DeltaIntersection();
// The accuracy of a single Step
//
G4double DeltaOneStep();
// The ratio DeltaOneStep()/h_current_step
//
G4double GetEpsilonStep(); // Relative accuracy for current Step (Calc.)
void SetEpsilonStep(G4double newEps);
// A maximum for the number of steps that a (looping) particle
// can take.
//
G4int GetMaxLoopCount();
void SetMaxLoopCount(G4int new_max);
void SetChargeMomentumMass( G4double Charge, // in e+ units
G4double Momentum, // in Geant4 units
G4double pMass);
G4ChordFinder* GetChordFinder();
// void SetChordFinder(G4ChordFinder* newCF); // Not yet relevant
G4int SetVerboseLevel( G4int Verbose ){ return fVerboseLevel=Verbose; }
G4int Verbose(){ return fVerboseLevel; }
// Print Method - useful mostly for debugging this class
//
void printStatus(
const G4FieldTrack& StartFT,
const G4FieldTrack& CurrentFT,
G4double requestStep,
G4double safety,
G4int Step,
G4VPhysicalVolume* startVolume);
// The Field Manager of the Detector
//
// void SetGlobalFieldMgr( G4FieldManager *detectorFieldMgr );
G4FieldTrack GetEndState() { return End_PointAndTangent; }
private:
// The Field Manager of the whole Detector
//
G4FieldManager *fDetectorFieldMgr;
G4Navigator *fNavigator;
// End point storage:
//
G4FieldTrack End_PointAndTangent;
// If such an intersection exists, this function
// calculate the intersection point of the true path of the particle
// with the surface of the current volume (or of one of its daughters).
// (Should use lateral displacement as measure of convergence).
//
G4bool LocateIntersectionPoint(
const G4FieldTrack& CurveStartPointTangent, // A
const G4FieldTrack& CurveEndPointTangent, // B
const G4ThreeVector& TrialPoint, // E
G4FieldTrack& IntersectPointTangent); // Output
//
// [ Should this have fewer or additional arguments ?
// pointer to info on solution already obtained
// tolerance
// ]
G4double fEpsilonStep; // Relative accuracy for current Step (Calc.)
G4bool fParticleIsLooping;
// For debuging purposes
G4int fVerboseLevel;
// For the moment class constants ... set in G4PropagatemagField.cc
//
static const G4double delta_intersection_val; // = 0.1 * mm;
static const G4double delta_one_step_val; // = 0.25 * mm;
G4int fmax_loop_count;
}; // End of class G4PropagatorInField {
// Defines the constructor.
//
#include "G4PropagatorInField.icc"
#endif
// End of "#ifndef G4PropagatorInField_hh"
@@ -0,0 +1,98 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PropagatorInField.icc,v 1.2 1999/02/17 17:35:59 japost Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------------------
// GEANT 4 include file implementation
//
// For information related to this code contact:
// CERN, IT Division (formely CN), ASD group
// ------------------------------------------------------------------------
//
// 25.10.96 John Apostolakis, design and implementation
// 25.03.97 John Apostolakis, adaptation for G4Transportation and cleanup
//
// To create an object, must have
// an object that calculates the Curved paths
// the navigator to find (linear) intersections
// and ?? also must know the value of the maximum displacement allowed
//
inline G4PropagatorInField::
G4PropagatorInField( G4Navigator *theNavigator,
G4FieldManager *detectorFieldMgr) :
fNavigator(theNavigator),
fDetectorFieldMgr(detectorFieldMgr),
fmax_loop_count(1000),
End_PointAndTangent(G4ThreeVector(0.,0.,0.),G4ThreeVector(0.,0.,0.),0.0,0.0)
{
// this->fChordFinder = new G4ChordFinder( (G4MagneticField*)0, 1e-6 );
}
inline
G4ChordFinder* G4PropagatorInField::GetChordFinder()
{
// Now only the "Chord Finder" of the global Field Mgr is used
// ...
return fDetectorFieldMgr->GetChordFinder();
}
inline void G4PropagatorInField::SetChargeMomentumMass(
G4double Charge, // in e+ units
G4double Momentum, // in GeV/c
G4double Mass) // in ? units
{
GetChordFinder()->SetChargeMomentumMass(Charge, Momentum, Mass);
}
// Obtain the final space-point and velocity (normal) at the end of the Step
//
inline
G4ThreeVector G4PropagatorInField::EndPosition()
{
return End_PointAndTangent.Position();
}
inline
G4ThreeVector G4PropagatorInField::EndMomentumDir()
{
return End_PointAndTangent.GetMomentumDir();
}
inline G4double G4PropagatorInField::GetEpsilonStep()
{
return fEpsilonStep;
}
inline void G4PropagatorInField::SetEpsilonStep(G4double newEps)
{
fEpsilonStep=newEps;
}
inline G4bool G4PropagatorInField::IsParticleLooping()
{
return fParticleIsLooping;
}
inline G4int G4PropagatorInField::GetMaxLoopCount()
{
return fmax_loop_count;
}
inline void G4PropagatorInField::SetMaxLoopCount(G4int new_max)
{
fmax_loop_count= new_max;
}
// inline void G4PropagatorInField::SetChordFinder(G4ChordFinder* newCF)
inline G4double G4PropagatorInField::DeltaOneStep()
{ return delta_one_step_val; }
inline G4double G4PropagatorInField::DeltaIntersection()
{ return delta_intersection_val; }
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ReplicaNavigation.hh,v 2.1 1998/11/02 12:11:57 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ReplicaNavigation.hh,v 1.1 1999/01/07 16:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4ReplicaNavigation: Utility for navigation in volumes
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ReplicaNavigation.icc,v 2.2 1998/11/02 12:11:57 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ReplicaNavigation.icc,v 1.1 1999/01/07 16:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4ReplicaNavigation Inline implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TouchableHistory.hh,v 2.2 1998/07/19 23:51:39 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4TouchableHistory.hh,v 1.1 1999/01/07 16:08:45 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4TouchableHistory Paul Kent August 1996
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TouchableHistory.icc,v 2.2 1998/07/19 23:51:39 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4TouchableHistory.icc,v 1.1 1999/01/07 16:08:45 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4TouchableHistory inline implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Transform.hh,v 2.0 1998/07/02 17:05:31 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Transform.hh,v 1.1 1999/01/07 16:08:45 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4Transform
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TransportationManager.hh,v 2.1 1998/07/12 02:58:22 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4TransportationManager.hh,v 1.1 1999/01/07 16:08:45 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TransportationManager.icc,v 2.1 1998/07/12 02:58:23 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4TransportationManager.icc,v 1.1 1999/01/07 16:08:46 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VoxelNavigation.hh,v 2.2 1998/11/02 12:11:58 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VoxelNavigation.hh,v 1.3 1999/02/17 17:31:05 japost Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4VoxelNavigation: Utility for navigation in volumes
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VoxelNavigation.icc,v 2.1 1998/11/02 12:11:59 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VoxelNavigation.icc,v 1.1 1999/01/07 16:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4VoxelNavigation Inline implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4BlockingList.cc,v 2.1 1998/07/12 02:58:25 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4BlockingList.cc,v 1.1 1999/01/07 16:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4BlockingList Implementation
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GRSSolid.cc,v 2.0 1998/07/02 17:06:27 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GRSSolid.cc,v 1.1 1999/01/07 16:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4GRSSolid Implementation
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GRSVolume.cc,v 2.0 1998/07/02 17:06:28 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GRSVolume.cc,v 1.1 1999/01/07 16:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4GRSVolume Implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalBorderSurface.cc,v 2.1 1998/07/13 16:55:04 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4LogicalBorderSurface.cc,v 1.1 1999/01/07 16:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalBorderSurface Implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSkinSurface.cc,v 2.1 1998/07/13 16:55:06 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4LogicalSkinSurface.cc,v 1.1 1999/01/07 16:08:48 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalSkinSurface Implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NavigationHistory.cc,v 2.1 1998/07/13 16:55:07 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NavigationHistory.cc,v 1.1 1999/01/07 16:08:48 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// G4NavigationHistory Implementation P.Kent August 96
@@ -1,14 +0,0 @@
// This code implementation is the intellectual property of
// the RD44 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: G4NavigationLevel.cc,v 2.0 1998/07/02 17:06:33 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4NavigationLevel.hh"
G4Allocator<G4NavigationLevel> aNavigationLevelAllocator;
G4Allocator<G4NavigationLevelRep> aNavigLevelRepAllocator;
+115 -48
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Navigator.cc,v 2.6 1998/11/25 17:57:23 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Navigator.cc,v 1.6 1999/05/17 14:19:09 stesting Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4Navigator Implementation Paul Kent July 95/96
@@ -71,13 +71,13 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
#ifdef G4VERBOSE
if( fVerbose > 0 )
{
cout << "G4Navigator::LocateGlobalPointAndSetup: " << endl;
cout.precision(8);
cout << " I was called with the following arguments: " << endl
<< " Globalpoint = " << globalPoint << endl
<< " relativeSearch = " << relativeSearch << endl;
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup: ***" << endl;
G4cout.precision(8);
G4cout << " I was called with the following arguments: " << endl
<< " Globalpoint = " << globalPoint << endl
<< " relativeSearch = " << relativeSearch << endl;
// << " = " << << endl
cout << " Upon entering my state is: " << endl;
G4cout << " Upon entering my state is: " << endl;
PrintState();
}
#endif
@@ -109,8 +109,11 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
// A fix for the case where a volume is "entered" at an edge
// and a coincident surface exists outside it.
// This stops it from exiting further volumes and cycling
if( fLastStepWasZero )
// - This stops it from exiting further volumes and cycling
// - However ReplicaNavigator treats this case itself
if( fLocatedOnEdge
&& (VolumeType(fBlockedPhysicalVolume) != kReplica ))
// ( fLastStepWasZero )
{
fExiting= false;
}
@@ -321,11 +324,13 @@ G4Navigator::LocateGlobalPointAndSetup(const G4ThreeVector& globalPoint,
if( fVerbose > 1 )
{
cout.precision(6);
G4cout.precision(6);
cout << " Return value = new volume = "
<< (targetPhysical==0 ? G4String("None") :
targetPhysical->GetName() ) << endl;
G4String curPhysVol_Name("None");
if (targetPhysical!=0)
curPhysVol_Name= targetPhysical->GetName();
G4cout << " Return value = new volume = "
<< curPhysVol_Name << endl;
}
#endif
@@ -393,6 +398,9 @@ G4double G4Navigator::ComputeStep(const G4ThreeVector &pGlobalpoint,
}
#endif
static G4double fAccuracyForWarning= kCarTolerance,
fAccuracyForException= 1000*kCarTolerance;
G4ThreeVector newLocalPoint =ComputeLocalPoint(pGlobalpoint);
if( newLocalPoint != fLastLocatedPointLocal )
{
@@ -432,17 +440,62 @@ G4double G4Navigator::ComputeStep(const G4ThreeVector &pGlobalpoint,
G4double safetyPlus = safety + kCarTolerance;
assert( moveLenSq <= sqr(safetyPlus) );
#endif
// Check that the starting point of this step is
// within the isotropic safety sphere of the last point
// to a accuracy/precision given by
// fAccuracyForWarning
// If so give warning. If it fails by more than
// fAccuracyForException
// exit with error.
if( shiftOriginSafSq >= sqr(fPreviousSafety) ){
G4double shiftOrigin=sqrt(shiftOriginSafSq);
if( shiftOrigin > fPreviousSafety + kCarTolerance ){
G4cerr << " ERROR in G4Navigator::ComputeStep: " << endl
<< "The Step's starting point has moved " << sqrt(moveLenSq)
<< " since the last call to one of the Locate methods " << endl
<< " This has resulted in moving " << shiftOrigin
<< " from the last point at which the safety was calculated "
<< endl
<< " which is more than the computed safety= "
<< fPreviousSafety << "at that point." << endl;
G4double diffShiftSaf= shiftOrigin - fPreviousSafety;
G4bool isError;
if( diffShiftSaf > fAccuracyForWarning ){
isError = ( diffShiftSaf >= fAccuracyForException );
G4cerr.precision(10);
if ( isError )
G4cerr << "Accuracy ERROR found in G4Navigator::ComputeStep: " << endl;
else
G4cerr << "Warning G4Navigator::ComputeStep found slightly inaccurate position:" << endl;
G4cerr << " The Step's starting point has moved "
<< sqrt(moveLenSq)/mm << " mm " << endl
<< " since the last call to a Locate method." << endl;
G4cerr << " This has resulted in moving "
<< shiftOrigin/mm << " mm "
<< " from the last point at which the safety "
<< " was calculated " << endl;
G4cerr << " which is more than the computed safety= "
<< fPreviousSafety/mm << " mm at that point." << endl;
G4cerr << " This difference is "
<< diffShiftSaf /mm << " mm." << endl;
#ifdef G4VERBOSE
static G4int warnNow= 0;
if( ((++warnNow % 100) == 1) ) { // || (warnNow < 4) ){
G4cerr << " This problem can be due to either " << endl;
G4cerr << " - a process that has proposed a displacement"
<< " larger than the current safety , or" << endl;
G4cerr << " - inaccuracy in the computation of the safety" << endl;
G4cerr << " - if you are using a magnetic field, a known conflict about the safety exists in this case."
<< endl;
G4cerr << " We suggest that you " << endl
<< " - find i) what particle is being tracked, and "
<< " ii) through what part of your geometry " << endl
<< " for example by reruning this event with " << endl
<< " /tracking/verbose 1 " << endl
<< " - check which processes you declare for this particle"
<< " (and look at non-standard ones) " << endl
<< " - if possible create a detailed logfile "
<< " of this event using:" << endl
<< " /tracking/verbose 6 "
<< endl;
}
// G4cerr << " - ." << endl;
#endif
}
#ifdef DEBUG
else
@@ -454,7 +507,7 @@ G4double G4Navigator::ComputeStep(const G4ThreeVector &pGlobalpoint,
}
#endif
}
G4double safetyPlus = fPreviousSafety+ kCarTolerance;
G4double safetyPlus = fPreviousSafety+ fAccuracyForException;
assert( shiftOriginSafSq <= sqr(safetyPlus) );
// Relocate the point within the same volume
@@ -518,6 +571,9 @@ G4double G4Navigator::ComputeStep(const G4ThreeVector &pGlobalpoint,
}
else
{
// In the case of a replica,
// it must handles the exiting edge/corner problem by itself
G4bool exitingReplica= fExitedMother;
Step=freplicaNav.ComputeStep(pGlobalpoint,
pDirection,
fLastLocatedPointLocal,
@@ -527,10 +583,12 @@ G4double G4Navigator::ComputeStep(const G4ThreeVector &pGlobalpoint,
fHistory,
fValidExitNormal,
fExitNormal,
fExiting,
exitingReplica,
fEntering,
&fBlockedPhysicalVolume,
fBlockedReplicaNo);
// still ok to set it ??
fExiting= exitingReplica;
}
if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
@@ -698,7 +756,7 @@ G4ThreeVector G4Navigator::GetLocalExitNormal(G4bool* valid)
}
// It assumes that it assumes that it will be
// i) called with the Point equal to the EndPoint of the ComputeStep.
// i) called at the Point in the same volume as the EndPoint of the ComputeStep.
// ii) after (or at the end of) ComputeStep OR after the relocation.
G4double G4Navigator::ComputeSafety(const G4ThreeVector &pGlobalpoint,
@@ -710,17 +768,20 @@ G4double G4Navigator::ComputeSafety(const G4ThreeVector &pGlobalpoint,
#ifdef G4VERBOSE
if( fVerbose > 0 )
{
cout << "*** G4Navigator::ComputeSafety: ***" << endl;
cout.precision(8);
cout << " I was called with the following arguments: " << endl
G4cout << "*** G4Navigator::ComputeSafety: ***" << endl;
G4cout.precision(8);
G4cout << " I was called with the following arguments: " << endl
<< " Globalpoint = " << pGlobalpoint << endl;
// cout << " pMaxLength = " << pMaxLength << endl;
cout << " Upon entering my state is: " << endl;
G4cout << " Upon entering my state is: " << endl;
PrintState();
}
#endif
// Pseudo-relocate to this point (updates voxel information only).
LocateGlobalPointWithinVolume( pGlobalpoint );
if( ! (fEnteredDaughter || fExitedMother ) )
{
G4VPhysicalVolume *motherPhysical=fHistory.GetTopVolume();
@@ -800,45 +861,51 @@ void G4Navigator::PrintState()
{
if( fVerbose >= 4 )
{
cout.precision(3);
cout << " Upon exiting my state is: " << endl;
cout << " ValidExitNormal= " << fValidExitNormal << endl
G4cout.precision(3);
G4cout << " Upon exiting my state is: " << endl;
G4cout << " ValidExitNormal= " << fValidExitNormal << endl
<< " ExitNormal = " << fExitNormal << endl
<< " Exiting = " << fExiting << endl
<< " Entering = " << fEntering << endl
<< " BlockedPhysicalVolume= " << (fBlockedPhysicalVolume==0 ? G4String("None") :
fBlockedPhysicalVolume->GetName() ) << endl
<< " BlockedPhysicalVolume= " ;
if (fBlockedPhysicalVolume==0 )
G4cout << "None";
else
G4cout << fBlockedPhysicalVolume->GetName();
G4cout << endl
<< " BlockedReplicaNo = " << fBlockedReplicaNo << endl
<< " LastStepWasZero = " << fLastStepWasZero << endl
<< endl;
}
if( ( 1 < fVerbose) && (fVerbose < 4) )
{
cout.precision(3);
cout << setw(18) << " ExitNormal " << " "
<< setw( 9) << " Valid " << " "
G4cout.precision(3);
G4cout << setw(18) << " ExitNormal " << " "
<< setw( 5) << " Valid " << " "
<< setw( 9) << " Exiting " << " "
<< setw( 9) << " Entering" << " "
<< setw(15) << " Blocked:Volume " << " "
<< setw( 9) << " ReplicaNo" << " "
<< setw( 8) << " LastStepZero " << " "
<< endl;
cout << setw(24) << fExitNormal << " "
<< setw( 3) << fValidExitNormal << " "
G4cout << setw(18) << fExitNormal << " "
<< setw( 5) << fValidExitNormal << " "
<< setw( 9) << fExiting << " "
<< setw( 9) << fEntering << " "
<< setw(15) << (fBlockedPhysicalVolume==0 ? G4String("None") :
fBlockedPhysicalVolume->GetName() ) << " "
<< setw( 9) << fBlockedReplicaNo << " "
<< setw( 9) << fEntering << " ";
if (fBlockedPhysicalVolume==0 )
G4cout << setw(15) << "None";
else
G4cout << setw(15)<< fBlockedPhysicalVolume->GetName();
G4cout << setw( 9) << fBlockedReplicaNo << " "
<< setw( 8) << fLastStepWasZero << " "
<< endl;
}
if( fVerbose > 2 )
{
cout.precision(8);
cout << " Current Localpoint = " << fLastLocatedPointLocal << endl;
cout << " PreviousSftOrigin = " << fPreviousSftOrigin << endl;
cout << " PreviousSafety = " << fPreviousSafety << endl;
G4cout.precision(8);
G4cout << " Current Localpoint = " << fLastLocatedPointLocal << endl;
G4cout << " PreviousSftOrigin = " << fPreviousSftOrigin << endl;
G4cout << " PreviousSafety = " << fPreviousSafety << endl;
}
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NormalNavigation.cc,v 2.0 1998/07/02 17:06:37 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NormalNavigation.cc,v 1.1 1999/01/07 16:08:49 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4NormalNavigation Implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParameterisedNavigation.cc,v 2.4 1998/09/15 13:57:33 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParameterisedNavigation.cc,v 1.1 1999/01/07 16:08:49 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4ParameterisedNavigation Implementation
@@ -0,0 +1,594 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PropagatorInField.cc,v 1.2 1999/07/01 17:56:22 japost Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//
// 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 //
// until the particle has traveled a set distance or it enters a new
// volume.
//
// Caveat: tracking is not exact - volumes can be missed!
//
//
// 14.10.96 John Apostolakis, design and implementation
// 17.03.97 John Apostolakis, renaming new set functions being added
//
#include "G4PropagatorInField.hh"
#include "G4ios.hh"
#include <iomanip.h>
const G4double G4PropagatorInField::delta_intersection_val= 0.1 * mm;
const G4double G4PropagatorInField::delta_one_step_val = 0.25 * mm;
G4double
G4PropagatorInField::
ComputeStep(const G4ThreeVector & StartPointA,
const G4ThreeVector & Velocity, // Unit or non
G4double CurrentProposedStepLength,
G4double &currentSafety, // In/Out
G4VPhysicalVolume *pPhysVol )
// Compute the next geometric Step for simple magnetic field
{
G4FieldTrack aFieldTrack =
G4FieldTrack( StartPointA,
Velocity,
0.0, // length of path
0.0, // energy
0.0, // lab tof
0.0, // proper tof
0 );
// Do the Transport in the field (non recti-linear)
return this->ComputeStep( aFieldTrack,
CurrentProposedStepLength,
currentSafety );
}
G4double
G4PropagatorInField::
ComputeStep(G4FieldTrack& pFieldTrack,
G4double CurrentProposedStepLength,
G4double& currentSafety, // IN/OUT
G4VPhysicalVolume *pPhysVol)
// Compute the next geometric Step
{
// Parameters for adaptive Runge-Kutta integration
//
G4double h_TrialStepSize; // 1st Step Size
G4double TruePathLength;
G4double StepTaken= 0.0;
G4double s_length_taken;
G4bool intersects;
G4bool first_substep= true;
G4double NewSafety;
fParticleIsLooping= false;
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 ){
G4ThreeVector StartPointA, VelocityUnit;
StartPointA = pFieldTrack.GetPosition();
VelocityUnit= pFieldTrack.GetMomentumDir();
CurrentProposedStepLength= 1.e3 * ( 10.0 * cm +
fNavigator->GetWorldVolume()->GetLogicalVolume()->
GetSolid()->DistanceToOut(StartPointA, VelocityUnit) ) ;
}
this->SetEpsilonStep( DeltaOneStep() / CurrentProposedStepLength);
G4int do_loop_count=0;
do
{
do_loop_count++;
G4FieldTrack SubStepStartState= CurrentState;
G4ThreeVector SubStartPoint= CurrentState.GetPosition();
// WAS = G4Navigator::Locate...
if( !first_substep)
{
fNavigator->LocateGlobalPointWithinVolume( SubStartPoint );
}
// First figure out how far to evolve the particle !
// -------------------------------------------------
// and (later) with what accuracy to calculate this path.
//
h_TrialStepSize= CurrentProposedStepLength - StepTaken ;
// Next evolve it as far as this allows.
// ---------------------------------------
//
// B <- Integrator - limited by the "chord miss" rule.
//
s_length_taken= GetChordFinder()->AdvanceChordLimited(
CurrentState, // Position & velocity
h_TrialStepSize,
GetEpsilonStep() );
// On Exit:
// CurrentState is updated with the final position and velocity.
G4ThreeVector EndPointB= CurrentState.Position();
// Calculate the direction and length of the chord AB
G4ThreeVector ChordAB_Vector= EndPointB - SubStartPoint;
G4double ChordAB_Length= ChordAB_Vector.mag(); // Magnitude (norm)
G4ThreeVector ChordAB_Dir= ChordAB_Vector.unit();
// Check whether any volumes are encountered by the chord AB
G4double LinearStepLength =
fNavigator->ComputeStep( SubStartPoint, ChordAB_Dir,
ChordAB_Length, NewSafety);
if( first_substep )
{
currentSafety= NewSafety;
}
// It might also be possible to update safety in other steps, but
// it must be Done with care. J.Apostolakis August 5th, 1997
intersects= (LinearStepLength <= ChordAB_Length);
// G4Navigator contracts to return k_infinity if len==asked
// and it did not find a surface boundary at that length
LinearStepLength = min( LinearStepLength, ChordAB_Length);
if( intersects )
{
// E <- Intersection Point of chord AB and either volume A's surface
// or a daughter volume's surface ..
G4ThreeVector pointE= SubStartPoint + LinearStepLength * ChordAB_Dir;
G4FieldTrack IntersectPointVelct_G(CurrentState); // FT-Def-Construct
// Find the intersection point of AB true path with the surface
// of vol(A) given our current "estimate" point E.
G4bool found_intersection=
LocateIntersectionPoint( SubStepStartState, CurrentState,
pointE, IntersectPointVelct_G );
if( found_intersection )
{
// G is our EndPoint ...
G4ThreeVector IntersectPoint_G = IntersectPointVelct_G.Position();
End_PointAndTangent= IntersectPointVelct_G;
G4ThreeVector NewChord= IntersectPoint_G - SubStartPoint;
// LinearStepLength= NewChord.mag();
StepTaken =
TruePathLength= IntersectPointVelct_G.CurveS()
- OriginalState.CurveS(); // which is Zero now.
#ifdef G4VERBOSE
if( Verbose() > 0 ){
G4cout << " Found an intersection after a Step of length " <<
StepTaken << endl;
}
#endif
// TruePathLength= StepTaken;
}
else
{
// "Minor" chords do not intersect
intersects= false;
}
}
if( ! intersects )
{
StepTaken += s_length_taken;
}
first_substep= false;
#ifdef G4VERBOSE
if( Verbose() > 0 )
printStatus( SubStepStartState, // or OriginalState,
CurrentState,
CurrentProposedStepLength,
NewSafety,
do_loop_count,
pPhysVol);
#endif
}
while( (!intersects ) && (StepTaken < CurrentProposedStepLength)
&& ( do_loop_count < GetMaxLoopCount() ) );
#ifdef G4VERBOSE
if( do_loop_count >= GetMaxLoopCount() ){
G4cerr << "G4PropagateInField: Warning: Particle is looping - "
<< " tracking in field will be stopped. " << endl;
G4cerr << " It has performed " << do_loop_count << " steps in Field "
<< " while a maximum of " << GetMaxLoopCount() << " are allowed. "
<< endl;
//G4cerr << " In future this will be treated better/quicker. " << endl;
fParticleIsLooping= true;
}
#endif
if( ! intersects )
{
// Chord AB or "minor chords" do not intersect
// B is the endpoint Step of the current Step.
// [ But if we were angle limited we could use B
// as a new starting point ? ]
// On return we specify the endpoint, point B
End_PointAndTangent= CurrentState;
// LinearStepLength= ChordAB_Length;
TruePathLength= StepTaken;
} // end if(!intersects)
// Set pFieldTrack to the return value
pFieldTrack =End_PointAndTangent;
#ifdef G4VERBOSE
// Check that "s" is correct
if( fabs(OriginalState.CurveS() + TruePathLength
- End_PointAndTangent.CurveS()) > 3.e-4 * TruePathLength )
{
G4cerr << " Error in G4PropagatorInField: Curve lenght mis-match, is advancement wrong ? ";
G4cerr << " The curve length of the endpoint should be "
<< OriginalState.CurveS() + TruePathLength
<< " and is " << End_PointAndTangent.CurveS()
<< " a difference of "
<< OriginalState.CurveS() + TruePathLength
- End_PointAndTangent.CurveS() << endl;
}
#endif
return TruePathLength;
}
// --------------------------------------------------------------------------
// G4bool
// G4PropagatorInField::LocateIntersectionPoint(
// const G4FieldTrack& CurveStartPointVelocity, // A
// const G4FieldTrack& CurveEndPointVelocity, // B
// const G4ThreeVector& TrialPoint, // E
// G4FieldTrack& IntersectPointVelocity) // Output
// --------------------------------------------------------------------------
//
// Function that returns the intersection of the true path with the surface
// of the current volume (either the external one or the inner one with one
// of the daughters
//
// A = Initial point
// B = another point
//
// Both A and B are assumed to be on the true path.
//
// E is the first point of intersection of the chord AB with
// a volume other than A (on the surface of A or of a daughter)
//
// First Version: October 16th, 1996 John Apostolakis, CERN CN/ASD
// Modified: January 22nd, 1997 J.A. IT/ASD
//
// Convention of Use :
// i) If it returns "true", then IntersectionPointVelocity is set
// to the approximate intersection point.
// ii) If it returns "false", no intersection was found and
// IntersectionPointVelocity is invalid.
// --------------------------------------------------------------------------
G4bool
G4PropagatorInField::LocateIntersectionPoint(
const G4FieldTrack& CurveStartPointVelocity, // A
const G4FieldTrack& CurveEndPointVelocity, // B
const G4ThreeVector& TrialPoint, // E
G4FieldTrack& IntersectPointVelocity) // Output
{
// 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;
G4bool first_step= true;
G4int substep_no= 0;
G4VPhysicalVolume *pPhysVol;
do{ // REPEAT
G4ThreeVector Point_A= CurrentA_PointVelocity.Position();
G4ThreeVector Point_B= CurrentB_PointVelocity.Position();
// F = a point on true AB path close to point E (the closest if possible)
//
ApproxIntersecPointV= GetChordFinder()->ApproxCurvePointV(
CurrentA_PointVelocity,
CurrentB_PointVelocity,
CurrentE_Point,
this->GetEpsilonStep() );
// The above function is the most difficult part ...
//
// Another approach would be for the curved true path
// to be an object and this should be a member function.
// -> The Curve Start and End point would not be needed as arguments.
//
G4ThreeVector CurrentF_Point= ApproxIntersecPointV.Position();
// First check whether EF is small - then F is a good approx. point
//
// Calculate the length and direction of the chord AF
// ChordEF_Vector= Chord_Vector(CurrentE_Point, CurrentF_Point);
// ------------
G4ThreeVector ChordEF_Vector = CurrentF_Point - CurrentE_Point;
if ( ChordEF_Vector.mag2() <= sqr(DeltaIntersection()) ){
found_approximate_intersection = true;
// Create the "point" return value
// IntersectPointVelocity.SetCurvePnt(
// CurrentE_Point,
// ApproxIntersecPointV.GetVelocity(),
// ApproxIntersecPointV.CurveS() );
IntersectPointVelocity = ApproxIntersecPointV;
IntersectPointVelocity.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).
if( !first_step){
// Check whether any volumes are encountered by the chord AF
//----------------------------------------------------------
fNavigator->LocateGlobalPointWithinVolume( Point_A );
// This locate is needed in all cases except for the
// original point A, because - presumably - that was
// called at the start of the physical Step
}
first_step= false;
// Calculate the length and direction of the chord AF
G4ThreeVector ChordAF_Vector= CurrentF_Point - Point_A;
G4double ChordAF_Length= ChordAF_Vector.mag();
G4ThreeVector ChordAF_Dir= ChordAF_Vector.unit();
G4double stepLength =
fNavigator->ComputeStep( Point_A, ChordAF_Dir,
ChordAF_Length, NewSafety);
G4bool Intersects_AF = (stepLength <= ChordAF_Length);
stepLength = min(stepLength, ChordAF_Length);
if( Intersects_AF ){
// There is an intersection of AF with a volume boundary
// G <- First Intersection of Chord AF
//
G4ThreeVector PointG= Point_A + stepLength * ChordAF_Dir;
// 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;
// Else (not Intersects_AF)
}else{
// In this case:
// There is NO intersection of AF with a volume boundary.
// We must continue the search in the segment FB!
// Check whether any volumes are encountered by the chord FB
//----------------------------------------------------------
// Calculate the length and direction of the chord AF
G4ThreeVector ChordFB_Vector= Point_B - CurrentF_Point;
G4double ChordFB_Length= ChordFB_Vector.mag();
G4ThreeVector ChordFB_Dir= ChordFB_Vector.unit();
fNavigator->LocateGlobalPointWithinVolume( CurrentF_Point );
G4double stepLength =
fNavigator->ComputeStep( CurrentF_Point, ChordFB_Dir,
ChordFB_Length, NewSafety);
G4bool Intersects_FB = stepLength <= ChordFB_Length;
stepLength = min(stepLength, ChordFB_Length);
if( Intersects_FB ) {
// There is an intersection of FB with a volume boundary
// H <- First Intersection of Chord FB
//
G4ThreeVector PointH= CurrentF_Point + stepLength * ChordFB_Dir;
// 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.
// 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
// This means that somehow a volume intersected the original
// chord but misses the chord (or series of chords)
// we have used.
//
there_is_no_intersection= true;
//
// the value of IntersectPointVelocity returned is not valid
} // 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.Position()
- CurrentA_PointVelocity.Position() ).mag2();
curveDist= CurrentB_PointVelocity.CurveS() -
CurrentA_PointVelocity.CurveS();
if( curveDist*(curveDist+2*perMillion ) < linDistSq ){
// Re-integrate to obtain a new B
G4FieldTrack newEndpoint= CurrentA_PointVelocity;
GetChordFinder()->GetIntegrationDriver()
->AccurateAdvance(newEndpoint, curveDist, GetEpsilonStep() );
CurrentB_PointVelocity= newEndpoint;
G4cerr << "G4PropagatorInField::LocateIntersectionPoint: "
<< " Warning: Integration inaccuracy requires an adjustment in the step's endpoint "
<< " Two mid-points are further apart than their curve length difference"
<< endl
<< " Dist = " << sqrt(linDistSq)
<< " curve length = " << curveDist
<< endl;
}
if( curveDist < 0.0 ) {
G4Exception("G4PropagatorInField::LocateIntersectionPoint : the final curve point is not further along than the original.");
}
} // EndIf ( E is close enough to the curve, ie point F. )
// tests ChordAF_Vector.mag() <= maximum_lateral_displacement
#ifdef G4VERBOSE
if( Verbose() > 1 )
// printStatus( CurveStartPointVelocity, CurveEndPointVelocity,
printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
-1.0, NewSafety, substep_no, 0); // startVolume);
#endif
substep_no++;
} while ( ( ! found_approximate_intersection ) &&
( ! there_is_no_intersection ) ); // UNTIL found or failed
return !there_is_no_intersection ; // Success or failure
}
void G4PropagatorInField::printStatus(
const G4FieldTrack& StartFT,
const G4FieldTrack& CurrentFT,
G4double requestStep,
G4double safety,
G4int Step,
G4VPhysicalVolume* startVolume)
// G4VPhysicalVolume* endVolume)
{
const G4int verboseLevel=1;
const G4ThreeVector StartPosition= StartFT.GetPosition();
const G4ThreeVector StartUnitVelocity= StartFT.GetMomentumDir();
const G4ThreeVector CurrentPosition= CurrentFT.GetPosition();
const G4ThreeVector CurrentUnitVelocity= CurrentFT.GetMomentumDir();
G4double step_len= CurrentFT.GetCurveLength()
- StartFT.GetCurveLength();
if( (Step == 0) && (verboseLevel <= 3) )
{
G4cout.precision(3);
// G4cout.setf(ios_base::fixed,ios_base::floatfield);
G4cout << setw( 6) << " "
<< setw( 25) << " Current Position and Direction" << " "
<< endl;
G4cout << setw( 5) << "Step#" << " "
<< setw( 9) << "X(mm)" << " "
<< setw( 9) << "Y(mm)" << " "
<< setw( 9) << "Z(mm)" << " "
<< setw( 7) << " N_x " << " "
<< setw( 7) << " N_y " << " "
<< setw( 7) << " N_z " << " "
// << setw( 9) << "KinE(MeV)" << " "
// << setw( 9) << "dE(MeV)" << " "
<< setw( 9) << "StepLen" << " "
<< setw( 9) << "PhsStep" << " "
<< setw(12) << "StartSafety" << " "
<< setw(18) << "NextVolume" << " "
<< endl;
}
//
if( verboseLevel > 3 )
{
// G4cout << "Current Position is " << CurrentPosition << endl
// << " and UnitVelocity is " << CurrentUnitVelocity << endl;
G4cout << "Step taken was " << step_len
<< " out of PhysicalStep= " << requestStep << endl;
G4cout << "Final safety is: " << safety << endl;
G4cout << "Chord length = " << (CurrentPosition-StartPosition).mag() << endl;
G4cout << endl;
}
else // if( verboseLevel > 0 )
{
G4cout.precision(3);
G4cout << setw( 5) << Step << " "
<< setw( 9) << CurrentPosition.x() << " "
<< setw( 9) << CurrentPosition.y() << " "
<< setw( 9) << CurrentPosition.z() << " "
<< setw( 7) << CurrentUnitVelocity.x() << " "
<< setw( 7) << CurrentUnitVelocity.y() << " "
<< setw( 7) << CurrentUnitVelocity.z() << " "
// << setw( 9) << KineticEnergy << " "
// << setw( 9) << EnergyDifference << " "
<< setw( 9) << step_len << " "
<< setw( 9) << requestStep << " "
<< setw(12) << safety << " ";
if( startVolume != 0) {
G4cout << setw(12) << startVolume->GetName() << " ";
} else {
G4cout << setw(12) << "OutOfWorld" << " ";
}
#if 0
if( CurrentVolume != 0)
{
G4cout << setw(12) << CurrentVolume()->GetName() << " ";
}
else
{
G4cout << setw(12) << "OutOfWorld or Unknown" << " ";
}
#endif
G4cout << endl;
}
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ReplicaNavigation.cc,v 2.1 1998/07/12 02:58:28 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ReplicaNavigation.cc,v 1.1 1999/01/07 16:08:49 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4REplicaNavigation Implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TouchableHistory.cc,v 2.1 1998/11/02 12:12:18 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4TouchableHistory.cc,v 1.1 1999/01/07 16:08:49 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4TouchableHistory Implementation
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TransportationManager.cc,v 2.0 1998/07/02 17:06:47 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4TransportationManager.cc,v 1.2 1999/07/02 15:47:28 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// G4TransportationManager
@@ -19,6 +19,12 @@
#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;
G4TransportationManager G4TransportationManager::fTransportationManager;
G4TransportationManager::G4TransportationManager()
@@ -5,13 +5,12 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VoxelNavigation.cc,v 2.6 1998/11/02 12:12:19 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VoxelNavigation.cc,v 1.3 1999/02/17 17:29:24 japost Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4VoxelNavigation Implementation
//
// $ Id: $
//
// Modified by:
// J. Apostolakis, 29 Apr 98 Fixed error in LocateNextVoxel that