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 // 28 // GEANT4 Class file 29 // 30 // File name: G4VCrossSectionDataSet 31 // 32 // Author F.W. Jones, TRIUMF, 20-JAN-97 33 // 34 // Modifications: 35 // 23.01.2009 V.Ivanchenko move constructor an 36 // 12.08.2011 G.Folger, V.Ivanchenko, T.Koi, D 37 // 38 39 #include "G4VCrossSectionDataSet.hh" 40 #include "G4SystemOfUnits.hh" 41 #include "G4CrossSectionDataSetRegistry.hh" 42 #include "G4Material.hh" 43 #include "G4Element.hh" 44 #include "G4Isotope.hh" 45 #include "G4NistManager.hh" 46 #include "Randomize.hh" 47 #include "G4HadronicParameters.hh" 48 49 G4VCrossSectionDataSet::G4VCrossSectionDataSet 50 name(nam), 51 maxKinEnergy(G4HadronicParameters::Instance( 52 { 53 registry = G4CrossSectionDataSetRegistry::In 54 registry->Register(this); 55 } 56 57 G4VCrossSectionDataSet::~G4VCrossSectionDataSe 58 { 59 registry->DeRegister(this); 60 } 61 62 G4bool 63 G4VCrossSectionDataSet::IsElementApplicable(co 64 G4int, 65 const G4Material*) 66 { 67 return false; 68 } 69 70 G4bool 71 G4VCrossSectionDataSet::IsIsoApplicable(const 72 G4int, 73 const 74 const 75 { 76 return false; 77 } 78 79 G4double 80 G4VCrossSectionDataSet::ComputeCrossSection(co 81 co 82 co 83 { 84 G4int Z = elm->GetZasInt(); 85 86 if (IsElementApplicable(part, Z, mat)) { 87 return GetElementCrossSection(part, Z, mat 88 } 89 90 // isotope-wise cross section making sum ove 91 // isotope cross sections, which may be inco 92 // the result is corrected 93 std::size_t nIso = elm->GetNumberOfIsotopes( 94 G4double fact = 0.0; 95 G4double xsec = 0.0; 96 97 // user-defined isotope abundances 98 const G4IsotopeVector* isoVector = elm->GetI 99 const G4double* abundVector = elm->GetRelati 100 for (std::size_t j=0; j<nIso; ++j) { 101 const G4Isotope* iso = (*isoVector)[j]; 102 G4int A = iso->GetN(); 103 if(abundVector[j] > 0.0 && IsIsoApplicable 104 fact += abundVector[j]; 105 xsec += abundVector[j]*GetIsoCrossSectio 106 } 107 } 108 return (fact > 0.0) ? xsec/fact : 0.0; 109 } 110 111 G4double 112 G4VCrossSectionDataSet::ComputeCrossSectionPer 113 G4double kinEnergy, G4 114 const G4ParticleDefini 115 const G4Element* elm, 116 { 117 G4int Z = elm->GetZasInt(); 118 std::size_t nIso = elm->GetNumberOfIsotopes( 119 G4double xsec = 0.0; 120 const G4IsotopeVector* isoVector = elm->GetI 121 const G4double* abundVector = elm->GetRelati 122 for (std::size_t j=0; j<nIso; ++j) { 123 const G4Isotope* iso = (*isoVector)[j]; 124 G4int A = iso->GetN(); 125 xsec += abundVector[j]* 126 ComputeIsoCrossSection(kinEnergy, loge, 127 } 128 return xsec; 129 } 130 131 G4double 132 G4VCrossSectionDataSet::GetElementCrossSection 133 G4int Z, 134 const G4Material* mat) 135 { 136 G4ExceptionDescription ed; 137 ed << "GetElementCrossSection is not impleme 138 << "Particle: " << dynPart->GetDefinition 139 << " Ekin(MeV)= " << dynPart->GetKineti 140 if(nullptr != mat) { ed << " material: " << 141 ed << " target Z= " << Z << G4endl; 142 G4Exception("G4VCrossSectionDataSet::GetElem 143 FatalException, ed); 144 return 0.0; 145 } 146 147 G4double 148 G4VCrossSectionDataSet::GetIsoCrossSection(con 149 G4int Z, G4int A, 150 const G4Isotope*, 151 const G4Element* elm, 152 const G4Material* mat) 153 { 154 G4ExceptionDescription ed; 155 ed << "GetIsoCrossSection is not implemented 156 << "Particle: " << dynPart->GetDefinition 157 << " Ekin(MeV)= " << dynPart->GetKineti 158 if(nullptr != mat) { ed << " material: " << 159 if(nullptr != elm) { ed << " element: " << e 160 ed << " target Z= " << Z << " A= " << A << G 161 G4Exception("G4VCrossSectionDataSet::GetIsoC 162 FatalException, ed); 163 return 0.0; 164 } 165 166 G4double 167 G4VCrossSectionDataSet::ComputeIsoCrossSection 168 const G4ParticleDefinition* p 169 G4int Z, G4int A, 170 const G4Isotope*, 171 const G4Element* elm, 172 const G4Material* mat) 173 { 174 G4ExceptionDescription ed; 175 ed << "GetIsoCrossSection is not implemented 176 << "Particle: " << pd->GetParticleName() 177 << " Ekin(MeV)= " << kinEnergy/CLHEP::M 178 if(nullptr != mat) { ed << " material: " << 179 if(nullptr != elm) { ed << " element: " << e 180 ed << " target Z= " << Z << " A= " << A << G 181 G4Exception("G4VCrossSectionDataSet::GetIsoC 182 FatalException, ed); 183 return 0.0; 184 } 185 186 const G4Isotope* 187 G4VCrossSectionDataSet::SelectIsotope(const G4 188 G4double 189 { 190 G4int nIso = (G4int)anElement->GetNumberOfIs 191 const G4Isotope* iso = anElement->GetIsotope 192 193 // more than 1 isotope 194 if(1 < nIso) { 195 const G4double* abundVector = anElement->G 196 G4double sum = 0.0; 197 G4double q = G4UniformRand(); 198 for (G4int j=0; j<nIso; ++j) { 199 sum += abundVector[j]; 200 if(q <= sum) { 201 iso = anElement->GetIsotope(j); 202 break; 203 } 204 } 205 } 206 return iso; 207 } 208 209 void G4VCrossSectionDataSet::BuildPhysicsTable 210 {} 211 212 void G4VCrossSectionDataSet::DumpPhysicsTable( 213 {} 214 215 void G4VCrossSectionDataSet::CrossSectionDescr 216 { 217 outFile << "The description for this cross s 218 } 219