92 return std::numeric_limits<T>::has_infinity
93 && value == std::numeric_limits<T>::infinity();
107 <<
"_______________________________________________________________________"
109 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep" <<
G4endl;
110 G4cout <<
"Check done for molecule : " << pMoleculeA->GetName()
116 auto pMolConfA = pMoleculeA->GetMolecularConfiguration();
127 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will return infinity "
128 "for the reaction because the molecule "
129 << pMoleculeA->GetName()
130 <<
" does not have any reactants given in the reaction table."
138 G4int nbReactives = pReactantList->size();
140 if (nbReactives == 0)
148 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will return infinity "
149 "for the reaction because the molecule "
150 << pMoleculeA->GetName()
151 <<
" does not have any reactants given in the reaction table."
152 <<
"This message can also result from a wrong implementation of the reaction table."
161 for (
G4int i = 0; i < nbReactives; i++)
163 auto pMoleculeB = (*pReactantList)[i];
164 G4int key = pMoleculeB->GetMoleculeID();
171 std::vector<std::pair<G4TrackList::iterator,G4double>> resultIndices;
172 resultIndices.clear();
174 FindNearestInRange(trackA,
179 if(resultIndices.empty())
183 for(
auto& it : resultIndices)
185 G4Track* pTrackB = *(std::get<0>(it));
187 if(pTrackB == &trackA)
191 if(pTrackB ==
nullptr)
194 exceptionDescription <<
"No trackB no valid";
196 "::BuildReactionMap()",
"NO_TRACK02",
199 Utils utils(trackA, *pTrackB);
202 auto pMolConfB = pMolB->GetMolecularConfiguration();
204 if(distance * distance < Reff * Reff)
208 if(processTable[typeOfReaction]->
209 GeminateRecombinationProbability(pMolConfA, pMolConfB))
242 G4cout <<
"G4DNAIndependentReactionTimeStepper::CalculateStep will finally return :"
247 G4cout <<
"Selected reactants for trackA: " << pMoleculeA->GetName()
250 vector<G4Track*>::iterator it;
280 exceptionDescription<<
"A track is reacting with itself"
281 " (which is impossible) ie fpTrackA == trackB"<<
G4endl;
282 exceptionDescription <<
"Molecule A is of type : "
287 G4Exception(
"G4DNAIndependentReactionTimeStepper::RetrieveResults",
289 exceptionDescription);
298 <<
"The interacting tracks are not synchronized in time" <<
G4endl;
300 <<
"trackB->GetGlobalTime() != fpTrackA.GetGlobalTime()" <<
G4endl;
304 <<
"\t fpTrackA->GetGlobalTime() = "
309 <<
"\t trackB->GetGlobalTime() = "
312 G4Exception(
"G4DNAIndependentReactionTimeStepper::RetrieveResults",
314 exceptionDescription);
319std::unique_ptr<G4ITReactionChange>
325 if (pReactionSet ==
nullptr)
331 if(reactionPerTime.empty())
336 for (
auto reaction_i = reactionPerTime.begin();
337 reaction_i != reactionPerTime.end();
338 reaction_i = reactionPerTime.begin())
340 G4Track* pTrackA = (*reaction_i)->GetReactants().first;
345 G4Track* pTrackB = (*reaction_i)->GetReactant(pTrackA);
351 if (pTrackB == pTrackA)
355 <<
"The IT reaction process sent back a reaction between trackA and trackB. ";
356 exceptionDescription <<
"The problem is trackA == trackB";
358 "ITModelProcessor005",
360 exceptionDescription);
371 if (pReactionChange ==
nullptr)
375 return pReactionChange;
412 exceptionDescription <<
"fpProManager is not "
415 "GetIndependentReactionTime()",
416 "G4DNAIndependentReactionTimeModel002",
445 if (pTrack ==
nullptr)
448 exceptionDescription <<
"No track found.";
449 G4Exception(
"G4Scheduler::CalculateMinStep",
"ITScheduler006",
463 if (sampledMinTimeStep < fTSTimeStep)
465 fTSTimeStep = sampledMinTimeStep;
475 else if (fTSTimeStep == sampledMinTimeStep &&
G4bool(reactants))
#define BuildChemicalMoleculeFinder()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4shared_ptr< std::vector< G4Track * > > G4TrackVectorHandle
std::multiset< G4ITReactionPtr, compReactionPerTime > G4ITReactionPerTime
G4Molecule * GetMolecule(const G4Track &track)
ReturnType & reference_cast(OriginalType &source)
G4GLOB_DLL std::ostream G4cout
Utils(const G4Track &tA, const G4Track &tB)
const G4Molecule * fpMoleculeA
const G4Molecule * fpMoleculeB
G4double CalculateStep(const G4Track &, const G4double &) override
G4DNAIndependentReactionTimeStepper()
const G4DNAMolecularReactionTable *& fMolecularReactionTable
G4double GetTimeToEncounter(const G4Track &trackA, const G4Track &trackB)
void CheckAndRecordResults(const Utils &utils)
void InitializeForNewTrack()
G4VDNAReactionModel * GetReactionModel()
G4VDNAReactionModel * fReactionModel
void SetReactionModel(G4VDNAReactionModel *)
G4double CalculateMinTimeStep(G4double, G4double) override
G4ITTrackHolder * fpTrackContainer
std::unique_ptr< G4ITReactionChange > FindReaction(G4ITReactionSet *pReactionSet, const G4double ¤tStepTime=0, const G4double &previousStepTime=0, const G4bool &reachedUserStepTimeLimit=false)
G4bool fHasAlreadyReachedNullTime
void SetReactionTypeManager(G4VReactionTypeManager *typeManager)
G4ITReactionSet * fReactionSet
G4VITReactionProcess * fpReactionProcess
ReactionType GetReactionType(const G4Track &trackA, const G4Track &trackB)
G4DNAReactionTypeManager * fReactionTypeManager
std::map< G4int, G4ThreeVector > fSampledPositions
void SetReactionProcess(G4VITReactionProcess *pReactionProcess)
int GetReactionID() const
Data * GetReactionData(Reactant *, Reactant *) const
const ReactantList * CanReactWith(Reactant *) const
const ReactionTypeTable * GetReactionTypeTable() const override
ReactionType GetReactionTypeByID(ReactionID iD)
static G4double GetRCutOff()
void SelectThisReaction(G4ITReactionPtr reaction)
void AddReactions(G4double time, G4Track *trackA, G4TrackVectorHandle reactants)
G4ITReactionPerTime & GetReactionsPerTime()
G4TrackList * GetMainList(Key)
const G4MolecularConfiguration * GetMolecularConfiguration() const
const G4String & GetName() const
static G4OctreeFinder * Instance()
static G4Scheduler * Instance()
G4TrackStatus GetTrackStatus() const
void SetPosition(const G4ThreeVector &aValue)
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
virtual void Initialise(const G4MolecularConfiguration *, const G4Track &)
virtual G4double GetReactionRadius(const G4MolecularConfiguration *, const G4MolecularConfiguration *)=0
virtual std::unique_ptr< G4ITReactionChange > MakeReaction(const G4Track &, const G4Track &)=0
virtual G4bool TestReactibility(const G4Track &, const G4Track &, double, bool)=0
G4TrackVectorHandle fReactants
G4TrackVectorHandle GetReactants()
virtual void ResetReactants()
const G4ITReactionTable * fpReactionTable
static G4ThreadLocal G4double fUserMinTimeStep
G4double fSampledMinTimeStep