Import Geant4 6.1.0 source tree
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DrawVoxels.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// class G4DrawVoxels
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestErrorList.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOverlapList.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestOvershootList.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestPoint.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestSegment.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestStreamLogger.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolPoint.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeomTestVolume.cc,v 1.3 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryMessenger.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4GeometryMessenger.cc,v 1.4 2004/03/11 13:09:28 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -80,9 +80,9 @@ G4GeometryMessenger::G4GeometryMessenger(G4TransportationManager* tman)
|
||||
verbCmd = new G4UIcmdWithAnInteger( "/geometry/navigator/verbose", this );
|
||||
verbCmd->SetGuidance( "Set run-time verbosity for the navigator." );
|
||||
verbCmd->SetGuidance(" 0 : Silent (default)");
|
||||
verbCmd->SetGuidance(" 1 : Display positioning and relative states");
|
||||
verbCmd->SetGuidance(" 1 : Display volume positioning and step lengths");
|
||||
verbCmd->SetGuidance(" 2 : Display step/safety info on point location");
|
||||
verbCmd->SetGuidance(" 3 : Display state at -every- step!");
|
||||
verbCmd->SetGuidance(" 3 : Display minimal state at -every- step");
|
||||
verbCmd->SetGuidance(" 4 : Maximum verbosity (very detailed!)");
|
||||
verbCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" );
|
||||
verbCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" );
|
||||
@@ -90,6 +90,18 @@ G4GeometryMessenger::G4GeometryMessenger(G4TransportationManager* tman)
|
||||
verbCmd->SetDefaultValue(0);
|
||||
verbCmd->SetRange("level >=0 && level <=4");
|
||||
|
||||
chkCmd = new G4UIcmdWithABool( "/geometry/navigator/check_mode", this );
|
||||
chkCmd->SetGuidance( "Set navigator in -check_mode- state." );
|
||||
chkCmd->SetGuidance( "This will cause extra checks to be applied during" );
|
||||
chkCmd->SetGuidance( "navigation. More strict and less tolerant conditions" );
|
||||
chkCmd->SetGuidance( "are applied. A run-time performance penalty may be" );
|
||||
chkCmd->SetGuidance( "observed when the -check_mode- state is activated." );
|
||||
chkCmd->SetGuidance( "NOTE: this command has effect -only- if Geant4 has" );
|
||||
chkCmd->SetGuidance( " been installed with the G4VERBOSE flag set!" );
|
||||
chkCmd->SetParameterName("checkFlag",true);
|
||||
chkCmd->SetDefaultValue(false);
|
||||
chkCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
//
|
||||
// Geometry verification test commands
|
||||
//
|
||||
@@ -228,7 +240,7 @@ G4GeometryMessenger::~G4GeometryMessenger()
|
||||
delete rcsCmd; delete rcdCmd;
|
||||
delete cyzCmd; delete cfzCmd; delete cfrCmd; delete cylCmd;
|
||||
delete tolCmd;
|
||||
delete resCmd; delete verbCmd;
|
||||
delete resCmd; delete verbCmd; delete chkCmd;
|
||||
delete geodir; delete navdir; delete testdir;
|
||||
delete tvolume; delete tlogger;
|
||||
}
|
||||
@@ -270,6 +282,9 @@ G4GeometryMessenger::SetNewValue( G4UIcommand* command, G4String newValues )
|
||||
else if (command == verbCmd) {
|
||||
SetVerbosity( newValues );
|
||||
}
|
||||
else if (command == chkCmd) {
|
||||
SetCheckMode( newValues );
|
||||
}
|
||||
else if (command == posCmd) {
|
||||
x = posCmd->GetNew3VectorValue( newValues );
|
||||
}
|
||||
@@ -395,6 +410,17 @@ G4GeometryMessenger::SetVerbosity(G4String input)
|
||||
navigator->SetVerboseLevel(level);
|
||||
}
|
||||
|
||||
//
|
||||
// Set navigator mode
|
||||
//
|
||||
void
|
||||
G4GeometryMessenger::SetCheckMode(G4String input)
|
||||
{
|
||||
G4bool mode = chkCmd->GetNewBoolValue(input);
|
||||
G4Navigator* navigator = tmanager->GetNavigatorForTracking();
|
||||
navigator->CheckMode(mode);
|
||||
}
|
||||
|
||||
//
|
||||
// LineTest
|
||||
//
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.cc,v 1.5 2003/11/10 08:58:42 gcosmo Exp $
|
||||
// $Id: G4Navigator.cc,v 1.8 2004/03/11 13:09:29 gcosmo Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4Navigator Implementation
|
||||
//
|
||||
// Author: Paul Kent, July 95/96
|
||||
// Original author: Paul Kent, July 95/96
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
G4Navigator::G4Navigator()
|
||||
: fWasLimitedByGeometry(false), fTopPhysical(0), fVerbose(0)
|
||||
: fWasLimitedByGeometry(false), fTopPhysical(0),
|
||||
fCheck(false), fVerbose(0)
|
||||
{
|
||||
ResetStackAndState();
|
||||
}
|
||||
@@ -105,23 +106,23 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4cerr << "Upon entering LocateGlobalPointAndSetup " << G4endl;
|
||||
G4cerr << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
G4cerr << "Upon entering LocateGlobalPointAndSetup():" << G4endl;
|
||||
G4cerr << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
#endif
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 0 )
|
||||
G4int oldcoutPrec = G4cout.precision(8);
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup: ***" << G4endl;
|
||||
G4cout.precision(8);
|
||||
G4cout << " I was called with the following arguments: " << G4endl
|
||||
<< " Globalpoint = " << globalPoint << G4endl
|
||||
<< " relativeSearch = " << relativeSearch << G4endl;
|
||||
}
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4cout << " Upon entering my state is: " << G4endl;
|
||||
PrintState();
|
||||
G4cout << " Called with arguments: " << G4endl
|
||||
<< " Globalpoint = " << globalPoint << G4endl
|
||||
<< " RelativeSearch = " << relativeSearch << G4endl;
|
||||
if( fVerbose == 4 )
|
||||
{
|
||||
G4cout << " ----- Upon entering:" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -381,28 +382,36 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
//
|
||||
fEntering = false;
|
||||
fEnteredDaughter = true;
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
|
||||
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup: ***" << G4endl;
|
||||
G4cout << " Entering volume: " << enteredPhysical->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (noResult);
|
||||
|
||||
fLastLocatedPointLocal = localPoint;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 )
|
||||
if( fVerbose == 4 )
|
||||
{
|
||||
G4cout.precision(6);
|
||||
G4String curPhysVol_Name("None");
|
||||
if (targetPhysical!=0)
|
||||
curPhysVol_Name = targetPhysical->GetName();
|
||||
G4cout << " Return value = new volume = "
|
||||
<< curPhysVol_Name << G4endl;
|
||||
G4cout << " Upon exiting my state is: " << G4endl;
|
||||
G4cout << " Return value = new volume = " << curPhysVol_Name << G4endl;
|
||||
G4cout << " ----- Upon exiting:" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
G4cerr << "Upon exiting LocateGlobalPointAndSetup " << G4endl;
|
||||
G4cerr << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
G4cerr << "Upon exiting LocateGlobalPointAndSetup():" << G4endl;
|
||||
G4cerr << " History = " << G4endl << fHistory << G4endl << G4endl;
|
||||
#endif
|
||||
}
|
||||
G4cout.precision(oldcoutPrec);
|
||||
#endif
|
||||
|
||||
return targetPhysical;
|
||||
@@ -472,35 +481,6 @@ G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoint)
|
||||
fEnteredDaughter = false; // Boundary not encountered, did not enter
|
||||
fExiting = false;
|
||||
fExitedMother = false; // Boundary not encountered, did not exit
|
||||
|
||||
#ifdef OLD_LOCATE
|
||||
// An alternative implementation using LocateGlobalPointAndSetup.
|
||||
// It can also be used to check the method's assumptions.
|
||||
//
|
||||
G4VPhysicalVolume *pOldVol, *pNewVol;
|
||||
|
||||
pOldVol = fHistory.GetTopVolume();
|
||||
pNewVol = LocateGlobalPointAndSetup(pGlobalpoint, 0);
|
||||
|
||||
if( pOldVol != pNewVol )
|
||||
{
|
||||
// This is abnormal behaviour.
|
||||
G4cerr << " ERROR in G4Navigator::LocateGlobalPointWithinVolume "
|
||||
<< G4endl;
|
||||
G4cerr << " A volume change has occured - this is not expected & illegal"
|
||||
<< G4endl;
|
||||
G4cerr << " Old volume name = " << pOldVol->GetName() << G4endl;
|
||||
G4cerr << " New volume name = " << pNewVol->GetName() << G4endl;
|
||||
|
||||
G4VPhysicalVolume* pNewVol2 = LocateGlobalPointAndSetup(pGlobalpoint, 0);
|
||||
G4cerr << " Tried again & found volume = " << pNewVol2->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
// Check that the new volume located is same as the old one
|
||||
//
|
||||
assert( pOldVol == pNewVol );
|
||||
#endif
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -565,31 +545,35 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
const G4double pCurrentProposedStepLength,
|
||||
G4double &pNewSafety)
|
||||
{
|
||||
G4double Step = DBL_MAX;
|
||||
G4ThreeVector localDirection = ComputeLocalAxis(pDirection);
|
||||
G4double Step = DBL_MAX;
|
||||
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
|
||||
G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
std::cout.precision(8);
|
||||
if( fVerbose > 1 )
|
||||
G4int oldcoutPrec= G4cout.precision(8);
|
||||
G4int oldcerrPrec= G4cerr.precision(10);
|
||||
if( fVerbose > 0 )
|
||||
{
|
||||
G4cout << "*** G4Navigator::ComputeStep: ***" << G4endl;
|
||||
std::cout.precision(8);
|
||||
G4cout << " I was called with the following arguments: " << G4endl
|
||||
<< " Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
|
||||
<< " Direction = " << std::setw(25) << pDirection << G4endl
|
||||
<< " ProposedStepLength= " << pCurrentProposedStepLength << G4endl;
|
||||
G4cout << " Volume = " << motherPhysical->GetName()
|
||||
<< " - Proposed step length = " << pCurrentProposedStepLength
|
||||
<< G4endl;
|
||||
if( fVerbose == 4 )
|
||||
{
|
||||
G4cout << " Called with the arguments: " << G4endl
|
||||
<< " Globalpoint = " << std::setw(25) << pGlobalpoint
|
||||
<< G4endl
|
||||
<< " Direction = " << std::setw(25) << pDirection
|
||||
<< G4endl;
|
||||
G4cout << " ----- Upon entering :" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
}
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4cout << " Upon entering my state is: " << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
#endif
|
||||
|
||||
static G4double fAccuracyForWarning = kCarTolerance,
|
||||
fAccuracyForException = 1000*kCarTolerance;
|
||||
#endif
|
||||
|
||||
G4ThreeVector newLocalPoint = ComputeLocalPoint(pGlobalpoint);
|
||||
if( newLocalPoint != fLastLocatedPointLocal )
|
||||
@@ -601,6 +585,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
|
||||
if ( moveLenSq >= kCarTolerance*kCarTolerance )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
// The following checks only make sense if the move is larger
|
||||
// than the tolerance.
|
||||
//
|
||||
@@ -620,18 +605,12 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
{
|
||||
G4double shiftOrigin = sqrt(shiftOriginSafSq);
|
||||
G4double diffShiftSaf = shiftOrigin - fPreviousSafety;
|
||||
G4bool isError;
|
||||
|
||||
if( diffShiftSaf > fAccuracyForWarning )
|
||||
{
|
||||
isError = ( diffShiftSaf >= fAccuracyForException );
|
||||
G4cerr.precision(10);
|
||||
if ( isError )
|
||||
G4cerr << "Accuracy ERROR found in G4Navigator::ComputeStep: "
|
||||
<< G4endl;
|
||||
else
|
||||
G4cerr << "Warning G4Navigator::ComputeStep found slightly "
|
||||
<< "inaccurate position:" << G4endl;
|
||||
G4Exception("G4Navigator::ComputeStep()",
|
||||
"UnexpectedPositionShift", JustWarning,
|
||||
"Accuracy ERROR or slightly inaccurate position shift.");
|
||||
G4cerr << " The Step's starting point has moved "
|
||||
<< sqrt(moveLenSq)/mm << " mm " << G4endl
|
||||
<< " since the last call to a Locate method." << G4endl;
|
||||
@@ -642,9 +621,10 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
G4cerr << " which is more than the computed safety= "
|
||||
<< fPreviousSafety/mm << " mm at that point." << G4endl;
|
||||
G4cerr << " This difference is "
|
||||
<< diffShiftSaf /mm << " mm." << G4endl;
|
||||
<< diffShiftSaf/mm << " mm." << G4endl
|
||||
<< " The tolerated accuracy is "
|
||||
<< fAccuracyForException/mm << " mm." << G4endl;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
static G4int warnNow = 0;
|
||||
if( ((++warnNow % 100) == 1) )
|
||||
{
|
||||
@@ -653,36 +633,45 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
<< " larger than the current safety , or" << G4endl;
|
||||
G4cerr << " - inaccuracy in the computation of the safety"
|
||||
<< G4endl;
|
||||
G4cerr << " - if you are using a magnetic field,"
|
||||
<< " a known conflict about the safety exists in this case."
|
||||
<< G4endl;
|
||||
G4cerr << " We suggest that you " << G4endl
|
||||
<< " - find i) what particle is being tracked, and "
|
||||
<< " ii) through what part of your geometry " << G4endl
|
||||
<< " for example by reruning this event with "
|
||||
<< " for example by re-running this event with "
|
||||
<< G4endl
|
||||
<< " /tracking/verbose 1 " << G4endl
|
||||
<< " - check which processes you declare for"
|
||||
<< " this particle (and look at non-standard ones)" << G4endl
|
||||
<< " - if possible create a detailed logfile"
|
||||
<< " this particle (and look at non-standard ones)"
|
||||
<< G4endl
|
||||
<< " - in case, create a detailed logfile"
|
||||
<< " of this event using:" << G4endl
|
||||
<< " /tracking/verbose 6 "
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef G4DEBUG_NAVIGATION
|
||||
else
|
||||
{
|
||||
G4cerr << " Warning in G4Navigator::ComputeStep: " << G4endl
|
||||
<< "The Step's starting point has moved " << sqrt(moveLenSq)
|
||||
<< " which has taken it to the limit of the current safety. "
|
||||
<< G4endl;
|
||||
G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl
|
||||
<< " The Step's starting point has moved "
|
||||
<< sqrt(moveLenSq) << "," << G4endl
|
||||
<< " which has taken it to the limit of"
|
||||
<< " the current safety. " << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
G4double safetyPlus = fPreviousSafety+ fAccuracyForException;
|
||||
assert( shiftOriginSafSq <= sqr(safetyPlus) );
|
||||
G4double safetyPlus = fPreviousSafety + fAccuracyForException;
|
||||
if ( shiftOriginSafSq > sqr(safetyPlus) )
|
||||
{
|
||||
G4cerr << "ERROR - G4Navigator::ComputeStep()" << G4endl
|
||||
<< " Position has shifted considerably without"
|
||||
<< " notifying the navigator !" << G4endl
|
||||
<< " Tolerated safety: " << safetyPlus << G4endl
|
||||
<< " Computed shift : " << shiftOriginSafSq << G4endl;
|
||||
G4Exception("G4Navigator::ComputeStep()",
|
||||
"SignificantPositionShift", JustWarning,
|
||||
"May lead to a crash or unreliable results.");
|
||||
}
|
||||
#endif // end G4VERBOSE
|
||||
|
||||
// Relocate the point within the same volume
|
||||
//
|
||||
@@ -765,14 +754,6 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
fExiting= exitingReplica; // still ok to set it ??
|
||||
}
|
||||
|
||||
if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
|
||||
{
|
||||
// This if Step is not really limited by the geometry.
|
||||
// The Navigator is obliged to return "infinity"
|
||||
//
|
||||
Step = kInfinity;
|
||||
}
|
||||
|
||||
// Remember last safety origin & value.
|
||||
//
|
||||
fPreviousSftOrigin = pGlobalpoint;
|
||||
@@ -819,8 +800,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
// (in order to have it if requested)
|
||||
//
|
||||
G4ThreeVector finalGlobalPoint, finalLocalPoint, localExitNormal;
|
||||
finalGlobalPoint = fLastLocatedPointLocal + localDirection*Step;
|
||||
finalLocalPoint = ComputeLocalPoint(finalGlobalPoint);
|
||||
finalLocalPoint = fLastLocatedPointLocal + localDirection*Step;
|
||||
localExitNormal = motherLogical->GetSolid()->
|
||||
SurfaceNormal(finalLocalPoint);
|
||||
const G4RotationMatrix* mRot = motherPhysical->GetRotation();
|
||||
@@ -840,12 +820,30 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 )
|
||||
if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
|
||||
{
|
||||
G4cout << "Upon exiting my state is: " << G4endl;
|
||||
PrintState();
|
||||
// This if Step is not really limited by the geometry.
|
||||
// The Navigator is obliged to return "infinity"
|
||||
//
|
||||
Step = kInfinity;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
if( fVerbose == 4 )
|
||||
{
|
||||
G4cout << " ----- Upon exiting :" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
G4cout <<" Returned step = " << Step << G4endl;
|
||||
if( Step == kInfinity )
|
||||
G4cout << " Original proposed step = "
|
||||
<< pCurrentProposedStepLength << G4endl;
|
||||
G4cout << " Safety = " << pNewSafety << G4endl;
|
||||
}
|
||||
G4cout.precision(oldcoutPrec);
|
||||
G4cerr.precision(oldcerrPrec);
|
||||
#endif
|
||||
|
||||
return Step;
|
||||
@@ -974,14 +972,20 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
G4double newSafety = 0.0;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 )
|
||||
G4int oldcoutPrec = G4cout.precision(8);
|
||||
if( fVerbose > 0 )
|
||||
{
|
||||
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
|
||||
G4cout << "*** G4Navigator::ComputeSafety: ***" << G4endl;
|
||||
G4cout.precision(8);
|
||||
G4cout << " I was called with the following arguments: " << G4endl
|
||||
<< " Globalpoint = " << pGlobalpoint << G4endl;
|
||||
G4cout << " Upon entering my state is: " << G4endl;
|
||||
PrintState();
|
||||
G4cout << " Volume = " << motherPhysical->GetName()
|
||||
<< " - Maximum length = " << pMaxLength << G4endl;
|
||||
if( fVerbose == 4 )
|
||||
{
|
||||
G4cout << " Called with the arguments: " << G4endl
|
||||
<< " Globalpoint = " << pGlobalpoint << G4endl;
|
||||
G4cout << " ----- Upon entering :" << G4endl;
|
||||
PrintState();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1033,11 +1037,11 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
std::cout.precision(8);
|
||||
G4cout << "Upon exiting my state is: " << G4endl;
|
||||
G4cout << " ----- Upon exiting :" << G4endl;
|
||||
PrintState();
|
||||
G4cout << " and I return a value of Safety = " << newSafety << G4endl;
|
||||
G4cout << " Returned value of Safety = " << newSafety << G4endl;
|
||||
}
|
||||
G4cout.precision(oldcoutPrec);
|
||||
#endif
|
||||
|
||||
return newSafety;
|
||||
@@ -1058,9 +1062,9 @@ G4TouchableHistoryHandle G4Navigator::CreateTouchableHistoryHandle() const
|
||||
//
|
||||
void G4Navigator::PrintState()
|
||||
{
|
||||
if( fVerbose >= 4 )
|
||||
G4int oldcoutPrec = G4cout.precision(4);
|
||||
if( fVerbose == 4 )
|
||||
{
|
||||
G4cout.precision(3);
|
||||
G4cout << "The current state of G4Navigator is: " << G4endl;
|
||||
G4cout << " ValidExitNormal= " << fValidExitNormal << G4endl
|
||||
<< " ExitNormal = " << fExitNormal << G4endl
|
||||
@@ -1078,8 +1082,7 @@ void G4Navigator::PrintState()
|
||||
}
|
||||
if( ( 1 < fVerbose) && (fVerbose < 4) )
|
||||
{
|
||||
G4cout.precision(3);
|
||||
G4cout << std::setw(24) << " ExitNormal " << " "
|
||||
G4cout << std::setw(30) << " ExitNormal " << " "
|
||||
<< std::setw( 5) << " Valid " << " "
|
||||
<< std::setw( 9) << " Exiting " << " "
|
||||
<< std::setw( 9) << " Entering" << " "
|
||||
@@ -1087,11 +1090,13 @@ void G4Navigator::PrintState()
|
||||
<< std::setw( 9) << " ReplicaNo" << " "
|
||||
<< std::setw( 8) << " LastStepZero " << " "
|
||||
<< G4endl;
|
||||
G4cout << std::setw(24) << fExitNormal << " "
|
||||
G4cout << "( " << std::setw(7) << fExitNormal.x()
|
||||
<< ", " << std::setw(7) << fExitNormal.y()
|
||||
<< ", " << std::setw(7) << fExitNormal.z() << " ) "
|
||||
<< std::setw( 5) << fValidExitNormal << " "
|
||||
<< std::setw( 9) << fExiting << " "
|
||||
<< std::setw( 9) << fEntering << " ";
|
||||
if (fBlockedPhysicalVolume==0 )
|
||||
if ( fBlockedPhysicalVolume==0 )
|
||||
G4cout << std::setw(15) << "None";
|
||||
else
|
||||
G4cout << std::setw(15)<< fBlockedPhysicalVolume->GetName();
|
||||
@@ -1106,6 +1111,7 @@ void G4Navigator::PrintState()
|
||||
G4cout << " PreviousSftOrigin = " << fPreviousSftOrigin << G4endl;
|
||||
G4cout << " PreviousSafety = " << fPreviousSafety << G4endl;
|
||||
}
|
||||
G4cout.precision(oldcoutPrec);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.cc,v 1.2 2003/11/03 17:15:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4NormalNavigation.cc,v 1.3 2004/03/10 18:21:20 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation Implementation
|
||||
@@ -34,6 +34,22 @@
|
||||
#include "G4NormalNavigation.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
// ********************************************************************
|
||||
// Constructor
|
||||
// ********************************************************************
|
||||
//
|
||||
G4NormalNavigation::G4NormalNavigation()
|
||||
: fCheck(false), fVerbose(0)
|
||||
{
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// Destructor
|
||||
// ********************************************************************
|
||||
//
|
||||
G4NormalNavigation::~G4NormalNavigation()
|
||||
{;}
|
||||
|
||||
// ********************************************************************
|
||||
// ComputeStep
|
||||
// ********************************************************************
|
||||
@@ -67,6 +83,40 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
|
||||
motherSafety = motherSolid->DistanceToOut(localPoint);
|
||||
ourSafety = motherSafety; // Working isotropic safety
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fCheck )
|
||||
{
|
||||
if ( motherSafety < 0.0 )
|
||||
{
|
||||
G4cerr << "ERROR - G4NormalNavigation::ComputeStep()" << G4endl
|
||||
<< " Current solid " << motherSolid->GetName()
|
||||
<< " gave negative safety: " << motherSafety << G4endl
|
||||
<< " for the current (local) point " << localPoint
|
||||
<< G4endl;
|
||||
G4Exception("G4NormalNavigation::ComputeStep()",
|
||||
"NegativeSafetyMotherVol", FatalException,
|
||||
"Negative Safety In Voxel Navigation !" );
|
||||
}
|
||||
if( motherSolid->Inside(localPoint)==kOutside )
|
||||
{
|
||||
G4cout << "WARNING - G4NormalNavigation::ComputeStep()" << G4endl
|
||||
<< " Point " << localPoint
|
||||
<< " is outside current volume " << motherPhysical->GetName()
|
||||
<< G4endl;
|
||||
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
|
||||
G4cout << " Estimated isotropic distance to solid (distToIn)= "
|
||||
<< estDistToSolid << G4endl;
|
||||
if( estDistToSolid > 100.0 * kCarTolerance )
|
||||
G4Exception("G4NormalNavigation::ComputeStep()",
|
||||
"FarOutsideCurrentVolume", FatalException,
|
||||
"Point is far outside Current Volume !" );
|
||||
else
|
||||
G4Exception("G4NormalNavigation::ComputeStep()", "OutsideCurrentVolume",
|
||||
JustWarning, "Point is a little outside Current Volume.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Compute daughter safeties & intersections
|
||||
//
|
||||
@@ -117,6 +167,47 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
|
||||
exiting = false;
|
||||
*pBlockedPhysical = samplePhysical;
|
||||
blockedReplicaNo = -1;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
// Check to see that the resulting point is indeed in/on volume.
|
||||
// This check could eventually be made only for successful candidate.
|
||||
|
||||
if ( ( fCheck ) && ( sampleStep < kInfinity ) )
|
||||
{
|
||||
G4ThreeVector intersectionPoint;
|
||||
intersectionPoint= samplePoint + sampleStep * sampleDirection;
|
||||
EInside insideIntPt= sampleSolid->Inside(intersectionPoint);
|
||||
if ( insideIntPt != kSurface )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(16);
|
||||
G4cout << "WARNING - G4NormalNavigation::ComputeStep()" << G4endl
|
||||
<< " Inaccurate DistanceToIn for solid "
|
||||
<< sampleSolid->GetName() << G4endl;
|
||||
G4cout << " Solid gave DistanceToIn = " << sampleStep
|
||||
<< " yet returns " ;
|
||||
if ( insideIntPt == kInside )
|
||||
G4cout << "-kInside-";
|
||||
else if ( insideIntPt == kOutside )
|
||||
G4cout << "-kOutside-";
|
||||
else
|
||||
G4cout << "-kSurface-";
|
||||
G4cout << " for this point !" << G4endl;
|
||||
G4cout << " Point = " << intersectionPoint << G4endl;
|
||||
if ( insideIntPt != kInside )
|
||||
G4cout << " DistanceToIn(p) = "
|
||||
<< sampleSolid->DistanceToIn(intersectionPoint)
|
||||
<< G4endl;
|
||||
if ( insideIntPt != kOutside )
|
||||
G4cout << " DistanceToOut(p) = "
|
||||
<< sampleSolid->DistanceToOut(intersectionPoint)
|
||||
<< G4endl;
|
||||
G4Exception("G4NormalNavigation::ComputeStep()",
|
||||
"InaccurateDistanceToIn", JustWarning,
|
||||
"Navigator gets conflicting response from Solid.");
|
||||
G4cout.precision(oldcoutPrec);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,6 +232,22 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
|
||||
true,
|
||||
&validExitNormal,
|
||||
&exitNormal);
|
||||
#ifdef G4VERBOSE
|
||||
if ( fCheck )
|
||||
if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) )
|
||||
{
|
||||
G4cerr << "ERROR - G4NormalNavigation::ComputeStep()" << G4endl
|
||||
<< " Problem in Navigation" << G4endl
|
||||
<< " Point (local coordinates): "
|
||||
<< localPoint << G4endl
|
||||
<< " Local Direction: " << localDirection << G4endl
|
||||
<< " Solid: " << motherSolid->GetName() << G4endl;
|
||||
G4Exception("G4NormalNavigation::ComputeStep()",
|
||||
"PointDistOutInvalid", FatalException,
|
||||
"Current point is outside the current solid !");
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( motherStep<=ourStep )
|
||||
{
|
||||
ourStep = motherStep;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.2 2003/11/03 17:15:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.3 2004/03/11 13:08:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Implementation
|
||||
@@ -102,6 +102,41 @@ G4double G4ParameterisedNavigation::
|
||||
motherSafety = motherSolid->DistanceToOut(localPoint);
|
||||
ourSafety = motherSafety; // Working isotropic safety
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fCheck )
|
||||
{
|
||||
if( motherSafety < 0.0 )
|
||||
{
|
||||
G4cout << "ERROR - G4ParameterisedNavigation::ComputeStep()" << G4endl
|
||||
<< " Current solid " << motherSolid->GetName()
|
||||
<< " gave negative safety: " << motherSafety << G4endl
|
||||
<< " for the current (local) point " << localPoint
|
||||
<< G4endl;
|
||||
G4Exception("G4ParameterisedNavigation::ComputeStep()",
|
||||
"NegativeSafetyMotherVol", FatalException,
|
||||
"Negative Safety In Voxel Navigation !" );
|
||||
}
|
||||
if( motherSolid->Inside(localPoint)==kOutside )
|
||||
{
|
||||
G4cout << "WARNING - G4ParameterisedNavigation::ComputeStep()" << G4endl
|
||||
<< " Point " << localPoint
|
||||
<< " is outside current volume " << motherPhysical->GetName()
|
||||
<< G4endl;
|
||||
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
|
||||
G4cout << " Estimated isotropic distance to solid (distToIn)= "
|
||||
<< estDistToSolid << G4endl;
|
||||
if( estDistToSolid > 100.0 * kCarTolerance )
|
||||
G4Exception("G4ParameterisedNavigation::ComputeStep()",
|
||||
"FarOutsideCurrentVolume", FatalException,
|
||||
"Point is far outside Current Volume !");
|
||||
else
|
||||
G4Exception("G4ParameterisedNavigation::ComputeStep()",
|
||||
"OutsideCurrentVolume", JustWarning,
|
||||
"Point is a little outside Current Volume.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Compute daughter safeties & intersections
|
||||
//
|
||||
@@ -171,6 +206,48 @@ G4double G4ParameterisedNavigation::
|
||||
exiting = false;
|
||||
*pBlockedPhysical = samplePhysical;
|
||||
blockedReplicaNo = sampleNo;
|
||||
#ifdef G4VERBOSE
|
||||
// Check to see that the resulting point is indeed in/on volume.
|
||||
// This check could eventually be made only for successful
|
||||
// candidate.
|
||||
|
||||
if ( ( fCheck ) && ( sampleStep < kInfinity ) )
|
||||
{
|
||||
G4ThreeVector intersectionPoint;
|
||||
intersectionPoint= samplePoint + sampleStep * sampleDirection;
|
||||
EInside insideIntPt= sampleSolid->Inside(intersectionPoint);
|
||||
if( insideIntPt != kSurface )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(16);
|
||||
G4cout << "WARNING - G4ParameterisedNavigation::ComputeStep()"
|
||||
<< G4endl
|
||||
<< " Inaccurate solid DistanceToIn"
|
||||
<< " for solid " << sampleSolid->GetName() << G4endl;
|
||||
G4cout << " Solid gave DistanceToIn = "
|
||||
<< sampleStep << " yet returns " ;
|
||||
if( insideIntPt == kInside )
|
||||
G4cout << "-kInside-";
|
||||
else if( insideIntPt == kOutside )
|
||||
G4cout << "-kOutside-";
|
||||
else
|
||||
G4cout << "-kSurface-";
|
||||
G4cout << " for this point !" << G4endl;
|
||||
G4cout << " Point = " << intersectionPoint << G4endl;
|
||||
if ( insideIntPt != kInside )
|
||||
G4cout << " DistanceToIn(p) = "
|
||||
<< sampleSolid->DistanceToIn(intersectionPoint)
|
||||
<< G4endl;
|
||||
if ( insideIntPt != kOutside )
|
||||
G4cout << " DistanceToOut(p) = "
|
||||
<< sampleSolid->DistanceToOut(intersectionPoint)
|
||||
<< G4endl;
|
||||
G4Exception("G4ParameterisedNavigation::ComputeStep()",
|
||||
"InaccurateDistanceToIn", JustWarning,
|
||||
"Navigator gets conflicting response from Solid.");
|
||||
G4cout.precision(oldcoutPrec);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,6 +273,7 @@ G4double G4ParameterisedNavigation::
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Compute mother intersection if required
|
||||
//
|
||||
if ( motherSafety<=ourStep )
|
||||
@@ -205,6 +283,26 @@ G4double G4ParameterisedNavigation::
|
||||
true,
|
||||
&validExitNormal,
|
||||
&exitNormal);
|
||||
#ifdef G4VERBOSE
|
||||
if ( fCheck )
|
||||
if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) )
|
||||
{
|
||||
G4int oldPrOut= G4cout.precision(16);
|
||||
G4int oldPrErr= G4cerr.precision(16);
|
||||
G4cerr << "ERROR - G4ParameterisedNavigation::ComputeStep()"
|
||||
<< G4endl
|
||||
<< " Problem in Navigation" << G4endl
|
||||
<< " Point (local coordinates): "
|
||||
<< localPoint << G4endl
|
||||
<< " Local Direction: " << localDirection << G4endl
|
||||
<< " Solid: " << motherSolid->GetName() << G4endl;
|
||||
G4Exception("G4ParameterisedNavigation::ComputeStep()",
|
||||
"PointOutsideCurrentVolume", FatalException,
|
||||
"Current point is outside the current solid !");
|
||||
G4cout.precision(oldPrOut);
|
||||
G4cerr.precision(oldPrErr);
|
||||
}
|
||||
#endif
|
||||
if ( motherStep<=ourStep )
|
||||
{
|
||||
ourStep = motherStep;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.cc,v 1.17 2003/12/11 01:30:47 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4PropagatorInField.cc,v 1.19 2004/02/09 12:02:22 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// This class implements an algorithm to track a particle in a
|
||||
@@ -217,10 +217,8 @@ G4PropagatorInField::ComputeStep(
|
||||
{
|
||||
G4FieldTrack SubStepStartState = CurrentState;
|
||||
G4ThreeVector SubStartPoint = CurrentState.GetPosition();
|
||||
// WAS = G4Navigator::Locate...
|
||||
|
||||
if( !first_substep)
|
||||
{
|
||||
if( !first_substep) {
|
||||
fNavigator->LocateGlobalPointWithinVolume( SubStartPoint );
|
||||
}
|
||||
|
||||
@@ -290,8 +288,7 @@ G4PropagatorInField::ComputeStep(
|
||||
first_substep = false;
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( fNoZeroStep > fActionThreshold_NoZeroSteps )
|
||||
{
|
||||
if( fNoZeroStep > fActionThreshold_NoZeroSteps ) {
|
||||
printStatus( SubStepStartState, // or OriginalState,
|
||||
CurrentState, CurrentProposedStepLength,
|
||||
NewSafety, do_loop_count, pPhysVol );
|
||||
@@ -483,6 +480,17 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
fEpsilonStep );
|
||||
// The above method is the key & most intuitive part ...
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( ApproxIntersecPointV.GetCurveLength() >
|
||||
CurrentB_PointVelocity.GetCurveLength() * (1.0 + kAngTolerance) ) {
|
||||
G4cerr << "Error - Intermediate F point is more advanced than endpoint B."
|
||||
<< G4endl;
|
||||
G4Exception("G4PropagatorInField::LocateIntersectionPoint()",
|
||||
"IntermediatePointConfusion",
|
||||
FatalException, "Intermediate F point is past end B point" );
|
||||
}
|
||||
#endif
|
||||
|
||||
G4ThreeVector CurrentF_Point= ApproxIntersecPointV.GetPosition();
|
||||
|
||||
// First check whether EF is small - then F is a good approx. point
|
||||
@@ -624,8 +632,12 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
{
|
||||
G4cerr << "G4PropagatorInField::LocateIntersectionPoint():" << G4endl
|
||||
<< "Error in advancing propagation." << G4endl;
|
||||
fVerboseLevel= 5; // Print out a maximum of information
|
||||
printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
|
||||
-1.0, NewSafety, substep_no, 0);
|
||||
G4cerr << " Point A (start) is " << CurrentA_PointVelocity << G4endl;
|
||||
G4cerr << " Point B (end) is " << CurrentB_PointVelocity << G4endl;
|
||||
G4cerr << " curveDist is " << curveDist << G4endl;
|
||||
G4cerr << G4endl
|
||||
<< "The final curve point is not further along"
|
||||
<< " than the original!" << G4endl;
|
||||
@@ -697,6 +709,8 @@ G4PropagatorInField::printStatus( const G4FieldTrack& StartFT,
|
||||
<< std::setw( 7) << " N_x " << " "
|
||||
<< std::setw( 7) << " N_y " << " "
|
||||
<< std::setw( 7) << " N_z " << " "
|
||||
<< std::setw( 7) << " Delta|N|" << " "
|
||||
// << std::setw( 7) << " Delta(N_z) " << " "
|
||||
<< std::setw( 9) << "StepLen" << " "
|
||||
<< std::setw(12) << "StartSafety" << " "
|
||||
<< std::setw( 9) << "PhsStep" << " "
|
||||
@@ -721,6 +735,9 @@ G4PropagatorInField::printStatus( const G4FieldTrack& StartFT,
|
||||
<< std::setw( 7) << CurrentUnitVelocity.x() << " "
|
||||
<< std::setw( 7) << CurrentUnitVelocity.y() << " "
|
||||
<< std::setw( 7) << CurrentUnitVelocity.z() << " ";
|
||||
G4cout.precision(2);
|
||||
G4cout << std::setw( 7) << CurrentFT.GetMomentum().mag()- StartFT.GetMomentum().mag() << " ";
|
||||
// << std::setw( 7) << CurrentUnitVelocity.z() - InitialUnitVelocity.z() << " ";
|
||||
G4cout << std::setw( 9) << step_len << " ";
|
||||
G4cout << std::setw(12) << safety << " ";
|
||||
if( requestStep != -1.0 )
|
||||
@@ -851,7 +868,7 @@ G4PropagatorInField::IntersectChord( G4ThreeVector StartPointA,
|
||||
return intersects;
|
||||
}
|
||||
|
||||
|
||||
// --------------------- oooo000000000000oooo ----------------------------
|
||||
|
||||
G4FieldTrack G4PropagatorInField::
|
||||
ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
@@ -860,24 +877,68 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
G4double curveDist
|
||||
)
|
||||
{
|
||||
// G4double checkCurveDist= EstimatedEndStateB.GetCurveLength()
|
||||
// - CurrentStateA.GetCurveLength();
|
||||
// G4double checkLinDistSq= (EstimatedEndStateB.GetPosition()
|
||||
// - CurrentStateA.GetPosition() ).mag2();
|
||||
|
||||
G4FieldTrack newEndPoint( CurrentStateA );
|
||||
G4MagInt_Driver* integrDriver= GetChordFinder()->GetIntegrationDriver();
|
||||
|
||||
G4bool goodAdvance=
|
||||
integrDriver->AccurateAdvance(newEndPoint, curveDist, fEpsilonStep);
|
||||
G4FieldTrack retEndPoint( CurrentStateA );
|
||||
G4bool goodAdvance;
|
||||
G4int itrial=0;
|
||||
const G4int no_trials= 20;
|
||||
|
||||
G4double endCurveLen= EstimatedEndStateB.GetCurveLength();
|
||||
do
|
||||
{
|
||||
G4double currentCurveLen= newEndPoint.GetCurveLength();
|
||||
G4double advanceLength= endCurveLen - currentCurveLen ;
|
||||
|
||||
goodAdvance=
|
||||
integrDriver->AccurateAdvance(newEndPoint, advanceLength, fEpsilonStep);
|
||||
// ***************
|
||||
}
|
||||
while( !goodAdvance && (++itrial < no_trials) );
|
||||
|
||||
if( goodAdvance ) {
|
||||
retEndPoint= newEndPoint;
|
||||
}else{
|
||||
retEndPoint= EstimatedEndStateB; // Could not improve without major work !!
|
||||
}
|
||||
|
||||
// All the work is done
|
||||
// below are some diagnostics only -- before the return!
|
||||
//
|
||||
static const G4String MethodName("G4PropagatorInField::ReEstimateEndpoint");
|
||||
#ifdef G4VERBOSE
|
||||
G4int latest_good_trials=0;
|
||||
if( itrial > 1) {
|
||||
if( fVerboseLevel > 0 ) {
|
||||
G4cout << MethodName << " called - goodAdv= " << goodAdvance
|
||||
<< " trials = " << itrial << " previous good= " << latest_good_trials
|
||||
<< G4endl;
|
||||
}
|
||||
latest_good_trials=0;
|
||||
}else{
|
||||
latest_good_trials++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4double lengthDone= newEndPoint.GetCurveLength()
|
||||
- CurrentStateA.GetCurveLength();
|
||||
if( !goodAdvance ) {
|
||||
newEndPoint= EstimatedEndStateB; // Could not improve without major work !!
|
||||
|
||||
if( fVerboseLevel >= 3 ){
|
||||
G4cout << "G4PropagatorInField::ReEstimateEndpoint> AccurateAdvance failed!" << G4endl;
|
||||
G4cout << " went only " << newEndPoint.GetCurveLength() - CurrentStateA.GetCurveLength()
|
||||
<< " instead of " << curveDist << G4endl;
|
||||
G4cout << " G4PropagatorInField::ReEstimateEndpoint> Reset endPoint to original value!" << G4endl;
|
||||
G4cout << MethodName << "> AccurateAdvance failed " ;
|
||||
G4cout << " in " << itrial << " integration trials/steps. " << G4endl
|
||||
G4cout << " It went only " << lengthDone << " instead of " << curveDist
|
||||
<< " -- a difference of " << curveDist - lengthDone << G4endl;
|
||||
G4cout << " ReEstimateEndpoint> Reset endPoint to original value!" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
static G4int noInaccuracyWarnings = 0;
|
||||
G4int maxNoWarnings = 10;
|
||||
if ( (noInaccuracyWarnings < maxNoWarnings )
|
||||
@@ -907,7 +968,7 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
linearDistSq -= curveDist; // To use linearDistSq ... !
|
||||
#endif
|
||||
|
||||
return newEndPoint;
|
||||
return retEndPoint;
|
||||
}
|
||||
|
||||
// Access the points which have passed through the filter. The
|
||||
@@ -963,3 +1024,16 @@ G4PropagatorInField::FindAndSetFieldManager( G4VPhysicalVolume* pCurrentPhysical
|
||||
|
||||
return currentFieldMgr;
|
||||
}
|
||||
|
||||
G4int G4PropagatorInField::SetVerboseLevel( G4int Verbose )
|
||||
{
|
||||
G4int oldval= fVerboseLevel;
|
||||
fVerboseLevel= Verbose;
|
||||
|
||||
// Forward the verbose level 'reduced' to ChordFinder, MagIntegratorDriver ... ?
|
||||
G4MagInt_Driver* integrDriver= GetChordFinder()->GetIntegrationDriver();
|
||||
integrDriver->SetVerboseLevel( Verbose - 2 );
|
||||
G4cout << "Set Driver verbosity to " << Verbose - 2 << G4endl;
|
||||
|
||||
return oldval;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.3 2003/11/03 17:15:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.5 2004/03/11 13:08:38 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation Implementation
|
||||
@@ -45,6 +45,15 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
G4ReplicaNavigation::G4ReplicaNavigation()
|
||||
: fCheck(false), fVerbose(0)
|
||||
{
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// Destructor
|
||||
// ********************************************************************
|
||||
//
|
||||
G4ReplicaNavigation::~G4ReplicaNavigation()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -755,6 +764,30 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
ourSafety = sampleSafety;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fCheck )
|
||||
{
|
||||
if( motherSolid->Inside(localPoint)==kOutside )
|
||||
{
|
||||
G4cout << "WARNING - G4ReplicaNavigation::ComputeStep()" << G4endl
|
||||
<< " Point " << localPoint
|
||||
<< " is outside current volume " << motherPhysical->GetName()
|
||||
<< G4endl;
|
||||
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
|
||||
G4cout << " Estimated isotropic distance to solid (distToIn)= "
|
||||
<< estDistToSolid << G4endl;
|
||||
if( estDistToSolid > 100.0 * kCarTolerance )
|
||||
G4Exception("G4ReplicaNavigation::ComputeStep()",
|
||||
"FarOutsideCurrentVolume", FatalException,
|
||||
"Point is far outside Current Volume !" );
|
||||
else
|
||||
G4Exception("G4ReplicaNavigation::ComputeStep()",
|
||||
"OutsideCurrentVolume", JustWarning,
|
||||
"Point is a little outside Current Volume.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// May need precision protection
|
||||
//
|
||||
if ( sampleSafety<=ourStep )
|
||||
@@ -814,6 +847,47 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
exiting = false;
|
||||
*pBlockedPhysical = samplePhysical;
|
||||
blockedReplicaNo = -1;
|
||||
#ifdef G4VERBOSE
|
||||
// Check to see that the resulting point is indeed in/on volume.
|
||||
// This check could eventually be made only for successful candidate.
|
||||
|
||||
if ( ( fCheck ) && ( sampleStep < kInfinity ) )
|
||||
{
|
||||
G4ThreeVector intersectionPoint;
|
||||
intersectionPoint= samplePoint + sampleStep * sampleDirection;
|
||||
EInside insideIntPt= sampleSolid->Inside(intersectionPoint);
|
||||
if ( insideIntPt != kSurface )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(16);
|
||||
G4cout << "WARNING - G4ReplicaNavigation::ComputeStep()"
|
||||
<< G4endl
|
||||
<< " Inaccurate DistanceToIn for solid "
|
||||
<< sampleSolid->GetName() << G4endl;
|
||||
G4cout << " Solid gave DistanceToIn = " << sampleStep
|
||||
<< " yet returns " ;
|
||||
if ( insideIntPt == kInside )
|
||||
G4cout << "-kInside-";
|
||||
else if ( insideIntPt == kOutside )
|
||||
G4cout << "-kOutside-";
|
||||
else
|
||||
G4cout << "-kSurface-";
|
||||
G4cout << " for this point !" << G4endl;
|
||||
G4cout << " Point = " << intersectionPoint << G4endl;
|
||||
if ( insideIntPt != kInside )
|
||||
G4cout << " DistanceToIn(p) = "
|
||||
<< sampleSolid->DistanceToIn(intersectionPoint)
|
||||
<< G4endl;
|
||||
if ( insideIntPt != kOutside )
|
||||
G4cout << " DistanceToOut(p) = "
|
||||
<< sampleSolid->DistanceToOut(intersectionPoint)
|
||||
<< G4endl;
|
||||
G4Exception("G4ReplicaNavigation::ComputeStep()",
|
||||
"InaccurateDistanceToIn", JustWarning,
|
||||
"Navigator gets conflicting response from Solid.");
|
||||
G4cout.precision(oldcoutPrec);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.cc,v 1.4 2003/12/05 17:08:27 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// G4TransportationManager
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.cc,v 1.2 2003/11/03 17:15:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4VoxelNavigation.cc,v 1.3 2004/03/10 18:21:20 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation Implementation
|
||||
@@ -44,7 +44,9 @@ G4VoxelNavigation::G4VoxelNavigation()
|
||||
fVoxelSliceWidthStack(kNavigatorVoxelStackMax,0.),
|
||||
fVoxelNodeNoStack(kNavigatorVoxelStackMax,0),
|
||||
fVoxelHeaderStack(kNavigatorVoxelStackMax,(G4SmartVoxelHeader*)0),
|
||||
fVoxelNode(0)
|
||||
fVoxelNode(0),
|
||||
fCheck(false),
|
||||
fVerbose(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -99,6 +101,40 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
|
||||
motherSafety = motherSolid->DistanceToOut(localPoint);
|
||||
ourSafety = motherSafety; // Working isotropic safety
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fCheck )
|
||||
{
|
||||
if( motherSafety < 0.0 )
|
||||
{
|
||||
G4cout << "ERROR - G4VoxelNavigation::ComputeStep()" << G4endl
|
||||
<< " Current solid " << motherSolid->GetName()
|
||||
<< " gave negative safety: " << motherSafety << G4endl
|
||||
<< " for the current (local) point " << localPoint
|
||||
<< G4endl;
|
||||
G4Exception("G4VoxelNavigation::ComputeStep()",
|
||||
"NegativeSafetyMotherVol", FatalException,
|
||||
"Negative Safety In Voxel Navigation !" );
|
||||
}
|
||||
if( motherSolid->Inside(localPoint)==kOutside )
|
||||
{
|
||||
G4cout << "WARNING - G4VoxelNavigation::ComputeStep()" << G4endl
|
||||
<< " Point " << localPoint
|
||||
<< " is outside current volume " << motherPhysical->GetName()
|
||||
<< G4endl;
|
||||
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
|
||||
G4cout << " Estimated isotropic distance to solid (distToIn)= "
|
||||
<< estDistToSolid << G4endl;
|
||||
if( estDistToSolid > 100.0 * kCarTolerance )
|
||||
G4Exception("G4VoxelNavigation::ComputeStep()",
|
||||
"FarOutsideCurrentVolume", FatalException,
|
||||
"Point is far outside Current Volume !");
|
||||
else
|
||||
G4Exception("G4VoxelNavigation::ComputeStep()", "OutsideCurrentVolume",
|
||||
JustWarning, "Point is a little outside Current Volume.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Compute daughter safeties & intersections
|
||||
//
|
||||
@@ -164,6 +200,48 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
|
||||
exiting = false;
|
||||
*pBlockedPhysical = samplePhysical;
|
||||
blockedReplicaNo = -1;
|
||||
#ifdef G4VERBOSE
|
||||
// Check to see that the resulting point is indeed in/on volume.
|
||||
// This check could eventually be made only for successful
|
||||
// candidate.
|
||||
|
||||
if ( ( fCheck ) && ( sampleStep < kInfinity ) )
|
||||
{
|
||||
G4ThreeVector intersectionPoint;
|
||||
intersectionPoint= samplePoint + sampleStep * sampleDirection;
|
||||
EInside insideIntPt= sampleSolid->Inside(intersectionPoint);
|
||||
if( insideIntPt != kSurface )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(16);
|
||||
G4cout << "WARNING - G4VoxelNavigation::ComputeStep()"
|
||||
<< G4endl
|
||||
<< " Inaccurate solid DistanceToIn"
|
||||
<< " for solid " << sampleSolid->GetName() << G4endl;
|
||||
G4cout << " Solid gave DistanceToIn = "
|
||||
<< sampleStep << " yet returns " ;
|
||||
if( insideIntPt == kInside )
|
||||
G4cout << "-kInside-";
|
||||
else if( insideIntPt == kOutside )
|
||||
G4cout << "-kOutside-";
|
||||
else
|
||||
G4cout << "-kSurface-";
|
||||
G4cout << " for this point !" << G4endl;
|
||||
G4cout << " Point = " << intersectionPoint << G4endl;
|
||||
if ( insideIntPt != kInside )
|
||||
G4cout << " DistanceToIn(p) = "
|
||||
<< sampleSolid->DistanceToIn(intersectionPoint)
|
||||
<< G4endl;
|
||||
if ( insideIntPt != kOutside )
|
||||
G4cout << " DistanceToOut(p) = "
|
||||
<< sampleSolid->DistanceToOut(intersectionPoint)
|
||||
<< G4endl;
|
||||
G4Exception("G4VoxelNavigation::ComputeStep()",
|
||||
"InaccurateDistanceToIn", JustWarning,
|
||||
"Navigator gets conflicting response from Solid.");
|
||||
G4cout.precision(oldcoutPrec);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,6 +276,25 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
|
||||
motherSolid->DistanceToOut(localPoint,
|
||||
localDirection,
|
||||
true, &validExitNormal, &exitNormal);
|
||||
#ifdef G4VERBOSE
|
||||
if ( fCheck )
|
||||
if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) )
|
||||
{
|
||||
G4int oldPrOut= G4cout.precision(16);
|
||||
G4int oldPrErr= G4cerr.precision(16);
|
||||
G4cerr << "ERROR - G4VoxelNavigation::ComputeStep()" << G4endl
|
||||
<< " Problem in Navigation" << G4endl
|
||||
<< " Point (local coordinates): "
|
||||
<< localPoint << G4endl
|
||||
<< " Local Direction: " << localDirection << G4endl
|
||||
<< " Solid: " << motherSolid->GetName() << G4endl;
|
||||
G4Exception("G4VoxelNavigation::ComputeStep()",
|
||||
"PointOutsideCurrentVolume", FatalException,
|
||||
"Current point is outside the current solid !");
|
||||
G4cout.precision(oldPrOut);
|
||||
G4cerr.precision(oldPrErr);
|
||||
}
|
||||
#endif
|
||||
if ( motherStep<=ourStep )
|
||||
{
|
||||
ourStep = motherStep;
|
||||
|
||||
Reference in New Issue
Block a user