Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /* 26 /* 27 * File: G4FissionFragmentGenerator.cc 27 * File: G4FissionFragmentGenerator.cc 28 * Author: B. Wendt (wendbryc@isu.edu) 28 * Author: B. Wendt (wendbryc@isu.edu) 29 * 29 * 30 * Created on May 11, 2011, 12:04 PM 30 * Created on May 11, 2011, 12:04 PM 31 */ 31 */ 32 32 33 #include "G4FFGDebuggingMacros.hh" 33 #include "G4FFGDebuggingMacros.hh" 34 #include "G4FFGDefaultValues.hh" 34 #include "G4FFGDefaultValues.hh" 35 #include "G4HadFinalState.hh" 35 #include "G4HadFinalState.hh" 36 #include "G4Ions.hh" 36 #include "G4Ions.hh" 37 #include "G4Neutron.hh" 37 #include "G4Neutron.hh" 38 #include "globals.hh" 38 #include "globals.hh" 39 39 40 #include <iostream> 40 #include <iostream> 41 #include <vector> 41 #include <vector> 42 // Use a few select constant of CLHEP namespac 42 // Use a few select constant of CLHEP namespace 43 using CLHEP::eV; 43 using CLHEP::eV; 44 using CLHEP::GeV; 44 using CLHEP::GeV; 45 using CLHEP::keV; 45 using CLHEP::keV; 46 using CLHEP::MeV; 46 using CLHEP::MeV; 47 #include "G4FFGEnumerations.hh" 47 #include "G4FFGEnumerations.hh" 48 #include "G4FPYBiasedLightFragmentDist.hh" 48 #include "G4FPYBiasedLightFragmentDist.hh" 49 #include "G4FPYNormalFragmentDist.hh" 49 #include "G4FPYNormalFragmentDist.hh" 50 #include "G4FissionFragmentGenerator.hh" 50 #include "G4FissionFragmentGenerator.hh" 51 #include "G4TableTemplate.hh" 51 #include "G4TableTemplate.hh" 52 52 53 G4FissionFragmentGenerator::G4FissionFragmentG 53 G4FissionFragmentGenerator::G4FissionFragmentGenerator() 54 { 54 { 55 // Set the default verbosity 55 // Set the default verbosity 56 Verbosity_ = G4FFGDefaultValues::Verbosity; 56 Verbosity_ = G4FFGDefaultValues::Verbosity; 57 57 58 // Initialize the class 58 // Initialize the class 59 Initialize(); 59 Initialize(); 60 } 60 } 61 61 62 G4FissionFragmentGenerator::G4FissionFragmentG 62 G4FissionFragmentGenerator::G4FissionFragmentGenerator(G4int Verbosity) 63 { 63 { 64 // Set the verbosity 64 // Set the verbosity 65 Verbosity_ = Verbosity; 65 Verbosity_ = Verbosity; 66 66 67 // Initialize the class 67 // Initialize the class 68 Initialize(); 68 Initialize(); 69 } 69 } 70 70 71 void G4FissionFragmentGenerator::Initialize() 71 void G4FissionFragmentGenerator::Initialize() 72 { 72 { 73 G4FFG_FUNCTIONENTER__ 73 G4FFG_FUNCTIONENTER__ 74 74 75 // Initialize the class descriptor variables 75 // Initialize the class descriptor variables to the default values. These 76 // will be used unless the user redefines th 76 // will be used unless the user redefines them. 77 Isotope_ = G4FFGDefaultValues::Isotope; 77 Isotope_ = G4FFGDefaultValues::Isotope; 78 MetaState_ = G4FFGDefaultValues::MetaState; 78 MetaState_ = G4FFGDefaultValues::MetaState; 79 Cause_ = G4FFGDefaultValues::FissionCause; 79 Cause_ = G4FFGDefaultValues::FissionCause; 80 IncidentEnergy_ = G4FFGDefaultValues::Therma 80 IncidentEnergy_ = G4FFGDefaultValues::ThermalNeutronEnergy; 81 YieldType_ = G4FFGDefaultValues::YieldType; 81 YieldType_ = G4FFGDefaultValues::YieldType; 82 TernaryProbability_ = G4FFGDefaultValues::Te 82 TernaryProbability_ = G4FFGDefaultValues::TernaryProbability; 83 AlphaProduction_ = G4FFGDefaultValues::Alpha 83 AlphaProduction_ = G4FFGDefaultValues::AlphaProduction; 84 SamplingScheme_ = G4FFGDefaultValues::Sampli 84 SamplingScheme_ = G4FFGDefaultValues::SamplingScheme; 85 85 86 // No data class has been created yet 86 // No data class has been created yet 87 YieldData_ = nullptr; 87 YieldData_ = nullptr; 88 IsReconstructionNeeded_ = TRUE; 88 IsReconstructionNeeded_ = TRUE; 89 89 90 G4FFG_FUNCTIONLEAVE__ 90 G4FFG_FUNCTIONLEAVE__ 91 } 91 } 92 92 93 G4DynamicParticleVector* G4FissionFragmentGene 93 G4DynamicParticleVector* G4FissionFragmentGenerator::G4GenerateFission() 94 { 94 { 95 G4FFG_FUNCTIONENTER__ 95 G4FFG_FUNCTIONENTER__ 96 96 97 const G4HadProjectile Projectile(G4DynamicPa 97 const G4HadProjectile Projectile(G4DynamicParticle(G4Neutron::Neutron(), G4ThreeVector(0, 0, 0), 98 98 G4FFGDefaultValues::ThermalNeutronEnergy)); 99 99 100 // Call the overloaded function and generate 100 // Call the overloaded function and generate 1 fission 101 std::vector<G4DynamicParticleVector*> Fissio 101 std::vector<G4DynamicParticleVector*> FissionEvent = G4GenerateFission(1, Projectile); 102 G4DynamicParticleVector* Container = Fission 102 G4DynamicParticleVector* Container = FissionEvent[0]; 103 103 104 G4FFG_FUNCTIONLEAVE__ 104 G4FFG_FUNCTIONLEAVE__ 105 return Container; 105 return Container; 106 } 106 } 107 107 108 G4DynamicParticleVector* 108 G4DynamicParticleVector* 109 G4FissionFragmentGenerator::G4GenerateFission( 109 G4FissionFragmentGenerator::G4GenerateFission(const G4HadProjectile& Projectile) 110 { 110 { 111 G4FFG_FUNCTIONENTER__ 111 G4FFG_FUNCTIONENTER__ 112 112 113 // Call the overloaded function and generate 113 // Call the overloaded function and generate 1 fission 114 std::vector<G4DynamicParticleVector*> Fissio 114 std::vector<G4DynamicParticleVector*> FissionEvent = G4GenerateFission(1, Projectile); 115 G4DynamicParticleVector* const Container = F 115 G4DynamicParticleVector* const Container = FissionEvent[0]; 116 116 117 G4FFG_FUNCTIONLEAVE__ 117 G4FFG_FUNCTIONLEAVE__ 118 return Container; 118 return Container; 119 } 119 } 120 120 121 const std::vector<G4DynamicParticleVector*> 121 const std::vector<G4DynamicParticleVector*> 122 G4FissionFragmentGenerator::G4GenerateFission( 122 G4FissionFragmentGenerator::G4GenerateFission(G4long NumberOfFissions, 123 123 const G4HadProjectile& Projectile) 124 { 124 { 125 G4FFG_FUNCTIONENTER__ 125 G4FFG_FUNCTIONENTER__ 126 126 127 // TK Modified 131107 127 // TK Modified 131107 128 // std::vector< G4DynamicParticleVector* > F 128 // std::vector< G4DynamicParticleVector* > FissionEvents(NumberOfFissions); 129 std::vector<G4DynamicParticleVector*> Fissio 129 std::vector<G4DynamicParticleVector*> FissionEvents(0); 130 130 131 if (Projectile.GetDefinition() == G4Neutron: 131 if (Projectile.GetDefinition() == G4Neutron::Neutron()) { 132 if (static_cast<int>(IsReconstructionNeede 132 if (static_cast<int>(IsReconstructionNeeded_) == TRUE) { 133 // TODO Eliminate potential need for res 133 // TODO Eliminate potential need for restructuring during run phase 134 // InitializeFissionProductYieldClass(); 134 // InitializeFissionProductYieldClass(); 135 } 135 } 136 136 137 for (G4long i = 0; i < NumberOfFissions; i 137 for (G4long i = 0; i < NumberOfFissions; i++) { 138 FissionEvents.push_back(YieldData_->G4Ge 138 FissionEvents.push_back(YieldData_->G4GetFission()); 139 // FIXME Use particle momentum in balanc 139 // FIXME Use particle momentum in balance equation 140 // FissionEvents.push_back(YieldData_->G 140 // FissionEvents.push_back(YieldData_->G4GetFission(Projectile.Get4Momentum())); 141 } 141 } 142 } 142 } 143 else { 143 else { 144 FissionEvents.push_back(nullptr); 144 FissionEvents.push_back(nullptr); 145 } 145 } 146 146 147 G4FFG_FUNCTIONLEAVE__ 147 G4FFG_FUNCTIONLEAVE__ 148 return FissionEvents; 148 return FissionEvents; 149 } 149 } 150 150 151 G4Ions* G4FissionFragmentGenerator::G4Generate 151 G4Ions* G4FissionFragmentGenerator::G4GenerateFissionProduct() 152 { 152 { 153 G4FFG_FUNCTIONENTER__ 153 G4FFG_FUNCTIONENTER__ 154 154 155 if (static_cast<int>(IsReconstructionNeeded_ 155 if (static_cast<int>(IsReconstructionNeeded_) == TRUE) { 156 // TODO Eliminate potential need for restr 156 // TODO Eliminate potential need for restructuring during run phase 157 // InitializeFissionProductYieldClass(); 157 // InitializeFissionProductYieldClass(); 158 } 158 } 159 159 160 G4Ions* Product = YieldData_->G4GetFissionPr 160 G4Ions* Product = YieldData_->G4GetFissionProduct(); 161 161 162 G4FFG_FUNCTIONLEAVE__ 162 G4FFG_FUNCTIONLEAVE__ 163 return Product; 163 return Product; 164 } 164 } 165 165 166 G4double G4FissionFragmentGenerator::G4GetAlph 166 G4double G4FissionFragmentGenerator::G4GetAlphaProduction() 167 { 167 { 168 G4FFG_FUNCTIONENTER__ 168 G4FFG_FUNCTIONENTER__ 169 169 170 G4FFG_FUNCTIONLEAVE__ 170 G4FFG_FUNCTIONLEAVE__ 171 return AlphaProduction_; 171 return AlphaProduction_; 172 } 172 } 173 173 174 G4double G4FissionFragmentGenerator::G4GetTern 174 G4double G4FissionFragmentGenerator::G4GetTernaryProbability() 175 { 175 { 176 G4FFG_FUNCTIONENTER__ 176 G4FFG_FUNCTIONENTER__ 177 177 178 G4FFG_FUNCTIONLEAVE__ 178 G4FFG_FUNCTIONLEAVE__ 179 return TernaryProbability_; 179 return TernaryProbability_; 180 } 180 } 181 181 182 G4FFGEnumerations::FissionCause G4FissionFragm 182 G4FFGEnumerations::FissionCause G4FissionFragmentGenerator::G4GetCause() 183 { 183 { 184 G4FFG_FUNCTIONENTER__ 184 G4FFG_FUNCTIONENTER__ 185 185 186 G4FFG_FUNCTIONLEAVE__ 186 G4FFG_FUNCTIONLEAVE__ 187 return Cause_; 187 return Cause_; 188 } 188 } 189 189 190 G4double G4FissionFragmentGenerator::G4GetInci 190 G4double G4FissionFragmentGenerator::G4GetIncidentEnergy() 191 { 191 { 192 G4FFG_FUNCTIONENTER__ 192 G4FFG_FUNCTIONENTER__ 193 193 194 G4FFG_FUNCTIONLEAVE__ 194 G4FFG_FUNCTIONLEAVE__ 195 return IncidentEnergy_; 195 return IncidentEnergy_; 196 } 196 } 197 197 198 G4int G4FissionFragmentGenerator::G4GetIsotope 198 G4int G4FissionFragmentGenerator::G4GetIsotope() 199 { 199 { 200 G4FFG_FUNCTIONENTER__ 200 G4FFG_FUNCTIONENTER__ 201 201 202 G4FFG_FUNCTIONLEAVE__ 202 G4FFG_FUNCTIONLEAVE__ 203 return Isotope_; 203 return Isotope_; 204 } 204 } 205 205 206 G4FFGEnumerations::MetaState G4FissionFragment 206 G4FFGEnumerations::MetaState G4FissionFragmentGenerator::G4GetMetaState() 207 { 207 { 208 G4FFG_FUNCTIONENTER__ 208 G4FFG_FUNCTIONENTER__ 209 209 210 G4FFG_FUNCTIONLEAVE__ 210 G4FFG_FUNCTIONLEAVE__ 211 return MetaState_; 211 return MetaState_; 212 } 212 } 213 213 214 G4FFGEnumerations::FissionSamplingScheme G4Fis 214 G4FFGEnumerations::FissionSamplingScheme G4FissionFragmentGenerator::G4GetSamplingScheme() 215 { 215 { 216 G4FFG_FUNCTIONENTER__ 216 G4FFG_FUNCTIONENTER__ 217 217 218 G4FFG_FUNCTIONLEAVE__ 218 G4FFG_FUNCTIONLEAVE__ 219 return SamplingScheme_; 219 return SamplingScheme_; 220 } 220 } 221 221 222 G4FFGEnumerations::YieldType G4FissionFragment 222 G4FFGEnumerations::YieldType G4FissionFragmentGenerator::G4GetYieldType() 223 { 223 { 224 G4FFG_FUNCTIONENTER__ 224 G4FFG_FUNCTIONENTER__ 225 225 226 G4FFG_FUNCTIONLEAVE__ 226 G4FFG_FUNCTIONLEAVE__ 227 return YieldType_; 227 return YieldType_; 228 } 228 } 229 229 230 G4int G4FissionFragmentGenerator::G4MakeIsotop 230 G4int G4FissionFragmentGenerator::G4MakeIsotopeCode(G4int Z, G4int A, G4int M) 231 { 231 { 232 // Sanity check; 232 // Sanity check; 233 A %= 1000; 233 A %= 1000; 234 Z %= 1000; 234 Z %= 1000; 235 M %= 10; 235 M %= 10; 236 236 237 return (A + Z * 1000) * 10 + M; 237 return (A + Z * 1000) * 10 + M; 238 } 238 } 239 239 240 void G4FissionFragmentGenerator::G4SetAlphaPro 240 void G4FissionFragmentGenerator::G4SetAlphaProduction(G4double WhatAlphaProduction) 241 { 241 { 242 G4FFG_FUNCTIONENTER__ 242 G4FFG_FUNCTIONENTER__ 243 243 244 AlphaProduction_ = WhatAlphaProduction; 244 AlphaProduction_ = WhatAlphaProduction; 245 if (YieldData_ != nullptr) { 245 if (YieldData_ != nullptr) { 246 YieldData_->G4SetAlphaProduction(AlphaProd 246 YieldData_->G4SetAlphaProduction(AlphaProduction_); 247 } 247 } 248 248 249 if ((Verbosity_ & G4FFGEnumerations::UPDATES 249 if ((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) { 250 G4FFG_SPACING__ 250 G4FFG_SPACING__ 251 G4FFG_LOCATION__ 251 G4FFG_LOCATION__ 252 252 253 G4cout << " -- Alpha production set to " < 253 G4cout << " -- Alpha production set to " << AlphaProduction_ << G4endl; 254 } 254 } 255 255 256 G4FFG_FUNCTIONLEAVE__ 256 G4FFG_FUNCTIONLEAVE__ 257 } 257 } 258 258 259 void G4FissionFragmentGenerator::G4SetTernaryP 259 void G4FissionFragmentGenerator::G4SetTernaryProbability(G4double WhatTernaryProbability) 260 { 260 { 261 G4FFG_FUNCTIONENTER__ 261 G4FFG_FUNCTIONENTER__ 262 262 263 TernaryProbability_ = WhatTernaryProbability 263 TernaryProbability_ = WhatTernaryProbability; 264 if (YieldData_ != nullptr) { 264 if (YieldData_ != nullptr) { 265 YieldData_->G4SetTernaryProbability(Ternar 265 YieldData_->G4SetTernaryProbability(TernaryProbability_); 266 } 266 } 267 267 268 if ((Verbosity_ & G4FFGEnumerations::UPDATES 268 if ((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) { 269 G4FFG_SPACING__ 269 G4FFG_SPACING__ 270 G4FFG_LOCATION__ 270 G4FFG_LOCATION__ 271 271 272 G4cout << " -- Ternary fission probability 272 G4cout << " -- Ternary fission probability set to " << TernaryProbability_ << G4endl; 273 } 273 } 274 274 275 G4FFG_FUNCTIONLEAVE__ 275 G4FFG_FUNCTIONLEAVE__ 276 } 276 } 277 277 278 void G4FissionFragmentGenerator::G4SetCause(G4 278 void G4FissionFragmentGenerator::G4SetCause(G4FFGEnumerations::FissionCause WhichCause) 279 { 279 { 280 G4FFG_FUNCTIONENTER__ 280 G4FFG_FUNCTIONENTER__ 281 281 282 G4bool IsValidCause = (WhichCause == G4FFGEn 282 G4bool IsValidCause = (WhichCause == G4FFGEnumerations::SPONTANEOUS 283 || WhichCause == G4FF 283 || WhichCause == G4FFGEnumerations::NEUTRON_INDUCED); 284 G4bool IsSameCause = (Cause_ == WhichCause); 284 G4bool IsSameCause = (Cause_ == WhichCause); 285 285 286 if (!IsSameCause && IsValidCause) { 286 if (!IsSameCause && IsValidCause) { 287 Cause_ = WhichCause; 287 Cause_ = WhichCause; 288 if (Cause_ == G4FFGEnumerations::SPONTANEO 288 if (Cause_ == G4FFGEnumerations::SPONTANEOUS) { 289 IncidentEnergy_ = 0; 289 IncidentEnergy_ = 0; 290 } 290 } 291 IsReconstructionNeeded_ = TRUE; 291 IsReconstructionNeeded_ = TRUE; 292 } 292 } 293 293 294 if (Verbosity_ != G4FFGEnumerations::SILENT) 294 if (Verbosity_ != G4FFGEnumerations::SILENT) { 295 G4String CauseString; 295 G4String CauseString; 296 switch (WhichCause) { 296 switch (WhichCause) { 297 case G4FFGEnumerations::SPONTANEOUS: 297 case G4FFGEnumerations::SPONTANEOUS: 298 CauseString = "SPONTANEOUS"; 298 CauseString = "SPONTANEOUS"; 299 break; 299 break; 300 case G4FFGEnumerations::NEUTRON_INDUCED: 300 case G4FFGEnumerations::NEUTRON_INDUCED: 301 CauseString = "NEUTRON_INDUCED"; 301 CauseString = "NEUTRON_INDUCED"; 302 break; 302 break; 303 case G4FFGEnumerations::PROTON_INDUCED: 303 case G4FFGEnumerations::PROTON_INDUCED: 304 CauseString = "PROTON_INDUCED"; 304 CauseString = "PROTON_INDUCED"; 305 break; 305 break; 306 case G4FFGEnumerations::GAMMA_INDUCED: 306 case G4FFGEnumerations::GAMMA_INDUCED: 307 CauseString = "GAMMA_INDUCED"; 307 CauseString = "GAMMA_INDUCED"; 308 break; 308 break; 309 } 309 } 310 310 311 if ((Verbosity_ & G4FFGEnumerations::WARNI 311 if ((Verbosity_ & G4FFGEnumerations::WARNING) != 0) { 312 G4FFG_SPACING__ 312 G4FFG_SPACING__ 313 G4FFG_LOCATION__ 313 G4FFG_LOCATION__ 314 314 315 if (IsValidCause) { 315 if (IsValidCause) { 316 if (IsSameCause && YieldData_ != nullp 316 if (IsSameCause && YieldData_ != nullptr) { 317 G4cout << " -- Already set to use " 317 G4cout << " -- Already set to use " << CauseString 318 << " as the fission cause. Yi 318 << " as the fission cause. Yield data class will not be reconstructed." << G4endl; 319 } 319 } 320 else if (YieldData_ == nullptr) { 320 else if (YieldData_ == nullptr) { 321 G4cout << " -- Yield data class not 321 G4cout << " -- Yield data class not yet constructed. " << CauseString 322 << " will be applied when it 322 << " will be applied when it is constructed." << G4endl; 323 } 323 } 324 } 324 } 325 else { 325 else { 326 G4cout << " -- Invalid cause of fissio 326 G4cout << " -- Invalid cause of fission" << G4endl; 327 } 327 } 328 } 328 } 329 329 330 if (((Verbosity_ & G4FFGEnumerations::UPDA 330 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidCause) { 331 G4FFG_SPACING__ 331 G4FFG_SPACING__ 332 G4FFG_LOCATION__ 332 G4FFG_LOCATION__ 333 333 334 G4cout << " -- Fission cause set to " << 334 G4cout << " -- Fission cause set to " << CauseString << "." << G4endl; 335 } 335 } 336 } 336 } 337 337 338 G4FFG_FUNCTIONLEAVE__ 338 G4FFG_FUNCTIONLEAVE__ 339 } 339 } 340 340 341 void G4FissionFragmentGenerator::G4SetIncident 341 void G4FissionFragmentGenerator::G4SetIncidentEnergy(G4double WhatIncidentEnergy) 342 { 342 { 343 G4FFG_FUNCTIONENTER__ 343 G4FFG_FUNCTIONENTER__ 344 344 345 if (Cause_ != G4FFGEnumerations::SPONTANEOUS 345 if (Cause_ != G4FFGEnumerations::SPONTANEOUS) { 346 IncidentEnergy_ = WhatIncidentEnergy; 346 IncidentEnergy_ = WhatIncidentEnergy; 347 if (YieldData_ != nullptr) { 347 if (YieldData_ != nullptr) { 348 YieldData_->G4SetEnergy(IncidentEnergy_) 348 YieldData_->G4SetEnergy(IncidentEnergy_); 349 } 349 } 350 } 350 } 351 351 352 if (Verbosity_ != G4FFGEnumerations::SILENT) 352 if (Verbosity_ != G4FFGEnumerations::SILENT) { 353 std::ostringstream EnergyString; 353 std::ostringstream EnergyString; 354 if (IncidentEnergy_ / GeV > 1) { 354 if (IncidentEnergy_ / GeV > 1) { 355 EnergyString << IncidentEnergy_ / GeV << 355 EnergyString << IncidentEnergy_ / GeV << " GeV"; 356 } 356 } 357 else if (IncidentEnergy_ / MeV > 1) { 357 else if (IncidentEnergy_ / MeV > 1) { 358 EnergyString << IncidentEnergy_ / MeV << 358 EnergyString << IncidentEnergy_ / MeV << " MeV"; 359 } 359 } 360 else if (IncidentEnergy_ / keV > 1) { 360 else if (IncidentEnergy_ / keV > 1) { 361 EnergyString << IncidentEnergy_ / keV << 361 EnergyString << IncidentEnergy_ / keV << " keV"; 362 } 362 } 363 else { 363 else { 364 EnergyString << IncidentEnergy_ / eV << 364 EnergyString << IncidentEnergy_ / eV << " eV"; 365 } 365 } 366 366 367 if (((Verbosity_ & G4FFGEnumerations::ENER 367 if (((Verbosity_ & G4FFGEnumerations::ENERGY_INFO) != 0) 368 || ((Verbosity_ & G4FFGEnumerations::W 368 || ((Verbosity_ & G4FFGEnumerations::WARNING) != 0)) 369 { 369 { 370 if (Cause_ == G4FFGEnumerations::SPONTAN 370 if (Cause_ == G4FFGEnumerations::SPONTANEOUS && IncidentEnergy_ != 0) { 371 G4FFG_SPACING__ 371 G4FFG_SPACING__ 372 G4FFG_LOCATION__ 372 G4FFG_LOCATION__ 373 373 374 G4cout << " -- Cannot set a non-zero e 374 G4cout << " -- Cannot set a non-zero energy for spontaneous fission" << G4endl; 375 } 375 } 376 else if (YieldData_ == nullptr) { 376 else if (YieldData_ == nullptr) { 377 G4FFG_SPACING__ 377 G4FFG_SPACING__ 378 G4FFG_LOCATION__ 378 G4FFG_LOCATION__ 379 379 380 G4cout << " -- Yield data class not ye 380 G4cout << " -- Yield data class not yet constructed. " << EnergyString.str() 381 << " will be applied when it is 381 << " will be applied when it is constructed." << G4endl; 382 } 382 } 383 } 383 } 384 384 385 if (((Verbosity_ & G4FFGEnumerations::ENER 385 if (((Verbosity_ & G4FFGEnumerations::ENERGY_INFO) != 0) 386 || ((Verbosity_ & G4FFGEnumerations::U 386 || ((Verbosity_ & G4FFGEnumerations::UPDATES) != 0)) 387 { 387 { 388 G4FFG_SPACING__ 388 G4FFG_SPACING__ 389 G4FFG_LOCATION__ 389 G4FFG_LOCATION__ 390 390 391 G4cout << " -- Incident neutron energy s 391 G4cout << " -- Incident neutron energy set to " << EnergyString.str() << "." << G4endl; 392 } 392 } 393 } 393 } 394 394 395 G4FFG_FUNCTIONLEAVE__ 395 G4FFG_FUNCTIONLEAVE__ 396 } 396 } 397 397 398 void G4FissionFragmentGenerator::G4SetIsotope( 398 void G4FissionFragmentGenerator::G4SetIsotope(G4int WhichIsotope) 399 { 399 { 400 G4FFG_FUNCTIONENTER__ 400 G4FFG_FUNCTIONENTER__ 401 401 402 G4bool IsSameIsotope = (Isotope_ == WhichIso 402 G4bool IsSameIsotope = (Isotope_ == WhichIsotope); 403 403 404 if (!IsSameIsotope) { 404 if (!IsSameIsotope) { 405 Isotope_ = WhichIsotope; 405 Isotope_ = WhichIsotope; 406 IsReconstructionNeeded_ = TRUE; 406 IsReconstructionNeeded_ = TRUE; 407 } 407 } 408 408 409 if (Verbosity_ != G4FFGEnumerations::SILENT) 409 if (Verbosity_ != G4FFGEnumerations::SILENT) { 410 if ((Verbosity_ & G4FFGEnumerations::WARNI 410 if ((Verbosity_ & G4FFGEnumerations::WARNING) != 0) { 411 if (IsSameIsotope && YieldData_ != nullp 411 if (IsSameIsotope && YieldData_ != nullptr) { 412 G4FFG_SPACING__ 412 G4FFG_SPACING__ 413 G4FFG_LOCATION__ 413 G4FFG_LOCATION__ 414 414 415 G4cout << " -- Isotope " << Isotope_ 415 G4cout << " -- Isotope " << Isotope_ 416 << " already in use. Yield data 416 << " already in use. Yield data class will not be reconstructed." << G4endl; 417 } 417 } 418 else if (YieldData_ == nullptr) { 418 else if (YieldData_ == nullptr) { 419 G4FFG_SPACING__ 419 G4FFG_SPACING__ 420 G4FFG_LOCATION__ 420 G4FFG_LOCATION__ 421 421 422 G4cout << " -- Yield data class not ye 422 G4cout << " -- Yield data class not yet constructed. The isotope will be set to " 423 << Isotope_ << " when it is con 423 << Isotope_ << " when it is constructed." << G4endl; 424 } 424 } 425 } 425 } 426 426 427 if ((Verbosity_ & G4FFGEnumerations::UPDAT 427 if ((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) { 428 G4FFG_SPACING__ 428 G4FFG_SPACING__ 429 G4FFG_LOCATION__ 429 G4FFG_LOCATION__ 430 430 431 G4cout << " -- Isotope set to " << Isoto 431 G4cout << " -- Isotope set to " << Isotope_ << "." << G4endl; 432 } 432 } 433 } 433 } 434 434 435 G4FFG_FUNCTIONLEAVE__ 435 G4FFG_FUNCTIONLEAVE__ 436 } 436 } 437 437 438 void G4FissionFragmentGenerator::G4SetMetaStat 438 void G4FissionFragmentGenerator::G4SetMetaState(G4FFGEnumerations::MetaState WhichMetaState) 439 { 439 { 440 G4FFG_FUNCTIONENTER__ 440 G4FFG_FUNCTIONENTER__ 441 441 442 G4bool IsValidMetaState = (WhichMetaState >= 442 G4bool IsValidMetaState = (WhichMetaState >= G4FFGEnumerations::MetaStateFirst 443 && WhichMetaState 443 && WhichMetaState <= G4FFGEnumerations::MetaStateLast); 444 G4bool IsSameMetaState = (MetaState_ == Whic 444 G4bool IsSameMetaState = (MetaState_ == WhichMetaState); 445 445 446 if (!IsSameMetaState && IsValidMetaState) { 446 if (!IsSameMetaState && IsValidMetaState) { 447 MetaState_ = WhichMetaState; 447 MetaState_ = WhichMetaState; 448 IsReconstructionNeeded_ = TRUE; 448 IsReconstructionNeeded_ = TRUE; 449 } 449 } 450 450 451 if (Verbosity_ != G4FFGEnumerations::SILENT) 451 if (Verbosity_ != G4FFGEnumerations::SILENT) { 452 G4String MetaName; 452 G4String MetaName; 453 switch (MetaState_) { 453 switch (MetaState_) { 454 case G4FFGEnumerations::GROUND_STATE: 454 case G4FFGEnumerations::GROUND_STATE: 455 MetaName = "GROUND_STATE"; 455 MetaName = "GROUND_STATE"; 456 break; 456 break; 457 457 458 case G4FFGEnumerations::META_1: 458 case G4FFGEnumerations::META_1: 459 MetaName = "META_1"; 459 MetaName = "META_1"; 460 break; 460 break; 461 461 462 case G4FFGEnumerations::META_2: 462 case G4FFGEnumerations::META_2: 463 MetaName = "META_2"; 463 MetaName = "META_2"; 464 break; 464 break; 465 } 465 } 466 466 467 if ((Verbosity_ & G4FFGEnumerations::WARNI 467 if ((Verbosity_ & G4FFGEnumerations::WARNING) != 0) { 468 G4FFG_SPACING__ 468 G4FFG_SPACING__ 469 G4FFG_LOCATION__ 469 G4FFG_LOCATION__ 470 470 471 std::ostringstream Temp; 471 std::ostringstream Temp; 472 if (IsValidMetaState) { 472 if (IsValidMetaState) { 473 if (IsSameMetaState && YieldData_ != n 473 if (IsSameMetaState && YieldData_ != nullptr) { 474 G4cout << " -- Already set to use " 474 G4cout << " -- Already set to use " << MetaName 475 << " as the metastable state. 475 << " as the metastable state. Yield data class will not be reconstructed" 476 << G4endl; 476 << G4endl; 477 } 477 } 478 else if (YieldData_ == nullptr) { 478 else if (YieldData_ == nullptr) { 479 G4cout << " -- Yield data class not 479 G4cout << " -- Yield data class not yet constructed. " << MetaName 480 << " will be applied when it 480 << " will be applied when it is constructed." << G4endl; 481 } 481 } 482 } 482 } 483 else { 483 else { 484 G4cout << " -- Invalid metastable stat 484 G4cout << " -- Invalid metastable state." << G4endl; 485 } 485 } 486 } 486 } 487 487 488 if (((Verbosity_ & G4FFGEnumerations::UPDA 488 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidMetaState) { 489 G4FFG_SPACING__ 489 G4FFG_SPACING__ 490 G4FFG_LOCATION__ 490 G4FFG_LOCATION__ 491 491 492 G4cout << " -- Metastable state set to " 492 G4cout << " -- Metastable state set to " << MetaName << "." << G4endl; 493 } 493 } 494 } 494 } 495 495 496 G4FFG_FUNCTIONLEAVE__ 496 G4FFG_FUNCTIONLEAVE__ 497 } 497 } 498 498 499 void G4FissionFragmentGenerator ::G4SetSamplin 499 void G4FissionFragmentGenerator ::G4SetSamplingScheme( 500 G4FFGEnumerations::FissionSamplingScheme New 500 G4FFGEnumerations::FissionSamplingScheme NewScheme) 501 { 501 { 502 G4FFG_FUNCTIONENTER__ 502 G4FFG_FUNCTIONENTER__ 503 503 504 G4bool IsValidScheme = (NewScheme >= G4FFGEn 504 G4bool IsValidScheme = (NewScheme >= G4FFGEnumerations::FissionSamplingSchemeFirst 505 && NewScheme <= G4FF 505 && NewScheme <= G4FFGEnumerations::FissionSamplingSchemeLast); 506 G4bool IsSameScheme = (NewScheme == Sampling 506 G4bool IsSameScheme = (NewScheme == SamplingScheme_); 507 507 508 if (!IsSameScheme && IsValidScheme) { 508 if (!IsSameScheme && IsValidScheme) { 509 SamplingScheme_ = NewScheme; 509 SamplingScheme_ = NewScheme; 510 IsReconstructionNeeded_ = TRUE; 510 IsReconstructionNeeded_ = TRUE; 511 } 511 } 512 512 513 if (Verbosity_ != G4FFGEnumerations::SILENT) 513 if (Verbosity_ != G4FFGEnumerations::SILENT) { 514 G4String SchemeString; 514 G4String SchemeString; 515 switch (SamplingScheme_) { 515 switch (SamplingScheme_) { 516 case G4FFGEnumerations::NORMAL: 516 case G4FFGEnumerations::NORMAL: 517 SchemeString = "NORMAL"; 517 SchemeString = "NORMAL"; 518 break; 518 break; 519 519 520 case G4FFGEnumerations::LIGHT_FRAGMENT: 520 case G4FFGEnumerations::LIGHT_FRAGMENT: 521 SchemeString = "LIGHT_FRAGMENT"; 521 SchemeString = "LIGHT_FRAGMENT"; 522 break; 522 break; 523 523 524 default: 524 default: 525 SchemeString = "UNSUPPORTED"; 525 SchemeString = "UNSUPPORTED"; 526 break; 526 break; 527 } 527 } 528 528 529 if ((Verbosity_ & G4FFGEnumerations::WARNI 529 if ((Verbosity_ & G4FFGEnumerations::WARNING) != 0) { 530 G4FFG_SPACING__ 530 G4FFG_SPACING__ 531 G4FFG_LOCATION__ 531 G4FFG_LOCATION__ 532 532 533 if (IsValidScheme) { 533 if (IsValidScheme) { 534 if (IsSameScheme && YieldData_ != null 534 if (IsSameScheme && YieldData_ != nullptr) { 535 G4cout << " -- Already set to use " 535 G4cout << " -- Already set to use " << SchemeString 536 << " as the sampling scheme. 536 << " as the sampling scheme. Yield data class will not be reconstructed." 537 << G4endl; 537 << G4endl; 538 } 538 } 539 else if (YieldData_ == nullptr) { 539 else if (YieldData_ == nullptr) { 540 G4cout << " -- Yield data class not 540 G4cout << " -- Yield data class not yet constructed. " << SchemeString 541 << " will be applied when it 541 << " will be applied when it is constructed." << G4endl; 542 } 542 } 543 } 543 } 544 else { 544 else { 545 G4cout << " -- Invalid sampling scheme 545 G4cout << " -- Invalid sampling scheme." << G4endl; 546 } 546 } 547 } 547 } 548 548 549 if (((Verbosity_ & G4FFGEnumerations::UPDA 549 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidScheme) { 550 G4FFG_SPACING__ 550 G4FFG_SPACING__ 551 G4FFG_LOCATION__ 551 G4FFG_LOCATION__ 552 552 553 G4cout << " -- Sampling scheme set to " 553 G4cout << " -- Sampling scheme set to " << SchemeString << "." << G4endl; 554 } 554 } 555 } 555 } 556 556 557 G4FFG_FUNCTIONLEAVE__ 557 G4FFG_FUNCTIONLEAVE__ 558 } 558 } 559 559 560 void G4FissionFragmentGenerator::G4SetYieldTyp 560 void G4FissionFragmentGenerator::G4SetYieldType(G4FFGEnumerations::YieldType WhichYieldType) 561 { 561 { 562 G4FFG_FUNCTIONENTER__ 562 G4FFG_FUNCTIONENTER__ 563 563 564 G4bool IsValidYieldType = (WhichYieldType == 564 G4bool IsValidYieldType = (WhichYieldType == G4FFGEnumerations::INDEPENDENT 565 || WhichYieldType 565 || WhichYieldType == G4FFGEnumerations::CUMULATIVE); 566 G4bool IsSameYieldType = (YieldType_ == Whic 566 G4bool IsSameYieldType = (YieldType_ == WhichYieldType); 567 567 568 if (!IsSameYieldType && IsValidYieldType) { 568 if (!IsSameYieldType && IsValidYieldType) { 569 YieldType_ = WhichYieldType; 569 YieldType_ = WhichYieldType; 570 IsReconstructionNeeded_ = TRUE; 570 IsReconstructionNeeded_ = TRUE; 571 } 571 } 572 572 573 if (Verbosity_ != G4FFGEnumerations::SILENT) 573 if (Verbosity_ != G4FFGEnumerations::SILENT) { 574 G4String YieldString; 574 G4String YieldString; 575 switch ((int)YieldType_) { 575 switch ((int)YieldType_) { 576 case G4FFGEnumerations::INDEPENDENT: 576 case G4FFGEnumerations::INDEPENDENT: 577 YieldString = "INDEPENDENT"; 577 YieldString = "INDEPENDENT"; 578 break; 578 break; 579 579 580 case G4FFGEnumerations::SPONTANEOUS: 580 case G4FFGEnumerations::SPONTANEOUS: 581 YieldString = "SPONTANEOUS"; 581 YieldString = "SPONTANEOUS"; 582 break; 582 break; 583 583 584 default: 584 default: 585 YieldString = "UNSUPPORTED"; 585 YieldString = "UNSUPPORTED"; 586 break; 586 break; 587 } 587 } 588 588 589 if ((Verbosity_ & G4FFGEnumerations::WARNI 589 if ((Verbosity_ & G4FFGEnumerations::WARNING) != 0) { 590 G4FFG_SPACING__ 590 G4FFG_SPACING__ 591 G4FFG_LOCATION__ 591 G4FFG_LOCATION__ 592 592 593 if (IsValidYieldType) { 593 if (IsValidYieldType) { 594 if (IsSameYieldType && YieldData_ != n 594 if (IsSameYieldType && YieldData_ != nullptr) { 595 } 595 } 596 else if (YieldData_ == nullptr) { 596 else if (YieldData_ == nullptr) { 597 G4cout << " -- Yield data class not 597 G4cout << " -- Yield data class not yet constructed. Yield type " << YieldString 598 << " will be applied when it 598 << " will be applied when it is constructed." << G4endl; 599 } 599 } 600 } 600 } 601 else { 601 else { 602 G4cout << " -- Invalid yield type." << 602 G4cout << " -- Invalid yield type." << G4endl; 603 } 603 } 604 } 604 } 605 605 606 if (((Verbosity_ & G4FFGEnumerations::UPDA 606 if (((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) && IsValidYieldType) { 607 G4FFG_SPACING__ 607 G4FFG_SPACING__ 608 G4FFG_LOCATION__ 608 G4FFG_LOCATION__ 609 609 610 G4cout << " -- Yield type set to " << Yi 610 G4cout << " -- Yield type set to " << YieldString << G4endl; 611 } 611 } 612 } 612 } 613 613 614 G4FFG_FUNCTIONLEAVE__ 614 G4FFG_FUNCTIONLEAVE__ 615 } 615 } 616 616 617 void G4FissionFragmentGenerator::G4SetVerbosit 617 void G4FissionFragmentGenerator::G4SetVerbosity(G4int Verbosity) 618 { 618 { 619 G4FFG_FUNCTIONENTER__ 619 G4FFG_FUNCTIONENTER__ 620 620 621 Verbosity_ = Verbosity; 621 Verbosity_ = Verbosity; 622 622 623 if (YieldData_ != nullptr) { 623 if (YieldData_ != nullptr) { 624 YieldData_->G4SetVerbosity(Verbosity_); 624 YieldData_->G4SetVerbosity(Verbosity_); 625 } 625 } 626 626 627 G4FFG_FUNCTIONLEAVE__ 627 G4FFG_FUNCTIONLEAVE__ 628 } 628 } 629 629 630 bool G4FissionFragmentGenerator::InitializeFis 630 bool G4FissionFragmentGenerator::InitializeFissionProductYieldClass(std::istringstream& dataStream) 631 { 631 { 632 G4FFG_FUNCTIONENTER__ 632 G4FFG_FUNCTIONENTER__ 633 633 634 if (YieldData_ != nullptr) { 634 if (YieldData_ != nullptr) { 635 delete YieldData_; 635 delete YieldData_; 636 636 637 if ((Verbosity_ & G4FFGEnumerations::UPDAT 637 if ((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) { 638 G4FFG_SPACING__ 638 G4FFG_SPACING__ 639 G4FFG_LOCATION__ 639 G4FFG_LOCATION__ 640 640 641 G4cout << " -- Old yield data class dele 641 G4cout << " -- Old yield data class deleted." << G4endl; 642 } 642 } 643 } 643 } 644 644 645 try { 645 try { 646 if (SamplingScheme_ == G4FFGEnumerations:: 646 if (SamplingScheme_ == G4FFGEnumerations::NORMAL) { 647 YieldData_ = new G4FPYNormalFragmentDist 647 YieldData_ = new G4FPYNormalFragmentDist(Isotope_, MetaState_, Cause_, YieldType_, Verbosity_, 648 648 dataStream); 649 } 649 } 650 else { 650 else { 651 YieldData_ = new G4FPYBiasedLightFragmen 651 YieldData_ = new G4FPYBiasedLightFragmentDist(Isotope_, MetaState_, Cause_, YieldType_, 652 652 Verbosity_, dataStream); 653 } 653 } 654 654 655 if (AlphaProduction_ != 0 && TernaryProbab 655 if (AlphaProduction_ != 0 && TernaryProbability_ != 0) { 656 YieldData_->G4SetTernaryProbability(Tern 656 YieldData_->G4SetTernaryProbability(TernaryProbability_); 657 YieldData_->G4SetAlphaProduction(AlphaPr 657 YieldData_->G4SetAlphaProduction(AlphaProduction_); 658 } 658 } 659 659 660 if ((Verbosity_ & G4FFGEnumerations::UPDAT 660 if ((Verbosity_ & G4FFGEnumerations::UPDATES) != 0) { 661 G4FFG_SPACING__ 661 G4FFG_SPACING__ 662 G4FFG_LOCATION__ 662 G4FFG_LOCATION__ 663 663 664 G4cout << " -- Yield data class construc 664 G4cout << " -- Yield data class constructed with defined values." << G4endl; 665 } 665 } 666 } 666 } 667 catch (std::exception& e) { 667 catch (std::exception& e) { 668 YieldData_ = nullptr; 668 YieldData_ = nullptr; 669 } 669 } 670 670 671 IsReconstructionNeeded_ = FALSE; 671 IsReconstructionNeeded_ = FALSE; 672 672 673 G4FFG_FUNCTIONLEAVE__ 673 G4FFG_FUNCTIONLEAVE__ 674 return YieldData_ != nullptr; 674 return YieldData_ != nullptr; 675 } 675 } 676 676 677 G4FissionFragmentGenerator::~G4FissionFragment 677 G4FissionFragmentGenerator::~G4FissionFragmentGenerator() 678 { 678 { 679 G4FFG_FUNCTIONENTER__ 679 G4FFG_FUNCTIONENTER__ 680 680 681 delete YieldData_; 681 delete YieldData_; 682 682 683 G4FFG_FUNCTIONLEAVE__ 683 G4FFG_FUNCTIONLEAVE__ 684 } 684 } 685 685