Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:53

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
0028 //
0029 #ifndef G4ParticleHPThermalScattering_h
0030 #define G4ParticleHPThermalScattering_h 1
0031 
0032 // Thermal Neutron Scattering
0033 // Koi, Tatsumi (SLAC/SCCS)
0034 //
0035 // Class Description
0036 // Final State Generators for a high precision (based on evaluated data
0037 // libraries) description of themal neutron scattering below 4 eV;
0038 // Based on Thermal neutron scattering files
0039 // from the evaluated nuclear data files ENDF/B-VI, Release2
0040 // To be used in your physics list in case you need this physics.
0041 // In this case you want to register an object of this class with
0042 // the corresponding process.
0043 // Class Description - End
0044 
0045 #include "G4HadronicInteraction.hh"
0046 #include "G4ParticleHPThermalScatteringNames.hh"
0047 #include "globals.hh"
0048 
0049 class G4ParticleHPThermalScatteringData;
0050 class G4ParticleHPElastic;
0051 
0052 struct E_isoAng
0053 {
0054     G4double energy;
0055     G4int n;
0056     std::vector<G4double> isoAngle;
0057     E_isoAng()
0058     {
0059       energy = 0.0;
0060       n = 0;
0061     };
0062 };
0063 
0064 struct E_P_E_isoAng
0065 {
0066     G4double energy;
0067     G4int n;
0068     std::vector<G4double> prob;
0069     std::vector<E_isoAng*> vE_isoAngle;
0070     G4double sum_of_probXdEs;  // should be close to 1
0071     std::vector<G4double> secondary_energy_cdf;
0072     std::vector<G4double> secondary_energy_pdf;
0073     std::vector<G4double> secondary_energy_value;
0074     G4int secondary_energy_cdf_size;
0075     E_P_E_isoAng()
0076     {
0077       energy = 0.0;
0078       n = 0;
0079       sum_of_probXdEs = 0.0;
0080       secondary_energy_cdf_size = 0;
0081     };
0082 };
0083 
0084 class G4ParticleHPThermalScattering : public G4HadronicInteraction
0085 {
0086   public:
0087     G4ParticleHPThermalScattering();
0088 
0089     ~G4ParticleHPThermalScattering() override;
0090 
0091     G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
0092                                    G4Nucleus& aTargetNucleus) override;
0093 
0094     const std::pair<G4double, G4double> GetFatalEnergyCheckLevels() const override;
0095 
0096     // For user prepared thermal files
0097     // Name of G4Element , Name of NDL file
0098     void AddUserThermalScatteringFile(G4String, G4String);
0099 
0100     void BuildPhysicsTable(const G4ParticleDefinition&) override;
0101 
0102     void ModelDescription(std::ostream& outFile) const override;
0103 
0104   private:
0105     void clearCurrentFSData();
0106 
0107     G4ParticleHPThermalScatteringNames names;
0108 
0109     // Coherent Elastic
0110     //         ElementID             temp                             BraggE     cumulativeP
0111     std::map<G4int, std::map<G4double, std::vector<std::pair<G4double, G4double>*>*>*>* coherentFSs{
0112       nullptr};
0113     std::map<G4double, std::vector<std::pair<G4double, G4double>*>*>* readACoherentFSDATA(G4String);
0114 
0115     // Incoherent Elastic
0116     //         ElementID          temp       aFS for this temp (and this element)
0117     std::map<G4int, std::map<G4double, std::vector<E_isoAng*>*>*>* incoherentFSs{nullptr};
0118     std::map<G4double, std::vector<E_isoAng*>*>* readAnIncoherentFSDATA(G4String);
0119     E_isoAng* readAnE_isoAng(std::istream*);
0120 
0121     // Inelastic
0122     //         ElementID          temp        aFS for this temp (and this element)
0123     std::map<G4int, std::map<G4double, std::vector<E_P_E_isoAng*>*>*>* inelasticFSs{nullptr};
0124     std::map<G4double, std::vector<E_P_E_isoAng*>*>* readAnInelasticFSDATA(G4String);
0125     E_P_E_isoAng* readAnE_P_E_isoAng(std::istream*);
0126 
0127     G4ParticleHPThermalScatteringData* theXSection;
0128 
0129     G4ParticleHPElastic* theHPElastic;
0130 
0131     G4double getMu(E_isoAng*);
0132     G4double getMu(G4double rndm1, G4double rndm2, E_isoAng* anEPM);
0133 
0134     std::pair<G4double, G4double> find_LH(G4double, std::vector<G4double>*);
0135     G4double get_linear_interpolated(G4double, std::pair<G4double, G4double>,
0136                                      std::pair<G4double, G4double>);
0137 
0138     E_isoAng create_E_isoAng_from_energy(G4double, std::vector<E_isoAng*>*);
0139 
0140     G4double get_secondary_energy_from_E_P_E_isoAng(G4double random, E_P_E_isoAng* anE_P_E_isoAng);
0141 
0142     std::pair<G4double, G4double> sample_inelastic_E_mu(G4double pE,
0143                                                         std::vector<E_P_E_isoAng*>* vNEP_EPM);
0144     std::pair<G4double, G4int> sample_inelastic_E(G4double rndm1, G4double rndm2,
0145                                                   E_P_E_isoAng* anE_P_E_isoAng);
0146 
0147     std::pair<G4double, E_isoAng>
0148     create_sE_and_EPM_from_pE_and_vE_P_E_isoAng(G4double, G4double, std::vector<E_P_E_isoAng*>*);
0149 
0150     std::map<std::pair<const G4Material*, const G4Element*>, G4int> dic;
0151     void buildPhysicsTable();
0152     G4int getTS_ID(const G4Material*, const G4Element*);
0153 
0154     // size_t sizeOfMaterialTable;
0155 
0156     G4bool check_E_isoAng(E_isoAng*);
0157 
0158     // In order to judge whether the rebuilding of physics table is a necessity or not
0159     size_t nMaterial;
0160     size_t nElement;
0161 };
0162 
0163 #endif