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)
195 G4cout <<
" G4ITTransportation: Statistics for looping particles " <<
G4endl;
226 G4double geometryStepLength(-1.0), newSafety(-1.0) ;
228 State(fParticleIsLooping) = false ;
229 State(fEndGlobalTimeComputed) = false ;
230 State(fGeometryLimitedStep) = false ;
258 if( MagSqShift >=
sqr(
State(fPreviousSafety)) )
260 currentSafety = 0.0 ;
264 currentSafety =
State(fPreviousSafety) - std::sqrt(MagSqShift) ;
279 G4bool fieldExertsForce = false ;
280 if( (particleCharge != 0.0) )
301 if( !fieldExertsForce )
308 geometryStepLength = currentMinimumStep ;
309 State(fGeometryLimitedStep) = false ;
321 State(fPreviousSftOrigin) = startPosition ;
322 State(fPreviousSafety) = newSafety ;
327 currentSafety = newSafety ;
329 State(fGeometryLimitedStep)= (linearStepLength <= currentMinimumStep);
330 if(
State(fGeometryLimitedStep) )
333 geometryStepLength = linearStepLength ;
338 geometryStepLength = currentMinimumStep ;
341 State(endpointDistance) = geometryStepLength ;
345 State(fTransportEndPosition) = startPosition+geometryStepLength*startMomentumDir ;
349 State(fTransportEndMomentumDir) = startMomentumDir ;
352 State(fParticleIsLooping) = false ;
353 State(fMomentumChanged) = false ;
354 State(fEndGlobalTimeComputed) = true ;
368 exceptionDescription <<
"ITTransportation does not support external fields.";
369 exceptionDescription <<
" If you are dealing with a tradiational MC simulation, ";
370 exceptionDescription <<
"please use G4Transportation.";
372 G4Exception(
"G4ITTransportation::AlongStepGetPhysicalInteractionLength",
"NoExternalFieldSupport",
521 if( currentMinimumStep == 0.0 )
523 if( currentSafety == 0.0 )
525 State(fGeometryLimitedStep) = true ;
534 if( currentSafety <
State(endpointDistance) )
539 if( particleCharge != 0.0 )
544 currentSafety = endSafety ;
545 State(fPreviousSftOrigin) =
State(fTransportEndPosition) ;
546 State(fPreviousSafety) = currentSafety ;
552 currentSafety +=
State(endpointDistance) ;
554 #ifdef G4DEBUG_TRANSPORT
556 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl ;
557 G4cout <<
" Called Navigator->ComputeSafety at " <<
State(fTransportEndPosition)
558 <<
" and it returned safety= " << endSafety <<
G4endl ;
559 G4cout <<
" Adding endpoint distance " <<
State(endpointDistance)
560 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl ;
567 return geometryStepLength ;
573 const double timeStep,
574 double& oPhysicalStep)
583 State(fGeometryLimitedStep) =
false;
589 State(fEndGlobalTimeComputed) = true ;
593 if( !
State(fMomentumChanged) )
597 oPhysicalStep = initialVelocity*timeStep ;
601 State(fTransportEndPosition) = startPosition + oPhysicalStep*startMomentumDir ;
646 if (
State(fEndGlobalTimeComputed) ==
false)
659 deltaTime = stepLength/finalVelocity ;
661 else if( initialVelocity > 0.0 )
663 deltaTime = stepLength/initialVelocity ;
666 State(fCandidateEndGlobalTime) = startTime + deltaTime ;
670 deltaTime =
State(fCandidateEndGlobalTime) - startTime ;
693 if (
State(fParticleIsLooping) )
716 G4cout <<
" G4ITTransportation is killing track that is looping or stuck "
719 <<
" MeV energy." <<
G4endl;
720 G4cout <<
" Number of trials = " <<
State(fNoLooperTrials)
721 <<
" No of calls to AlongStepDoIt = " << noCalls
725 State(fNoLooperTrials)=0;
729 State(fNoLooperTrials) ++;
733 G4cout <<
" G4ITTransportation::AlongStepDoIt(): Particle looping - "
734 <<
" Number of trials = " <<
State(fNoLooperTrials)
735 <<
" No of calls to = " << noCalls
743 State(fNoLooperTrials)=0;
793 if(
State(fGeometryLimitedStep))
802 if(
State(fCurrentTouchableHandle)->GetVolume() == 0 )
805 exceptionDescription <<
"No current touchable found " ;
806 G4Exception(
" G4ITTransportation::PostStepDoIt",
"G4ITTransportation001",
812 LocateGlobalPointAndUpdateTouchableHandle( track.
GetPosition(),
814 State(fCurrentTouchableHandle),
819 if(
State(fCurrentTouchableHandle)->GetVolume() == 0 )
826 G4cout <<
"G4ITTransportation will killed the track because State(fCurrentTouchableHandle)->GetVolume() == 0"<<
G4endl;
832 retCurrentTouchable =
State(fCurrentTouchableHandle) ;
847 #ifdef G4DEBUG_TRANSPORT
852 if( ! (exiting || entering) )
854 G4cout <<
" Transport> : Proposed isLastStep= " << isLastStep
878 #ifdef G4DEBUG_TRANSPORT
880 G4cout <<
" Transport> Proposed isLastStep= " << isLastStep
881 <<
" Geometry did not limit step. Position : "
910 if( pNewVol!=0 && pNewMaterialCutsCouple!=0 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
914 pNewMaterialCutsCouple =
939 if(fInstantiateProcessState)
971 fieldMgrStore->ClearAllChordFindersState();
void SetMaterialInTouchable(G4Material *fMaterial)
void SetTouchableHandle(const G4TouchableHandle &fTouchable)
const G4ThreeVector & GetPolarization() const
G4double fCandidateEndGlobalTime
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4double GetLocalTime() const
G4ParticleChangeForTransport fParticleChange
void SetMaterialCutsCoupleInTouchable(const G4MaterialCutsCouple *fMaterialCutsCouple)
std::ostringstream G4ExceptionDescription
std::vector< G4ThreeVector > * GimmeTrajectoryVectorAndForgetIt() const
G4bool fShortStepOptimisation
CLHEP::Hep3Vector G4ThreeVector
G4double GetVelocity() const
const G4DynamicParticle * GetDynamicParticle() const
G4Material * GetMaterial() const
G4double endpointDistance
virtual ~G4ITTransportationState()
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=false)
const G4ThreeVector & GetPosition() const
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
G4TrackStatus GetTrackStatus() const
G4double fMaxEnergyKilled
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &)
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
G4ThreeVector fTransportEndPosition
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
G4ITTransportation(const G4String &aName="ITTransportation", G4int verbosityLevel=1)
G4double GetVelocity() const
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
G4bool ExitedMotherVolume() const
void SetInstantiateProcessState(G4bool flag)
void ProposePosition(G4double x, G4double y, G4double z)
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
G4ITNavigator * fLinearNavigator
G4StepPoint * GetPreStepPoint() const
virtual void Initialize(const G4Track &)
virtual void StartTracking(G4Track *)
G4double CalculateVelocityForOpticalPhoton() const
G4bool DoesGlobalFieldExist()
virtual void ConfigureForTrack(const G4Track *)
virtual void StartTracking(G4Track *aTrack)
void SetGeometricallyLimitedStep()
G4double GetKineticEnergy() const
static G4ITTransportationManager * GetTransportationManager()
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double, G4ForceCondition *pForceCond)
G4GLOB_DLL std::ostream G4cout
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
const G4ThreeVector & GetMomentumDirection() const
G4PropagatorInField * fFieldPropagator
virtual ~G4ITTransportation()
G4bool fGeometryLimitedStep
G4double GetCharge() const
G4bool DoesFieldExist() const
virtual void StartTracking(G4Track *)
void SetInstantiateProcessState(G4bool flag)
const G4ParticleDefinition * GetParticleDefinition() const
void SetProcessSubType(G4int)
G4bool enablePostStepDoIt
G4double GetGlobalTime() const
G4double CalculateVelocity() const
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
const G4TouchableHandle & GetTouchableHandle() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
G4double fSumEnergyKilled
static G4ProductionCutsTable * GetProductionCutsTable()
const G4ThreeVector & GetMomentumDirection() const
#define InitProcessState(destination, source)
G4ITNavigator * GetNavigatorForTracking()
G4LogicalVolume * GetLogicalVolume() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4FieldManagerStore * GetInstance()
void SetSensitiveDetectorInTouchable(G4VSensitiveDetector *fSensitiveDetector)
static G4ParticleTable * GetParticleTable()
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
void ProposeGlobalTime(G4double t)
G4double fTransportEndKineticEnergy
G4bool fEndGlobalTimeComputed
G4bool EnteredDaughterVolume() const
G4VParticleChange * pParticleChange
void ProposeEnergy(G4double finalEnergy)
G4SafetyHelper * fpSafetyHelper
G4VPhysicalVolume * GetVolume() const
G4TouchableHandle fCurrentTouchableHandle
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
void ClearPropagatorState()
G4bool enableAlongStepDoIt
void ProposeLastStepInVolume(G4bool flag)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void ProposeTrackStatus(G4TrackStatus status)
G4double fUnimportant_Energy
G4double fThreshold_Important_Energy
const G4Field * GetDetectorField() const
G4double fThreshold_Warning_Energy
G4bool fParticleIsLooping
void SetMomentumChanged(G4bool b)
G4PropagatorInField * GetPropagatorInField() const
void ProposeVelocity(G4double finalVelocity)
G4ProductionCuts * GetProductionCuts() const
G4VSensitiveDetector * GetSensitiveDetector() const
void ProposeLocalTime(G4double t)
G4ThreeVector fTransportEndSpin
G4double GetStepLength() const
G4ITTransportationState()
Process State.
G4ThreeVector fTransportEndMomentumDir
G4ThreeVector fPreviousSftOrigin
const G4Material * GetMaterial() const