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 // ClassName: G4HadProcesses 29 // 30 // Author: 8 July 2020 V.Ivanchenko 31 // 32 // Modified: 33 // 34 //---------------------------------------------------------------------------- 35 // 36 37 #include "G4HadProcesses.hh" 38 #include "G4SystemOfUnits.hh" 39 #include "G4PhysListUtil.hh" 40 #include "G4ParticleTable.hh" 41 #include "G4Neutron.hh" 42 #include "G4CrossSectionDataSetRegistry.hh" 43 #include "G4VCrossSectionDataSet.hh" 44 #include "G4ComponentGGHadronNucleusXsc.hh" 45 #include "G4ComponentGGNuclNuclXsc.hh" 46 #include "G4ComponentAntiNuclNuclearXS.hh" 47 #include "G4HadronicParameters.hh" 48 #include "G4PhysicsListHelper.hh" 49 #include "G4NeutronCaptureProcess.hh" 50 #include "G4NeutronRadCapture.hh" 51 #include "G4NeutronInelasticXS.hh" 52 #include "G4NeutronElasticXS.hh" 53 #include "G4NeutronCaptureXS.hh" 54 55 const G4ParticleDefinition* G4HadProcesses::FindParticle(const G4String& pname) 56 { 57 return G4ParticleTable::GetParticleTable()->FindParticle(pname); 58 } 59 60 G4HadronicProcess* G4HadProcesses::FindInelasticProcess(const G4ParticleDefinition* ptr) 61 { 62 return G4PhysListUtil::FindInelasticProcess(ptr); 63 } 64 65 G4HadronicProcess* G4HadProcesses::FindInelasticProcess(const G4String& pname) 66 { 67 return FindInelasticProcess( FindParticle(pname) ); 68 } 69 70 G4HadronicProcess* G4HadProcesses::FindElasticProcess(const G4ParticleDefinition* ptr) 71 { 72 return G4PhysListUtil::FindElasticProcess(ptr); 73 } 74 75 G4HadronicProcess* G4HadProcesses::FindElasticProcess(const G4String& pname) 76 { 77 return FindElasticProcess( FindParticle(pname) ); 78 } 79 80 G4HadronicProcess* G4HadProcesses::FindCaptureProcess() 81 { 82 return G4PhysListUtil::FindCaptureProcess(G4Neutron::Neutron()); 83 } 84 85 G4HadronicProcess* G4HadProcesses::FindFissionProcess() 86 { 87 return G4PhysListUtil::FindFissionProcess(G4Neutron::Neutron()); 88 } 89 90 G4CrossSectionInelastic* G4HadProcesses::InelasticXS(const G4String& compName) 91 { 92 G4CrossSectionInelastic* xs = nullptr; 93 auto comp = G4CrossSectionDataSetRegistry::Instance()->GetComponentCrossSection(compName); 94 if( comp != nullptr ) { 95 xs = new G4CrossSectionInelastic(comp); 96 } else if( "Glauber-Gribov" == compName ) { 97 xs = new G4CrossSectionInelastic(new G4ComponentGGHadronNucleusXsc()); 98 } else if( "Glauber-Gribov Nucl-nucl" == compName ) { 99 xs = new G4CrossSectionInelastic(new G4ComponentGGNuclNuclXsc()); 100 } else if( "AntiAGlauber" == compName ) { 101 xs = new G4CrossSectionInelastic(new G4ComponentAntiNuclNuclearXS()); 102 } 103 return xs; 104 } 105 106 G4CrossSectionElastic* G4HadProcesses::ElasticXS(const G4String& compName) 107 { 108 G4CrossSectionElastic* xs = nullptr; 109 auto comp = G4CrossSectionDataSetRegistry::Instance()->GetComponentCrossSection(compName); 110 if( comp != nullptr ) { 111 xs = new G4CrossSectionElastic(comp); 112 } else if( "Glauber-Gribov" == compName ) { 113 xs = new G4CrossSectionElastic(new G4ComponentGGHadronNucleusXsc()); 114 } else if( "Glauber-Gribov Nucl-nucl" == compName ) { 115 xs = new G4CrossSectionElastic(new G4ComponentGGNuclNuclXsc()); 116 } else if( "AntiAGlauber" == compName ) { 117 xs = new G4CrossSectionElastic(new G4ComponentAntiNuclNuclearXS()); 118 } 119 return xs; 120 } 121 122 G4bool G4HadProcesses::AddInelasticCrossSection(const G4ParticleDefinition* ptr, 123 G4VCrossSectionDataSet* xs) 124 { 125 G4bool isOK(false); 126 if( ptr != nullptr ) { 127 G4HadronicProcess* had = FindInelasticProcess( ptr ); 128 if( had != nullptr ) { 129 isOK = true; 130 had->AddDataSet( xs ); 131 } 132 } 133 return isOK; 134 } 135 136 G4bool G4HadProcesses::AddInelasticCrossSection(const G4String& pname, G4VCrossSectionDataSet* xs) 137 { 138 return AddInelasticCrossSection( FindParticle(pname), xs ); 139 } 140 141 G4bool G4HadProcesses::AddElasticCrossSection(const G4ParticleDefinition* ptr, G4VCrossSectionDataSet* xs) 142 { 143 G4bool isOK(false); 144 if( ptr != nullptr ) { 145 G4HadronicProcess* had = FindElasticProcess( ptr ); 146 if( had != nullptr ) { 147 isOK = true; 148 had->AddDataSet( xs ); 149 } 150 } 151 return isOK; 152 } 153 154 G4bool G4HadProcesses::AddElasticCrossSection(const G4String& pname, G4VCrossSectionDataSet* xs) 155 { 156 return AddElasticCrossSection( FindParticle(pname), xs ); 157 } 158 159 G4bool G4HadProcesses::AddCaptureCrossSection(G4VCrossSectionDataSet* xs) 160 { 161 G4bool isOK(false); 162 G4HadronicProcess* had = FindCaptureProcess(); 163 if( had != nullptr ) { 164 isOK = true; 165 had->AddDataSet( xs ); 166 } 167 return isOK; 168 } 169 170 G4bool G4HadProcesses::AddFissionCrossSection(G4VCrossSectionDataSet* xs) 171 { 172 G4bool isOK(false); 173 G4HadronicProcess* had = FindFissionProcess(); 174 if( had != nullptr ) { 175 isOK = true; 176 had->AddDataSet( xs ); 177 } 178 return isOK; 179 } 180 181 void G4HadProcesses::BuildNeutronInelasticAndCapture(G4HadronicProcess* nInel) 182 { 183 G4HadronicParameters* param = G4HadronicParameters::Instance(); 184 G4bool useNeutronGeneral = param->EnableNeutronGeneralProcess(); 185 186 G4HadronicProcess* nCap = new G4NeutronCaptureProcess("nCapture"); 187 nCap->RegisterMe(new G4NeutronRadCapture()); 188 189 if ( useNeutronGeneral ) { 190 auto nGen = G4PhysListUtil::FindNeutronGeneralProcess(); 191 nGen->SetInelasticProcess(nInel); 192 nGen->SetCaptureProcess(nCap); 193 } else { 194 auto neutron = G4Neutron::Neutron(); 195 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); 196 nInel->AddDataSet(new G4NeutronInelasticXS()); 197 ph->RegisterProcess(nInel, neutron); 198 ph->RegisterProcess(nCap, neutron); 199 } 200 if ( param->ApplyFactorXS() ) { 201 nInel->MultiplyCrossSectionBy( param->XSFactorNucleonInelastic() ); 202 } 203 } 204 205 void G4HadProcesses::BuildNeutronElastic(G4HadronicProcess* nEl) 206 { 207 G4HadronicParameters* param = G4HadronicParameters::Instance(); 208 G4bool useNeutronGeneral = param->EnableNeutronGeneralProcess(); 209 210 if ( useNeutronGeneral ) { 211 auto nGen = G4PhysListUtil::FindNeutronGeneralProcess(); 212 nGen->SetElasticProcess(nEl); 213 } else { 214 auto neutron = G4Neutron::Neutron(); 215 nEl->AddDataSet(new G4NeutronElasticXS()); 216 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); 217 ph->RegisterProcess(nEl, neutron); 218 } 219 if ( param->ApplyFactorXS() ) { 220 nEl->MultiplyCrossSectionBy( param->XSFactorNucleonElastic() ); 221 } 222 } 223