Geant4 Cross Reference |
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 // ------------------------------------------------------------------- 28 // 29 // Geant4 source file 30 // 31 // File name: G4ParticleHPElasticURR.cc 32 // 33 // Authors: Marek Zmeskal (CTU, Czech Technical University in Prague, Czech Republic) 34 // Loic Thulliez (CEA France) 35 // 36 // Creation date: 4 June 2024 37 // 38 // Description: Class to handle URR range, can be omitted once the 39 // proper isotope cross-section is stored in ParticleHP. 40 // 41 // Modifications: 42 // 43 // ------------------------------------------------------------------- 44 // 45 // 46 47 #include "G4ParticleHPElasticURR.hh" 48 #include "G4ParticleHPManager.hh" 49 #include "G4ParticleHPChannel.hh" 50 #include "G4ParticleHPElastic.hh" 51 #include "G4ParticleHPProbabilityTablesStore.hh" 52 #include "G4SystemOfUnits.hh" 53 #include "G4Threading.hh" 54 55 56 G4ParticleHPElasticURR::G4ParticleHPElasticURR( G4bool isThermalScatteringOn ) : 57 G4HadronicInteraction( "NeutronHPElasticURR" ) { 58 G4double minEnergy = 0.0; 59 if ( isThermalScatteringOn ) minEnergy = 4.0 * CLHEP::eV; 60 SetMinEnergy( minEnergy ); 61 SetMaxEnergy( 20.0 * CLHEP::MeV ); 62 particleHPelastic = new G4ParticleHPElastic; 63 } 64 65 66 G4ParticleHPElasticURR::~G4ParticleHPElasticURR() {} 67 68 69 G4HadFinalState* G4ParticleHPElasticURR::ApplyYourself( const G4HadProjectile& aTrack, G4Nucleus& aNucleus ) { 70 const G4Material* theMaterial = aTrack.GetMaterial(); 71 G4double kineticEnergy = aTrack.GetKineticEnergy(); 72 G4HadFinalState* theFinalState = nullptr; 73 if ( kineticEnergy < (*URRlimits).back().first || kineticEnergy > (*URRlimits).back().second ) { 74 return particleHPelastic->ApplyYourself( aTrack, aNucleus ); 75 } 76 G4int elementI = -1; 77 G4int isotopeJ = -1; 78 G4int A = aNucleus.GetA_asInt(); 79 G4int Z = aNucleus.GetZ_asInt(); 80 // finds the element and isotope of the selected target aNucleus 81 for ( G4int i = 0; i < (G4int)theMaterial->GetNumberOfElements(); ++i ) { 82 if ( Z == theMaterial->GetElement(i)->GetZasInt() ) { 83 for ( G4int j = 0; j < (G4int)theMaterial->GetElement(i)->GetNumberOfIsotopes(); ++j ) { 84 if ( A == theMaterial->GetElement(i)->GetIsotope(j)->GetN() ) { 85 isotopeJ = j; 86 break; 87 } 88 } 89 // the loop cannot be ended here because the material can have two elements with same Z but different isotopic composition 90 if ( isotopeJ != -1 ) { 91 // isotope was found and for loop is ended 92 elementI = (G4int)theMaterial->GetElement(i)->GetIndex(); 93 break; 94 } 95 } // end if find element 96 } // end element loop 97 // Check whether the energy is out of the URR limits for the given element 98 if ( kineticEnergy < (*URRlimits).at(elementI).first || kineticEnergy > (*URRlimits).at(elementI).second ) { 99 // Call elastic final state in G4ParicleHPChannel and SELECT ISOTOPE (to be improved in the future) 100 G4ParticleHPManager::GetInstance()->OpenReactionWhiteBoard(); 101 theFinalState = (*G4ParticleHPManager::GetInstance()->GetElasticFinalStates())[elementI]->ApplyYourself( aTrack ); 102 // Update target nucleus information according to the selected isotope 103 G4int selectedIsotope_A = G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA(); 104 aNucleus.SetParameters( selectedIsotope_A, Z ); 105 const G4Element* target_element = (*G4Element::GetElementTable())[elementI]; 106 const G4Isotope* target_isotope = nullptr; 107 // Find the selected isotope among in the element 108 for ( G4int j = 0; j < (G4int)target_element->GetNumberOfIsotopes(); ++j ) { 109 target_isotope = target_element->GetIsotope(j); 110 if ( target_isotope->GetN() == selectedIsotope_A ) break; 111 } 112 aNucleus.SetIsotope( target_isotope ); 113 G4ParticleHPManager::GetInstance()->CloseReactionWhiteBoard(); 114 } else { 115 // the energy is inside the limits of the URR, calls the final state for the found element and isotope 116 theFinalState = ((*G4ParticleHPManager::GetInstance()->GetElasticFinalStates())[elementI]->GetFinalStates())[isotopeJ]->ApplyYourself( aTrack ); 117 } 118 return theFinalState; 119 } 120 121 122 void G4ParticleHPElasticURR::BuildPhysicsTable( const G4ParticleDefinition& ) { 123 particleHPelastic->BuildPhysicsTable( *(G4Neutron::Neutron()) ); 124 URRlimits = G4ParticleHPManager::GetInstance()->GetURRlimits(); 125 if ( URRlimits == nullptr ) { 126 G4ParticleHPProbabilityTablesStore::GetInstance()->InitURRlimits(); 127 URRlimits = G4ParticleHPProbabilityTablesStore::GetInstance()->GetURRlimits(); 128 G4ParticleHPManager::GetInstance()->RegisterURRlimits( URRlimits ); 129 } 130 } 131 132 133 const std::pair< G4double, G4double > G4ParticleHPElasticURR::GetFatalEnergyCheckLevels() const { 134 // max energy non-conservation is mass of heavy nucleus 135 return std::pair< G4double, G4double >( 10.0 * perCent, 350.0 * CLHEP::GeV ); 136 } 137 138 139 G4int G4ParticleHPElasticURR::GetVerboseLevel() const { 140 return G4ParticleHPManager::GetInstance()->GetVerboseLevel(); 141 } 142 143 144 void G4ParticleHPElasticURR::SetVerboseLevel( G4int newValue ) { 145 G4ParticleHPManager::GetInstance()->SetVerboseLevel( newValue ); 146 } 147 148 149 void G4ParticleHPElasticURR::ModelDescription( std::ostream& outFile ) const { 150 outFile << "High Precision model based on Evaluated Nuclear Data Files (ENDF) for elastic reaction of neutrons in the unresolved resonance region."; 151 } 152