326{
327
328
329
330
331
332
333
334 theDecayRateVector.clear();
335
336 G4int nGeneration = 0;
337
338 std::vector<G4double> taos;
339
340
341 std::vector<G4double> Acoeffs;
342
343
344 Acoeffs.push_back(-1.);
345
346 const G4Ions* ion = static_cast<const G4Ions*>(&theParentNucleus);
351 if (tao < 0.) tao = 1e-100;
352 taos.push_back(tao);
354
355
356
358
359
360 theDecayRateVector.push_back(ratesToDaughter);
361 ++nEntry;
362
363
366 G4VDecayChannel* theChannel = 0;
367 G4NuclearDecay* theNuclearDecayChannel = 0;
368
369 G4ITDecay* theITChannel = 0;
370 G4BetaMinusDecay* theBetaMinusChannel = 0;
371 G4BetaPlusDecay* theBetaPlusChannel = 0;
372 G4AlphaDecay* theAlphaChannel = 0;
373 G4ProtonDecay* theProtonChannel = 0;
374 G4TritonDecay* theTritonChannel = 0;
375 G4NeutronDecay* theNeutronChannel = 0;
376 G4SFDecay* theFissionChannel = 0;
377
385 std::vector<G4double> TP;
386 std::vector<G4double> RP;
387 G4ParticleDefinition *theDaughterNucleus;
390 G4int nearestLevelIndex = 0;
391 G4ParticleDefinition *aParentNucleus;
392 G4IonTable* theIonTable;
393 G4DecayTable* parentDecayTable;
400
402
404 while (!stable) {
405 loop++;
406 if (loop > 10000) {
407 G4Exception(
"G4RadioactiveDecay::CalculateChainsFromParent()",
"HAD_RDM_100",
409 break;
410 }
411 nGeneration++;
412 for (j = nS; j < nT; ++j) {
413
414 ZP = theDecayRateVector[j].GetZ();
415 AP = theDecayRateVector[j].GetA();
416 EP = theDecayRateVector[j].GetE();
417 RP = theDecayRateVector[j].GetDecayRateC();
418 TP = theDecayRateVector[j].GetTaos();
420 G4cout <<
"G4RadioactiveDecay::CalculateChainsFromParent: daughters of ("
421 << ZP << ", " << AP << ", " << EP
422 << ") are being calculated, generation = " << nGeneration
424 }
425
426 aParentNucleus = theIonTable->
GetIon(ZP,AP,EP);
428 if (nullptr == parentDecayTable) { continue; }
429
430 G4DecayTable* summedDecayTable = new G4DecayTable();
431
432
433
434
435
436
437
438
439
440 for (
G4int k = 0; k < nMode; ++k) brs[k] = 0.0;
441
442
443 for (
G4int i = 0; i < parentDecayTable->
entries(); ++i) {
445 theNuclearDecayChannel = static_cast<G4NuclearDecay*>(theChannel);
450 ZD = ((const G4Ions*)(theDaughterNucleus))->GetAtomicNumber();
451 const G4LevelManager* levelManager =
453
454
455
456
459 if ((std::abs(daughterExcitation - nearestEnergy) <
levelTolerance) &&
460 (std::abs(daughterExcitation - nearestEnergy) >
DBL_EPSILON)) {
461
462
464 if (levelManager->
LifeTime(nearestLevelIndex)*
ns >= halflifethreshold){
465
466 summedDecayTable->
Insert(theChannel);
467 } else {
468 brs[theDecayMode] += theChannel->
GetBR();
469 }
470 } else {
471 brs[theDecayMode] += theChannel->
GetBR();
472 }
473 } else {
474 brs[theDecayMode] += theChannel->
GetBR();
475 }
476
477 }
478
481 for (
G4int i = 0; i < nMode; ++i) {
482 if (brs[i] > 0.) {
483 switch (i) {
485
486 theITChannel =
new G4ITDecay(aParentNucleus, brs[
IT], 0.0, 0.0);
487
488 summedDecayTable->
Insert(theITChannel);
489 break;
490
492
493 theBetaMinusChannel =
new G4BetaMinusDecay(aParentNucleus, brs[
BetaMinus],
494 0.*MeV, 0.*MeV,
496 summedDecayTable->
Insert(theBetaMinusChannel);
497 break;
498
500
501 theBetaPlusChannel =
new G4BetaPlusDecay(aParentNucleus, brs[
BetaPlus],
502 0.*MeV, 0.*MeV,
504 summedDecayTable->
Insert(theBetaPlusChannel);
505 break;
506
508
509 theAlphaChannel =
new G4AlphaDecay(aParentNucleus, brs[
Alpha], 0.*MeV,
511 summedDecayTable->
Insert(theAlphaChannel);
512 break;
513
515
516 theProtonChannel =
new G4ProtonDecay(aParentNucleus, brs[
Proton], 0.*MeV,
518 summedDecayTable->
Insert(theProtonChannel);
519 break;
520
522
523 theNeutronChannel =
new G4NeutronDecay(aParentNucleus, brs[
Neutron], 0.*MeV,
525 summedDecayTable->
Insert(theNeutronChannel);
526 break;
527
529
530 theFissionChannel =
new G4SFDecay(aParentNucleus, brs[
SpFission], 0.*MeV,
532 summedDecayTable->
Insert(theFissionChannel);
533 break;
534
536
537 break;
538
540
541 break;
542
544
545 break;
546
548
549 break;
550
552
553 break;
554
556
557 break;
558
560
561 theTritonChannel =
new G4TritonDecay(aParentNucleus, brs[
Triton], 0.*MeV,
563 summedDecayTable->
Insert(theTritonChannel);
564 break;
565
566 default:
567 break;
568 }
569 }
570 }
571
572
573
574 for (
G4int i = 0; i < summedDecayTable->
entries(); ++i){
576 theNuclearDecayChannel = static_cast<G4NuclearDecay*>(theChannel);
577 theBR = theChannel->
GetBR();
579
580
581
582 if (theNuclearDecayChannel->
GetDecayMode() ==
IT && nGeneration == 1) {
583
584 A = ((
const G4Ions*)(theDaughterNucleus))->GetAtomicMass();
585 Z = ((const G4Ions*)(theDaughterNucleus))->GetAtomicNumber();
586 theDaughterNucleus=theIonTable->
GetIon(Z,
A,0.);
587 }
589 aParentNucleus != theDaughterNucleus) {
590
592 if (
nullptr != parentDecayTable && parentDecayTable->
entries() > 0) {
593 A = ((
const G4Ions*)(theDaughterNucleus))->GetAtomicMass();
594 Z = ((const G4Ions*)(theDaughterNucleus))->GetAtomicNumber();
595 E = ((const G4Ions*)(theDaughterNucleus))->GetExcitationEnergy();
596
598 if (TaoPlus <= 0.) TaoPlus = 1e-100;
599
600
601 taos.clear();
602 taos = TP;
603 std::size_t k;
604
605
606
607
608 taos.push_back(TaoPlus);
609
610
611
612
613 Acoeffs.clear();
614 long double ta1,ta2;
615 ta2 = (long double)TaoPlus;
616 for (k = 0; k < RP.size(); ++k){
617 ta1 = (long double)TP[k];
618 if (ta1 == ta2) {
619 theRate = 1.e100;
620 } else {
621 theRate = ta1/(ta1-ta2);
622 }
623 theRate = theRate * theBR * RP[k];
624 Acoeffs.push_back(theRate);
625 }
626
627
628
629
630 theRate = 0.;
631 long double aRate, aRate1;
632 aRate1 = 0.L;
633 for (k = 0; k < RP.size(); ++k){
634 ta1 = (long double)TP[k];
635 if (ta1 == ta2 ) {
636 aRate = 1.e100;
637 } else {
638 aRate = ta2/(ta1-ta2);
639 }
640 aRate = aRate * (long double)(theBR * RP[k]);
641 aRate1 += aRate;
642 }
643 theRate = -aRate1;
644 Acoeffs.push_back(theRate);
646 theDecayRateVector.push_back(ratesToDaughter);
647 nEntry++;
648 }
649 }
650 }
651
652 delete summedDecayTable;
653
654 }
655 nS = nT;
656 nT = nEntry;
657 if (nS == nT) stable = true;
658 }
659
660
661
662
663
664
665
667
668
669 chainsFromParent.SetItsRates(theDecayRateVector);
670
671
672 theParentChainTable.push_back(chainsFromParent);
673}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
@ G4RadioactiveDecayModeSize
G4VDecayChannel * GetDecayChannel(G4int index) const
void Insert(G4VDecayChannel *aChannel)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
G4double GetExcitationEnergy() const
std::size_t NearestLevelIndex(const G4double energy, const std::size_t index=0) const
std::size_t NumberOfTransitions() const
G4double LifeTime(const std::size_t i) const
G4double NearestLevelEnergy(const G4double energy, const std::size_t index=0) const
G4RadioactiveDecayMode GetDecayMode() const
G4double GetDaughterExcitation() const
G4ParticleDefinition * GetDaughterNucleus()
const G4LevelManager * GetLevelManager(G4int Z, G4int A)
static G4NuclearLevelData * GetInstance()
G4int GetAtomicNumber() const
G4int GetAtomicMass() const
const G4String & GetParticleName() const
G4IonTable * GetIonTable() const
static G4ParticleTable * GetParticleTable()
void SetDecayRate(G4int, G4int, G4double, G4int, std::vector< G4double > &, std::vector< G4double > &)
G4bool IsApplicable(const G4ParticleDefinition &) override
static const G4double levelTolerance
G4DecayTable * GetDecayTable(const G4ParticleDefinition *)