76 #define State(theXInfo) (fTransportationState->theXInfo)
84 fThreshold_Warning_Energy( 100 *
MeV ),
85 fThreshold_Important_Energy( 250 *
MeV ),
86 fThresholdTrials( 10 ),
87 fUnimportant_Energy( 1 *
MeV ),
88 fSumEnergyKilled( 0.0 ), fMaxEnergyKilled( 0.0 ),
89 fShortStepOptimisation(false),
90 fVerboseLevel( verbose )
112 fInstantiateProcessState =
true;
151 fInstantiateProcessState = right.fInstantiateProcessState;
156 if(
this == &right)
return *
this;
164 fCurrentTouchableHandle(0)
194 G4cout <<
" G4ITTransportation: Statistics for looping particles " <<
G4endl;
225 G4double geometryStepLength(-1.0), newSafety(-1.0) ;
227 State(fParticleIsLooping) = false ;
228 State(fEndGlobalTimeComputed) = false ;
229 State(fGeometryLimitedStep) = false ;
257 if( MagSqShift >=
sqr(
State(fPreviousSafety)) )
259 currentSafety = 0.0 ;
263 currentSafety =
State(fPreviousSafety) - std::sqrt(MagSqShift) ;
278 G4bool fieldExertsForce = false ;
279 if( (particleCharge != 0.0) )
300 if( !fieldExertsForce )
307 geometryStepLength = currentMinimumStep ;
308 State(fGeometryLimitedStep) = false ;
320 State(fPreviousSftOrigin) = startPosition ;
321 State(fPreviousSafety) = newSafety ;
326 currentSafety = newSafety ;
328 State(fGeometryLimitedStep)= (linearStepLength <= currentMinimumStep);
329 if(
State(fGeometryLimitedStep) )
332 geometryStepLength = linearStepLength ;
337 geometryStepLength = currentMinimumStep ;
340 State(endpointDistance) = geometryStepLength ;
344 State(fTransportEndPosition) = startPosition+geometryStepLength*startMomentumDir ;
348 State(fTransportEndMomentumDir) = startMomentumDir ;
351 State(fParticleIsLooping) = false ;
352 State(fMomentumChanged) = false ;
353 State(fEndGlobalTimeComputed) = true ;
367 exceptionDescription <<
"ITTransportation does not support external fields.";
368 exceptionDescription <<
" If you are dealing with a tradiational MC simulation, ";
369 exceptionDescription <<
"please use G4Transportation.";
371 G4Exception(
"G4ITTransportation::AlongStepGetPhysicalInteractionLength",
"NoExternalFieldSupport",
520 if( currentMinimumStep == 0.0 )
522 if( currentSafety == 0.0 )
524 State(fGeometryLimitedStep) = true ;
533 if( currentSafety <
State(endpointDistance) )
538 if( particleCharge != 0.0 )
543 currentSafety = endSafety ;
544 State(fPreviousSftOrigin) =
State(fTransportEndPosition) ;
545 State(fPreviousSafety) = currentSafety ;
551 currentSafety +=
State(endpointDistance) ;
553 #ifdef G4DEBUG_TRANSPORT
555 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl ;
556 G4cout <<
" Called Navigator->ComputeSafety at " <<
State(fTransportEndPosition)
557 <<
" and it returned safety= " << endSafety <<
G4endl ;
558 G4cout <<
" Adding endpoint distance " <<
State(endpointDistance)
559 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl ;
566 return geometryStepLength ;
572 const double timeStep,
573 double& oPhysicalStep)
582 State(fGeometryLimitedStep) =
false;
588 State(fEndGlobalTimeComputed) = true ;
592 if( !
State(fMomentumChanged) )
596 oPhysicalStep = initialVelocity*timeStep ;
600 State(fTransportEndPosition) = startPosition + oPhysicalStep*startMomentumDir ;
619 static G4int noCalls=0;
643 if (
State(fEndGlobalTimeComputed) ==
false)
656 deltaTime = stepLength/finalVelocity ;
658 else if( initialVelocity > 0.0 )
660 deltaTime = stepLength/initialVelocity ;
663 State(fCandidateEndGlobalTime) = startTime + deltaTime ;
667 deltaTime =
State(fCandidateEndGlobalTime) - startTime ;
690 if (
State(fParticleIsLooping) )
713 G4cout <<
" G4ITTransportation is killing track that is looping or stuck "
716 <<
" MeV energy." <<
G4endl;
717 G4cout <<
" Number of trials = " <<
State(fNoLooperTrials)
718 <<
" No of calls to AlongStepDoIt = " << noCalls
722 State(fNoLooperTrials)=0;
726 State(fNoLooperTrials) ++;
730 G4cout <<
" G4ITTransportation::AlongStepDoIt(): Particle looping - "
731 <<
" Number of trials = " <<
State(fNoLooperTrials)
732 <<
" No of calls to = " << noCalls
740 State(fNoLooperTrials)=0;
790 if(
State(fGeometryLimitedStep))
799 if(
State(fCurrentTouchableHandle)->GetVolume() == 0 )
802 exceptionDescription <<
"No current touchable found " ;
803 G4Exception(
" G4ITTransportation::PostStepDoIt",
"G4ITTransportation001",
809 LocateGlobalPointAndUpdateTouchableHandle( track.
GetPosition(),
811 State(fCurrentTouchableHandle),
816 if(
State(fCurrentTouchableHandle)->GetVolume() == 0 )
823 G4cout <<
"G4ITTransportation will killed the track because State(fCurrentTouchableHandle)->GetVolume() == 0"<<
G4endl;
829 retCurrentTouchable =
State(fCurrentTouchableHandle) ;
844 #ifdef G4DEBUG_TRANSPORT
849 if( ! (exiting || entering) )
851 G4cout <<
" Transport> : Proposed isLastStep= " << isLastStep
875 #ifdef G4DEBUG_TRANSPORT
877 G4cout <<
" Transport> Proposed isLastStep= " << isLastStep
878 <<
" Geometry did not limit step. Position : "
907 if( pNewVol!=0 && pNewMaterialCutsCouple!=0 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
911 pNewMaterialCutsCouple =
936 if(fInstantiateProcessState)