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 // G4ParticleHPThermalScattering 27 // 28 // Class Description: 29 // 30 // Final State Generators for a high precision (based on evaluated data 31 // libraries) description of themal neutron scattering below 4 eV; 32 // Based on Thermal neutron scattering files 33 // from the evaluated nuclear data files ENDF/B-VI, Release2 34 // To be used in your physics list in case you need this physics. 35 // In this case you want to register an object of this class with 36 // the corresponding process. 37 // 38 // Author: T. Koi (SLAC/SCCS), November-2006 - First implementation. 39 // P. Arce (CIEMAT), June-2014 - Conversion neutron_hp to particle_hp 40 // -------------------------------------------------------------------- 41 #ifndef G4ParticleHPThermalScattering_h 42 #define G4ParticleHPThermalScattering_h 1 43 44 #include "G4HadronicInteraction.hh" 45 #include "G4ParticleHPThermalScatteringNames.hh" 46 #include "globals.hh" 47 48 class G4ParticleHPThermalScatteringData; 49 class G4ParticleHPElastic; 50 51 struct E_isoAng 52 { 53 G4double energy; 54 G4int n; 55 std::vector<G4double> isoAngle; 56 E_isoAng() 57 { 58 energy = 0.0; 59 n = 0; 60 }; 61 }; 62 63 struct E_P_E_isoAng 64 { 65 G4double energy; 66 G4int n; 67 std::vector<G4double> prob; 68 std::vector<E_isoAng*> vE_isoAngle; 69 G4double sum_of_probXdEs; // should be close to 1 70 std::vector<G4double> secondary_energy_cdf; 71 std::vector<G4double> secondary_energy_pdf; 72 std::vector<G4double> secondary_energy_value; 73 G4int secondary_energy_cdf_size; 74 E_P_E_isoAng() 75 { 76 energy = 0.0; 77 n = 0; 78 sum_of_probXdEs = 0.0; 79 secondary_energy_cdf_size = 0; 80 }; 81 }; 82 83 class G4ParticleHPThermalScattering : public G4HadronicInteraction 84 { 85 public: 86 87 G4ParticleHPThermalScattering(); 88 89 ~G4ParticleHPThermalScattering() override; 90 91 G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack, 92 G4Nucleus& aTargetNucleus) override; 93 94 const std::pair<G4double, G4double> GetFatalEnergyCheckLevels() const override; 95 96 // For user prepared thermal files 97 // Name of G4Element , Name of NDL file 98 void AddUserThermalScatteringFile(const G4String&, const G4String&); 99 100 void BuildPhysicsTable(const G4ParticleDefinition&) override; 101 102 void ModelDescription(std::ostream& outFile) const override; 103 104 private: 105 106 void clearCurrentFSData(); 107 108 G4double getMu(E_isoAng*); 109 G4double getMu(G4double rndm1, G4double rndm2, E_isoAng* anEPM); 110 111 std::pair<G4double, G4double> find_LH(G4double, std::vector<G4double>*); 112 G4double get_linear_interpolated(G4double, std::pair<G4double, G4double>, 113 std::pair<G4double, G4double>); 114 115 E_isoAng create_E_isoAng_from_energy(G4double, std::vector<E_isoAng*>*); 116 117 G4double get_secondary_energy_from_E_P_E_isoAng(G4double random, E_P_E_isoAng* anE_P_E_isoAng); 118 119 std::pair<G4double, G4double> sample_inelastic_E_mu(G4double pE, 120 std::vector<E_P_E_isoAng*>* vNEP_EPM); 121 std::pair<G4double, G4int> sample_inelastic_E(G4double rndm1, G4double rndm2, 122 E_P_E_isoAng* anE_P_E_isoAng); 123 124 std::pair<G4double, E_isoAng> 125 create_sE_and_EPM_from_pE_and_vE_P_E_isoAng(G4double, G4double, std::vector<E_P_E_isoAng*>*); 126 127 void buildPhysicsTable(); 128 G4int getTS_ID(const G4Material*, const G4Element*); 129 130 G4bool check_E_isoAng(E_isoAng*); 131 132 private: 133 134 G4ParticleHPThermalScatteringNames names; 135 136 // Coherent Elastic 137 // ElementID temp BraggE cumulativeP 138 std::map<G4int, std::map<G4double, std::vector<std::pair<G4double, G4double>*>*>*>* coherentFSs{nullptr}; 139 std::map<G4double, std::vector<std::pair<G4double, G4double>*>*>* readACoherentFSDATA(const G4String&); 140 141 // Incoherent Elastic 142 // ElementID temp aFS for this temp (and this element) 143 std::map<G4int, std::map<G4double, std::vector<E_isoAng*>*>*>* incoherentFSs{nullptr}; 144 std::map<G4double, std::vector<E_isoAng*>*>* readAnIncoherentFSDATA(const G4String&); 145 E_isoAng* readAnE_isoAng(std::istream*); 146 147 // Inelastic 148 // ElementID temp aFS for this temp (and this element) 149 std::map<G4int, std::map<G4double, std::vector<E_P_E_isoAng*>*>*>* inelasticFSs{nullptr}; 150 std::map<G4double, std::vector<E_P_E_isoAng*>*>* readAnInelasticFSDATA(const G4String&); 151 E_P_E_isoAng* readAnE_P_E_isoAng(std::istream*); 152 153 G4ParticleHPThermalScatteringData* theXSection; 154 155 G4ParticleHPElastic* theHPElastic; 156 157 std::map<std::pair<const G4Material*, const G4Element*>, G4int> dic; 158 159 // In order to judge whether the rebuilding of physics table is a necessity or not 160 std::size_t nMaterial; 161 std::size_t nElement; 162 }; 163 164 #endif 165