Import Geant4 3.1.0 source tree
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4BlockingList.cc,v 1.2 1999/12/15 14:50:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4BlockingList Implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GRSSolid.cc,v 1.3 2000/11/01 16:51:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4GRSSolid Implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GRSVolume.cc,v 1.3 2000/11/01 16:51:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4GRSVolume Implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LogicalBorderSurface.cc,v 1.5 2000/11/20 19:05:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// G4LogicalBorderSurface Implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LogicalSkinSurface.cc,v 1.5 2000/11/20 19:05:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// G4LogicalSkinSurface Implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NavigationHistory.cc,v 1.3 2000/11/01 16:51:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4NavigationHistory Implementation P.Kent August 96
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Navigator.cc,v 1.11 2000/11/20 19:05:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4Navigator Implementation Paul Kent July 95/96
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NormalNavigation.cc,v 1.3 2000/11/20 19:05:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation Implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.3 2000/11/20 19:05:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Implementation
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PropagatorInField.cc,v 1.12 2000/11/20 19:05:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4PropagatorInField.cc,v 1.12.4.1 2001/02/20 18:23:32 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -33,6 +33,7 @@
|
||||
//const G4double G4PropagatorInField::fDefault_Delta_One_Step_Value = 0.25 * mm;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
#if OLD_SIGNATURE_IS_INVALID
|
||||
G4double
|
||||
G4PropagatorInField::
|
||||
ComputeStep(const G4ThreeVector & StartPointA,
|
||||
@@ -47,6 +48,7 @@ G4PropagatorInField::
|
||||
Velocity,
|
||||
0.0, // length of path
|
||||
0.0, // energy
|
||||
// PROBLEM ---> zero energy will create zero momentum !!
|
||||
0.0, // lab tof
|
||||
0.0, // proper tof
|
||||
0 );
|
||||
@@ -56,6 +58,7 @@ G4PropagatorInField::
|
||||
CurrentProposedStepLength,
|
||||
currentSafety );
|
||||
}
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
G4double
|
||||
@@ -158,7 +161,7 @@ G4PropagatorInField::
|
||||
// On Exit:
|
||||
// CurrentState is updated with the final position and velocity.
|
||||
|
||||
G4ThreeVector EndPointB= CurrentState.Position();
|
||||
G4ThreeVector EndPointB= CurrentState.GetPosition();
|
||||
|
||||
// Calculate the direction and length of the chord AB
|
||||
|
||||
@@ -204,8 +207,8 @@ G4PropagatorInField::
|
||||
// G is our EndPoint ...
|
||||
End_PointAndTangent= IntersectPointVelct_G;
|
||||
StepTaken =
|
||||
TruePathLength= IntersectPointVelct_G.CurveS()
|
||||
- OriginalState.CurveS(); // which is Zero now.
|
||||
TruePathLength= IntersectPointVelct_G.GetCurveLength()
|
||||
- OriginalState.GetCurveLength(); // which is Zero now.
|
||||
#ifdef G4VERBOSE
|
||||
if( Verbose() > 0 )
|
||||
G4cout << " Found intersection after Step of length " <<
|
||||
@@ -272,16 +275,16 @@ G4PropagatorInField::
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
// Check that "s" is correct
|
||||
if( fabs(OriginalState.CurveS() + TruePathLength
|
||||
- End_PointAndTangent.CurveS()) > 3.e-4 * TruePathLength )
|
||||
if( fabs(OriginalState.GetCurveLength() + TruePathLength
|
||||
- End_PointAndTangent.GetCurveLength()) > 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()
|
||||
<< OriginalState.GetCurveLength() + TruePathLength
|
||||
<< " and is " << End_PointAndTangent.GetCurveLength()
|
||||
<< " a difference of "
|
||||
<< OriginalState.CurveS() + TruePathLength
|
||||
- End_PointAndTangent.CurveS() << G4endl;
|
||||
<< OriginalState.GetCurveLength() + TruePathLength
|
||||
- End_PointAndTangent.GetCurveLength() << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -352,8 +355,8 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
|
||||
do{ // REPEAT
|
||||
|
||||
G4ThreeVector Point_A= CurrentA_PointVelocity.Position();
|
||||
G4ThreeVector Point_B= CurrentB_PointVelocity.Position();
|
||||
G4ThreeVector Point_A= CurrentA_PointVelocity.GetPosition();
|
||||
G4ThreeVector Point_B= CurrentB_PointVelocity.GetPosition();
|
||||
|
||||
// F = a point on true AB path close to point E (the closest if possible)
|
||||
//
|
||||
@@ -365,7 +368,7 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
|
||||
// The above function is the most difficult part ...
|
||||
//
|
||||
G4ThreeVector CurrentF_Point= ApproxIntersecPointV.Position();
|
||||
G4ThreeVector CurrentF_Point= ApproxIntersecPointV.GetPosition();
|
||||
// fMidPoint_CurveLen_of_LastAttempt =
|
||||
// ApproxIntersecPointV. GetCurveLength() -
|
||||
// CurrentA_PointVelocity.GetCurveLength();
|
||||
@@ -386,7 +389,7 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
// IntersectPointVelocity.SetCurvePnt(
|
||||
// CurrentE_Point,
|
||||
// ApproxIntersecPointV.GetVelocity(),
|
||||
// ApproxIntersecPointV.CurveS() );
|
||||
// ApproxIntersecPointV.GetCurveLength() );
|
||||
IntersectPointVelocity = ApproxIntersecPointV;
|
||||
IntersectPointVelocity.SetPosition( CurrentE_Point );
|
||||
|
||||
@@ -493,10 +496,10 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
// 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();
|
||||
linDistSq= ( CurrentB_PointVelocity.GetPosition()
|
||||
- CurrentA_PointVelocity.GetPosition() ).mag2();
|
||||
curveDist= CurrentB_PointVelocity.GetCurveLength() -
|
||||
CurrentA_PointVelocity.GetCurveLength();
|
||||
if( curveDist*(curveDist+2*perMillion ) < linDistSq ){
|
||||
// Re-integrate to obtain a new B
|
||||
G4FieldTrack newEndpoint= CurrentA_PointVelocity;
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.4 2000/11/20 19:06:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.8 2001/03/09 15:32:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4REplicaNavigation Implementation
|
||||
// class G4ReplicaNavigation Implementation
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4ReplicaNavigation.hh"
|
||||
|
||||
@@ -19,9 +21,10 @@ G4ReplicaNavigation::G4ReplicaNavigation()
|
||||
{
|
||||
}
|
||||
|
||||
EInside G4ReplicaNavigation::Inside(const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint) const
|
||||
EInside
|
||||
G4ReplicaNavigation::Inside(const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint) const
|
||||
{
|
||||
EInside in=kOutside;
|
||||
// Replication data
|
||||
@@ -71,7 +74,6 @@ EInside G4ReplicaNavigation::Inside(const G4VPhysicalVolume *pVol,
|
||||
case kRho:
|
||||
rad2=localPoint.perp2();
|
||||
rmax=(replicaNo+1)*width+offset;
|
||||
|
||||
tolRMax2=rmax-kRadTolerance*0.5;
|
||||
tolRMax2*=tolRMax2;
|
||||
if (rad2>tolRMax2)
|
||||
@@ -118,9 +120,10 @@ EInside G4ReplicaNavigation::Inside(const G4VPhysicalVolume *pVol,
|
||||
return in;
|
||||
}
|
||||
|
||||
G4double G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint) const
|
||||
G4double
|
||||
G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint) const
|
||||
{
|
||||
// Replication data
|
||||
EAxis axis;
|
||||
@@ -176,10 +179,11 @@ G4double G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
return (safety >= kCarTolerance) ? safety : 0;
|
||||
}
|
||||
|
||||
G4double G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection) const
|
||||
G4double
|
||||
G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
const G4int replicaNo,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection) const
|
||||
{
|
||||
// Replication data
|
||||
EAxis axis;
|
||||
@@ -199,7 +203,6 @@ G4double G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
case kZAxis:
|
||||
coord=localPoint(axis);
|
||||
Comp=localDirection(axis);
|
||||
|
||||
if (Comp>0)
|
||||
{
|
||||
lindist=width*0.5-coord;
|
||||
@@ -229,9 +232,10 @@ G4double G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume *pVol,
|
||||
}
|
||||
|
||||
|
||||
G4double G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width) const
|
||||
G4double
|
||||
G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width) const
|
||||
{
|
||||
// Phi Intersection
|
||||
// NOTE: width<=M_PI by definition
|
||||
@@ -242,21 +246,28 @@ G4double G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
{
|
||||
sinSPhi=sin(-width*0.5); // SIN of starting phi plane
|
||||
cosSPhi=cos(width*0.5); // COS of starting phi plane
|
||||
// pDist -ve when inside
|
||||
|
||||
// pDist -ve when inside
|
||||
//
|
||||
pDistS=localPoint.x()*sinSPhi-localPoint.y()*cosSPhi;
|
||||
pDistE=localPoint.x()*sinSPhi+localPoint.y()*cosSPhi;
|
||||
// Comp -ve when in direction of outwards normal
|
||||
|
||||
// Comp -ve when in direction of outwards normal
|
||||
//
|
||||
compS=-sinSPhi*localDirection.x()+cosSPhi*localDirection.y();
|
||||
compE=-sinSPhi*localDirection.x()-cosSPhi*localDirection.y();
|
||||
|
||||
if (pDistS<=0&&pDistE<=0)
|
||||
{
|
||||
// Inside both phi *full* planes
|
||||
//
|
||||
if (compS<0)
|
||||
{
|
||||
dist2=pDistS/compS;
|
||||
yi=localPoint.y()+dist2*localDirection.y();
|
||||
|
||||
// Check intersecting with correct half-plane (no -> no intersect)
|
||||
//
|
||||
if (yi<=0)
|
||||
{
|
||||
Dist=(pDistS<=-kCarTolerance*0.5) ? dist2 : 0;
|
||||
@@ -270,47 +281,56 @@ G4double G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
{
|
||||
Dist=kInfinity;
|
||||
}
|
||||
|
||||
if (compE<0)
|
||||
{
|
||||
dist2=pDistE/compE;
|
||||
|
||||
// Only check further if < starting phi intersection
|
||||
//
|
||||
if (dist2<Dist)
|
||||
{
|
||||
yi=localPoint.y()+dist2*localDirection.y();
|
||||
// Check intersecting with correct half-plane
|
||||
|
||||
// Check intersecting with correct half-plane
|
||||
//
|
||||
if (yi>=0)
|
||||
{
|
||||
// Leaving via ending phi
|
||||
// Leaving via ending phi
|
||||
//
|
||||
Dist=(pDistE<=-kCarTolerance*0.5) ? dist2 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (pDistS>=0&&pDistE>=0)
|
||||
{
|
||||
// Outside both *full* phi planes
|
||||
// if towards both >=0 then once inside will remain inside
|
||||
// Outside both *full* phi planes
|
||||
// if towards both >=0 then once inside will remain inside
|
||||
//
|
||||
Dist= (compS>=0&&compE>=0) ? kInfinity : 0;
|
||||
}
|
||||
else if (pDistS>0&&pDistE<0)
|
||||
{
|
||||
// Outside full starting plane, inside full ending plane
|
||||
//
|
||||
if (compS>=0)
|
||||
{
|
||||
if (compE<0)
|
||||
{
|
||||
dist2=pDistE/compE;
|
||||
yi=localPoint.y()+dist2*localDirection.y();
|
||||
// Check intersection in correct half-plane (if not -> remain in extent)
|
||||
|
||||
// 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
|
||||
// Leaving immediately by starting phi
|
||||
//
|
||||
Dist=0;
|
||||
}
|
||||
}
|
||||
@@ -318,6 +338,7 @@ G4double G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
{
|
||||
// Must be pDistS<0&&pDistE>0
|
||||
// Inside full starting plane, outside full ending plane
|
||||
//
|
||||
if (compE>=0)
|
||||
{
|
||||
if (compS<0)
|
||||
@@ -325,7 +346,10 @@ G4double G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
|
||||
dist2=pDistS/compS;
|
||||
yi=localPoint.y()+dist2*localDirection.y();
|
||||
// Check intersection in correct half-plane (if not -> remain in extent)
|
||||
|
||||
// Check intersection in correct half-plane
|
||||
// (if not -> remain in extent)
|
||||
//
|
||||
Dist=(yi<0) ? dist2 : kInfinity;
|
||||
}
|
||||
else
|
||||
@@ -335,7 +359,8 @@ G4double G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
}
|
||||
else
|
||||
{
|
||||
// leaving immediately by ending phi
|
||||
// Leaving immediately by ending phi
|
||||
//
|
||||
Dist=0;
|
||||
}
|
||||
}
|
||||
@@ -343,17 +368,18 @@ G4double G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
|
||||
else
|
||||
{
|
||||
// On z axis + travel not || to z axis -> use direction vector
|
||||
//
|
||||
Dist = (fabs(localDirection.phi())<=width*0.5) ? kInfinity : 0;
|
||||
}
|
||||
|
||||
return Dist;
|
||||
}
|
||||
|
||||
G4double G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width,
|
||||
const G4double offset,
|
||||
const G4int replicaNo) const
|
||||
G4double
|
||||
G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double width,
|
||||
const G4double offset,
|
||||
const G4int replicaNo) const
|
||||
{
|
||||
|
||||
G4double rmin,rmax,t1,t2,t3,deltaR;
|
||||
@@ -378,18 +404,23 @@ G4double G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
rmin=replicaNo*width+offset;
|
||||
rmax=(replicaNo+1)*width+offset;
|
||||
|
||||
t1=1.0-localDirection.z()*localDirection.z(); // since v normalised
|
||||
t1=1.0-localDirection.z()*localDirection.z(); // since v normalised
|
||||
t2=localPoint.x()*localDirection.x()+localPoint.y()*localDirection.y();
|
||||
t3=localPoint.x()*localPoint.x()+localPoint.y()*localPoint.y();
|
||||
|
||||
if (t1>0) // Check not parallel
|
||||
{
|
||||
// Calculate sr, r exit distance
|
||||
// Calculate sr, r exit distance
|
||||
//
|
||||
if (t2>=0)
|
||||
{
|
||||
// Delta r not negative => leaving via rmax
|
||||
// Delta r not negative => leaving via rmax
|
||||
//
|
||||
deltaR=t3-rmax*rmax;
|
||||
// NOTE: Should use rho-rmax<-kRadTolerance*0.5 - [no sqrts for efficiency]
|
||||
|
||||
// NOTE: Should use
|
||||
// rho-rmax<-kRadTolerance*0.5 - [no sqrts for efficiency]
|
||||
//
|
||||
if (deltaR<-kRadTolerance*0.5)
|
||||
{
|
||||
b=t2/t1;
|
||||
@@ -398,14 +429,16 @@ G4double G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
}
|
||||
else
|
||||
{
|
||||
// On tolerant boundary & heading outwards (or locally perpendicular to)
|
||||
// outer radial surface -> leaving immediately
|
||||
// On tolerant boundary & heading outwards (or locally
|
||||
// perpendicular to) outer radial surface -> leaving immediately
|
||||
//
|
||||
sr=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Possible rmin intersection
|
||||
//
|
||||
if (rmin)
|
||||
{
|
||||
deltaR=t3-rmin*rmin;
|
||||
@@ -415,12 +448,15 @@ G4double G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
if (d2>=0)
|
||||
{
|
||||
// Leaving via rmin
|
||||
// NOTE: Should use rho-rmin>kRadTolerance*0.5 - [no sqrts for efficiency]
|
||||
// NOTE: Should use
|
||||
// rho-rmin>kRadTolerance*0.5 - [no sqrts for efficiency]
|
||||
//
|
||||
sr= (deltaR>kRadTolerance*0.5) ? -b-sqrt(d2) : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No rmin intersect -> must be rmax intersect
|
||||
//
|
||||
deltaR=t3-rmax*rmax;
|
||||
c=deltaR/t1;
|
||||
sr=-b+sqrt(b*b-c);
|
||||
@@ -429,6 +465,7 @@ G4double G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
else
|
||||
{
|
||||
// No rmin intersect -> must be rmax intersect
|
||||
//
|
||||
deltaR=t3-rmax*rmax;
|
||||
b=t2/t1;
|
||||
c=deltaR/t1;
|
||||
@@ -443,13 +480,17 @@ G4double G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
|
||||
return sr;
|
||||
}
|
||||
|
||||
// Setup transformation and transform point into local system
|
||||
void G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
G4VPhysicalVolume *pVol,
|
||||
G4ThreeVector& point) const
|
||||
void
|
||||
G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
G4VPhysicalVolume *pVol,
|
||||
G4ThreeVector& point) const
|
||||
//
|
||||
// Setup transformation and transform point into local system
|
||||
{
|
||||
G4double val,cosv,sinv,tmp;
|
||||
G4double val,cosv,sinv,tmpx,tmpy;
|
||||
|
||||
// Replication data
|
||||
//
|
||||
EAxis axis;
|
||||
G4int nReplicas;
|
||||
G4double width,offset;
|
||||
@@ -480,9 +521,10 @@ void G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
SetPhiTransformation(val,pVol);
|
||||
cosv=cos(val);
|
||||
sinv=sin(val);
|
||||
tmp=point.x()*cosv-point.y()*sinv;
|
||||
point.setY(point.x()*sinv+point.y()*cosv);
|
||||
point.setX(tmp);
|
||||
tmpx=point.x()*cosv-point.y()*sinv;
|
||||
tmpy=point.x()*sinv+point.y()*cosv;
|
||||
point.setY(tmpy);
|
||||
point.setX(tmpx);
|
||||
break;
|
||||
case kRho:
|
||||
// No setup required for radial case
|
||||
@@ -491,12 +533,15 @@ void G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
}
|
||||
}
|
||||
|
||||
// Setup transformation
|
||||
void G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
G4VPhysicalVolume *pVol) const
|
||||
void
|
||||
G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
G4VPhysicalVolume *pVol) const
|
||||
// Setup transformation.
|
||||
{
|
||||
G4double val;
|
||||
|
||||
// Replication data
|
||||
//
|
||||
EAxis axis;
|
||||
G4int nReplicas;
|
||||
G4double width,offset;
|
||||
@@ -521,7 +566,7 @@ void G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
break;
|
||||
case kPhi:
|
||||
val=-(offset+width*(replicaNo+0.5));
|
||||
SetPhiTransformation(val);
|
||||
SetPhiTransformation(val,pVol);
|
||||
break;
|
||||
case kRho:
|
||||
// No setup required for radial case
|
||||
@@ -530,19 +575,20 @@ void G4ReplicaNavigation::ComputeTransformation(const G4int replicaNo,
|
||||
}
|
||||
}
|
||||
|
||||
G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector &globalDirection,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double &newSafety,
|
||||
G4NavigationHistory &history,
|
||||
G4bool &validExitNormal,
|
||||
G4ThreeVector &exitNormal,
|
||||
G4bool &exiting,
|
||||
G4bool &entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int &blockedReplicaNo)
|
||||
G4double
|
||||
G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector &globalDirection,
|
||||
const G4ThreeVector &localPoint,
|
||||
const G4ThreeVector &localDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double &newSafety,
|
||||
G4NavigationHistory &history,
|
||||
G4bool &validExitNormal,
|
||||
G4ThreeVector &exitNormal,
|
||||
G4bool &exiting,
|
||||
G4bool &entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int &blockedReplicaNo)
|
||||
{
|
||||
G4VPhysicalVolume *repPhysical,*motherPhysical;
|
||||
G4VPhysicalVolume *samplePhysical,*blockedExitedVol=0;
|
||||
@@ -555,12 +601,14 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
G4int localNoDaughters,sampleNo;
|
||||
G4int depth;
|
||||
|
||||
// Exiting normal optimisation
|
||||
// Exiting normal optimisation
|
||||
//
|
||||
if (exiting&&validExitNormal)
|
||||
{
|
||||
if (localDirection.dot(exitNormal)>=kMinExitingNormalCosine)
|
||||
{
|
||||
// Block exited daughter volume
|
||||
// Block exited daughter volume
|
||||
//
|
||||
blockedExitedVol=*pBlockedPhysical;
|
||||
ourSafety=0;
|
||||
}
|
||||
@@ -591,10 +639,12 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
localDirection);
|
||||
if (sampleStep<ourStep)
|
||||
{
|
||||
if (sampleStep != 0)
|
||||
ourStep=sampleStep;
|
||||
exiting=true;
|
||||
validExitNormal=false;
|
||||
if (sampleStep != 0)
|
||||
ourStep=sampleStep;
|
||||
else
|
||||
ourStep=sampleStep+kCarTolerance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,9 +662,8 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
if (sampleSafety<ourStep)
|
||||
{
|
||||
sampleStep=DistanceToOut(history.GetVolume(depth),
|
||||
history.GetReplicaNo(depth),
|
||||
repPoint,
|
||||
history.GetTransform(depth).TransformAxis(globalDirection));
|
||||
history.GetReplicaNo(depth), repPoint,
|
||||
history.GetTransform(depth).TransformAxis(globalDirection));
|
||||
if (sampleStep<ourStep)
|
||||
{
|
||||
ourStep=sampleStep;
|
||||
@@ -625,7 +674,8 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
depth--;
|
||||
}
|
||||
|
||||
// Compute mother safety & intersection
|
||||
// Compute mother safety & intersection
|
||||
//
|
||||
repPoint=history.GetTransform(depth).TransformPoint(globalPoint);
|
||||
motherPhysical=history.GetVolume(depth);
|
||||
motherSolid=motherPhysical->GetLogicalVolume()->GetSolid();
|
||||
@@ -637,15 +687,13 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
}
|
||||
|
||||
// May need precision protection
|
||||
//
|
||||
if (sampleSafety<=ourStep)
|
||||
{
|
||||
repDirection=history.GetTransform(depth).TransformAxis(globalDirection);
|
||||
sampleStep=motherSolid
|
||||
->DistanceToOut(repPoint,
|
||||
repDirection,
|
||||
true,
|
||||
&validExitNormal,
|
||||
&exitNormal);
|
||||
->DistanceToOut(repPoint,repDirection,true,
|
||||
&validExitNormal,&exitNormal);
|
||||
if (sampleStep<=ourStep)
|
||||
{
|
||||
ourStep=sampleStep;
|
||||
@@ -664,10 +712,9 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
validExitNormal=false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Compute daughter safeties & intersections
|
||||
//
|
||||
//
|
||||
// Compute daughter safeties & intersections
|
||||
//
|
||||
localNoDaughters=repLogical->GetNoDaughters();
|
||||
for (sampleNo=localNoDaughters-1;sampleNo>=0;sampleNo--)
|
||||
{
|
||||
@@ -679,11 +726,10 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
samplePhysical->GetTranslation());
|
||||
sampleTf.Invert();
|
||||
const G4ThreeVector samplePoint=sampleTf.TransformPoint(localPoint);
|
||||
const G4VSolid *sampleSolid=samplePhysical
|
||||
->GetLogicalVolume()
|
||||
->GetSolid();
|
||||
const G4double sampleSafety=sampleSolid
|
||||
->DistanceToIn(samplePoint);
|
||||
const G4VSolid *sampleSolid=
|
||||
samplePhysical->GetLogicalVolume()->GetSolid();
|
||||
const G4double sampleSafety=
|
||||
sampleSolid->DistanceToIn(samplePoint);
|
||||
if (sampleSafety<ourSafety)
|
||||
{
|
||||
ourSafety=sampleSafety;
|
||||
@@ -691,9 +737,8 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
if (sampleSafety<=ourStep)
|
||||
{
|
||||
sampleDirection=sampleTf.TransformAxis(localDirection);
|
||||
const G4double sampleStep=sampleSolid
|
||||
->DistanceToIn(samplePoint,
|
||||
sampleDirection);
|
||||
const G4double sampleStep=
|
||||
sampleSolid->DistanceToIn(samplePoint,sampleDirection);
|
||||
if (sampleStep<=ourStep)
|
||||
{
|
||||
ourStep=sampleStep;
|
||||
@@ -705,20 +750,19 @@ G4double G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newSafety=ourSafety;
|
||||
return ourStep;
|
||||
}
|
||||
|
||||
// Compute the isotropic distance to current volume's boundaries and
|
||||
// to daughter volumes.
|
||||
G4double
|
||||
G4ReplicaNavigation::ComputeSafety(const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector &localPoint,
|
||||
G4NavigationHistory &history,
|
||||
const G4double pProposedMaxLength )
|
||||
//
|
||||
// Compute the isotropic distance to current volume's boundaries and
|
||||
// to daughter volumes.
|
||||
|
||||
G4double G4ReplicaNavigation::ComputeSafety(const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector &localPoint,
|
||||
G4NavigationHistory &history,
|
||||
// const G4NavigationHistory &history, // -> NON-CONST
|
||||
const G4double pProposedMaxLength )
|
||||
{
|
||||
G4VPhysicalVolume *repPhysical,*motherPhysical;
|
||||
G4VPhysicalVolume *samplePhysical,*blockedExitedVol=0;
|
||||
@@ -759,7 +803,8 @@ G4double G4ReplicaNavigation::ComputeSafety(const G4ThreeVector &globalPoint,
|
||||
depth--;
|
||||
}
|
||||
|
||||
// Compute mother safety & intersection
|
||||
// Compute mother safety & intersection
|
||||
//
|
||||
repPoint=history.GetTransform(depth).TransformPoint(globalPoint);
|
||||
motherPhysical=history.GetVolume(depth);
|
||||
motherSolid=motherPhysical->GetLogicalVolume()->GetSolid();
|
||||
@@ -770,9 +815,8 @@ G4double G4ReplicaNavigation::ComputeSafety(const G4ThreeVector &globalPoint,
|
||||
ourSafety=sampleSafety;
|
||||
}
|
||||
|
||||
//
|
||||
// Compute daughter safeties & intersections
|
||||
//
|
||||
// Compute daughter safeties & intersections
|
||||
//
|
||||
localNoDaughters=repLogical->GetNoDaughters();
|
||||
for (sampleNo=localNoDaughters-1;sampleNo>=0;sampleNo--)
|
||||
{
|
||||
@@ -799,13 +843,12 @@ G4double G4ReplicaNavigation::ComputeSafety(const G4ThreeVector &globalPoint,
|
||||
return ourSafety;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EInside G4ReplicaNavigation::BackLocate(G4NavigationHistory &history,
|
||||
const G4ThreeVector &globalPoint,
|
||||
G4ThreeVector &localPoint,
|
||||
const G4bool &exiting,
|
||||
G4bool ¬KnownInside) const
|
||||
EInside
|
||||
G4ReplicaNavigation::BackLocate(G4NavigationHistory &history,
|
||||
const G4ThreeVector &globalPoint,
|
||||
G4ThreeVector &localPoint,
|
||||
const G4bool &exiting,
|
||||
G4bool ¬KnownInside) const
|
||||
{
|
||||
G4VPhysicalVolume *pNRMother=0;
|
||||
G4VSolid *motherSolid;
|
||||
@@ -814,7 +857,9 @@ EInside G4ReplicaNavigation::BackLocate(G4NavigationHistory &history,
|
||||
EInside insideCode;
|
||||
|
||||
cdepth=history.GetDepth();
|
||||
|
||||
// Find non replicated mother
|
||||
//
|
||||
for (mdepth=cdepth-1;mdepth>=0;mdepth--)
|
||||
{
|
||||
if (history.GetVolumeType(mdepth)!=kReplica)
|
||||
@@ -828,6 +873,7 @@ EInside G4ReplicaNavigation::BackLocate(G4NavigationHistory &history,
|
||||
{
|
||||
// All the tree of mother volumes were Replicas.
|
||||
// This is an error, as the World volume must be a Placement
|
||||
//
|
||||
G4Exception( "G4ReplicaNavigation::BackLocate - World volume must be a Placement" );
|
||||
}
|
||||
|
||||
@@ -839,15 +885,18 @@ EInside G4ReplicaNavigation::BackLocate(G4NavigationHistory &history,
|
||||
{
|
||||
// Outside mother -> back up to mother level
|
||||
// Locate.. in Navigator will back up one more level
|
||||
// localPoint not reqd
|
||||
// localPoint not required
|
||||
//
|
||||
history.BackLevel(cdepth-mdepth);
|
||||
// localPoint=goodPoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
notKnownInside=false;
|
||||
|
||||
// Still within replications
|
||||
// Check down: if on outside stop at this level
|
||||
//
|
||||
for (depth=mdepth+1;depth<cdepth;depth++)
|
||||
{
|
||||
repPoint=history.GetTransform(depth).TransformPoint(globalPoint);
|
||||
@@ -872,6 +921,7 @@ EInside G4ReplicaNavigation::BackLocate(G4NavigationHistory &history,
|
||||
// If outside level, set localPoint = coordinates in reference system
|
||||
// of *previous* level - location code in navigator will back up one
|
||||
// level [And also manage blocking]
|
||||
//
|
||||
if (insideCode==kOutside||insideCode==kSurface&&exiting)
|
||||
{
|
||||
localPoint=goodPoint;
|
||||
@@ -880,4 +930,3 @@ EInside G4ReplicaNavigation::BackLocate(G4NavigationHistory &history,
|
||||
|
||||
return insideCode;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4TouchableHistory.cc,v 1.4 2000/11/01 16:51:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4TouchableHistory Implementation
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4TransportationManager.cc,v 1.5 1999/12/15 14:50:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// G4TransportationManager
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VoxelNavigation.cc,v 1.6 2000/11/20 19:06:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation Implementation
|
||||
|
||||
Reference in New Issue
Block a user