Geant4  10.01.p01
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 
33 #include <iostream>
34 #include <vector>
35 
36 #include "G4Ions.hh"
37 #include "globals.hh"
38 #include "G4HadFinalState.hh"
39 #include "G4Neutron.hh"
40 
41 #include "G4FFGDebuggingMacros.hh"
42 #include "G4FFGDefaultValues.hh"
43 #include "G4FFGEnumerations.hh"
47 #include "G4TableTemplate.hh"
48 
51 {
52  // Set the default verbosity
54 
55  // Initialize the class
56  Initialize();
57 }
58 
61 {
62  // Set the verbosity
64 
65  // Initialize the class
66  Initialize();
67 }
68 
70 Initialize( void )
71 {
73 
74  // Initialize the class descriptor variables to the default values. These
75  // will be used unless the user redefines them.
84 
85  // No data class has been created yet
86  YieldData_ = NULL;
88 
90 }
91 
94 {
96 
98  G4ThreeVector(0, 0, 0),
100 
101  // Call the overloaded function and generate 1 fission
102  std::vector< G4DynamicParticleVector* > FissionEvent = G4GenerateFission(1, Projectile);
103  G4DynamicParticleVector* Container = FissionEvent[0];
104 
106  return Container;
107 }
108 
110 G4GenerateFission( const G4HadProjectile& Projectile )
111 {
113 
114  // Call the overloaded function and generate 1 fission
115  std::vector< G4DynamicParticleVector* > FissionEvent = G4GenerateFission(1, Projectile);
116  G4DynamicParticleVector* const Container = FissionEvent[0];
117 
119  return Container;
120 }
121 
122 const std::vector< G4DynamicParticleVector* > G4FissionFragmentGenerator::
123 G4GenerateFission( G4long NumberOfFissions,
124  const G4HadProjectile& Projectile )
125 {
127 
128 
129  //TK Modified 131107
130  //std::vector< G4DynamicParticleVector* > FissionEvents(NumberOfFissions);
131  std::vector< G4DynamicParticleVector* > FissionEvents(0);
132 
133  if(Projectile.GetDefinition() == G4Neutron::Neutron())
134  {
136  {
137  // TODO Eliminate potential need for restructuring during run phase
138  //InitializeFissionProductYieldClass();
139  }
140 
141  for(G4long i = 0; i < NumberOfFissions; i++)
142  {
143  FissionEvents.push_back(YieldData_->G4GetFission());
144  // FIXME Use particle momentum in balance equation
145  // FissionEvents.push_back(YieldData_->G4GetFission(Projectile.Get4Momentum()));
146  }
147  } else
148  {
149  FissionEvents.push_back(NULL);
150  }
151 
153  return FissionEvents;
154 }
155 
158 {
160 
162  {
163  // TODO Eliminate potential need for restructuring during run phase
164  //InitializeFissionProductYieldClass();
165  }
166 
167  G4Ions* Product = YieldData_->G4GetFissionProduct();
168 
170  return Product;
171 }
172 
175 {
177 
179  return AlphaProduction_;
180 }
181 
184 {
186 
188  return TernaryProbability_;
189 }
190 
192 G4GetCause( void )
193 {
195 
197  return Cause_;
198 }
199 
202 {
204 
206  return IncidentEnergy_;
207 }
208 
211 {
213 
215  return Isotope_;
216 }
217 
220 {
222 
224  return MetaState_;
225 }
226 
229 {
231 
233  return SamplingScheme_;
234 }
235 
238 {
240 
242  return YieldType_;
243 }
244 
247 {
248  // Sanity check;
249  A %= 1000;
250  Z %= 1000;
251  M %= 10;
252 
253  return (A + Z * 1000) * 10 + M;
254 }
255 
257 G4SetAlphaProduction( G4double WhatAlphaProduction )
258 {
260 
261  AlphaProduction_ = WhatAlphaProduction;
262  if(YieldData_ != NULL)
263  {
264  YieldData_->G4SetAlphaProduction(AlphaProduction_);
265  }
266 
268  {
271 
272  G4cout << " -- Alpha production set to " << AlphaProduction_ << G4endl;
273  }
274 
276 }
277 
279 G4SetTernaryProbability( G4double WhatTernaryProbability )
280 {
282 
283  TernaryProbability_ = WhatTernaryProbability;
284  if(YieldData_ != NULL)
285  {
286  YieldData_->G4SetTernaryProbability(TernaryProbability_);
287  }
288 
290  {
293 
294  G4cout << " -- Ternary fission probability set to " << TernaryProbability_ << G4endl;
295  }
296 
298 }
299 
302 {
304 
305  G4bool IsValidCause = (WhichCause == G4FFGEnumerations::SPONTANEOUS
306  || WhichCause == G4FFGEnumerations::NEUTRON_INDUCED );
307  G4bool IsSameCause = (Cause_ == WhichCause);
308 
309  if(!IsSameCause && IsValidCause)
310  {
311  Cause_ = WhichCause;
313  {
314  IncidentEnergy_ = 0;
315  }
317  }
318 
320  {
321  G4String CauseString;
322  switch(WhichCause)
323  {
325  CauseString = "SPONTANEOUS";
326  break;
328  CauseString = "NEUTRON_INDUCED";
329  break;
331  CauseString = "PROTON_INDUCED";
332  break;
334  CauseString = "GAMMA_INDUCED";
335  break;
336  }
337 
339  {
342 
343  if(IsValidCause)
344  {
345  if(IsSameCause && YieldData_ != NULL)
346  {
347  G4cout << " -- Already set to use " << CauseString << " as the fission cause. Yield data class will not be reconstructed." << G4endl;
348  } else if(YieldData_ == NULL)
349  {
350  G4cout << " -- Yield data class not yet constructed. " << CauseString << " will be applied when it is constructed." << G4endl;
351  }
352  } else
353  {
354  G4cout << " -- Invalid cause of fission" << G4endl;
355  }
356  }
357 
359  && IsValidCause)
360  {
363 
364  G4cout << " -- Fission cause set to " << CauseString << "." << G4endl;
365  }
366  }
367 
369 }
370 
372 G4SetIncidentEnergy( G4double WhatIncidentEnergy )
373 {
375 
377  {
378  IncidentEnergy_ = WhatIncidentEnergy;
379  if(YieldData_ != NULL)
380  {
382  }
383  }
384 
386  {
387  std::ostringstream EnergyString;
388  if(IncidentEnergy_ / GeV > 1)
389  {
390  EnergyString << IncidentEnergy_ / GeV << " GeV";
391  } else if(IncidentEnergy_ / MeV > 1)
392  {
393  EnergyString << IncidentEnergy_ / MeV << " MeV";
394  } else if(IncidentEnergy_ / keV > 1)
395  {
396  EnergyString << IncidentEnergy_ / keV << " keV";
397  } else
398  {
399  EnergyString << IncidentEnergy_ / eV << " eV";
400  }
401 
404  {
406  {
409 
410  G4cout << " -- Cannot set a non-zero energy for spontaneous fission" << G4endl;
411  } else if(YieldData_ == NULL)
412  {
415 
416  G4cout << " -- Yield data class not yet constructed. " << EnergyString.str() << " will be applied when it is constructed." << G4endl;
417 
418  }
419  }
420 
423  {
426 
427  G4cout << " -- Incident neutron energy set to " << EnergyString.str() << "." << G4endl;
428  }
429  }
430 
432 }
433 
435 G4SetIsotope( G4int WhichIsotope )
436 {
438 
439  G4bool IsSameIsotope = (Isotope_ == WhichIsotope);
440 
441  if(!IsSameIsotope)
442  {
443  Isotope_ = WhichIsotope;
445  }
446 
448  {
450  {
451  if(IsSameIsotope && YieldData_ != NULL)
452  {
455 
456  G4cout << " -- Isotope " << Isotope_ << " already in use. Yield data class will not be reconstructed." << G4endl;
457  } else if(YieldData_ == NULL)
458  {
461 
462  G4cout << " -- Yield data class not yet constructed. The isotope will be set to " << Isotope_ << " when it is constructed." << G4endl;
463  }
464  }
465 
467  {
470 
471  G4cout << " -- Isotope set to " << Isotope_ << "." << G4endl;
472  }
473  }
474 
476 }
477 
480 {
482 
483  G4bool IsValidMetaState = (WhichMetaState >= G4FFGEnumerations::MetaStateFirst
484  && WhichMetaState <= G4FFGEnumerations::MetaStateLast);
485  G4bool IsSameMetaState = (MetaState_ == WhichMetaState);
486 
487  if(!IsSameMetaState && IsValidMetaState)
488  {
489  MetaState_ = WhichMetaState;
491  }
492 
494  {
495  G4String MetaName;
496  switch(MetaState_)
497  {
499  MetaName = "GROUND_STATE";
500  break;
501 
503  MetaName = "META_1";
504  break;
505 
507  MetaName = "META_2";
508  break;
509  }
510 
512  {
515 
516  std::ostringstream Temp;
517  if(IsValidMetaState)
518  {
519  if(IsSameMetaState && YieldData_ != NULL)
520  {
521  G4cout << " -- Already set to use " << MetaName << " as the metastable state. Yield data class will not be reconstructed" << G4endl;
522  } else if(YieldData_ == NULL)
523  {
524  G4cout << " -- Yield data class not yet constructed. " << MetaName << " will be applied when it is constructed." << G4endl;
525  }
526  } else
527  {
528  G4cout << " -- Invalid metastable state." << G4endl;
529  }
530  }
531 
533  && IsValidMetaState)
534  {
537 
538  G4cout << " -- Metastable state set to " << MetaName << "." << G4endl;
539  }
540  }
541 
543 }
544 
547 {
549 
550  G4bool IsValidScheme = (NewScheme >= G4FFGEnumerations::FissionSamplingSchemeFirst
552  G4bool IsSameScheme = (NewScheme == SamplingScheme_);
553 
554  if(!IsSameScheme && IsValidScheme)
555  {
556  SamplingScheme_ = NewScheme;
557  IsReconstructionNeeded_ = TRUE;
558  }
559 
560  if(Verbosity_ != G4FFGEnumerations::SILENT)
561  {
562  G4String SchemeString;
563  switch(SamplingScheme_)
564  {
566  SchemeString = "NORMAL";
567  break;
568 
570  SchemeString = "LIGHT_FRAGMENT";
571  break;
572 
573  default:
574  SchemeString = "UNSUPPORTED";
575  break;
576  }
577 
578  if(Verbosity_ & G4FFGEnumerations::WARNING)
579  {
582 
583  if(IsValidScheme)
584  {
585  if(IsSameScheme && YieldData_ != NULL)
586  {
587  G4cout << " -- Already set to use " << SchemeString << " as the sampling scheme. Yield data class will not be reconstructed." << G4endl;
588  } else if(YieldData_ == NULL)
589  {
590  G4cout << " -- Yield data class not yet constructed. " << SchemeString << " will be applied when it is constructed." << G4endl;
591  }
592  } else
593  {
594  G4cout << " -- Invalid sampling scheme." << G4endl;
595  }
596  }
597 
598  if((Verbosity_ & G4FFGEnumerations::UPDATES)
599  && IsValidScheme)
600  {
603 
604  G4cout << " -- Sampling scheme set to " << SchemeString << "." << G4endl;
605  }
606  }
607 
609 }
610 
613 {
615 
616  G4bool IsValidYieldType = (WhichYieldType == G4FFGEnumerations::INDEPENDENT
617  ||WhichYieldType == G4FFGEnumerations::CUMULATIVE);
618  G4bool IsSameYieldType = (YieldType_ == WhichYieldType);
619 
620  if(!IsSameYieldType && IsValidYieldType)
621  {
622  YieldType_ = WhichYieldType;
624  }
625 
627  {
628  G4String YieldString;
629  switch((int)YieldType_)
630  {
632  YieldString = "INDEPENDENT";
633  break;
634 
636  YieldString = "SPONTANEOUS";
637  break;
638 
639  default:
640  YieldString = "UNSUPPORTED";
641  break;
642  }
643 
645  {
648 
649  if(IsValidYieldType)
650  {
651 
652  if(IsSameYieldType && YieldData_ != NULL)
653  {
654  } else if(YieldData_ == NULL)
655  {
656  G4cout << " -- Yield data class not yet constructed. Yield type " << YieldString << " will be applied when it is constructed." << G4endl;
657  }
658  } else
659  {
660  G4cout << " -- Invalid yield type." << G4endl;
661  }
662  }
663 
665  && IsValidYieldType)
666  {
669 
670  G4cout << " -- Yield type set to " << YieldString << G4endl;
671  }
672  }
673 
675 }
676 
679 {
681 
683 
684  if(YieldData_ != NULL)
685  {
686  YieldData_->G4SetVerbosity(Verbosity_);
687  }
688 
690 }
691 
693 InitializeFissionProductYieldClass( std::istringstream& dataStream )
694 {
696 
697  if(YieldData_ != NULL)
698  {
699  delete YieldData_;
700 
702  {
705 
706  G4cout << " -- Old yield data class deleted." << G4endl;
707  }
708  }
709 
710  try
711  {
713  {
715  MetaState_,
716  Cause_,
717  YieldType_,
718  Verbosity_,
719  dataStream);
720  } else
721  {
723  MetaState_,
724  Cause_,
725  YieldType_,
726  Verbosity_,
727  dataStream);
728  }
729 
730  if(AlphaProduction_ != 0 && TernaryProbability_ != 0)
731  {
734  }
735 
737  {
740 
741  G4cout << " -- Yield data class constructed with defined values." << G4endl;
742  }
743  } catch (std::exception& e)
744  {
745  YieldData_ = NULL;
746  }
747 
749 
751  return YieldData_;
752 }
753 
756 {
758 
759  delete YieldData_;
760 
762 }
static const G4double AlphaProduction
Default alpha production in a ternary fission.
G4FFGEnumerations::MetaState MetaState_
MetaState information of the isotope that G4FissionFragmentGenerator references A value of 0 refers...
G4DynamicParticleVector * G4GenerateFission(const G4HadProjectile &Projectile)
Generates a single fission event.
MetaState
ENDF format provides for 3 isomers - 1 ground state and 2 meta states.
G4bool IsReconstructionNeeded_
If Isotope_, MetaState_, Cause_, or IncidentEnergy_ are changed in the middle of a run then the class...
static const double MeV
Definition: G4SIunits.hh:193
G4double IncidentEnergy_
Kinetic energy, if any, of the incident particle in GeV.
void G4SetSamplingScheme(G4FFGEnumerations::FissionSamplingScheme NewScheme)
Set the sampling scheme.
void Initialize(void)
Initialize is a common function called by all constructors.
G4FPYBiasedLightFragmentDist is an inherited class of G4FissionProductYield that only samples the 'li...
CLHEP::Hep3Vector G4ThreeVector
static const G4FFGEnumerations::FissionSamplingScheme SamplingScheme
Default sampling scheme.
G4int G4GetIsotope(void)
Returns the code of the fission isotope in ZZZAAA format.
void G4SetTernaryProbability(G4double TernaryProbability)
Sets the probability of ternary fission.
#define G4FFG_LOCATION__
G4FFG_LOCATION__ outputs the current location in the code.
G4FFGEnumerations::MetaState G4GetMetaState(void)
Returns the MetaState of the fission isotope.
void G4SetYieldType(G4FFGEnumerations::YieldType WhichYieldType)
Sets the ENDF yield type to be used for the data.
void G4SetMetaState(G4FFGEnumerations::MetaState WhichMetaState)
Sets the metastable state of the fission isotope.
G4int Isotope_
Number in ZZZAAA format of the isotope that G4FissionFragmentGenerator references.
G4DynamicParticleVector * G4GenerateFission(void)
Generates a single fission event.
long G4long
Definition: G4Types.hh:80
G4DynamicParticleVector * G4GetFission(void)
Generates a fission event using default sampling and returns the pointer to that fission event...
G4FissionProductYieldDist * YieldData_
Pointer to G4FissionProductYieldDist class that holds all the probabilistic yield data...
void G4SetAlphaProduction(G4double WhatAlphaProduction)
Set the alpha production behavior for fission event generation.
YieldType
The two types of fission data available.
int G4int
Definition: G4Types.hh:78
static const G4int MetaStateLast
The last value of MetaState.
void G4SetVerbosity(G4int WhatVerbosity)
Sets the verbosity levels.
static G4int G4MakeIsotopeCode(G4int Z, G4int A, G4int M)
Converts the Z, A and M of an isotope into an integer representation.
FissionCause
Causes of fission.
Verbosity
These are the verbosity levels.
void G4SetVerbosity(G4int WhatVerbosity)
Sets the verbosity levels.
G4Ions * G4GenerateFissionProduct(void)
Returns a randomly sampled fission product.
bool InitializeFissionProductYieldClass(std::istringstream &dataFile)
Initializes a new G4FPY...Dist class based on the class descriptor variables of G4FissionFragmentGene...
static const G4int MetaStateFirst
The first value of MetaState.
G4GLOB_DLL std::ostream G4cout
G4double TernaryProbability_
Sets the ternary fission probability.
const G4ParticleDefinition * GetDefinition() const
Definition: G4Ions.hh:51
bool G4bool
Definition: G4Types.hh:79
static const G4double TernaryProbability
Default probabilility of a ternary fission.
#define FALSE
Definition: globals.hh:52
std::vector< G4DynamicParticle * > G4DynamicParticleVector
void G4SetIsotope(G4int WhichIsotope)
Sets the fission isotope.
#define TRUE
Definition: globals.hh:55
static const double GeV
Definition: G4SIunits.hh:196
void G4SetEnergy(G4double WhatIncidentEnergy)
Sets the energy of the incident particle.
G4FFGEnumerations::YieldType YieldType_
The type of yield to be used: INDEPENDET or CUMULATIVE.
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4FFGEnumerations::YieldType G4GetYieldType(void)
Returns the yield type that is currently in use.
static const G4int FissionSamplingSchemeFirst
The first value of FissionSamplingScheme.
static const G4int Isotope
Default Isotope.
static const G4double A[nN]
void G4SetAlphaProduction(G4double WhatAlphaProduction)
Sets the number of alpha particles produced in fission.
static const double eV
Definition: G4SIunits.hh:194
void G4SetCause(G4FFGEnumerations::FissionCause WhichCause)
Sets the cause of fission event.
G4double AlphaProduction_
Controls whether alpha particles are emitted, and how many.
void G4SetIncidentEnergy(G4double WhatIncidentEnergy)
Sets the incident energy, if any, of the particle that cause fission.
G4FFGEnumerations::FissionSamplingScheme SamplingScheme_
The sampling scheme that is used: NORMAL, LIGHT_FRAGMENT, or WENDT.
static const G4FFGEnumerations::MetaState MetaState
Default meta state.
FissionSamplingScheme
The possible fission sampling methods.
#define G4FFG_FUNCTIONLEAVE__
G4FFGEnumerations::FissionCause G4GetCause(void)
Returns the FissionCause of the fission event.
#define G4endl
Definition: G4ios.hh:61
#define G4FFG_SPACING__
G4FFG_SPACING__ indents the debug messages according to the debugging depth.
static const G4FFGEnumerations::YieldType YieldType
Default yield type.
static const double keV
Definition: G4SIunits.hh:195
G4double G4GetIncidentEnergy(void)
Returns the energy of the fission inducing particle.
G4double G4GetTernaryProbability(void)
Returns the probability of ternary fission.
void G4SetTernaryProbability(G4double WhatTernaryProbability)
Sets the probability of ternary fission.
double G4double
Definition: G4Types.hh:76
static const G4double ThermalNeutronEnergy
The energy of thermal neutrons.
G4FFGEnumerations::FissionSamplingScheme G4GetSamplingScheme(void)
Returns the FissionSamplingScheme that is currently in use.
G4Ions * G4GetFissionProduct(void)
Selects a fission fragment at random from the probability tree and returns the G4Ions pointer...
G4FPYNormalFragmentDist is an inherited class of G4FissionProductYield that samples fission fragments...
#define G4FFG_FUNCTIONENTER__
G4double G4GetAlphaProduction(void)
Returns the production rate of alpha particles for fission events.
static const G4FFGEnumerations::Verbosity Verbosity
Verbosity for the entire package.
static const G4FFGEnumerations::FissionCause FissionCause
Default fission cause.
G4FissionFragmentGenerator(void)
Default constructor.
G4FFGEnumerations::FissionCause Cause_
The cause of fission: SPONTANEOUS or N_INDUCED.
~G4FissionFragmentGenerator()
Default deconstructor.
static const G4int FissionSamplingSchemeLast
The last value of FissionSamplingScheme.