77 #define PrepareState() G4ITTransportationState* __state = this->GetState<G4ITTransportationState>();
81 #define State(theXInfo) (__state->theXInfo)
96 fThreshold_Warning_Energy(100 *
MeV),
97 fThreshold_Important_Energy(250 *
MeV),
99 fUnimportant_Energy(1 *
MeV),
100 fSumEnergyKilled(0.0),
101 fMaxEnergyKilled(0.0),
102 fShortStepOptimisation(false),
103 fVerboseLevel(verbose)
176 if (
this == &right)
return *
this;
218 G4cout <<
" G4ITTransportation: Statistics for looping particles "
220 G4cout <<
" Sum of energy of loopers killed: "
222 G4cout <<
" Max energy of loopers killed: "
258 G4double geometryStepLength(-1.0), newSafety(-1.0);
260 State(fParticleIsLooping) =
false;
261 State(fEndGlobalTimeComputed) =
false;
262 State(fGeometryLimitedStep) =
false;
289 G4double MagSqShift = OriginShift.mag2();
310 G4bool fieldExertsForce =
false;
311 if ((particleCharge != 0.0))
332 if (!fieldExertsForce)
339 geometryStepLength = currentMinimumStep;
340 State(fGeometryLimitedStep) =
false;
366 State(fTransportEndPosition));
371 currentSafety = newSafety;
373 State(fGeometryLimitedStep) = (linearStepLength <= currentMinimumStep);
374 if (
State(fGeometryLimitedStep))
377 geometryStepLength = linearStepLength;
382 geometryStepLength = currentMinimumStep;
385 State(fEndPointDistance) = geometryStepLength;
389 State(fTransportEndPosition) = startPosition
390 + geometryStepLength * startMomentumDir;
394 State(fTransportEndMomentumDir) = startMomentumDir;
397 State(fParticleIsLooping) =
false;
398 State(fMomentumChanged) =
false;
399 State(fEndGlobalTimeComputed) =
true;
420 <<
"ITTransportation does not support external fields.";
422 <<
" If you are dealing with a tradiational MC simulation, ";
423 exceptionDescription <<
"please use G4Transportation.";
425 G4Exception(
"G4ITTransportation::AlongStepGetPhysicalInteractionLength",
581 if (currentMinimumStep == 0.0)
583 if (currentSafety == 0.0)
585 State(fGeometryLimitedStep) =
true;
595 if (currentSafety <
State(fEndPointDistance))
600 if (particleCharge != 0.0)
604 State(fTransportEndPosition));
605 currentSafety = endSafety;
618 State(fTransportEndPosition));
624 currentSafety +=
State(fEndPointDistance);
626 #ifdef G4DEBUG_TRANSPORT
628 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
629 G4cout <<
" Called Navigator->ComputeSafety at "
630 <<
State(fTransportEndPosition)
631 <<
" and it returned safety= " << endSafety <<
G4endl;
632 G4cout <<
" Adding endpoint distance " <<
State(fEndPointDistance)
633 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl;
643 return geometryStepLength;
648 const double timeStep,
649 double& oPhysicalStep)
659 State(fGeometryLimitedStep) =
false;
665 State(fEndGlobalTimeComputed) =
true;
669 if (!
State(fMomentumChanged))
673 oPhysicalStep = initialVelocity * timeStep;
677 State(fTransportEndPosition) = startPosition
678 + oPhysicalStep * startMomentumDir;
691 #if defined (DEBUG_MEM)
692 MemStat mem_first, mem_second, mem_diff;
695 #if defined (DEBUG_MEM)
707 if (!pdefOpticalPhoton) pdefOpticalPhoton =
734 if (
State(fEndGlobalTimeComputed) ==
false)
747 deltaTime = stepLength / finalVelocity;
749 else if (initialVelocity > 0.0)
751 deltaTime = stepLength / initialVelocity;
754 State(fCandidateEndGlobalTime) = startTime + deltaTime;
758 deltaTime =
State(fCandidateEndGlobalTime) - startTime;
781 if (
State(fParticleIsLooping))
804 <<
" G4ITTransportation is killing track that is looping or stuck "
806 <<
" MeV energy." <<
G4endl;
807 G4cout <<
" Number of trials = " <<
State(fNoLooperTrials)
808 <<
" No of calls to AlongStepDoIt = " << noCalls
812 State(fNoLooperTrials) = 0;
816 State(fNoLooperTrials)++;
820 G4cout <<
" G4ITTransportation::AlongStepDoIt(): Particle looping - "
821 <<
" Number of trials = " <<
State(fNoLooperTrials)
822 <<
" No of calls to = " << noCalls <<
G4endl;
829 State(fNoLooperTrials)=0;
840 #if defined (DEBUG_MEM)
842 mem_diff = mem_second-mem_first;
843 G4cout <<
"\t || MEM || End of G4ITTransportation::AlongStepDoIt, diff is: "
876 G4bool isLastStep =
false;
887 if (
State(fGeometryLimitedStep))
892 G4cout <<
"Step is limited by geometry "
900 if (
State(fCurrentTouchableHandle)->GetVolume() == 0)
903 exceptionDescription <<
"No current touchable found ";
904 G4Exception(
" G4ITTransportation::PostStepDoIt",
"G4ITTransportation001",
911 State(fCurrentTouchableHandle),
true);
915 if (
State(fCurrentTouchableHandle)->GetVolume() == 0)
923 G4cout <<
"G4ITTransportation will killed the track because "
924 "State(fCurrentTouchableHandle)->GetVolume() == 0"<<
G4endl;
930 retCurrentTouchable =
State(fCurrentTouchableHandle);
946 #ifdef G4DEBUG_TRANSPORT
951 if( ! (exiting || entering) )
953 G4cout <<
" Transport> : Proposed isLastStep= " << isLastStep
979 #ifdef G4DEBUG_TRANSPORT
981 G4cout <<
" Transport> Proposed isLastStep= " << isLastStep
982 <<
" Geometry did not limit step. Position : "
1009 pNewMaterialCutsCouple =
1013 if (pNewVol != 0 && pNewMaterialCutsCouple != 0
1014 && pNewMaterialCutsCouple->
GetMaterial() != pNewMaterial)
1051 GetIT(track)->GetTrackingInfo()->GetTrackStateManager());
1082 fieldMgrStore->ClearAllChordFindersState();
void SetMaterialInTouchable(G4Material *fMaterial)
G4ITSafetyHelper * GetSafetyHelper() const
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
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
const G4DynamicParticle * GetDynamicParticle() const
G4Material * GetMaterial() const
static const double nanometer
virtual ~G4ITTransportationState()
const G4ThreeVector & GetPosition() const
G4TrackStatus GetTrackStatus() const
virtual void LoadTrackState(G4TrackStateManager &manager)
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
G4double GetVelocity() const
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
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 *)
G4ITTransportation & operator=(const G4ITTransportation &)
virtual void StartTracking(G4Track *aTrack)
G4IT * GetIT(const G4Track *track)
G4double GetKineticEnergy() const
G4double fEndPointDistance
static G4ITTransportationManager * GetTransportationManager()
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double, G4ForceCondition *pForceCond)
G4GLOB_DLL std::ostream G4cout
virtual void ResetTrackState()
virtual void NewTrackState()
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
const G4ThreeVector & GetMomentumDirection() const
G4PropagatorInField * fFieldPropagator
virtual ~G4ITTransportation()
G4bool fInstantiateProcessState
G4bool fGeometryLimitedStep
G4double GetCharge() const
void ProposeTrueStepLength(G4double truePathLength)
G4bool DoesFieldExist() const
virtual void StartTracking(G4Track *)
void SetInstantiateProcessState(G4bool flag)
const G4ParticleDefinition * GetParticleDefinition() const
void SetProcessSubType(G4int)
G4shared_ptr< G4ProcessState > fpState
G4bool enablePostStepDoIt
G4double GetGlobalTime() const
G4double CalculateVelocity() const
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
const G4TouchableHandle & GetTouchableHandle() const
G4ITSafetyHelper * fpSafetyHelper
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
G4TrackingInformation * GetTrackingInfo()
G4double fSumEnergyKilled
static G4ProductionCutsTable * GetProductionCutsTable()
const G4ThreeVector & GetMomentumDirection() const
G4LogicalVolume * GetLogicalVolume() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4FieldManagerStore * GetInstance()
void SetSensitiveDetectorInTouchable(G4VSensitiveDetector *fSensitiveDetector)
static G4ParticleTable * GetParticleTable()
#define fPreviousSftOrigin
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
void ProposeGlobalTime(G4double t)
G4ITTransportation(const G4String &aName="ITTransportation", G4int verbosityLevel=0)
G4double fTransportEndKineticEnergy
G4bool fEndGlobalTimeComputed
G4ITNavigator * GetNavigatorForTracking() const
G4VParticleChange * pParticleChange
void ProposeEnergy(G4double finalEnergy)
G4VPhysicalVolume * GetVolume() const
G4TouchableHandle fCurrentTouchableHandle
void ClearPropagatorState()
G4bool enableAlongStepDoIt
void ProposeLastStepInVolume(G4bool flag)
virtual void SaveTrackState(G4TrackStateManager &manager)
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
G4VITProcess inherits from G4VProcess.
G4double fThreshold_Warning_Energy
G4bool fParticleIsLooping
void SetMomentumChanged(G4bool b)
G4PropagatorInField * GetPropagatorInField() const
void ProposeVelocity(G4double finalVelocity)
G4ProductionCuts * GetProductionCuts() const
G4VSensitiveDetector * GetSensitiveDetector() const
G4double * theInteractionTimeLeft
void ProposeLocalTime(G4double t)
G4ThreeVector fTransportEndSpin
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
G4double GetStepLength() const
G4ITTransportationState()
Process State.
G4ThreeVector fTransportEndMomentumDir
G4ThreeVector fPreviousSftOrigin
const G4Material * GetMaterial() const