50# define State(theXInfo) (GetState<G4ITBrownianState>()->theXInfo)
59# define State(theXInfo) (GetState<G4ITTransportationState>()->theXInfo)
69 fpState = std::make_shared<G4ITBrownianState>();
85 fpState = std::make_shared<G4ITBrownianState>();
98 errMsg <<
"fpBoundingBox is nullptr";
100 "ChemReboundTransportation::BuildPhysicsTable"
101 "ChemReboundTransportation",
114 if (
GetIT(track)->GetTrackingInfo()->IsLeadingStep()) {
116 exceptionDescription <<
"ComputeStep is called while the track has"
117 "the minimum interaction time";
118 exceptionDescription <<
" so it should not recompute a timeStep ";
119 G4Exception(
"ChemReboundTransportation::ComputeStep",
"ChemReboundTransportation0001",
122 State(fGeometryLimitedStep) =
false;
131 State(fTransportEndPosition) =
139 <<
" State(theInteractionTimeLeft) : " <<
State(theInteractionTimeLeft)
140 <<
" State(fEndPointDistance) : " <<
G4BestUnit(
State(fEndPointDistance),
"Length")
142 <<
" Molecule name: " <<
"track.GetPosition() : " << track.
GetPosition()
143 <<
" State(fTransportEndPosition) : " <<
State(fTransportEndPosition) <<
" "
147 State(fEndGlobalTimeComputed) =
true;
160 if (
GetIT(track)->GetTrackingInfo()->IsLeadingStep()) {
161 G4cout <<
"ChemReboundTransportation::PostStepDoIt() :" <<
" trackID : " << track.
GetTrackID()
184 "ChemReboundTransportation::AlongStepGetPhysicalInteractionLength"
185 "ChemReboundTransportation",
190 errMsg <<
"This is not water";
192 "ChemReboundTransportation::AlongStepGetPhysicalInteractionLength"
193 "ChemReboundTransportation",
202 auto reaction_i = reactionPerTime.begin();
203 if (reaction_i == reactionPerTime.end()) {
204 State(fGeometryLimitedStep) =
false;
211 G4Track* pTrackA = (*reaction_i)->GetReactants().first;
212 G4Track* pTrackB = (*reaction_i)->GetReactant(pTrackA);
214 if (&track == pTrackA || &track == pTrackB) {
216 State(fTimeStepReachedLimit) =
false;
217 State(fGeometryLimitedStep) =
false;
223 <<
" State(theInteractionTimeLeft) : "
227 State(fTimeStepReachedLimit) =
true;
231 State(fTimeStepReachedLimit) =
true;
236 State(fGeometryLimitedStep) =
false;
242 State(fTransportEndPosition) =
245 State(fTimeStepReachedLimit) =
true;
247 State(fEndGlobalTimeComputed) =
true;
251 G4cout <<
"ChemReboundTransportation::AlongStepGetPhysicalInteractionLength = "
252 <<
G4BestUnit(geometryStepLength,
"Length") <<
" "
257 return geometryStepLength;
264 if (
GetIT(track)->GetTrackingInfo()->IsLeadingStep()) {
280 G4cout <<
"G4DNABrownianTransportation::AlongStepDoIt() : IsLeadingStep " <<
" trackID : "
283 <<
" Molecule name: "
284 <<
GetMolecule(track)->
GetName()<<
"State(fTransportEndPosition) : "<<
State(fTransportEndPosition) <<
" State(theInteractionTimeLeft) : "
328 if (std::abs(length) < 1e-10) {
332 G4double relativePos = std::abs(nextPos - low);
333 if (!std::isfinite(relativePos)) {
338 if (!std::isfinite(n)) {
345 h = std::fmod(truncVal, 2.0);
350 if(relativePos > length) {
351 mod = std::fmod(relativePos, length);
354 return low + h * length + (1 - 2 * h) * std::abs(mod);
363 exceptionDescription <<
"GetDiffusionCoefficient is negative";
364 G4Exception(
"ChemReboundTransportation::calculateDistanceFromTimeStep",
367 G4double sqrt_2Dt = sqrt(2 * diffuCoeff * timeStep);
368 G4double x = G4RandGauss::shoot(0, sqrt_2Dt);
369 G4double y = G4RandGauss::shoot(0, sqrt_2Dt);
370 G4double z = G4RandGauss::shoot(0, sqrt_2Dt);
371 return sqrt(x * x + y * y + z * z);
383 "BoundedBrownianAction::GetTimeToBoundary"
384 "BoundedBrownianAction",
396 std::vector<G4double> distanceVector{dx, dy, dz};
398 for (
const auto& it : distanceVector) {
401 auto minTime = 1 / (4 * diffusionCoefficient) * pow(distance / InvErfc(random), 2);
403 if (MinTime > minTime) {
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::multiset< G4ITReactionPtr, compReactionPerTime > G4ITReactionPerTime
G4IT * GetIT(const G4Track *track)
@ fLowEnergyBrownianTransportation
G4Molecule * GetMolecule(const G4Track &track)
G4ThreeVector G4RandomDirection()
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
static double inverseErf(double t)
void StartTracking(G4Track *aTrack) override
G4ThreeVector BouncingAction(const G4ThreeVector &nextPosition)
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &) override
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &) override
G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double, G4double, G4double &, G4GPILSelection *) override
static G4double calculateNextCoordinate(G4double nextPos, G4double high, G4double low)
G4double fInternalMinTimeStep
void ComputeStep(const G4Track &, const G4Step &, G4double, G4double &) override
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4double calculateDistanceFromTimeStep(MolConf mol, G4double timeStep)
G4ITReactionSet * fReactionSet
G4double fMaximumTimeStep
const G4DNABoundingBox * fpBoundingBox
G4double GetTimeToBoundary(const G4Track &track)
G4ChemReboundTransportation(const G4String &aName="ChemReboundTransportation", const G4DNABoundingBox *=nullptr, G4int verbosityLevel=0)
static G4H3O * Definition()
G4ParticleChangeForTransport fParticleChange
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData) override
void SetInstantiateProcessState(G4bool flag)
void BuildPhysicsTable(const G4ParticleDefinition &) override
void StartTracking(G4Track *aTrack) override
G4ITSafetyHelper * fpSafetyHelper
G4ITTransportation(const G4String &aName="ITTransportation", G4int verbosityLevel=0)
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &) override
G4TrackingInformation * GetTrackingInfo()
virtual const G4String & GetName() const =0
G4double GetDiffusionCoefficient() const
const G4MolecularConfiguration * GetMolecularConfiguration() const
const G4String & GetName() const override
G4double GetDiffusionCoefficient() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4NistManager * Instance()
G4double GetGlobalTime() const
const G4ThreeVector & GetPosition() const
G4double GetDeltaTime() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4StepPoint * GetPostStepPoint() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4Material * GetMaterial() const
const G4ThreeVector & GetMomentumDirection() const
G4shared_ptr< G4ProcessState > fpState
void SetProcessSubType(G4int)
G4bool fTimeStepReachedLimit