65 #define State(theXInfo) (GetState<G4ITBrownianState>()->theXInfo)
75 #define RED "\033[0;31m"
76 #define LIGHT_RED "\33[1;31m"
77 #define GREEN "\033[32;40m"
78 #define GREEN_ON_BLUE "\033[1;32;44m"
79 #define RESET_COLOR "\033[0m"
84 #define GREEN_ON_BLUE ""
85 #define RESET_COLOR ""
92 using namespace G4MemStat;
117 #define State(theXInfo) (GetState<G4ITTransportationState>()->theXInfo)
165 if(
this == &rhs)
return *
this;
206 const double timeStep,
222 if(
GetIT(track)->GetTrackingInfo()->IsLeadingStep())
226 bool makeException =
true;
234 exceptionDescription <<
"ComputeStep is called while the track has"
235 "the minimum interaction time";
236 exceptionDescription <<
" so it should not recompute a timeStep ";
237 G4Exception(
"G4DNABrownianTransportation::ComputeStep",
239 exceptionDescription);
243 State(fGeometryLimitedStep) =
false;
255 static double sqrt_2 = sqrt(2.);
256 double sqrt_Dt = sqrt(diffCoeff*timeStep);
257 double sqrt_2Dt = sqrt_2*sqrt_Dt;
259 if(
State(fTimeStepReachedLimit)==
true)
262 State(fGeometryLimitedStep) =
true;
264 spaceStep =
State(fEndPointDistance);
273 spaceStep = sqrt(x*x + y*y + z*z);
275 if(spaceStep >=
State(fEndPointDistance))
279 State(fGeometryLimitedStep) =
true;
294 <<
"G4ITBrownianTransportation::ComputeStep() : "
295 <<
"Step was limited to boundary"
301 if(
State(fRandomNumber)>=0)
321 double invErfc =
InvErfc(value);
322 spaceStep = invErfc*2*sqrt_Dt;
324 if(
State(fTimeStepReachedLimit)==
false)
327 State(fGeometryLimitedStep) =
false;
348 double min_randomNumber =
Erfc(
State(fEndPointDistance)/2*sqrt_Dt);
350 double invErfc =
InvErfc(value);
351 spaceStep = invErfc*2*sqrt_Dt;
352 if(spaceStep >=
State(fEndPointDistance))
355 State(fGeometryLimitedStep) =
true;
358 else if(
State(fTimeStepReachedLimit)==
false)
361 State(fGeometryLimitedStep) =
false;
368 State(fGeometryLimitedStep) =
true;
370 spaceStep =
State(fEndPointDistance);
387 State(fTransportEndPosition)= spaceStep*
395 State(fGeometryLimitedStep) =
false;
406 State(fGeometryLimitedStep) =
false;
411 State(fEndGlobalTimeComputed) =
true;
418 <<
"G4ITBrownianTransportation::ComputeStep() : "
419 <<
" trackID : " << track.
GetTrackID() <<
" : Molecule name: "
424 <<
"Final position:" <<
G4BestUnit(
State(fTransportEndPosition),
"Length")
428 <<
"Final magnitude:" <<
G4BestUnit(
State(fTransportEndPosition).mag(),
"Length")
430 <<
"Diffusion length : "
432 <<
" within time step : " <<
G4BestUnit(timeStep,
"Time")
434 <<
"State(fTimeStepReachedLimit)= " <<
State(fTimeStepReachedLimit) <<
G4endl
435 <<
"State(fGeometryLimitedStep)=" <<
State(fGeometryLimitedStep) <<
G4endl
436 <<
"End point distance was: " <<
G4BestUnit(
State(fEndPointDistance),
"Length")
461 <<
" trackID : " << track.
GetTrackID() <<
" Molecule name: "
463 G4cout <<
"Diffusion length : "
466 <<
"\t Current global time : "
487 <<
"G4DNABrownianTransportation::Diffusion :" << setw(8)
489 <<
"\t" <<
" Global Time = "
510 if (waterDensity == 0.0)
524 G4cout <<
"A track is outside water material : trackID = "
541 mem_diff = mem_intermediaire-mem_first;
542 G4cout <<
"\t\t\t >> || MEM || In G4DNABrownianTransportation::Diffusion "
543 "after dealing with waterDensity for "<< track.
GetTrackID()
544 <<
", diff is : " << mem_diff <<
G4endl;
548 State(fMomentumChanged) =
true;
553 mem_diff = mem_intermediaire-mem_first;
554 G4cout <<
"\t\t\t >> || MEM || In G4DNABrownianTransportation::"
555 "After proposing new direction to fParticleChange for "
591 G4cout <<
" G4DNABrownianTransportation::AlongStepGetPhysicalInteractionLength - track ID: "
600 track, previousStepSize, currentMinimumStep, currentSafety,
603 if(geometryStepLength==0)
606 if(
State(fGeometryLimitedStep))
612 State(fCurrentTouchableHandle)->GetHistory());
624 State(fCurrentTouchableHandle) = newTouchable;
639 track, previousStepSize, currentMinimumStep, currentSafety,
681 State(fComputeLastPosition) =
false;
682 State(fTimeStepReachedLimit) =
false;
684 if (
State(fGeometryLimitedStep))
695 / (diffusionCoefficient);
700 / (diffusionCoefficient);
707 State(fComputeLastPosition) =
true;
715 * pow(geometryStepLength /
InvErfc(
State(fRandomNumber)),2);
717 State(fTransportEndPosition) = geometryStepLength*
732 State(fTimeStepReachedLimit) =
true;
733 State(fComputeLastPosition) =
true;
739 State(fTimeStepReachedLimit) =
true;
743 State(fComputeLastPosition) =
true;
747 State(fCandidateEndGlobalTime) =
750 State(fEndGlobalTimeComputed) =
true;
752 State(fPathLengthWasCorrected) =
false;
757 geometryStepLength = 2
760 State(fPathLengthWasCorrected) =
true;
762 State(fTransportEndPosition) = geometryStepLength*
771 <<
"G4DNABrownianTransportation::AlongStepGetPhysicalInteractionLength = "
783 return geometryStepLength;
795 MemStat mem_first, mem_second, mem_diff;
802 if (
GetIT(track)->GetTrackingInfo()->IsLeadingStep()
803 &&
State(fComputeLastPosition))
816 spaceStep =
State(fEndPointDistance);
817 State(fGeometryLimitedStep) =
true;
822 GetDiffusionCoefficient();
829 spaceStep = sqrt(x * x + y * y + z * z);
831 if(spaceStep >=
State(fEndPointDistance))
833 State(fGeometryLimitedStep) =
true;
837 && spaceStep >=
State(fEndPointDistance))
839 spaceStep =
State(fEndPointDistance);
844 State(fGeometryLimitedStep) =
false;
860 <<
"G4DNABrownianTransportation::AlongStepDoIt: "
861 "GeometryLimitedStep = "
862 <<
State(fGeometryLimitedStep)
876 mem_diff = mem_intermediaire-mem_first;
877 G4cout <<
"\t\t\t >> || MEM || After calling G4ITTransportation::"
878 "AlongStepDoIt for "<< track.
GetTrackID() <<
", diff is : "
927 mem_diff = mem_intermediaire-mem_first;
928 G4cout <<
"\t\t\t >> || MEM || After calling G4DNABrownianTransportation::"
929 "Diffusion for "<< track.
GetTrackID() <<
", diff is : "
virtual void UpdateYourself(G4VPhysicalVolume *pPhysVol, const G4NavigationHistory *history=0)
G4double GetDeltaTime() const
G4ITSafetyHelper * fpSafetyHelper
static double Erfc(double x)
std::ostringstream G4ExceptionDescription
virtual void LoadTrackState(G4TrackStateManager &manager)
G4bool fUseMaximumTimeBeforeReachingBoundary
virtual double GetLimitingTimeStep() const
G4StepPoint * GetPreStepPoint() const
G4bool fComputeLastPosition
G4double * theInteractionTimeLeft
G4double GetStepLength() const
const G4String & GetName() const
G4double ComputeGeomLimit(const G4Track &track, G4double &presafety, G4double limit)
const G4String & GetParticleName() const
G4shared_ptr< G4ProcessState > fpState
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4ThreeVector G4RandomDirection()
G4int GetCurrentStepNumber() const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
G4bool ProposesTimeStep() const
static double InvErfc(double x)
virtual void StartTracking(G4Track *aTrack)
void SetInstantiateProcessState(G4bool flag)
const XML_Char int const XML_Char * value
G4double GetStepLength() const
const G4ThreeVector & GetPosition() const
static G4DNAMolecularMaterial * Instance()
G4BrownianAction * fpBrownianAction
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &)
static G4VScheduler * Instance()
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
static double inverseErf(double t)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4double GetGlobalTime() const
G4DNABrownianTransportation(const G4String &aName="DNABrownianTransportation", G4int verbosityLevel=0)
G4DNABrownianTransportation & operator=(const G4DNABrownianTransportation &)
const G4String & GetProcessName() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4double CheckNextStep(const G4ThreeVector &position, const G4ThreeVector &direction, const G4double currentMaxStep, G4double &newSafety)
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
G4StepPoint * GetPostStepPoint() const
void ProposeEnergy(G4double finalEnergy)
G4Material * GetMaterial() const
const G4Step * GetStep() const
G4Molecule * GetMolecule(const G4Track &track)
ThreeVector shoot(const G4int Ap, const G4int Af)
void Diffusion(const G4Track &track)
G4ParticleChangeForTransport fParticleChange
const std::vector< G4double > * fpWaterDensity
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4bool fUseSchedulerMinTimeSteps
G4VPhysicalVolume * GetWorldVolume()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double GetDiffusionCoefficient() const
G4double fInternalMinTimeStep
static double InvErf(double x)
G4ITNavigator * fLinearNavigator
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void SetProcessSubType(G4int)
G4GLOB_DLL std::ostream G4cout
virtual void ComputeStep(const G4Track &, const G4Step &, const double, double &)
static double erf(double x)
virtual void Transport(const G4Track &, G4ParticleChangeForTransport &)=0
virtual ~G4DNABrownianTransportation()
const G4VProcess * GetProcessDefinedStep() const
G4bool fPathLengthWasCorrected
const G4ThreeVector & GetMomentumDirection() const
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
virtual void StartTracking(G4Track *aTrack)
static constexpr double picosecond
virtual void ResetTrackState()
void ProposeTrackStatus(G4TrackStatus status)
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &)
G4IT * GetIT(const G4Track *track)
G4bool fTimeStepReachedLimit
void SetMomentumChanged(G4bool b)
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
const G4String & GetName() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &)
G4TrackingInformation * GetTrackingInfo()
G4double GetTemperature() const
G4VPhysicalVolume * GetVolume() const
virtual const G4String & GetName() const =0
static G4NistManager * Instance()
G4int GetProcessSubType() const