Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4NucleiPropertiesTheoreticalTable << 27 // 23 // 28 // Author: Tatsumi Koi, SLAC << 24 // $Id: G4NucleiPropertiesTheoreticalTableA.cc,v 1.5 2003/05/19 17:10:25 kurasige Exp $ 29 // ------------------------------------------- << 25 // GEANT4 tag $Name: geant4-06-00 $ >> 26 // >> 27 // >> 28 // ------------------------------------------------------------ >> 29 // GEANT 4 class implementation file >> 30 // >> 31 // ------------------------------------------------------------ 30 32 31 #include "G4NucleiPropertiesTheoreticalTable.h 33 #include "G4NucleiPropertiesTheoreticalTable.hh" 32 #include "G4PhysicalConstants.hh" << 34 33 #include "G4SystemOfUnits.hh" << 35 >> 36 >> 37 G4int G4NucleiPropertiesTheoreticalTable::shortTable[G4NucleiPropertiesTheoreticalTable::shortTableSize]; >> 38 >> 39 G4NucleiPropertiesTheoreticalTable G4NucleiPropertiesTheoreticalTable::theInstance(2.5); >> 40 // Default constructor >> 41 G4NucleiPropertiesTheoreticalTable::G4NucleiPropertiesTheoreticalTable(G4double ) >> 42 { >> 43 G4int j = 0; >> 44 >> 45 for (G4int i = 0; i < G4NucleiPropertiesTheoreticalTable::nEntries; i++) { >> 46 if (indexArray[0][i] > j+7) { >> 47 shortTable[j++] = i; >> 48 } >> 49 } >> 50 shortTable[G4NucleiPropertiesTheoreticalTable::shortTableSize-1] = >> 51 G4NucleiPropertiesTheoreticalTable::nEntries; >> 52 } 34 53 35 // Determine the table index for a Nuclide wit 54 // Determine the table index for a Nuclide with Z protons and A nucleons 36 // << 55 G4int G4NucleiPropertiesTheoreticalTable::GetIndex(G4int Z, G4int A) 37 G4int G4NucleiPropertiesTheoreticalTable::GetI << 38 { 56 { 39 if (A > 339) { << 40 G4Exception("G4NucleiPropertiesTheoretical << 41 "Nucleon number larger than 33 << 42 } << 43 else if (A < 16) { << 44 G4Exception("G4NucleiPropertiesTheoretical << 45 " Nucleon number smaller than << 46 } << 47 else if (Z > 136) { << 48 G4Exception("G4NucleiPropertiesTheoretical << 49 "Proton number larger than 136 << 50 } << 51 else if (Z < 8) { << 52 G4Exception("G4NucleiPropertiesTheoretical << 53 "Proton number smaller than 8" << 54 } << 55 else if (Z > A) { << 56 G4Exception("G4NucleiPropertiesTheoretical << 57 "Nucleon number smaller than Z << 58 } << 59 57 60 for (G4int i = shortTable[Z - 8]; i < shortT << 58 if(A>339) G4Exception( 61 if (indexArray[1][i] == A) return i; << 59 "G4NucleiPropertiesTheoreticalTable::GetIndex : Nucleon number larger than 339!\n"); >> 60 if(A<16) G4Exception( >> 61 "G4NucleiPropertiesTheoreticalTable::GetIndex : Nucleon number smaller than 16!\n"); >> 62 if(Z>136) G4Exception( >> 63 "G4NucleiPropertiesTheoreticalTable::GetIndex : Proton number larger than 136!\n"); >> 64 if(Z<8) G4Exception( >> 65 "G4NucleiPropertiesTheoreticalTable::GetIndex : Proton number smaller than 8!\n"); >> 66 if(Z>A) G4Exception( >> 67 "G4NucleiPropertiesTheoreticalTable::GetIndex : Nucleon number smaller than Z!\n"); >> 68 >> 69 >> 70 G4int i = shortTable[Z-8]; >> 71 while ( i < shortTable[Z-8+1] ) { >> 72 if (indexArray[1][i] != A ) i++; >> 73 else return i; 62 } 74 } 63 << 75 64 return -1; 76 return -1; 65 } 77 } 66 78 67 G4double G4NucleiPropertiesTheoreticalTable::G << 79 >> 80 >> 81 G4double G4NucleiPropertiesTheoreticalTable::GetMassExcess(G4int Z, G4int A) 68 { 82 { 69 G4int i = GetIndex(Z, A); << 83 G4int i=GetIndex(Z, A); 70 if (i >= 0) { 84 if (i >= 0) { 71 return AtomicMassExcess[i] * MeV; << 85 return AtomicMassExcess[i]*MeV; >> 86 } else { >> 87 return 0.0; 72 } 88 } 73 << 74 return 0.0; << 75 } 89 } 76 90 77 G4double G4NucleiPropertiesTheoreticalTable::G 91 G4double G4NucleiPropertiesTheoreticalTable::GetBindingEnergy(G4int Z, G4int A) 78 { 92 { 79 G4int i = GetIndex(Z, A); << 93 G4int i=GetIndex(Z, A); 80 if (i >= 0) { << 94 if (i >= 0){ 81 const G4double Mh = 7.289034 * MeV; // hy << 95 const G4double Mh = 7.289034*MeV; // hydrogen atom mass excess 82 const G4double Mn = 8.071431 * MeV; // ne << 96 const G4double Mn = 8.071431*MeV; // neutron mass excess 83 return G4double(Z) * Mh + G4double(A - Z) << 97 return G4double(Z)*Mh + G4double(A-Z)*Mn - AtomicMassExcess[i]*MeV; >> 98 } else { >> 99 return 0.0; 84 } 100 } 85 << 86 return 0.0; << 87 } 101 } 88 102 89 G4double G4NucleiPropertiesTheoreticalTable::G << 103 >> 104 >> 105 G4double G4NucleiPropertiesTheoreticalTable::GetAtomicMass(G4int Z, G4int A) 90 { 106 { 91 G4int i = GetIndex(Z, A); << 107 G4int i=GetIndex(Z, A); 92 if (i >= 0) { 108 if (i >= 0) { 93 return AtomicMassExcess[i] * MeV + A * amu << 109 return AtomicMassExcess[i]*MeV + A*amu_c2; 94 } << 110 } else { 95 << 111 return 0.0; 96 return 0.0; << 112 } 97 } 113 } 98 114 99 G4double G4NucleiPropertiesTheoreticalTable::G << 115 >> 116 >> 117 G4double G4NucleiPropertiesTheoreticalTable::GetNuclearMass(G4int Z, G4int A) 100 { 118 { 101 G4int i = GetIndex(Z, A); << 119 G4int i=GetIndex(Z, A); 102 if (i >= 0) { 120 if (i >= 0) { 103 return GetAtomicMass(Z, A) - G4double(Z) * << 121 return GetAtomicMass(Z,A) - G4double(Z)*electron_mass_c2 + ElectronicBindingEnergy(Z); >> 122 } else { >> 123 return 0.0; 104 } 124 } 105 << 106 return 0.0; << 107 } 125 } 108 126 109 G4double G4NucleiPropertiesTheoreticalTable::E << 127 G4double G4NucleiPropertiesTheoreticalTable::ElectronicBindingEnergy(G4int Z) { 110 { << 128 const G4double ael = 1.433e-5*MeV; // electronic-binding constant 111 const G4double ael = 1.433e-5 * MeV; // ele << 129 return ael*pow(G4double(Z),2.39); 112 return ael * std::pow(G4double(Z), 2.39); << 113 } 130 } 114 131 115 G4bool G4NucleiPropertiesTheoreticalTable::IsI 132 G4bool G4NucleiPropertiesTheoreticalTable::IsInTable(G4int Z, G4int A) 116 { 133 { 117 return (Z <= A && A >= 16 && A <= 339 && Z < 134 return (Z <= A && A >= 16 && A <= 339 && Z <= 136 && Z >= 8 && GetIndex(Z, A) >= 0); 118 } 135 } >> 136 119 137