Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -53,6 +53,8 @@ G4bool G4CoupledTransportation::fSignifyStepInAnyVolume= false;
|
||||
// This mode must apply to all threads
|
||||
|
||||
G4bool G4CoupledTransportation::fUseMagneticMoment=false;
|
||||
G4bool G4CoupledTransportation::fUseGravity= false;
|
||||
G4bool G4CoupledTransportation::fSilenceLooperWarnings= false;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constructor
|
||||
@@ -115,8 +117,7 @@ G4CoupledTransportation::G4CoupledTransportation( G4int verbosity )
|
||||
fCurrentTouchableHandle = *pNullTouchableHandle;
|
||||
// Points to (G4VTouchable*) 0
|
||||
|
||||
G4FieldManager *globalFieldMgr= transportMgr->GetFieldManager();
|
||||
fGlobalFieldExists= globalFieldMgr ? globalFieldMgr->GetDetectorField() : 0 ;
|
||||
fAnyFieldExists= DoesAnyFieldExist();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -259,34 +260,32 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
|
||||
|
||||
// Check if the particle has a force, EM or gravitational, exerted on it
|
||||
//
|
||||
G4FieldManager* fieldMgr=0;
|
||||
G4FieldManager* fieldMgr= nullptr;
|
||||
G4bool fieldExertsForce = false ;
|
||||
|
||||
G4bool gravityOn = false;
|
||||
const G4Field* ptrField= 0;
|
||||
const G4Field* ptrField= nullptr;
|
||||
|
||||
fieldMgr = fFieldPropagator->FindAndSetFieldManager( track.GetVolume() );
|
||||
if( fieldMgr != 0 )
|
||||
G4bool eligibleEM = (particleCharge != 0.0)
|
||||
|| ( fUseMagneticMoment && (magneticMoment != 0.0) );
|
||||
G4bool eligibleGrav = fUseGravity && (restMass != 0.0) ;
|
||||
|
||||
if( (fieldMgr!=nullptr) && (eligibleEM||eligibleGrav) )
|
||||
{
|
||||
// Message the field Manager, to configure it for this track
|
||||
//
|
||||
fieldMgr->ConfigureForTrack( &track );
|
||||
|
||||
// Here it can transition from a null field-ptr to a finite field.
|
||||
// The above call can transition from a null field-ptr oto a finite field.
|
||||
// If the field manager has no field ptr, the field is zero
|
||||
// by definition ( = there is no field ! )
|
||||
//
|
||||
ptrField= fieldMgr->GetDetectorField();
|
||||
|
||||
if( ptrField != 0)
|
||||
if( ptrField != nullptr)
|
||||
{
|
||||
gravityOn= ptrField->IsGravityActive();
|
||||
if( (particleCharge != 0.0)
|
||||
|| (fUseMagneticMoment && (magneticMoment != 0.0) )
|
||||
|| (gravityOn && (restMass != 0.0)) )
|
||||
{
|
||||
fieldExertsForce = true;
|
||||
}
|
||||
fieldExertsForce = eligibleEM
|
||||
|| ( eligibleGrav && ptrField->IsGravityActive() );
|
||||
}
|
||||
}
|
||||
G4double momentumMagnitude = pParticle->GetTotalMomentum() ;
|
||||
@@ -434,6 +433,7 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
|
||||
}
|
||||
else
|
||||
{
|
||||
fParticleIsLooping = fFieldPropagator->IsParticleLooping() ;
|
||||
|
||||
#ifdef G4DEBUG_TRANSPORT
|
||||
if( verboseLevel > 1 )
|
||||
@@ -484,13 +484,11 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
|
||||
// Correct the energy for fields that conserve it
|
||||
// This - hides the integration error
|
||||
// - but gives a better physical answer
|
||||
fTransportEndKineticEnergy= track.GetKineticEnergy();
|
||||
fTransportEndKineticEnergy= track.GetKineticEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
fEndpointDistance = (fTransportEndPosition - startPosition).mag() ;
|
||||
fParticleIsLooping = fFieldPropagator->IsParticleLooping() ;
|
||||
|
||||
fTransportEndSpin = endTrackState.GetSpin();
|
||||
|
||||
// Calculate the safety
|
||||
@@ -677,7 +675,7 @@ G4CoupledTransportation::AlongStepDoIt( const G4Track& track,
|
||||
}
|
||||
}
|
||||
|
||||
if( endEnergy > fThreshold_Warning_Energy )
|
||||
if( endEnergy > fThreshold_Warning_Energy && ! fSilenceLooperWarnings )
|
||||
{
|
||||
fpLogger->ReportLoopingTrack( track, stepData, fNoLooperTrials,
|
||||
noCallsCT_ASDI, methodName );
|
||||
@@ -696,7 +694,7 @@ G4CoupledTransportation::AlongStepDoIt( const G4Track& track,
|
||||
fSumEnergyUnstableSaved += endEnergy;
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 2 )
|
||||
if( verboseLevel > 2 && ! fSilenceLooperWarnings )
|
||||
{
|
||||
G4cout << " ** G4CoupledTransportation::AlongStepDoIt():"
|
||||
<< " Particle is looping but is saved ..." << G4endl
|
||||
@@ -957,8 +955,8 @@ G4CoupledTransportation::StartTracking(G4Track* aTrack)
|
||||
fPathFinder->PrepareNewTrack( position, direction);
|
||||
// This implies a call to fPathFinder->Locate( position, direction );
|
||||
|
||||
// Global field, if any, must exist before tracking is started
|
||||
fGlobalFieldExists= DoesGlobalFieldExist();
|
||||
// Whether field exists should be determined at run level -- TODO
|
||||
fAnyFieldExists= DoesAnyFieldExist();
|
||||
|
||||
// reset safety value and center
|
||||
//
|
||||
@@ -975,7 +973,7 @@ G4CoupledTransportation::StartTracking(G4Track* aTrack)
|
||||
|
||||
// ChordFinder reset internal state
|
||||
//
|
||||
if( fGlobalFieldExists )
|
||||
if( fFieldPropagator && fAnyFieldExists )
|
||||
{
|
||||
fFieldPropagator->ClearPropagatorState();
|
||||
// Resets safety values, in case of overlaps.
|
||||
@@ -1064,7 +1062,7 @@ ReportInexactEnergy(G4double startEnergy, G4double endEnergy)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
G4bool G4CoupledTransportation::EnableUseMagneticMoment(G4bool useMoment)
|
||||
G4bool G4CoupledTransportation::EnableMagneticMoment(G4bool useMoment)
|
||||
{
|
||||
G4bool lastValue= fUseMagneticMoment;
|
||||
fUseMagneticMoment= useMoment;
|
||||
@@ -1072,6 +1070,34 @@ G4bool G4CoupledTransportation::EnableUseMagneticMoment(G4bool useMoment)
|
||||
return lastValue;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4bool G4CoupledTransportation::EnableGravity(G4bool useGravity)
|
||||
{
|
||||
G4bool lastValue= fUseGravity;
|
||||
fUseGravity= useGravity;
|
||||
G4Transportation::fUseGravity= useGravity;
|
||||
return lastValue;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Supress (or not) warnings about 'looping' particles
|
||||
|
||||
void G4CoupledTransportation::SetSilenceLooperWarnings( G4bool val)
|
||||
{
|
||||
fSilenceLooperWarnings= val; // Flag to *Supress* all 'looper' warnings
|
||||
// G4CoupledTransportation::fSilenceLooperWarnings= val;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4CoupledTransportation::GetSilenceLooperWarnings()
|
||||
{
|
||||
return fSilenceLooperWarnings;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4CoupledTransportation::SetHighLooperThresholds()
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
class G4VSensitiveDetector;
|
||||
|
||||
G4bool G4Transportation::fUseMagneticMoment=false;
|
||||
G4bool G4Transportation::fUseGravity= false;
|
||||
G4bool G4Transportation::fSilenceLooperWarnings= false;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -66,18 +68,6 @@ G4bool G4Transportation::fUseMagneticMoment=false;
|
||||
|
||||
G4Transportation::G4Transportation( G4int verbosity )
|
||||
: G4VProcess( G4String("Transportation"), fTransportation ),
|
||||
// fTransportEndPosition( 0.0, 0.0, 0.0 ),
|
||||
// fTransportEndMomentumDir( 0.0, 0.0, 0.0 ),
|
||||
// fTransportEndKineticEnergy( 0.0 ),
|
||||
// fTransportEndSpin( 0.0, 0.0, 0.0 ),
|
||||
// fMomentumChanged(true),
|
||||
// fEndGlobalTimeComputed(false),
|
||||
// fCandidateEndGlobalTime(0.0),
|
||||
// fParticleIsLooping( false ),
|
||||
// fNewTrack( true ),
|
||||
// fFirstStepInVolume( true ),
|
||||
// fLastStepInVolume( false ),
|
||||
// fGeometryLimitedStep(true),
|
||||
fFieldExertedForce( false ),
|
||||
fPreviousSftOrigin( 0.,0.,0. ),
|
||||
fPreviousSafety( 0.0 ),
|
||||
@@ -109,8 +99,10 @@ G4Transportation::G4Transportation( G4int verbosity )
|
||||
// Cannot determine whether a field exists here, as it would
|
||||
// depend on the relative order of creating the detector's
|
||||
// field and this process. That order is not guaranted.
|
||||
// Instead later the method DoesGlobalFieldExist() is called
|
||||
|
||||
fAnyFieldExists= DoesAnyFieldExist();
|
||||
// This value must be updated using DoesAnyFieldExist() at least at the
|
||||
// start of each Run -- for now this is at the Start of every Track. TODO
|
||||
|
||||
static G4ThreadLocal G4TouchableHandle* pNullTouchableHandle = 0;
|
||||
if ( !pNullTouchableHandle)
|
||||
{
|
||||
@@ -119,6 +111,7 @@ G4Transportation::G4Transportation( G4int verbosity )
|
||||
fCurrentTouchableHandle = *pNullTouchableHandle;
|
||||
// Points to (G4VTouchable*) 0
|
||||
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 0)
|
||||
{
|
||||
@@ -251,34 +244,28 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
|
||||
G4FieldManager* fieldMgr=0;
|
||||
G4bool fieldExertsForce = false ;
|
||||
|
||||
G4bool gravityOn = false;
|
||||
G4bool fieldExists = false; // Field is not 0 (null pointer)
|
||||
|
||||
fieldMgr = fFieldPropagator->FindAndSetFieldManager( track.GetVolume() );
|
||||
if( fieldMgr != 0 )
|
||||
G4bool eligibleEM = (particleCharge != 0.0)
|
||||
|| ( fUseMagneticMoment && (magneticMoment != 0.0) );
|
||||
G4bool eligibleGrav = fUseGravity && (restMass != 0.0) ;
|
||||
|
||||
if( (fieldMgr!=nullptr) && (eligibleEM||eligibleGrav) )
|
||||
{
|
||||
// Message the field Manager, to configure it for this track
|
||||
//
|
||||
// User can configure the field Manager for this track
|
||||
fieldMgr->ConfigureForTrack( &track );
|
||||
|
||||
// Is here to allow a transition from no-field pointer
|
||||
// Called here to allow a transition from no-field pointer
|
||||
// to finite field (non-zero pointer).
|
||||
|
||||
// If the field manager has no field ptr, the field is zero
|
||||
// by definition ( = there is no field ! )
|
||||
//
|
||||
const G4Field* ptrField= fieldMgr->GetDetectorField();
|
||||
fieldExists = (ptrField!=0) ;
|
||||
if( fieldExists )
|
||||
// by definition ( = there is no field ! )
|
||||
const G4Field* ptrField= fieldMgr->GetDetectorField();
|
||||
if( ptrField )
|
||||
{
|
||||
gravityOn= ptrField->IsGravityActive();
|
||||
|
||||
if( (particleCharge != 0.0)
|
||||
|| (fUseMagneticMoment && (magneticMoment != 0.0) )
|
||||
|| (gravityOn && (restMass != 0.0) ) )
|
||||
{
|
||||
fieldExertsForce = fieldExists;
|
||||
}
|
||||
fieldExertsForce = eligibleEM
|
||||
|| ( eligibleGrav && ptrField->IsGravityActive() );
|
||||
}
|
||||
// || (gravityOn && (restMass != 0.0)) )
|
||||
|
||||
}
|
||||
fFieldExertedForce = fieldExertsForce;
|
||||
|
||||
@@ -371,7 +358,8 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
|
||||
lengthAlongCurve = fFieldPropagator->ComputeStep( aFieldTrack,
|
||||
currentMinimumStep,
|
||||
currentSafety,
|
||||
track.GetVolume() );
|
||||
track.GetVolume(),
|
||||
track.GetKineticEnergy() < fThreshold_Important_Energy );
|
||||
|
||||
fGeometryLimitedStep= fFieldPropagator->IsLastStepInVolume();
|
||||
//
|
||||
@@ -397,6 +385,10 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
|
||||
//
|
||||
fTransportEndPosition = aFieldTrack.GetPosition() ;
|
||||
|
||||
fTransportEndSpin = aFieldTrack.GetSpin();
|
||||
fParticleIsLooping = fFieldPropagator->IsParticleLooping() ;
|
||||
fEndPointDistance = (fTransportEndPosition - startPosition).mag() ;
|
||||
|
||||
// Momentum: Magnitude and direction can be changed too now ...
|
||||
//
|
||||
fMomentumChanged = true ;
|
||||
@@ -484,9 +476,6 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
|
||||
fTransportEndKineticEnergy= track.GetKineticEnergy();
|
||||
}
|
||||
|
||||
fTransportEndSpin = aFieldTrack.GetSpin();
|
||||
fParticleIsLooping = fFieldPropagator->IsParticleLooping() ;
|
||||
fEndPointDistance = (fTransportEndPosition - startPosition).mag() ;
|
||||
}
|
||||
|
||||
// If we are asked to go a step length of 0, and we are on a boundary
|
||||
@@ -643,7 +632,7 @@ G4VParticleChange* G4Transportation::AlongStepDoIt( const G4Track& track,
|
||||
}
|
||||
}
|
||||
|
||||
if( endEnergy > fThreshold_Warning_Energy )
|
||||
if( endEnergy > fThreshold_Warning_Energy && ! fSilenceLooperWarnings )
|
||||
{
|
||||
fpLogger->ReportLoopingTrack( track, stepData, fNoLooperTrials,
|
||||
noCallsASDI, methodName );
|
||||
@@ -659,7 +648,7 @@ G4VParticleChange* G4Transportation::AlongStepDoIt( const G4Track& track,
|
||||
fSumEnergyUnstableSaved += endEnergy;
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 2 )
|
||||
if( verboseLevel > 2 && ! fSilenceLooperWarnings )
|
||||
{
|
||||
G4cout << " " << methodName
|
||||
<< " Particle is looping but is saved ..." << G4endl
|
||||
@@ -828,6 +817,9 @@ G4Transportation::StartTracking(G4Track* aTrack)
|
||||
// The actions here are those that were taken in AlongStepGPIL
|
||||
// when track.GetCurrentStepNumber()==1
|
||||
|
||||
// Whether field exists should be determined at run level -- TODO
|
||||
fAnyFieldExists= DoesAnyFieldExist();
|
||||
|
||||
// reset safety value and center
|
||||
//
|
||||
fPreviousSafety = 0.0 ;
|
||||
@@ -841,7 +833,7 @@ G4Transportation::StartTracking(G4Track* aTrack)
|
||||
|
||||
// ChordFinder reset internal state
|
||||
//
|
||||
if( DoesGlobalFieldExist() )
|
||||
if( fFieldPropagator && fAnyFieldExists )
|
||||
{
|
||||
fFieldPropagator->ClearPropagatorState();
|
||||
// Resets all state of field propagator class (ONLY) including safety
|
||||
@@ -865,7 +857,7 @@ G4Transportation::StartTracking(G4Track* aTrack)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4bool G4Transportation::EnableUseMagneticMoment(G4bool useMoment)
|
||||
G4bool G4Transportation::EnableMagneticMoment(G4bool useMoment)
|
||||
{
|
||||
G4bool lastValue= fUseMagneticMoment;
|
||||
fUseMagneticMoment= useMoment;
|
||||
@@ -873,6 +865,35 @@ G4bool G4Transportation::EnableUseMagneticMoment(G4bool useMoment)
|
||||
return lastValue;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4bool G4Transportation::EnableGravity(G4bool useGravity)
|
||||
{
|
||||
G4bool lastValue= fUseGravity;
|
||||
fUseGravity= useGravity;
|
||||
G4CoupledTransportation::fUseGravity= useGravity;
|
||||
return lastValue;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Supress (or not) warnings about 'looping' particles
|
||||
|
||||
void G4Transportation::SetSilenceLooperWarnings( G4bool val)
|
||||
{
|
||||
fSilenceLooperWarnings= val; // Flag to *Supress* all 'looper' warnings
|
||||
// G4CoupledTransportation::fSilenceLooperWarnings= val;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4Transportation::GetSilenceLooperWarnings()
|
||||
{
|
||||
return fSilenceLooperWarnings;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4Transportation::SetHighLooperThresholds()
|
||||
|
||||
Reference in New Issue
Block a user