Import Geant4 9.0.0 source tree
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.cc,v 1.30 2007/01/25 21:27:50 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
// $Id: G4PropagatorInField.cc,v 1.35 2007/06/08 10:05:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
//
|
||||
//
|
||||
// This class implements an algorithm to track a particle in a
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
#include "G4VCurvedTrajectoryFilter.hh"
|
||||
#include "G4ChordFinder.hh"
|
||||
|
||||
@@ -80,15 +81,27 @@ G4PropagatorInField::G4PropagatorInField( G4Navigator *theNavigator,
|
||||
|
||||
fPreviousSftOrigin= G4ThreeVector(0.,0.,0.);
|
||||
fPreviousSafety= 0.0;
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
|
||||
// In case of too slow progress in finding Intersection Point
|
||||
// intermediates Points on the Track must be stored.
|
||||
// Initialise the array of Pointers [max_depth+1] to do this
|
||||
|
||||
G4ThreeVector zeroV(0.0,0.0,0.0);
|
||||
for (G4int idepth=0; idepth<max_depth+1; idepth++ )
|
||||
{
|
||||
ptrInterMedFT[ idepth ] = new G4FieldTrack( zeroV, zeroV, 0., 0., 0., 0.);
|
||||
}
|
||||
}
|
||||
|
||||
G4PropagatorInField::~G4PropagatorInField()
|
||||
{
|
||||
for ( G4int idepth=0; idepth<max_depth+1; idepth++)
|
||||
{
|
||||
delete ptrInterMedFT[idepth];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Compute the next geometric Step
|
||||
@@ -101,11 +114,17 @@ G4PropagatorInField::ComputeStep(
|
||||
G4VPhysicalVolume* pPhysVol)
|
||||
{
|
||||
// If CurrentProposedStepLength is too small for finding Chords
|
||||
// just forget.
|
||||
if(CurrentProposedStepLength<kCarTolerance) return DBL_MAX;
|
||||
// then return with no action (for now - TODO: some action)
|
||||
//
|
||||
if(CurrentProposedStepLength<kCarTolerance)
|
||||
{
|
||||
return kInfinity;
|
||||
}
|
||||
|
||||
// Introducing smooth trajectory display (jacek 01/11/2002)
|
||||
if (fpTrajectoryFilter) {
|
||||
//
|
||||
if (fpTrajectoryFilter)
|
||||
{
|
||||
fpTrajectoryFilter->CreateNewTrajectorySegment();
|
||||
}
|
||||
|
||||
@@ -487,19 +506,7 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
|
||||
G4int depth=0; // Depth counts how many subdivisions of initial step made
|
||||
|
||||
const G4int max_depth=4; // Max allowed depth, test parameter
|
||||
|
||||
// Intermediates Points on the Track = Subdivided Points must be stored.
|
||||
// Use array of Pointers [max_depth+1] to do this
|
||||
// Array of pointers to the Intermediate G4FieldTrack
|
||||
|
||||
G4FieldTrack* ptrInterMedFT[max_depth+1];
|
||||
G4ThreeVector zeroV(0.0,0.0,0.0);
|
||||
for (G4int idepth=0; idepth<max_depth+1; idepth++ )
|
||||
{
|
||||
ptrInterMedFT[ idepth ] = new G4FieldTrack( zeroV, zeroV, 0., 0., 0., 0.);
|
||||
}
|
||||
|
||||
// Give the initial values to 'InterMedFt'
|
||||
// Important is 'ptrInterMedFT[0]', it saves the 'EndCurvePoint'
|
||||
//
|
||||
@@ -944,11 +951,7 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
"Many substeps while trying to locate intersection.");
|
||||
G4cout.precision( oldprc );
|
||||
}
|
||||
|
||||
for ( G4int idepth=0; idepth<max_depth+1; idepth++)
|
||||
{
|
||||
delete ptrInterMedFT[idepth];
|
||||
}
|
||||
|
||||
return !there_is_no_intersection; // Success or failure
|
||||
}
|
||||
|
||||
@@ -1159,7 +1162,7 @@ G4PropagatorInField::IntersectChord( G4ThreeVector StartPointA,
|
||||
|
||||
G4cout << " G4PropagatorInField::IntersectChord reports " << G4endl;
|
||||
G4cout << " PiF-IC> "
|
||||
<< "Start=" << std::setw(12) << StartPointA << " "
|
||||
<< "Start=" << std::setw(12) << StartPointA << " "
|
||||
<< "End= " << std::setw(8) << EndPointB << " "
|
||||
<< "StepIn=" << std::setw(8) << LinearStepLength << " "
|
||||
<< "NewSft=" << std::setw(8) << NewSafety << " "
|
||||
@@ -1200,16 +1203,23 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
{
|
||||
G4double currentCurveLen= newEndPoint.GetCurveLength();
|
||||
G4double advanceLength= endCurveLen - currentCurveLen ;
|
||||
|
||||
if (std::abs(advanceLength)<kCarTolerance)
|
||||
{
|
||||
advanceLength=(EstimatedEndStateB.GetPosition()
|
||||
-newEndPoint.GetPosition()).mag();
|
||||
}
|
||||
goodAdvance=
|
||||
integrDriver->AccurateAdvance(newEndPoint, advanceLength, fEpsilonStep);
|
||||
// ***************
|
||||
}
|
||||
while( !goodAdvance && (++itrial < no_trials) );
|
||||
|
||||
if( goodAdvance ) {
|
||||
if( goodAdvance )
|
||||
{
|
||||
retEndPoint= newEndPoint;
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
retEndPoint= EstimatedEndStateB; // Could not improve without major work !!
|
||||
}
|
||||
|
||||
@@ -1217,16 +1227,22 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
// 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 ) {
|
||||
if( itrial > 1)
|
||||
{
|
||||
if( fVerboseLevel > 0 )
|
||||
{
|
||||
G4cout << MethodName << " called - goodAdv= " << goodAdvance
|
||||
<< " trials = " << itrial << " previous good= " << latest_good_trials
|
||||
<< G4endl;
|
||||
<< " trials = " << itrial
|
||||
<< " previous good= " << latest_good_trials
|
||||
<< G4endl;
|
||||
}
|
||||
latest_good_trials=0;
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
latest_good_trials++;
|
||||
}
|
||||
#endif
|
||||
@@ -1234,13 +1250,16 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4double lengthDone= newEndPoint.GetCurveLength()
|
||||
- CurrentStateA.GetCurveLength();
|
||||
if( !goodAdvance ) {
|
||||
if( fVerboseLevel >= 3 ){
|
||||
if( !goodAdvance )
|
||||
{
|
||||
if( fVerboseLevel >= 3 )
|
||||
{
|
||||
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;
|
||||
G4cout << " ReEstimateEndpoint> Reset endPoint to original value!"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1263,10 +1282,12 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
}
|
||||
#else
|
||||
// Statistics on the RMS value of the corrections
|
||||
|
||||
static G4int noCorrections=0;
|
||||
static G4double sumCorrectionsSq = 0;
|
||||
noCorrections++;
|
||||
if( goodAdvance ){
|
||||
if( goodAdvance )
|
||||
{
|
||||
sumCorrectionsSq += (EstimatedEndStateB.GetPosition() -
|
||||
newEndPoint.GetPosition()).mag2();
|
||||
}
|
||||
@@ -1285,36 +1306,38 @@ ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
// the points are not re-used in subsequent steps, therefore THIS
|
||||
// METHOD MUST BE CALLED EXACTLY ONCE PER STEP. (jacek 08/11/2002)
|
||||
|
||||
|
||||
std::vector<G4ThreeVector>*
|
||||
G4PropagatorInField::GimmeTrajectoryVectorAndForgetIt() const {
|
||||
G4PropagatorInField::GimmeTrajectoryVectorAndForgetIt() const
|
||||
{
|
||||
// NB, GimmeThePointsAndForgetThem really forgets them, so it can
|
||||
// only be called (exactly) once for each step.
|
||||
if (fpTrajectoryFilter) {
|
||||
|
||||
if (fpTrajectoryFilter)
|
||||
{
|
||||
return fpTrajectoryFilter->GimmeThePointsAndForgetThem();
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
G4PropagatorInField::SetTrajectoryFilter(G4VCurvedTrajectoryFilter* filter) {
|
||||
G4PropagatorInField::SetTrajectoryFilter(G4VCurvedTrajectoryFilter* filter)
|
||||
{
|
||||
fpTrajectoryFilter = filter;
|
||||
}
|
||||
|
||||
|
||||
void G4PropagatorInField::ClearPropagatorState()
|
||||
{
|
||||
// G4Exception("G4PropagatorInField::ClearPropagatorState()", "NotImplemented",
|
||||
// FatalException, "Functionality not yet implemented.");
|
||||
|
||||
// Goal: Clear all memory of previous steps, cached information
|
||||
|
||||
fParticleIsLooping= false;
|
||||
fNoZeroStep= 0;
|
||||
|
||||
End_PointAndTangent= G4FieldTrack( G4ThreeVector(0.,0.,0.),
|
||||
G4ThreeVector(0.,0.,0.),0.0,0.0,0.0,0.0,0.0);
|
||||
|
||||
G4ThreeVector(0.,0.,0.),
|
||||
0.0,0.0,0.0,0.0,0.0);
|
||||
fFull_CurveLen_of_LastAttempt = -1;
|
||||
fLast_ProposedStepLength = -1;
|
||||
|
||||
@@ -1322,8 +1345,8 @@ void G4PropagatorInField::ClearPropagatorState()
|
||||
fPreviousSafety= 0.0;
|
||||
}
|
||||
|
||||
G4FieldManager*
|
||||
G4PropagatorInField::FindAndSetFieldManager( G4VPhysicalVolume* pCurrentPhysicalVolume)
|
||||
G4FieldManager* G4PropagatorInField::
|
||||
FindAndSetFieldManager( G4VPhysicalVolume* pCurrentPhysicalVolume)
|
||||
{
|
||||
G4FieldManager* currentFieldMgr;
|
||||
|
||||
@@ -1348,7 +1371,9 @@ G4int G4PropagatorInField::SetVerboseLevel( G4int Verbose )
|
||||
G4int oldval= fVerboseLevel;
|
||||
fVerboseLevel= Verbose;
|
||||
|
||||
// Forward the verbose level 'reduced' to ChordFinder, MagIntegratorDriver ... ?
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user