Geant4 11.2.2
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 ([email protected])
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 for (G4long i = 0; i < NumberOfFissions; i++) {
138 FissionEvents.push_back(YieldData_->G4GetFission());
139 // FIXME Use particle momentum in balance equation
140 // FissionEvents.push_back(YieldData_->G4GetFission(Projectile.Get4Momentum()));
141 }
142 }
143 else {
144 FissionEvents.push_back(nullptr);
145 }
146
148 return FissionEvents;
149}
150
152{
154
155 if (static_cast<int>(IsReconstructionNeeded_) == TRUE) {
156 // TODO Eliminate potential need for restructuring during run phase
157 // InitializeFissionProductYieldClass();
158 }
159
161
163 return Product;
164}
165
173
181
189
197
205
213
221
229
231{
232 // Sanity check;
233 A %= 1000;
234 Z %= 1000;
235 M %= 10;
236
237 return (A + Z * 1000) * 10 + M;
238}
239
241{
243
244 AlphaProduction_ = WhatAlphaProduction;
245 if (YieldData_ != nullptr) {
247 }
248
252
253 G4cout << " -- Alpha production set to " << AlphaProduction_ << G4endl;
254 }
255
257}
258
260{
262
263 TernaryProbability_ = WhatTernaryProbability;
264 if (YieldData_ != nullptr) {
266 }
267
271
272 G4cout << " -- Ternary fission probability set to " << TernaryProbability_ << G4endl;
273 }
274
276}
277
279{
281
282 G4bool IsValidCause = (WhichCause == G4FFGEnumerations::SPONTANEOUS
283 || WhichCause == G4FFGEnumerations::NEUTRON_INDUCED);
284 G4bool IsSameCause = (Cause_ == WhichCause);
285
286 if (!IsSameCause && IsValidCause) {
287 Cause_ = WhichCause;
289 IncidentEnergy_ = 0;
290 }
292 }
293
295 G4String CauseString;
296 switch (WhichCause) {
298 CauseString = "SPONTANEOUS";
299 break;
301 CauseString = "NEUTRON_INDUCED";
302 break;
304 CauseString = "PROTON_INDUCED";
305 break;
307 CauseString = "GAMMA_INDUCED";
308 break;
309 }
310
314
315 if (IsValidCause) {
316 if (IsSameCause && YieldData_ != nullptr) {
317 G4cout << " -- Already set to use " << CauseString
318 << " as the fission cause. Yield data class will not be reconstructed." << G4endl;
319 }
320 else if (YieldData_ == nullptr) {
321 G4cout << " -- Yield data class not yet constructed. " << CauseString
322 << " will be applied when it is constructed." << G4endl;
323 }
324 }
325 else {
326 G4cout << " -- Invalid cause of fission" << G4endl;
327 }
328 }
329
330 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidCause) {
333
334 G4cout << " -- Fission cause set to " << CauseString << "." << G4endl;
335 }
336 }
337
339}
340
342{
344
346 IncidentEnergy_ = WhatIncidentEnergy;
347 if (YieldData_ != nullptr) {
349 }
350 }
351
353 std::ostringstream EnergyString;
354 if (IncidentEnergy_ / GeV > 1) {
355 EnergyString << IncidentEnergy_ / GeV << " GeV";
356 }
357 else if (IncidentEnergy_ / MeV > 1) {
358 EnergyString << IncidentEnergy_ / MeV << " MeV";
359 }
360 else if (IncidentEnergy_ / keV > 1) {
361 EnergyString << IncidentEnergy_ / keV << " keV";
362 }
363 else {
364 EnergyString << IncidentEnergy_ / eV << " eV";
365 }
366
369 {
373
374 G4cout << " -- Cannot set a non-zero energy for spontaneous fission" << G4endl;
375 }
376 else if (YieldData_ == nullptr) {
379
380 G4cout << " -- Yield data class not yet constructed. " << EnergyString.str()
381 << " will be applied when it is constructed." << G4endl;
382 }
383 }
384
387 {
390
391 G4cout << " -- Incident neutron energy set to " << EnergyString.str() << "." << G4endl;
392 }
393 }
394
396}
397
399{
401
402 G4bool IsSameIsotope = (Isotope_ == WhichIsotope);
403
404 if (!IsSameIsotope) {
405 Isotope_ = WhichIsotope;
407 }
408
411 if (IsSameIsotope && YieldData_ != nullptr) {
414
415 G4cout << " -- Isotope " << Isotope_
416 << " already in use. Yield data class will not be reconstructed." << G4endl;
417 }
418 else if (YieldData_ == nullptr) {
421
422 G4cout << " -- Yield data class not yet constructed. The isotope will be set to "
423 << Isotope_ << " when it is constructed." << G4endl;
424 }
425 }
426
430
431 G4cout << " -- Isotope set to " << Isotope_ << "." << G4endl;
432 }
433 }
434
436}
437
439{
441
442 G4bool IsValidMetaState = (WhichMetaState >= G4FFGEnumerations::MetaStateFirst
443 && WhichMetaState <= G4FFGEnumerations::MetaStateLast);
444 G4bool IsSameMetaState = (MetaState_ == WhichMetaState);
445
446 if (!IsSameMetaState && IsValidMetaState) {
447 MetaState_ = WhichMetaState;
449 }
450
452 G4String MetaName;
453 switch (MetaState_) {
455 MetaName = "GROUND_STATE";
456 break;
457
459 MetaName = "META_1";
460 break;
461
463 MetaName = "META_2";
464 break;
465 }
466
470
471 std::ostringstream Temp;
472 if (IsValidMetaState) {
473 if (IsSameMetaState && YieldData_ != nullptr) {
474 G4cout << " -- Already set to use " << MetaName
475 << " as the metastable state. Yield data class will not be reconstructed"
476 << G4endl;
477 }
478 else if (YieldData_ == nullptr) {
479 G4cout << " -- Yield data class not yet constructed. " << MetaName
480 << " will be applied when it is constructed." << G4endl;
481 }
482 }
483 else {
484 G4cout << " -- Invalid metastable state." << G4endl;
485 }
486 }
487
488 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidMetaState) {
491
492 G4cout << " -- Metastable state set to " << MetaName << "." << G4endl;
493 }
494 }
495
497}
498
499void G4FissionFragmentGenerator ::G4SetSamplingScheme(
501{
503
504 G4bool IsValidScheme = (NewScheme >= G4FFGEnumerations::FissionSamplingSchemeFirst
505 && NewScheme <= G4FFGEnumerations::FissionSamplingSchemeLast);
506 G4bool IsSameScheme = (NewScheme == SamplingScheme_);
507
508 if (!IsSameScheme && IsValidScheme) {
509 SamplingScheme_ = NewScheme;
510 IsReconstructionNeeded_ = TRUE;
511 }
512
513 if (Verbosity_ != G4FFGEnumerations::SILENT) {
514 G4String SchemeString;
515 switch (SamplingScheme_) {
517 SchemeString = "NORMAL";
518 break;
519
521 SchemeString = "LIGHT_FRAGMENT";
522 break;
523
524 default:
525 SchemeString = "UNSUPPORTED";
526 break;
527 }
528
529 if ((Verbosity_ & G4FFGEnumerations::WARNING) != 0) {
532
533 if (IsValidScheme) {
534 if (IsSameScheme && YieldData_ != nullptr) {
535 G4cout << " -- Already set to use " << SchemeString
536 << " as the sampling scheme. Yield data class will not be reconstructed."
537 << G4endl;
538 }
539 else if (YieldData_ == nullptr) {
540 G4cout << " -- Yield data class not yet constructed. " << SchemeString
541 << " will be applied when it is constructed." << G4endl;
542 }
543 }
544 else {
545 G4cout << " -- Invalid sampling scheme." << G4endl;
546 }
547 }
548
549 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidScheme) {
552
553 G4cout << " -- Sampling scheme set to " << SchemeString << "." << G4endl;
554 }
555 }
556
558}
559
561{
563
564 G4bool IsValidYieldType = (WhichYieldType == G4FFGEnumerations::INDEPENDENT
565 || WhichYieldType == G4FFGEnumerations::CUMULATIVE);
566 G4bool IsSameYieldType = (YieldType_ == WhichYieldType);
567
568 if (!IsSameYieldType && IsValidYieldType) {
569 YieldType_ = WhichYieldType;
571 }
572
574 G4String YieldString;
575 switch ((int)YieldType_) {
577 YieldString = "INDEPENDENT";
578 break;
579
581 YieldString = "SPONTANEOUS";
582 break;
583
584 default:
585 YieldString = "UNSUPPORTED";
586 break;
587 }
588
592
593 if (IsValidYieldType) {
594 if (IsSameYieldType && YieldData_ != nullptr) {
595 }
596 else if (YieldData_ == nullptr) {
597 G4cout << " -- Yield data class not yet constructed. Yield type " << YieldString
598 << " will be applied when it is constructed." << G4endl;
599 }
600 }
601 else {
602 G4cout << " -- Invalid yield type." << G4endl;
603 }
604 }
605
606 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidYieldType) {
609
610 G4cout << " -- Yield type set to " << YieldString << G4endl;
611 }
612 }
613
615}
616
618{
620
621 Verbosity_ = Verbosity;
622
623 if (YieldData_ != nullptr) {
625 }
626
628}
629
631{
633
634 if (YieldData_ != nullptr) {
635 delete YieldData_;
636
640
641 G4cout << " -- Old yield data class deleted." << G4endl;
642 }
643 }
644
645 try {
648 dataStream);
649 }
650 else {
652 Verbosity_, dataStream);
653 }
654
655 if (AlphaProduction_ != 0 && TernaryProbability_ != 0) {
658 }
659
663
664 G4cout << " -- Yield data class constructed with defined values." << G4endl;
665 }
666 }
667 catch (std::exception& e) {
668 YieldData_ = nullptr;
669 }
670
672
674 return YieldData_ != nullptr;
675}
676
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()
void G4SetEnergy(G4double WhatIncidentEnergy)
void G4SetAlphaProduction(G4double WhatAlphaProduction)
void G4SetVerbosity(G4int WhatVerbosity)
G4DynamicParticleVector * G4GetFission()
void G4SetTernaryProbability(G4double TernaryProbability)
const G4ParticleDefinition * GetDefinition() const
static G4Neutron * Neutron()
Definition G4Neutron.cc:101
#define TRUE
Definition globals.hh:41
#define FALSE
Definition globals.hh:38