Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FissionFragmentGenerator.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26/*
27 * File: G4FissionFragmentGenerator.cc
28 * Author: B. Wendt (wendbryc@isu.edu)
29 *
30 * Created on May 11, 2011, 12:04 PM
31 */
32
34#include "G4FFGDefaultValues.hh"
35#include "G4HadFinalState.hh"
36#include "G4Ions.hh"
37#include "G4Neutron.hh"
38#include "globals.hh"
39
40#include <iostream>
41#include <vector>
42// Use a few select constant of CLHEP namespace
43using CLHEP::eV;
44using CLHEP::GeV;
45using CLHEP::keV;
46using CLHEP::MeV;
47#include "G4FFGEnumerations.hh"
51#include "G4TableTemplate.hh"
52
54{
55 // Set the default verbosity
56 Verbosity_ = G4FFGDefaultValues::Verbosity;
57
58 // Initialize the class
59 Initialize();
60}
61
63{
64 // Set the verbosity
65 Verbosity_ = Verbosity;
66
67 // Initialize the class
68 Initialize();
69}
70
72{
74
75 // Initialize the class descriptor variables to the default values. These
76 // will be used unless the user redefines them.
77 Isotope_ = G4FFGDefaultValues::Isotope;
78 MetaState_ = G4FFGDefaultValues::MetaState;
79 Cause_ = G4FFGDefaultValues::FissionCause;
80 IncidentEnergy_ = G4FFGDefaultValues::ThermalNeutronEnergy;
81 YieldType_ = G4FFGDefaultValues::YieldType;
82 TernaryProbability_ = G4FFGDefaultValues::TernaryProbability;
83 AlphaProduction_ = G4FFGDefaultValues::AlphaProduction;
84 SamplingScheme_ = G4FFGDefaultValues::SamplingScheme;
85
86 // No data class has been created yet
87 YieldData_ = nullptr;
89
91}
92
94{
96
98 G4FFGDefaultValues::ThermalNeutronEnergy));
99
100 // Call the overloaded function and generate 1 fission
101 std::vector<G4DynamicParticleVector*> FissionEvent = G4GenerateFission(1, Projectile);
102 G4DynamicParticleVector* Container = FissionEvent[0];
103
105 return Container;
106}
107
110{
112
113 // Call the overloaded function and generate 1 fission
114 std::vector<G4DynamicParticleVector*> FissionEvent = G4GenerateFission(1, Projectile);
115 G4DynamicParticleVector* const Container = FissionEvent[0];
116
118 return Container;
119}
120
121const std::vector<G4DynamicParticleVector*>
123 const G4HadProjectile& Projectile)
124{
126
127 // TK Modified 131107
128 // std::vector< G4DynamicParticleVector* > FissionEvents(NumberOfFissions);
129 std::vector<G4DynamicParticleVector*> FissionEvents(0);
130
131 if (Projectile.GetDefinition() == G4Neutron::Neutron()) {
132 if (static_cast<int>(IsReconstructionNeeded_) == TRUE) {
133 // TODO Eliminate potential need for restructuring during run phase
134 // InitializeFissionProductYieldClass();
135 }
136
137 if (nullptr != YieldData_) {
138 for (G4long i = 0; i < NumberOfFissions; i++) {
139 FissionEvents.push_back(YieldData_->G4GetFission());
140 // FIXME Use particle momentum in balance equation
141 // FissionEvents.push_back(YieldData_->G4GetFission(Projectile.Get4Momentum()));
142 }
143 }
144 }
145 else {
146 FissionEvents.push_back(nullptr);
147 }
148
150 return FissionEvents;
151}
152
154{
156
157 if (static_cast<int>(IsReconstructionNeeded_) == TRUE) {
158 // TODO Eliminate potential need for restructuring during run phase
159 // InitializeFissionProductYieldClass();
160 }
161
162 G4Ions* Product = YieldData_->G4GetFissionProduct();
163
165 return Product;
166}
167
175
183
191
199
207
215
223
231
233{
234 // Sanity check;
235 A %= 1000;
236 Z %= 1000;
237 M %= 10;
238
239 return (A + Z * 1000) * 10 + M;
240}
241
243{
245
246 AlphaProduction_ = WhatAlphaProduction;
247 if (YieldData_ != nullptr) {
248 YieldData_->G4SetAlphaProduction(AlphaProduction_);
249 }
250
254
255 G4cout << " -- Alpha production set to " << AlphaProduction_ << G4endl;
256 }
257
259}
260
262{
264
265 TernaryProbability_ = WhatTernaryProbability;
266 if (YieldData_ != nullptr) {
267 YieldData_->G4SetTernaryProbability(TernaryProbability_);
268 }
269
273
274 G4cout << " -- Ternary fission probability set to " << TernaryProbability_ << G4endl;
275 }
276
278}
279
281{
283
284 G4bool IsValidCause = (WhichCause == G4FFGEnumerations::SPONTANEOUS
285 || WhichCause == G4FFGEnumerations::NEUTRON_INDUCED);
286 G4bool IsSameCause = (Cause_ == WhichCause);
287
288 if (!IsSameCause && IsValidCause) {
289 Cause_ = WhichCause;
291 IncidentEnergy_ = 0;
292 }
294 }
295
297 G4String CauseString;
298 switch (WhichCause) {
300 CauseString = "SPONTANEOUS";
301 break;
303 CauseString = "NEUTRON_INDUCED";
304 break;
306 CauseString = "PROTON_INDUCED";
307 break;
309 CauseString = "GAMMA_INDUCED";
310 break;
311 }
312
316
317 if (IsValidCause) {
318 if (IsSameCause && YieldData_ != nullptr) {
319 G4cout << " -- Already set to use " << CauseString
320 << " as the fission cause. Yield data class will not be reconstructed." << G4endl;
321 }
322 else if (YieldData_ == nullptr) {
323 G4cout << " -- Yield data class not yet constructed. " << CauseString
324 << " will be applied when it is constructed." << G4endl;
325 }
326 }
327 else {
328 G4cout << " -- Invalid cause of fission" << G4endl;
329 }
330 }
331
332 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidCause) {
335
336 G4cout << " -- Fission cause set to " << CauseString << "." << G4endl;
337 }
338 }
339
341}
342
344{
346
348 IncidentEnergy_ = WhatIncidentEnergy;
349 if (YieldData_ != nullptr) {
350 YieldData_->G4SetEnergy(IncidentEnergy_);
351 }
352 }
353
355 std::ostringstream EnergyString;
356 if (IncidentEnergy_ / GeV > 1) {
357 EnergyString << IncidentEnergy_ / GeV << " GeV";
358 }
359 else if (IncidentEnergy_ / MeV > 1) {
360 EnergyString << IncidentEnergy_ / MeV << " MeV";
361 }
362 else if (IncidentEnergy_ / keV > 1) {
363 EnergyString << IncidentEnergy_ / keV << " keV";
364 }
365 else {
366 EnergyString << IncidentEnergy_ / eV << " eV";
367 }
368
371 {
375
376 G4cout << " -- Cannot set a non-zero energy for spontaneous fission" << G4endl;
377 }
378 else if (YieldData_ == nullptr) {
381
382 G4cout << " -- Yield data class not yet constructed. " << EnergyString.str()
383 << " will be applied when it is constructed." << G4endl;
384 }
385 }
386
389 {
392
393 G4cout << " -- Incident neutron energy set to " << EnergyString.str() << "." << G4endl;
394 }
395 }
396
398}
399
401{
403
404 G4bool IsSameIsotope = (Isotope_ == WhichIsotope);
405
406 if (!IsSameIsotope) {
407 Isotope_ = WhichIsotope;
409 }
410
413 if (IsSameIsotope && YieldData_ != nullptr) {
416
417 G4cout << " -- Isotope " << Isotope_
418 << " already in use. Yield data class will not be reconstructed." << G4endl;
419 }
420 else if (YieldData_ == nullptr) {
423
424 G4cout << " -- Yield data class not yet constructed. The isotope will be set to "
425 << Isotope_ << " when it is constructed." << G4endl;
426 }
427 }
428
432
433 G4cout << " -- Isotope set to " << Isotope_ << "." << G4endl;
434 }
435 }
436
438}
439
441{
443
444 G4bool IsValidMetaState = (WhichMetaState >= G4FFGEnumerations::MetaStateFirst
445 && WhichMetaState <= G4FFGEnumerations::MetaStateLast);
446 G4bool IsSameMetaState = (MetaState_ == WhichMetaState);
447
448 if (!IsSameMetaState && IsValidMetaState) {
449 MetaState_ = WhichMetaState;
451 }
452
454 G4String MetaName;
455 switch (MetaState_) {
457 MetaName = "GROUND_STATE";
458 break;
459
461 MetaName = "META_1";
462 break;
463
465 MetaName = "META_2";
466 break;
467 }
468
472
473 std::ostringstream Temp;
474 if (IsValidMetaState) {
475 if (IsSameMetaState && YieldData_ != nullptr) {
476 G4cout << " -- Already set to use " << MetaName
477 << " as the metastable state. Yield data class will not be reconstructed"
478 << G4endl;
479 }
480 else if (YieldData_ == nullptr) {
481 G4cout << " -- Yield data class not yet constructed. " << MetaName
482 << " will be applied when it is constructed." << G4endl;
483 }
484 }
485 else {
486 G4cout << " -- Invalid metastable state." << G4endl;
487 }
488 }
489
490 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidMetaState) {
493
494 G4cout << " -- Metastable state set to " << MetaName << "." << G4endl;
495 }
496 }
497
499}
500
501void G4FissionFragmentGenerator ::G4SetSamplingScheme(
503{
505
506 G4bool IsValidScheme = (NewScheme >= G4FFGEnumerations::FissionSamplingSchemeFirst
507 && NewScheme <= G4FFGEnumerations::FissionSamplingSchemeLast);
508 G4bool IsSameScheme = (NewScheme == SamplingScheme_);
509
510 if (!IsSameScheme && IsValidScheme) {
511 SamplingScheme_ = NewScheme;
513 }
514
516 G4String SchemeString;
517 switch (SamplingScheme_) {
519 SchemeString = "NORMAL";
520 break;
521
523 SchemeString = "LIGHT_FRAGMENT";
524 break;
525
526 default:
527 SchemeString = "UNSUPPORTED";
528 break;
529 }
530
534
535 if (IsValidScheme) {
536 if (IsSameScheme && YieldData_ != nullptr) {
537 G4cout << " -- Already set to use " << SchemeString
538 << " as the sampling scheme. Yield data class will not be reconstructed."
539 << G4endl;
540 }
541 else if (YieldData_ == nullptr) {
542 G4cout << " -- Yield data class not yet constructed. " << SchemeString
543 << " will be applied when it is constructed." << G4endl;
544 }
545 }
546 else {
547 G4cout << " -- Invalid sampling scheme." << G4endl;
548 }
549 }
550
551 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidScheme) {
554
555 G4cout << " -- Sampling scheme set to " << SchemeString << "." << G4endl;
556 }
557 }
558
560}
561
563{
565
566 G4bool IsValidYieldType = (WhichYieldType == G4FFGEnumerations::INDEPENDENT
567 || WhichYieldType == G4FFGEnumerations::CUMULATIVE);
568 G4bool IsSameYieldType = (YieldType_ == WhichYieldType);
569
570 if (!IsSameYieldType && IsValidYieldType) {
571 YieldType_ = WhichYieldType;
573 }
574
576 G4String YieldString;
577 switch ((int)YieldType_) {
579 YieldString = "INDEPENDENT";
580 break;
581
583 YieldString = "SPONTANEOUS";
584 break;
585
586 default:
587 YieldString = "UNSUPPORTED";
588 break;
589 }
590
594
595 if (IsValidYieldType) {
596 if (IsSameYieldType && YieldData_ != nullptr) {
597 }
598 else if (YieldData_ == nullptr) {
599 G4cout << " -- Yield data class not yet constructed. Yield type " << YieldString
600 << " will be applied when it is constructed." << G4endl;
601 }
602 }
603 else {
604 G4cout << " -- Invalid yield type." << G4endl;
605 }
606 }
607
608 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidYieldType) {
611
612 G4cout << " -- Yield type set to " << YieldString << G4endl;
613 }
614 }
615
617}
618
620{
622
623 Verbosity_ = Verbosity;
624
625 if (YieldData_ != nullptr) {
626 YieldData_->G4SetVerbosity(Verbosity_);
627 }
628
630}
631
633{
635
636 if (YieldData_ != nullptr) {
637 delete YieldData_;
638
642
643 G4cout << " -- Old yield data class deleted." << G4endl;
644 }
645 }
646
647 try {
650 dataStream);
651 }
652 else {
654 Verbosity_, dataStream);
655 }
656
657 if (AlphaProduction_ != 0 && TernaryProbability_ != 0) {
658 YieldData_->G4SetTernaryProbability(TernaryProbability_);
659 YieldData_->G4SetAlphaProduction(AlphaProduction_);
660 }
661
665
666 G4cout << " -- Yield data class constructed with defined values." << G4endl;
667 }
668 }
669 catch (std::exception& e) {
670 YieldData_ = nullptr;
671 }
672
674
676 return YieldData_ != nullptr;
677}
678
std::vector< G4DynamicParticle * > G4DynamicParticleVector
#define G4FFG_FUNCTIONLEAVE__
#define G4FFG_FUNCTIONENTER__
#define G4FFG_LOCATION__
#define G4FFG_SPACING__
#define M(row, col)
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
long G4long
Definition G4Types.hh:87
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
const G4double A[17]
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4FFGEnumerations::MetaState MetaState_
bool InitializeFissionProductYieldClass(std::istringstream &dataFile)
G4FFGEnumerations::YieldType YieldType_
void G4SetYieldType(G4FFGEnumerations::YieldType WhichYieldType)
G4FFGEnumerations::MetaState G4GetMetaState()
G4FissionProductYieldDist * YieldData_
G4FFGEnumerations::FissionCause Cause_
void G4SetMetaState(G4FFGEnumerations::MetaState WhichMetaState)
void G4SetAlphaProduction(G4double WhatAlphaProduction)
G4FFGEnumerations::FissionSamplingScheme SamplingScheme_
G4FFGEnumerations::YieldType G4GetYieldType()
G4FFGEnumerations::FissionCause G4GetCause()
static G4int G4MakeIsotopeCode(G4int Z, G4int A, G4int M)
G4FFGEnumerations::FissionSamplingScheme G4GetSamplingScheme()
void G4SetCause(G4FFGEnumerations::FissionCause WhichCause)
void G4SetTernaryProbability(G4double WhatTernaryProbability)
void G4SetIncidentEnergy(G4double WhatIncidentEnergy)
void G4SetVerbosity(G4int WhatVerbosity)
G4DynamicParticleVector * G4GenerateFission()
const G4ParticleDefinition * GetDefinition() const
static G4Neutron * Neutron()
Definition G4Neutron.cc:101
#define TRUE
Definition globals.hh:41
#define FALSE
Definition globals.hh:38