Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // Use a few select constant of CLHEP namespace
44 using CLHEP::eV;
45 using CLHEP::keV;
46 using CLHEP::MeV;
47 using CLHEP::GeV;
48 #include "G4FFGEnumerations.hh"
52 #include "G4TableTemplate.hh"
53 
56 {
57  // Set the default verbosity
59 
60  // Initialize the class
61  Initialize();
62 }
63 
66 {
67  // Set the verbosity
69 
70  // Initialize the class
71  Initialize();
72 }
73 
75 Initialize( void )
76 {
78 
79  // Initialize the class descriptor variables to the default values. These
80  // will be used unless the user redefines them.
89 
90  // No data class has been created yet
91  YieldData_ = NULL;
93 
95 }
96 
99 {
101 
103  G4ThreeVector(0, 0, 0),
105 
106  // Call the overloaded function and generate 1 fission
107  std::vector< G4DynamicParticleVector* > FissionEvent = G4GenerateFission(1, Projectile);
108  G4DynamicParticleVector* Container = FissionEvent[0];
109 
111  return Container;
112 }
113 
115 G4GenerateFission( const G4HadProjectile& Projectile )
116 {
118 
119  // Call the overloaded function and generate 1 fission
120  std::vector< G4DynamicParticleVector* > FissionEvent = G4GenerateFission(1, Projectile);
121  G4DynamicParticleVector* const Container = FissionEvent[0];
122 
124  return Container;
125 }
126 
127 const std::vector< G4DynamicParticleVector* > G4FissionFragmentGenerator::
128 G4GenerateFission( G4long NumberOfFissions,
129  const G4HadProjectile& Projectile )
130 {
132 
133 
134  //TK Modified 131107
135  //std::vector< G4DynamicParticleVector* > FissionEvents(NumberOfFissions);
136  std::vector< G4DynamicParticleVector* > FissionEvents(0);
137 
138  if(Projectile.GetDefinition() == G4Neutron::Neutron())
139  {
141  {
142  // TODO Eliminate potential need for restructuring during run phase
143  //InitializeFissionProductYieldClass();
144  }
145 
146  for(G4long i = 0; i < NumberOfFissions; i++)
147  {
148  FissionEvents.push_back(YieldData_->G4GetFission());
149  // FIXME Use particle momentum in balance equation
150  // FissionEvents.push_back(YieldData_->G4GetFission(Projectile.Get4Momentum()));
151  }
152  } else
153  {
154  FissionEvents.push_back(NULL);
155  }
156 
158  return FissionEvents;
159 }
160 
163 {
165 
167  {
168  // TODO Eliminate potential need for restructuring during run phase
169  //InitializeFissionProductYieldClass();
170  }
171 
172  G4Ions* Product = YieldData_->G4GetFissionProduct();
173 
175  return Product;
176 }
177 
180 {
182 
184  return AlphaProduction_;
185 }
186 
189 {
191 
193  return TernaryProbability_;
194 }
195 
197 G4GetCause( void )
198 {
200 
202  return Cause_;
203 }
204 
207 {
209 
211  return IncidentEnergy_;
212 }
213 
216 {
218 
220  return Isotope_;
221 }
222 
225 {
227 
229  return MetaState_;
230 }
231 
234 {
236 
238  return SamplingScheme_;
239 }
240 
243 {
245 
247  return YieldType_;
248 }
249 
252 {
253  // Sanity check;
254  A %= 1000;
255  Z %= 1000;
256  M %= 10;
257 
258  return (A + Z * 1000) * 10 + M;
259 }
260 
262 G4SetAlphaProduction( G4double WhatAlphaProduction )
263 {
265 
266  AlphaProduction_ = WhatAlphaProduction;
267  if(YieldData_ != NULL)
268  {
269  YieldData_->G4SetAlphaProduction(AlphaProduction_);
270  }
271 
273  {
276 
277  G4cout << " -- Alpha production set to " << AlphaProduction_ << G4endl;
278  }
279 
281 }
282 
284 G4SetTernaryProbability( G4double WhatTernaryProbability )
285 {
287 
288  TernaryProbability_ = WhatTernaryProbability;
289  if(YieldData_ != NULL)
290  {
291  YieldData_->G4SetTernaryProbability(TernaryProbability_);
292  }
293 
295  {
298 
299  G4cout << " -- Ternary fission probability set to " << TernaryProbability_ << G4endl;
300  }
301 
303 }
304 
307 {
309 
310  G4bool IsValidCause = (WhichCause == G4FFGEnumerations::SPONTANEOUS
311  || WhichCause == G4FFGEnumerations::NEUTRON_INDUCED );
312  G4bool IsSameCause = (Cause_ == WhichCause);
313 
314  if(!IsSameCause && IsValidCause)
315  {
316  Cause_ = WhichCause;
318  {
319  IncidentEnergy_ = 0;
320  }
322  }
323 
325  {
326  G4String CauseString;
327  switch(WhichCause)
328  {
330  CauseString = "SPONTANEOUS";
331  break;
333  CauseString = "NEUTRON_INDUCED";
334  break;
336  CauseString = "PROTON_INDUCED";
337  break;
339  CauseString = "GAMMA_INDUCED";
340  break;
341  }
342 
344  {
347 
348  if(IsValidCause)
349  {
350  if(IsSameCause && YieldData_ != NULL)
351  {
352  G4cout << " -- Already set to use " << CauseString << " as the fission cause. Yield data class will not be reconstructed." << G4endl;
353  } else if(YieldData_ == NULL)
354  {
355  G4cout << " -- Yield data class not yet constructed. " << CauseString << " will be applied when it is constructed." << G4endl;
356  }
357  } else
358  {
359  G4cout << " -- Invalid cause of fission" << G4endl;
360  }
361  }
362 
364  && IsValidCause)
365  {
368 
369  G4cout << " -- Fission cause set to " << CauseString << "." << G4endl;
370  }
371  }
372 
374 }
375 
377 G4SetIncidentEnergy( G4double WhatIncidentEnergy )
378 {
380 
382  {
383  IncidentEnergy_ = WhatIncidentEnergy;
384  if(YieldData_ != NULL)
385  {
387  }
388  }
389 
391  {
392  std::ostringstream EnergyString;
393  if(IncidentEnergy_ / GeV > 1)
394  {
395  EnergyString << IncidentEnergy_ / GeV << " GeV";
396  } else if(IncidentEnergy_ / MeV > 1)
397  {
398  EnergyString << IncidentEnergy_ / MeV << " MeV";
399  } else if(IncidentEnergy_ / keV > 1)
400  {
401  EnergyString << IncidentEnergy_ / keV << " keV";
402  } else
403  {
404  EnergyString << IncidentEnergy_ / eV << " eV";
405  }
406 
409  {
411  {
414 
415  G4cout << " -- Cannot set a non-zero energy for spontaneous fission" << G4endl;
416  } else if(YieldData_ == NULL)
417  {
420 
421  G4cout << " -- Yield data class not yet constructed. " << EnergyString.str() << " will be applied when it is constructed." << G4endl;
422 
423  }
424  }
425 
428  {
431 
432  G4cout << " -- Incident neutron energy set to " << EnergyString.str() << "." << G4endl;
433  }
434  }
435 
437 }
438 
440 G4SetIsotope( G4int WhichIsotope )
441 {
443 
444  G4bool IsSameIsotope = (Isotope_ == WhichIsotope);
445 
446  if(!IsSameIsotope)
447  {
448  Isotope_ = WhichIsotope;
450  }
451 
453  {
455  {
456  if(IsSameIsotope && YieldData_ != NULL)
457  {
460 
461  G4cout << " -- Isotope " << Isotope_ << " already in use. Yield data class will not be reconstructed." << G4endl;
462  } else if(YieldData_ == NULL)
463  {
466 
467  G4cout << " -- Yield data class not yet constructed. The isotope will be set to " << Isotope_ << " when it is constructed." << G4endl;
468  }
469  }
470 
472  {
475 
476  G4cout << " -- Isotope set to " << Isotope_ << "." << G4endl;
477  }
478  }
479 
481 }
482 
485 {
487 
488  G4bool IsValidMetaState = (WhichMetaState >= G4FFGEnumerations::MetaStateFirst
489  && WhichMetaState <= G4FFGEnumerations::MetaStateLast);
490  G4bool IsSameMetaState = (MetaState_ == WhichMetaState);
491 
492  if(!IsSameMetaState && IsValidMetaState)
493  {
494  MetaState_ = WhichMetaState;
496  }
497 
499  {
500  G4String MetaName;
501  switch(MetaState_)
502  {
504  MetaName = "GROUND_STATE";
505  break;
506 
508  MetaName = "META_1";
509  break;
510 
512  MetaName = "META_2";
513  break;
514  }
515 
517  {
520 
521  std::ostringstream Temp;
522  if(IsValidMetaState)
523  {
524  if(IsSameMetaState && YieldData_ != NULL)
525  {
526  G4cout << " -- Already set to use " << MetaName << " as the metastable state. Yield data class will not be reconstructed" << G4endl;
527  } else if(YieldData_ == NULL)
528  {
529  G4cout << " -- Yield data class not yet constructed. " << MetaName << " will be applied when it is constructed." << G4endl;
530  }
531  } else
532  {
533  G4cout << " -- Invalid metastable state." << G4endl;
534  }
535  }
536 
538  && IsValidMetaState)
539  {
542 
543  G4cout << " -- Metastable state set to " << MetaName << "." << G4endl;
544  }
545  }
546 
548 }
549 
552 {
554 
555  G4bool IsValidScheme = (NewScheme >= G4FFGEnumerations::FissionSamplingSchemeFirst
557  G4bool IsSameScheme = (NewScheme == SamplingScheme_);
558 
559  if(!IsSameScheme && IsValidScheme)
560  {
561  SamplingScheme_ = NewScheme;
562  IsReconstructionNeeded_ = TRUE;
563  }
564 
565  if(Verbosity_ != G4FFGEnumerations::SILENT)
566  {
567  G4String SchemeString;
568  switch(SamplingScheme_)
569  {
571  SchemeString = "NORMAL";
572  break;
573 
575  SchemeString = "LIGHT_FRAGMENT";
576  break;
577 
578  default:
579  SchemeString = "UNSUPPORTED";
580  break;
581  }
582 
583  if(Verbosity_ & G4FFGEnumerations::WARNING)
584  {
587 
588  if(IsValidScheme)
589  {
590  if(IsSameScheme && YieldData_ != NULL)
591  {
592  G4cout << " -- Already set to use " << SchemeString << " as the sampling scheme. Yield data class will not be reconstructed." << G4endl;
593  } else if(YieldData_ == NULL)
594  {
595  G4cout << " -- Yield data class not yet constructed. " << SchemeString << " will be applied when it is constructed." << G4endl;
596  }
597  } else
598  {
599  G4cout << " -- Invalid sampling scheme." << G4endl;
600  }
601  }
602 
603  if((Verbosity_ & G4FFGEnumerations::UPDATES)
604  && IsValidScheme)
605  {
608 
609  G4cout << " -- Sampling scheme set to " << SchemeString << "." << G4endl;
610  }
611  }
612 
614 }
615 
618 {
620 
621  G4bool IsValidYieldType = (WhichYieldType == G4FFGEnumerations::INDEPENDENT
622  ||WhichYieldType == G4FFGEnumerations::CUMULATIVE);
623  G4bool IsSameYieldType = (YieldType_ == WhichYieldType);
624 
625  if(!IsSameYieldType && IsValidYieldType)
626  {
627  YieldType_ = WhichYieldType;
629  }
630 
632  {
633  G4String YieldString;
634  switch((int)YieldType_)
635  {
637  YieldString = "INDEPENDENT";
638  break;
639 
641  YieldString = "SPONTANEOUS";
642  break;
643 
644  default:
645  YieldString = "UNSUPPORTED";
646  break;
647  }
648 
650  {
653 
654  if(IsValidYieldType)
655  {
656 
657  if(IsSameYieldType && YieldData_ != NULL)
658  {
659  } else if(YieldData_ == NULL)
660  {
661  G4cout << " -- Yield data class not yet constructed. Yield type " << YieldString << " will be applied when it is constructed." << G4endl;
662  }
663  } else
664  {
665  G4cout << " -- Invalid yield type." << G4endl;
666  }
667  }
668 
670  && IsValidYieldType)
671  {
674 
675  G4cout << " -- Yield type set to " << YieldString << G4endl;
676  }
677  }
678 
680 }
681 
684 {
686 
688 
689  if(YieldData_ != NULL)
690  {
691  YieldData_->G4SetVerbosity(Verbosity_);
692  }
693 
695 }
696 
698 InitializeFissionProductYieldClass( std::istringstream& dataStream )
699 {
701 
702  if(YieldData_ != NULL)
703  {
704  delete YieldData_;
705 
707  {
710 
711  G4cout << " -- Old yield data class deleted." << G4endl;
712  }
713  }
714 
715  try
716  {
718  {
720  MetaState_,
721  Cause_,
722  YieldType_,
723  Verbosity_,
724  dataStream);
725  } else
726  {
728  MetaState_,
729  Cause_,
730  YieldType_,
731  Verbosity_,
732  dataStream);
733  }
734 
735  if(AlphaProduction_ != 0 && TernaryProbability_ != 0)
736  {
739  }
740 
742  {
745 
746  G4cout << " -- Yield data class constructed with defined values." << G4endl;
747  }
748  } catch (std::exception& e)
749  {
750  YieldData_ = NULL;
751  }
752 
754 
756  return YieldData_;
757 }
758 
761 {
763 
764  delete YieldData_;
765 
767 }
static const G4double AlphaProduction
G4FFGEnumerations::MetaState MetaState_
void G4SetSamplingScheme(G4FFGEnumerations::FissionSamplingScheme NewScheme)
CLHEP::Hep3Vector G4ThreeVector
static const G4FFGEnumerations::FissionSamplingScheme SamplingScheme
static constexpr double keV
void G4SetTernaryProbability(G4double TernaryProbability)
#define G4FFG_LOCATION__
G4FFGEnumerations::MetaState G4GetMetaState(void)
void G4SetYieldType(G4FFGEnumerations::YieldType WhichYieldType)
void G4SetMetaState(G4FFGEnumerations::MetaState WhichMetaState)
G4DynamicParticleVector * G4GenerateFission(void)
long G4long
Definition: G4Types.hh:80
G4DynamicParticleVector * G4GetFission(void)
G4FissionProductYieldDist * YieldData_
void G4SetAlphaProduction(G4double WhatAlphaProduction)
int G4int
Definition: G4Types.hh:78
static const G4int MetaStateLast
void G4SetVerbosity(G4int WhatVerbosity)
static G4int G4MakeIsotopeCode(G4int Z, G4int A, G4int M)
void G4SetVerbosity(G4int WhatVerbosity)
bool InitializeFissionProductYieldClass(std::istringstream &dataFile)
static const G4int MetaStateFirst
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
const G4ParticleDefinition * GetDefinition() const
Definition: G4Ions.hh:51
bool G4bool
Definition: G4Types.hh:79
static const G4double TernaryProbability
#define FALSE
Definition: globals.hh:52
static constexpr double MeV
static constexpr double eV
Definition: G4SIunits.hh:215
std::vector< G4DynamicParticle * > G4DynamicParticleVector
void G4SetIsotope(G4int WhichIsotope)
#define TRUE
Definition: globals.hh:55
void G4SetEnergy(G4double WhatIncidentEnergy)
G4FFGEnumerations::YieldType YieldType_
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4FFGEnumerations::YieldType G4GetYieldType(void)
static const G4int FissionSamplingSchemeFirst
static const G4int Isotope
static constexpr double eV
void G4SetAlphaProduction(G4double WhatAlphaProduction)
static constexpr double GeV
void G4SetCause(G4FFGEnumerations::FissionCause WhichCause)
void G4SetIncidentEnergy(G4double WhatIncidentEnergy)
G4FFGEnumerations::FissionSamplingScheme SamplingScheme_
static const G4FFGEnumerations::MetaState MetaState
static constexpr double GeV
Definition: G4SIunits.hh:217
#define G4FFG_FUNCTIONLEAVE__
G4FFGEnumerations::FissionCause G4GetCause(void)
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
#define G4FFG_SPACING__
static const G4FFGEnumerations::YieldType YieldType
void G4SetTernaryProbability(G4double WhatTernaryProbability)
double G4double
Definition: G4Types.hh:76
static const G4double ThermalNeutronEnergy
G4FFGEnumerations::FissionSamplingScheme G4GetSamplingScheme(void)
static constexpr double keV
Definition: G4SIunits.hh:216
#define G4FFG_FUNCTIONENTER__
static const G4FFGEnumerations::Verbosity Verbosity
static const G4FFGEnumerations::FissionCause FissionCause
G4FFGEnumerations::FissionCause Cause_
static const G4int FissionSamplingSchemeLast