43# define State(theXInfo) (GetState<G4DNAScavengerProcessState>()->theXInfo)
69 for(
auto& iter2 : iter.second)
105 <<
"G4DNASecondOrderReaction was already initialised. ";
106 exceptionDescription <<
"You cannot set a reaction after initialisation.";
107 G4Exception(
"G4DNASecondOrderReaction::SetReaction",
109 exceptionDescription);
115 G4cout <<
"G4DNAScavengerProcess::SetReaction : " << molConf->
GetName()
116 <<
" materialConf : " << materialConf->GetName() <<
G4endl;
118 fConfMap[molConf][materialConf] = pData;
138 auto MaterialMap = it->second;
141 std::map<
G4double , std::pair<MolType, G4double>>
145 for(
const auto& mat_it : MaterialMap)
147 auto matConf = mat_it.first;
151 if(numMol == 0 && matConf !=
fH2O){
153 auto data = mat_it.second;
154 auto reactionRate = data->GetObservedReactionRateConstant();
156 numMol * reactionRate / (
fpBoundingBox->Volume() * Avogadro);
159 auto factor = reactionRate;
165 G4cout <<
" Material of " << matConf->GetName() <<
" : " << propensity
169 auto reactionData = std::make_pair(mat_it.first, propensity);
174 alpha0 += propensity;
175 ReactionDataMap[alpha0] = reactionData;
179 if(
State(fIsInGoodMaterial))
182 State(fIsInGoodMaterial) =
false;
186 auto rSelectedIter = ReactionDataMap.upper_bound(r1 * alpha0);
197 State(fIsInGoodMaterial) =
true;
200 if(
State(fPreviousTimeAtPreStepPoint) != -1)
211 if((previousTimeStep <= 0.0) ||
212 (
fpState->theNumberOfInteractionLengthLeft <= 0.0))
216 else if(previousTimeStep > 0.0)
221 fpState->currentInteractionLength = 1 / (rSelectedIter->second.second);
225 value =
fpState->theNumberOfInteractionLengthLeft *
226 (
fpState->currentInteractionLength);
234 <<
" name : " << molConf->GetName()
255 std::vector<G4Track*> products;
260 <<
"molecule: "<<molConf->GetName()<<
G4endl;
272 <<
"No reaction data for scavenger reaction between : "<<
fpMaterialConf->GetName()
273 <<
" + "<<molConf->GetName()<<
G4endl;
276 exceptionDescription);
281 auto nbSecondaries = data->GetNbProducts();
283 for(
G4int j = 0; j < nbSecondaries; ++j)
285 auto product = data->GetProduct(j);
289 AddNumberMoleculePerVolumeUnitForMaterialConf(product,track.
GetGlobalTime());
292 auto pProduct =
new G4Molecule(data->GetProduct(j));
294 pProduct->BuildTrack(reactionTime, track.
GetPosition());
295 pProductTrack->SetTrackStatus(
fAlive);
300 products.push_back(pProductTrack);
313 if(nbSecondaries > 0)
315 for(
G4int i = 0; i < nbSecondaries; ++i)
325 auto product = data->GetProduct(i);
329 G4cout<<product->GetName()<<
" (B)";
333 auto trackSize = products.size();
336 for(
G4int it = 0; it < (
G4int)trackSize; ++it)
343 << products.at(it)->GetTrackID() <<
")";
372 State(fPreviousTimeAtPreStepPoint) = -1;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4IT * GetIT(const G4Track *track)
G4Molecule * GetMolecule(const G4Track &track)
G4GLOB_DLL std::ostream G4cout
Reactant * GetReactant1() const
Reactant * GetReactant2() const
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
const G4MolecularConfiguration * MolType
void StartTracking(G4Track *) override
std::map< MolType, std::map< MolType, Data * > > fConfMap
const G4DNABoundingBox * fpBoundingBox
const G4MolecularConfiguration * fpMolecularConfiguration
~G4DNAScavengerProcess() override
G4DNAScavengerProcess(const G4String &aName, const G4DNABoundingBox &box, G4ProcessType type=fUserDefined)
G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
G4DNAScavengerMaterial * fpScavengerMaterial
void BuildPhysicsTable(const G4ParticleDefinition &) override
void SetReaction(MolType, Data *pData)
G4ParticleChange fParticleChange
const G4DNAMolecularReactionData Data
void Push(G4Track *track) override
static G4ITFinder * Instance()
void Push(G4Track *) override
static G4ITTrackHolder * Instance()
virtual const G4String & GetName() const =0
const G4String & GetName() const
const G4MolecularConfiguration * GetMolecularConfiguration() const
static G4OctreeFinder * Instance()
void SetInteractionStep(G4bool InteractionStep)
static G4Scheduler * Instance()
G4VScavengerMaterial * GetScavengerMaterial() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
void SetInstantiateProcessState(G4bool flag)
virtual void SubtractNumberOfInteractionLengthLeft(G4double previousStepSize)
G4shared_ptr< G4ProcessState > fpState
void StartTracking(G4Track *) override
G4VITProcess(const G4String &name, G4ProcessType type=fNotDefined)
void ResetNumberOfInteractionLengthLeft() override
G4bool enableAlongStepDoIt
void SetProcessSubType(G4int)
virtual void StartTracking(G4Track *)
G4bool enablePostStepDoIt
G4VParticleChange * pParticleChange
G4double fPreviousTimeAtPreStepPoint
G4DNAScavengerProcessState()