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