117{
120 auto pMotherMoleculeDefinition = pMotherMolecule->GetDefinition();
121
122 if (pMotherMoleculeDefinition->GetDecayTable())
123 {
124 const auto pDissociationChannels = pMotherMolecule->GetDissociationChannels();
125
126 if (pDissociationChannels == nullptr)
127 {
129 pMotherMolecule->PrintState();
130 exceptionDescription << "No decay channel was found for the molecule : "
131 << pMotherMolecule->GetName() <<
G4endl;
133 "G4DNAMolecularDissociation::NoDecayChannel",
135 exceptionDescription);
137 }
138
139 auto decayVectorSize = pDissociationChannels->size();
141
143 size_t i = 0;
144 do
145 {
146 pDecayChannel = (*pDissociationChannels)[i];
147 if (RdmValue < pDecayChannel->GetProbability())
148 {
149 break;
150 }
152 i++;
153 } while (i < decayVectorSize);
154
157
158 if (decayEnergy > 0.)
159 {
161 }
162
163 if (nbProducts)
164 {
165 std::vector<G4ThreeVector> productsDisplacement(nbProducts);
167
168 auto it = fDisplacementMap.find(pMotherMoleculeDefinition);
169
170 if (it != fDisplacementMap.end())
171 {
172 auto pDisplacer = it->second.get();
173 productsDisplacement = pDisplacer->GetProductsDisplacement(pDecayChannel);
174 motherMoleculeDisplacement =
175 pDisplacer->GetMotherMoleculeDisplacement(pDecayChannel);
176 }
177 else
178 {
180 errMsg << "No G4MolecularDecayProcess::theDecayDisplacementMap["
181 << pMotherMolecule->GetName() + "]";
183 "DNAMolecularDecay001",
185 errMsg);
186 }
187
189
190#ifdef G4VERBOSE
191 if (fVerbose)
192 {
193 G4cout <<
"Decay Process : " << pMotherMolecule->GetName()
194 <<
" (trackID :" << track.
GetTrackID() <<
") "
196 }
197#endif
198
200
201 for (
G4int j = 0; j < nbProducts; j++)
202 {
204
205 G4ThreeVector displacement = motherMoleculeDisplacement + productsDisplacement[j];
206 double mag_displacement = displacement.
mag();
207 G4ThreeVector displacement_direction = displacement / (mag_displacement + 1e-30);
208
210
211
213 displacement_direction,
214 mag_displacement,
215 prNewSafety);
216
217
218 mag_displacement = std::min(prNewSafety * 0.8, mag_displacement);
219
221 + displacement_direction * mag_displacement;
222
224
226
228 EInside::kInside)
229 {
231 ED << "The decayed product is outside of the volume : "
233 G4Exception(
"G4DNAMolecularDissociation::DecayIt()",
234 "OUTSIDE_OF_MOTHER_VOLUME",
236 }
237
238 auto pSecondary = pProduct->BuildTrack(track.
GetGlobalTime(), product_pos);
239
240 pSecondary->SetTrackStatus(
fAlive);
241#ifdef G4VERBOSE
242 if (fVerbose)
243 {
244 G4cout <<
"Product : " << pProduct->GetName() <<
G4endl;
245 }
246#endif
247
249 }
250#ifdef G4VERBOSE
251 if (fVerbose)
252 {
254 }
255#endif
256 }
257
258 else if (fVerbose && decayEnergy)
259 {
262 }
263
264
265
266
267
268
269
270
271
272
273
274
275 }
276
278
280}
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
Product * GetProduct(int) const
G4int GetNbProducts() const
const G4String & GetName() const
G4double GetProbability() const
G4double GetEnergy() const
virtual void Initialize(const G4Track &)
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