121{
124 auto pMotherMoleculeDefinition = pMotherMolecule->GetDefinition();
125
126 if (pMotherMoleculeDefinition->GetDecayTable())
127 {
128 const auto pDissociationChannels = pMotherMolecule->GetDissociationChannels();
129
130 if (pDissociationChannels == nullptr)
131 {
133 pMotherMolecule->PrintState();
134 exceptionDescription << "No decay channel was found for the molecule : "
135 << pMotherMolecule->GetName() <<
G4endl;
137 "G4DNAMolecularDissociation::NoDecayChannel",
139 exceptionDescription);
141 }
142
143 auto decayVectorSize = pDissociationChannels->size();
145
147 size_t i = 0;
148 do
149 {
150 pDecayChannel = (*pDissociationChannels)[i];
151 if (RdmValue < pDecayChannel->GetProbability())
152 {
153 break;
154 }
156 i++;
157 } while (i < decayVectorSize);
158
161
162 if (decayEnergy > 0.)
163 {
165 }
166
167 if (nbProducts)
168 {
169 std::vector<G4ThreeVector> productsDisplacement(nbProducts);
171
172 auto it = fDisplacementMap.find(pMotherMoleculeDefinition);
173
174 if (it != fDisplacementMap.end())
175 {
176 auto pDisplacer = it->second.get();
177 productsDisplacement = pDisplacer->GetProductsDisplacement(pDecayChannel);
178 motherMoleculeDisplacement =
179 pDisplacer->GetMotherMoleculeDisplacement(pDecayChannel);
180 }
181 else
182 {
184 errMsg << "No G4MolecularDecayProcess::theDecayDisplacementMap["
185 << pMotherMolecule->GetName() + "]";
187 "DNAMolecularDecay001",
189 errMsg);
190 }
191
193
194#ifdef G4VERBOSE
195 if (fVerbose)
196 {
197 G4cout <<
"Decay Process : " << pMotherMolecule->GetName()
198 <<
" (trackID :" << track.
GetTrackID() <<
") "
200 }
201#endif
202
204
205 for (
G4int j = 0; j < nbProducts; j++)
206 {
208
209 G4ThreeVector displacement = motherMoleculeDisplacement + productsDisplacement[j];
210 double mag_displacement = displacement.
mag();
211 G4ThreeVector displacement_direction = displacement / (mag_displacement + 1e-30);
212
214
215
217 displacement_direction,
218 mag_displacement,
219 prNewSafety);
220
221
222 mag_displacement = std::min(prNewSafety * 0.8, mag_displacement);
223
225 + displacement_direction * mag_displacement;
226
227
228 if(fpBrownianAction != nullptr)
229 {
230 fpBrownianAction->
Transport(product_pos);
231 }
232
233
235
237
238
239
241 EInside::kInside)
242 {
245 GetMotherLogical();
246 if (Motherlogic != nullptr
247 && Motherlogic->GetMaterial() != WaterMaterial)
248 {
250 ED << "The decayed product is outside of the volume : "
252 << " with material : "<< Motherlogic->GetMaterial()
254 G4Exception(
"G4DNAMolecularDissociation::DecayIt()",
255 "OUTSIDE_OF_MOTHER_VOLUME",
257 }
258 }
259
260 auto pSecondary = pProduct->BuildTrack(track.
GetGlobalTime(), product_pos);
261
262 pSecondary->SetTrackStatus(
fAlive);
263#ifdef G4VERBOSE
264 if (fVerbose)
265 {
266 G4cout <<
"Product : " << pProduct->GetName() <<
G4endl;
267 }
268#endif
269
271 }
272#ifdef G4VERBOSE
273 if (fVerbose)
274 {
276 }
277#endif
278 }
279
280 else if (fVerbose && decayEnergy)
281 {
284 }
285
286
287
288
289
290
291
292
293
294
295
296
297 }
298
300
302}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4Molecule * GetMolecule(const G4Track &track)
static G4ITTransportationManager * GetTransportationManager()
G4ITNavigator * GetNavigatorForTracking() const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Product * GetProduct(int) const
G4int GetNbProducts() const
const G4String & GetName() const
G4double GetProbability() const
G4double GetEnergy() const
void Initialize(const G4Track &) override
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
const G4VTouchable * GetTouchable() const
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetNumberOfSecondaries(G4int totSecondaries)
const G4String & GetName() const
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4VSolid * GetSolid(G4int depth=0) const
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
virtual void Transport(G4ThreeVector &, G4Track *pTrack=nullptr)=0