Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4AuxiliaryNavServices.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-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-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-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-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-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-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-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-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-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-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GeomTestSegment.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4GeomTestSegment.cc,v 1.4 2004/09/02 14:44:11 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -274,17 +274,19 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
"DistanceToOut(p,v) = kInfinity for point inside", p );
return;
}
s += sign*dist;
entering = false;
break;
case kOutside:
dist = solid->DistanceToIn(p,vSearch);
if (dist >= kInfinity) return;
s += sign*dist;
entering = true;
break;
case kSurface:
entering = (v.dot(solid->SurfaceNormal(p)) > 0);
entering = (v.dot(solid->SurfaceNormal(p)) < 0);
break;
default:
logger->SolidProblem( solid,
@@ -352,11 +354,41 @@ void G4GeomTestSegment::FindSomePoints( G4GeomTestLogger *logger,
"DistanceToOut(p,v) = kInfinity for point inside", p );
return;
}
if ( (dist > kCarTolerance)
&& (solid->Inside(p + (dist*0.999)*vSearch) == kOutside) ) {
//
// This shouldn't have happened
//
if (solid->Inside(p) == kOutside)
logger->SolidProblem(solid,
"Entering point is outside (possible roundoff error)",p);
else
logger->SolidProblem(solid,
"DistanceToOut(p,v) brings trajectory well outside solid",p);
return;
}
entering = false;
}
else {
dist = solid->DistanceToIn(p,vSearch);
if (dist >= kInfinity) return;
if ( (dist > kCarTolerance)
&& (solid->Inside(p + (dist*0.999)*vSearch) == kInside) ) {
//
// This shouldn't have happened
//
if (solid->Inside(p) == kInside)
logger->SolidProblem(solid,
"Exiting point is inside (possible roundoff error)", p);
else
logger->SolidProblem(solid,
"DistanceToIn(p,v) brings trajectory well inside solid", p);
return;
}
entering = true;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestStreamLogger.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-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-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GeomTestVolume.cc,v 1.3 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4GeomTestVolume.cc,v 1.4 2004/12/02 09:31:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -252,7 +252,7 @@ void G4GeomTestVolume::TestCylinder( G4int nPhi, G4int nZ, G4int nRho,
//
G4double xMax = std::max(extent.GetXmax(),-extent.GetXmin());
G4double yMax = std::max(extent.GetYmax(),-extent.GetYmin());
G4double rhoMax = sqrt(xMax*xMax + yMax*yMax);
G4double rhoMax = std::sqrt(xMax*xMax + yMax*yMax);
G4double zMax = extent.GetZmax();
G4double zMin = extent.GetZmin();
@@ -269,8 +269,8 @@ void G4GeomTestVolume::TestCylinder( G4int nPhi, G4int nZ, G4int nRho,
if ((iPhi&1) == 0) iPhi++; // Also use odd number phi slices
do
{
G4double cosPhi = cos(phi);
G4double sinPhi = sin(phi);
G4double cosPhi = std::cos(phi);
G4double sinPhi = std::sin(phi);
//
// Loop over rho
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeometryMessenger.cc,v 1.4 2004/03/11 13:09:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
+48 -58
View File
@@ -21,7 +21,7 @@
// ********************************************************************
//
//
// $Id: G4Navigator.cc,v 1.13 2004/06/18 12:47:05 gcosmo Exp $
// $Id: G4Navigator.cc,v 1.17 2004/12/02 09:31:23 gcosmo Exp $
// GEANT4 tag $ Name: $
//
// class G4Navigator Implementation
@@ -198,7 +198,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
G4LogicalVolume *pLogical;
pLogical = fBlockedPhysicalVolume->GetLogicalVolume();
pLogical->SetSolid( pSolid );
pLogical->SetMaterial(pParam->ComputeMaterial(fBlockedReplicaNo,
pLogical->UpdateMaterial(pParam->ComputeMaterial(fBlockedReplicaNo,
fBlockedPhysicalVolume));
break;
}
@@ -624,7 +624,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
//
if( shiftOriginSafSq >= sqr(fPreviousSafety) )
{
G4double shiftOrigin = sqrt(shiftOriginSafSq);
G4double shiftOrigin = std::sqrt(shiftOriginSafSq);
G4double diffShiftSaf = shiftOrigin - fPreviousSafety;
if( diffShiftSaf > fAccuracyForWarning )
@@ -633,7 +633,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
"UnexpectedPositionShift", JustWarning,
"Accuracy ERROR or slightly inaccurate position shift.");
G4cerr << " The Step's starting point has moved "
<< sqrt(moveLenSq)/mm << " mm " << G4endl
<< std::sqrt(moveLenSq)/mm << " mm " << G4endl
<< " since the last call to a Locate method." << G4endl;
G4cerr << " This has resulted in moving "
<< shiftOrigin/mm << " mm "
@@ -674,7 +674,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
{
G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl
<< " The Step's starting point has moved "
<< sqrt(moveLenSq) << "," << G4endl
<< std::sqrt(moveLenSq) << "," << G4endl
<< " which has taken it to the limit of"
<< " the current safety. " << G4endl;
}
@@ -809,38 +809,41 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
<< G4endl;
}
#endif
if( (fNumberZeroSteps > fActionThreshold_NoZeroSteps-1) && (!fPushed) )
if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
{
// Act to recover this stuck track. Pushing it once along direction
// Act to recover this stuck track. Pushing it along direction
//
Step += 0.9*kCarTolerance;
fPushed = true;
#ifdef G4VERBOSE
G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< " in volume -" << motherPhysical->GetName()
<< "- at point " << pGlobalpoint << G4endl
<< " direction: " << pDirection << "." << G4endl
<< " Potential geometry or navigation problem !"
<< G4endl
<< " Trying pushing it of " << Step << " mm ..."
<< G4endl;
if (!fPushed)
{
G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< " in volume -" << motherPhysical->GetName()
<< "- at point " << pGlobalpoint << G4endl
<< " direction: " << pDirection << "." << G4endl
<< " Potential geometry or navigation problem !"
<< G4endl
<< " Trying pushing it of " << Step << " mm ..."
<< G4endl;
}
#endif
}
if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
{
// Must kill this stuck track
//
G4cerr << "ERROR - G4Navigator::ComputeStep()" << G4endl
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< " in volume -" << motherPhysical->GetName()
<< "- at point " << pGlobalpoint << G4endl
<< " direction: " << pDirection << "." << G4endl;
G4Exception("G4Navigator::ComputeStep()",
"StuckTrack", EventMustBeAborted,
"Stuck Track: potential geometry or navigation problem.");
fPushed = true;
}
if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
{
// Must kill this stuck track
//
G4cerr << "ERROR - G4Navigator::ComputeStep()" << G4endl
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< " in volume -" << motherPhysical->GetName()
<< "- at point " << pGlobalpoint << G4endl
<< " direction: " << pDirection << "." << G4endl;
G4Exception("G4Navigator::ComputeStep()",
"StuckTrack", EventMustBeAborted,
"Stuck Track: potential geometry or navigation problem.");
}
}
else
@@ -864,38 +867,23 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
// Convention: fExitNormal is in the 'grand-mother' coordinate system
//
fGrandMotherExitNormal= fExitNormal;
// If no relocation were made, we would need to rotate it back to
// this (the mother) coordinate system
// const G4RotationMatrix* motherRotation= motherPhysical->GetRotation();
// G4ThreeVector trueMotherExitNormal = fGrandMotherExitNormal;
// Un-rotate gran->mother
//
// trueMotherExitNormal *= (*motherRotation);
// However, relocation will put us either in
// - the grand-mother (OK)
// - in the grand-grand mother (to BE checked if this is dealt with)
}
else
{
// We must calculate the normal anyway
// (in order to have it if requested)
// We must calculate the normal anyway (in order to have it if requested)
//
G4ThreeVector finalGlobalPoint, finalLocalPoint, localExitNormal;
finalLocalPoint = fLastLocatedPointLocal + localDirection*Step;
localExitNormal = motherLogical->GetSolid()->
SurfaceNormal(finalLocalPoint);
G4ThreeVector finalLocalPoint =
fLastLocatedPointLocal + localDirection*Step;
// Now fGrandMotherExitNormal is in the 'grand-mother' coordinate system
//
fGrandMotherExitNormal =
motherLogical->GetSolid()->SurfaceNormal(finalLocalPoint);
const G4RotationMatrix* mRot = motherPhysical->GetRotation();
if( mRot )
{
G4ThreeVector grandMotherExitNormal = localExitNormal;
grandMotherExitNormal *= (*mRot);
// Now fGrandMotherExitNormal is in the 'grand-mother'
// coordinate system
//
fGrandMotherExitNormal = grandMotherExitNormal;
fGrandMotherExitNormal *= (*mRot);
}
}
#ifdef G4DEBUG_NAVIGATION
@@ -1003,7 +991,7 @@ void G4Navigator::SetupHierarchy()
//
G4LogicalVolume *pLogical = current->GetLogicalVolume();
pLogical->SetSolid( pSolid );
pLogical->SetMaterial( pParam->ComputeMaterial(replicaNo, current));
pLogical->UpdateMaterial( pParam->ComputeMaterial(replicaNo, current));
break;
}
mother = current;
@@ -1028,6 +1016,7 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
*valid = true;
}
else
{
if( fExitedMother )
{
ExitNormal = fGrandMotherExitNormal;
@@ -1040,6 +1029,7 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
//
*valid = false;
}
}
return ExitNormal;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NormalNavigation.cc,v 1.4 2004/05/17 13:30:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4NormalNavigation.cc,v 1.7 2004/09/10 15:38:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// class G4NormalNavigation Implementation
@@ -34,6 +34,8 @@
#include "G4NormalNavigation.hh"
#include "G4AffineTransform.hh"
#include <iomanip>
// ********************************************************************
// Constructor
// ********************************************************************
@@ -84,6 +86,7 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
ourSafety = motherSafety; // Working isotropic safety
#ifdef G4VERBOSE
static G4int precVerf= 20; // Precision
if ( fCheck )
{
if( fVerbose == 1 )
@@ -102,6 +105,7 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
<< " gave negative safety: " << motherSafety << G4endl
<< " for the current (local) point " << localPoint
<< G4endl;
motherSolid->DumpInfo();
G4Exception("G4NormalNavigation::ComputeStep()",
"NegativeSafetyMotherVol", FatalException,
"Negative Safety In Voxel Navigation !" );
@@ -115,14 +119,39 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
G4cout << " Estimated isotropic distance to solid (distToIn)= "
<< estDistToSolid << G4endl;
if( estDistToSolid > 100.0 * kCarTolerance )
if( estDistToSolid > 100.0 * kCarTolerance )
{
motherSolid->DumpInfo();
G4Exception("G4NormalNavigation::ComputeStep()",
"FarOutsideCurrentVolume", FatalException,
"Point is far outside Current Volume !" );
}
else
G4Exception("G4NormalNavigation::ComputeStep()", "OutsideCurrentVolume",
JustWarning, "Point is a little outside Current Volume.");
}
// Verification / verbosity
//
if ( fVerbose > 1 )
{
G4int oldprec = G4cout.precision(precVerf);
G4cout << " G4NormalNavigation::ComputeStep()"
<< " - Information on mother / key daughters ..." << G4endl;
G4cout << " Type " << std::setw(12) << "Solid-Name" << " "
<< std::setw(3*(6+precVerf)) << " local point" << " "
<< std::setw(4+precVerf) << "solid-Safety" << " "
<< std::setw(4+precVerf) << "solid-Step" << " "
<< std::setw(17) << "distance Method "
<< std::setw(3*(6+precVerf)) << " local direction" << " "
<< G4endl;
G4cout << " Mother " << std::setw(12) << motherSolid->GetName() << " "
<< std::setw(4+precVerf) << localPoint << " "
<< std::setw(4+precVerf) << motherSafety << " "
<< G4endl;
G4cout.precision(oldprec);
}
}
#endif
@@ -236,6 +265,22 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
G4cout.precision(oldcoutPrec);
}
}
// Verification / verbosity
//
if ( fVerbose > 1 )
{
G4int oldprec = G4cout.precision(precVerf);
G4cout << " Daught "
<< std::setw(12) << sampleSolid->GetName() << " "
<< std::setw(4+precVerf) << samplePoint << " "
<< std::setw(4+precVerf) << sampleSafety << " "
<< std::setw(4+precVerf) << sampleStep << " "
<< std::setw(16) << "distanceToIn" << " "
<< std::setw(4+precVerf) << localDirection << " "
<< G4endl;
G4cout.precision(oldprec);
}
#endif
}
}
@@ -282,11 +327,24 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
<< localPoint << G4endl
<< " Local Direction: " << localDirection << G4endl
<< " Solid: " << motherSolid->GetName() << G4endl;
motherSolid->DumpInfo();
G4Exception("G4NormalNavigation::ComputeStep()",
"PointDistOutInvalid", FatalException,
"Current point is outside the current solid !");
}
}
if ( fVerbose > 1 )
{
G4int oldprec = G4cout.precision(precVerf);
G4cout << " Mother " << std::setw(12) << motherSolid->GetName() << " "
<< std::setw(4+precVerf) << localPoint << " "
<< std::setw(4+precVerf) << motherSafety << " "
<< std::setw(4+precVerf) << motherStep << " "
<< std::setw(16) << "distanceToOut" << " "
<< std::setw(4+precVerf) << localDirection << " "
<< G4endl;
G4cout.precision(oldprec);
}
#endif
if ( motherStep<=ourStep )
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisedNavigation.cc,v 1.3 2004/03/11 13:08:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4ParameterisedNavigation.cc,v 1.4 2004/09/10 15:38:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// class G4ParameterisedNavigation Implementation
@@ -112,6 +112,7 @@ G4double G4ParameterisedNavigation::
<< " gave negative safety: " << motherSafety << G4endl
<< " for the current (local) point " << localPoint
<< G4endl;
motherSolid->DumpInfo();
G4Exception("G4ParameterisedNavigation::ComputeStep()",
"NegativeSafetyMotherVol", FatalException,
"Negative Safety In Voxel Navigation !" );
@@ -125,10 +126,13 @@ G4double G4ParameterisedNavigation::
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
G4cout << " Estimated isotropic distance to solid (distToIn)= "
<< estDistToSolid << G4endl;
if( estDistToSolid > 100.0 * kCarTolerance )
if( estDistToSolid > 100.0 * kCarTolerance )
{
motherSolid->DumpInfo();
G4Exception("G4ParameterisedNavigation::ComputeStep()",
"FarOutsideCurrentVolume", FatalException,
"Point is far outside Current Volume !");
}
else
G4Exception("G4ParameterisedNavigation::ComputeStep()",
"OutsideCurrentVolume", JustWarning,
@@ -296,6 +300,7 @@ G4double G4ParameterisedNavigation::
<< localPoint << G4endl
<< " Local Direction: " << localDirection << G4endl
<< " Solid: " << motherSolid->GetName() << G4endl;
motherSolid->DumpInfo();
G4Exception("G4ParameterisedNavigation::ComputeStep()",
"PointOutsideCurrentVolume", FatalException,
"Current point is outside the current solid !");
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PropagatorInField.cc,v 1.19 2004/02/09 12:02:22 japost Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PropagatorInField.cc,v 1.20 2004/12/02 09:31:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// This class implements an algorithm to track a particle in a
@@ -344,7 +344,7 @@ G4PropagatorInField::ComputeStep(
#ifdef G4VERBOSE
// Check that "s" is correct
//
if( fabs(OriginalState.GetCurveLength() + TruePathLength
if( std::fabs(OriginalState.GetCurveLength() + TruePathLength
- End_PointAndTangent.GetCurveLength()) > 3.e-4 * TruePathLength )
{
G4cerr << " ERROR - G4PropagatorInField::ComputeStep():" << G4endl
@@ -816,7 +816,7 @@ G4PropagatorInField::IntersectChord( G4ThreeVector StartPointA,
{
currentSafety = 0.0 ;
}else{
currentSafety = fPreviousSafety - sqrt(MagSqShift) ;
currentSafety = fPreviousSafety - std::sqrt(MagSqShift) ;
}
if( fUseSafetyForOptimisation && (ChordAB_Length <= currentSafety) )
@@ -950,7 +950,7 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
<< " an adjustment in the step's endpoint." << G4endl
<< " Two mid-points are further apart than their"
<< " curve length difference" << G4endl
<< " Dist = " << sqrt(linearDistSq)
<< " Dist = " << std::sqrt(linearDistSq)
<< " curve length = " << curveDist << G4endl;
G4cerr << " Correction applied is "
<< (newEndPoint.GetPosition()-EstimatedEndStateB.GetPosition()).mag()
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ReplicaNavigation.cc,v 1.5 2004/03/11 13:08:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4ReplicaNavigation.cc,v 1.10 2004/12/10 16:20:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
//
// class G4ReplicaNavigation Implementation
@@ -85,7 +85,7 @@ G4ReplicaNavigation::Inside(const G4VPhysicalVolume *pVol,
case kXAxis:
case kYAxis:
case kZAxis:
coord = fabs(localPoint(axis))-width*0.5;
coord = std::fabs(localPoint(axis))-width*0.5;
if ( coord<=-kCarTolerance*0.5 )
{
in = kInside;
@@ -98,7 +98,7 @@ G4ReplicaNavigation::Inside(const G4VPhysicalVolume *pVol,
case kPhi:
if ( localPoint.y()||localPoint.x() )
{
coord = fabs(atan2(localPoint.y(),localPoint.x()))-width*0.5;
coord = std::fabs(std::atan2(localPoint.y(),localPoint.x()))-width*0.5;
if ( coord<=-kAngTolerance*0.5 )
{
in = kInside;
@@ -199,11 +199,11 @@ G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
case kPhi:
if ( localPoint.y()<=0 )
{
safety = localPoint.x()*sin(width*0.5)+localPoint.y()*cos(width*0.5);
safety = localPoint.x()*std::sin(width*0.5)+localPoint.y()*std::cos(width*0.5);
}
else
{
safety = localPoint.x()*sin(width*0.5)-localPoint.y()*cos(width*0.5);
safety = localPoint.x()*std::sin(width*0.5)-localPoint.y()*std::cos(width*0.5);
}
break;
case kRho:
@@ -297,14 +297,14 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
const G4double width) const
{
// Phi Intersection
// NOTE: width<=M_PI by definition
// NOTE: width<=pi by definition
//
G4double sinSPhi, cosSPhi;
G4double pDistS, pDistE, compS, compE, Dist, dist2, yi;
if ( localPoint.x()||localPoint.y() )
{
sinSPhi = sin(-width*0.5); // SIN of starting phi plane
cosSPhi = cos(width*0.5); // COS of starting phi plane
sinSPhi = std::sin(-width*0.5); // SIN of starting phi plane
cosSPhi = std::cos(width*0.5); // COS of starting phi plane
// pDist -ve when inside
//
@@ -372,28 +372,19 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
{
// Outside full starting plane, inside full ending plane
//
if ( compS>=0 )
{
if ( compE<0 )
{
dist2 = pDistE/compE;
yi = localPoint.y()+dist2*localDirection.y();
if ( compE<0 )
{
dist2 = pDistE/compE;
yi = localPoint.y()+dist2*localDirection.y();
// Check intersection in correct half-plane
// (if not -> remain in extent)
//
Dist = (yi>0) ? dist2 : kInfinity;
}
else
{
Dist = kInfinity;
}
}
else
{
// Leaving immediately by starting phi
// Check intersection in correct half-plane
// (if not -> remain in extent)
//
Dist = (compE<0) ? 0 : kInfinity;
Dist = (yi>0) ? dist2 : kInfinity;
}
else // Leaving immediately by starting phi
{
Dist = kInfinity;
}
}
else
@@ -430,7 +421,7 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
{
// On z axis + travel not || to z axis -> use direction vector
//
Dist = (fabs(localDirection.phi())<=width*0.5) ? kInfinity : 0;
Dist = (std::fabs(localDirection.phi())<=width*0.5) ? kInfinity : 0;
}
return Dist;
}
@@ -489,7 +480,7 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
{
b = t2/t1;
c = deltaR/t1;
sr = -b+sqrt(b*b-c);
sr = -b+std::sqrt(b*b-c);
}
else
{
@@ -515,7 +506,7 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
// NOTE: Should use
// rho-rmin>kRadTolerance*0.5 - [no sqrts for efficiency]
//
sr = (deltaR>kRadTolerance*0.5) ? -b-sqrt(d2) : 0;
sr = (deltaR>kRadTolerance*0.5) ? -b-std::sqrt(d2) : 0;
}
else
{
@@ -523,7 +514,7 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
//
deltaR = t3-rmax*rmax;
c = deltaR/t1;
sr = -b+sqrt(b*b-c);
sr = -b+std::sqrt(b*b-c);
}
}
else
@@ -533,7 +524,7 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
deltaR = t3-rmax*rmax;
b = t2/t1;
c = deltaR/t1;
sr = -b+sqrt(b*b-c);
sr = -b+std::sqrt(b*b-c);
}
}
}
@@ -587,8 +578,8 @@ G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
case kPhi:
val = -(offset+width*(replicaNo+0.5));
SetPhiTransformation(val,pVol);
cosv = cos(val);
sinv = sin(val);
cosv = std::cos(val);
sinv = std::sin(val);
tmpx = point.x()*cosv-point.y()*sinv;
tmpy = point.x()*sinv+point.y()*cosv;
point.setY(tmpy);
@@ -674,7 +665,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
G4ThreeVector repPoint, repDirection, sampleDirection;
G4double ourStep=currentProposedStepLength;
G4double ourSafety=kInfinity;
G4double sampleStep, sampleSafety;
G4double sampleStep, sampleSafety, motherStep, motherSafety;
G4int localNoDaughters, sampleNo;
G4int depth;
@@ -700,7 +691,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
// Compute intersection with replica boundaries & replica safety
//
sampleSafety = DistanceToOut(history.GetTopVolume(),
sampleSafety = DistanceToOut(repPhysical,
history.GetTopReplicaNo(),
localPoint);
@@ -710,16 +701,13 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
}
if ( sampleSafety<ourStep )
{
sampleStep = DistanceToOut(history.GetTopVolume(),
sampleStep = DistanceToOut(repPhysical,
history.GetTopReplicaNo(),
localPoint,
localDirection);
if ( sampleStep<ourStep )
{
if ( (sampleStep == 0) && (sampleSafety<0.5*kCarTolerance) )
ourStep = sampleStep+kCarTolerance;
else
ourStep = sampleStep;
ourStep = sampleStep;
exiting = true;
validExitNormal = false;
}
@@ -757,11 +745,20 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
repPoint = history.GetTransform(depth).TransformPoint(globalPoint);
motherPhysical = history.GetVolume(depth);
motherSolid = motherPhysical->GetLogicalVolume()->GetSolid();
sampleSafety = motherSolid->DistanceToOut(repPoint);
motherSafety = motherSolid->DistanceToOut(repPoint);
repDirection = history.GetTransform(depth).TransformAxis(globalDirection);
motherStep = motherSolid->DistanceToOut(repPoint,repDirection,true,
&validExitNormal,&exitNormal);
if ( sampleSafety<ourSafety )
if ( ( !ourStep && (sampleSafety<0.5*kCarTolerance) )
&& ( repLogical->GetSolid()->Inside(localPoint)==kSurface ) )
{
ourSafety = sampleSafety;
ourStep += kCarTolerance;
}
if ( motherSafety<ourSafety )
{
ourSafety = motherSafety;
}
#ifdef G4VERBOSE
@@ -776,10 +773,13 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
G4cout << " Estimated isotropic distance to solid (distToIn)= "
<< estDistToSolid << G4endl;
if( estDistToSolid > 100.0 * kCarTolerance )
if( estDistToSolid > 100.0 * kCarTolerance )
{
motherSolid->DumpInfo();
G4Exception("G4ReplicaNavigation::ComputeStep()",
"FarOutsideCurrentVolume", FatalException,
"Point is far outside Current Volume !" );
}
else
G4Exception("G4ReplicaNavigation::ComputeStep()",
"OutsideCurrentVolume", JustWarning,
@@ -790,14 +790,11 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
// May need precision protection
//
if ( sampleSafety<=ourStep )
if ( motherSafety<=ourStep )
{
repDirection = history.GetTransform(depth).TransformAxis(globalDirection);
sampleStep = motherSolid->DistanceToOut(repPoint,repDirection,true,
&validExitNormal,&exitNormal);
if ( sampleStep<=ourStep )
if ( motherStep<=ourStep )
{
ourStep = sampleStep;
ourStep = motherStep;
exiting = true;
if ( validExitNormal )
{
@@ -897,7 +894,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
}
// ********************************************************************
// ComputeTransformation
// ComputeSafety
//
// Compute the isotropic distance to current volume's boundaries
// and to daughter volumes.
@@ -22,7 +22,7 @@
//
//
// $Id: G4TransportationManager.cc,v 1.4 2003/12/05 17:08:27 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// G4TransportationManager
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VoxelNavigation.cc,v 1.4 2004/05/17 13:30:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4VoxelNavigation.cc,v 1.5 2004/09/10 15:38:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// class G4VoxelNavigation Implementation
@@ -120,6 +120,7 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
<< " gave negative safety: " << motherSafety << G4endl
<< " for the current (local) point " << localPoint
<< G4endl;
motherSolid->DumpInfo();
G4Exception("G4VoxelNavigation::ComputeStep()",
"NegativeSafetyMotherVol", FatalException,
"Negative Safety In Voxel Navigation !" );
@@ -133,10 +134,13 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
G4double estDistToSolid= motherSolid->DistanceToIn(localPoint);
G4cout << " Estimated isotropic distance to solid (distToIn)= "
<< estDistToSolid << G4endl;
if( estDistToSolid > 100.0 * kCarTolerance )
if( estDistToSolid > 100.0 * kCarTolerance )
{
motherSolid->DumpInfo();
G4Exception("G4VoxelNavigation::ComputeStep()",
"FarOutsideCurrentVolume", FatalException,
"Point is far outside Current Volume !");
}
else
G4Exception("G4VoxelNavigation::ComputeStep()", "OutsideCurrentVolume",
JustWarning, "Point is a little outside Current Volume.");
@@ -339,6 +343,7 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
<< localPoint << G4endl
<< " Local Direction: " << localDirection << G4endl
<< " Solid: " << motherSolid->GetName() << G4endl;
motherSolid->DumpInfo();
G4Exception("G4VoxelNavigation::ComputeStep()",
"PointOutsideCurrentVolume", FatalException,
"Current point is outside the current solid !");