- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/cascade/cascade/src/G4InuclNuclei.cc
r1337 r1340 23 23 // * acceptance of all terms of the Geant4 Software license. * 24 24 // ******************************************************************** 25 // 26 // $Id: G4InuclNuclei.cc,v 1.8.2.1 2010/06/25 09:44:42 gunter Exp $ 27 // Geant4 tag: $Name: geant4-09-04-beta-01 $ 25 // $Id: G4InuclNuclei.cc,v 1.22 2010/09/25 06:44:30 mkelsey Exp $ 26 // Geant4 tag: $Name: hadr-casc-V09-03-85 $ 28 27 // 29 28 // 20100301 M. Kelsey -- Add function to create unphysical nuclei for use … … 31 30 // 20100319 M. Kelsey -- Add information message to makeNuclearFragment(). 32 31 // Use new GetBindingEnergy() function instead of bindingEnergy(). 32 // 20100622 M. Kelsey -- Use local "bindingEnergy()" function to call through. 33 // 20100627 M. Kelsey -- Test for non-physical fragments and abort job. 34 // 20100630 M. Kelsey -- Use excitation energy in G4Ions 35 // 20100714 M. Kelsey -- Use G4DynamicParticle::theDynamicalMass to deal with 36 // excitation energy without instantianting "infinite" G4PartDefns. 37 // 20100719 M. Kelsey -- Change excitation energy without altering momentum 38 // 20100906 M. Kelsey -- Add fill() functions to rewrite contents 39 // 20100910 M. Kelsey -- Add clearExitonConfiguration() to fill() functions 40 // 20100914 M. Kelsey -- Make printout symmetric with G4InuclElemPart, 41 // migrate to integer A and Z 42 // 20100924 M. Kelsey -- Add constructor to copy G4Fragment input, and output 43 // functions to create G4Fragment 33 44 34 45 #include "G4InuclNuclei.hh" 46 #include "G4Fragment.hh" 47 #include "G4HadronicException.hh" 35 48 #include "G4InuclSpecialFunctions.hh" 36 49 #include "G4Ions.hh" 50 #include "G4IonTable.hh" 51 #include "G4NucleiProperties.hh" 37 52 #include "G4ParticleDefinition.hh" 38 53 #include "G4ParticleTable.hh" 39 #include "G4HadTmpUtil.hh"40 #include "G4NucleiProperties.hh"41 54 #include <assert.h> 42 55 #include <sstream> … … 46 59 47 60 61 // Convert contents from (via constructor) and to G4Fragment 62 63 G4InuclNuclei::G4InuclNuclei(const G4Fragment& aFragment, G4int model) 64 : G4InuclParticle(makeDefinition(aFragment.GetA_asInt(), 65 aFragment.GetZ_asInt()), 66 aFragment.GetMomentum()/GeV) { // Bertini units 67 setExitationEnergy(aFragment.GetExcitationEnergy()); 68 setModel(model); 69 70 // Exciton configuration must be set by hand 71 theExitonConfiguration.protonQuasiParticles = aFragment.GetNumberOfCharged(); 72 73 theExitonConfiguration.neutronQuasiParticles = 74 aFragment.GetNumberOfCharged() - aFragment.GetNumberOfCharged(); 75 76 // Split hole count evenly between protons and neutrons (arbitrary!) 77 theExitonConfiguration.protonHoles = aFragment.GetNumberOfHoles()/2; 78 79 theExitonConfiguration.neutronHoles = 80 aFragment.GetNumberOfHoles() - theExitonConfiguration.protonHoles; 81 } 82 83 // FIXME: Should we have a local buffer and return by const-reference instead? 84 G4Fragment G4InuclNuclei::makeG4Fragment() const { 85 G4Fragment frag(getA(), getZ(), getMomentum()*GeV); // From Bertini units 86 87 // Note: exciton configuration has to be set piece by piece 88 frag.SetNumberOfHoles(theExitonConfiguration.protonHoles 89 + theExitonConfiguration.neutronHoles); 90 91 frag.SetNumberOfParticles(theExitonConfiguration.protonQuasiParticles 92 + theExitonConfiguration.neutronQuasiParticles); 93 94 frag.SetNumberOfCharged(theExitonConfiguration.protonQuasiParticles); 95 96 return frag; 97 } 98 99 G4InuclNuclei::operator G4Fragment() const { 100 return makeG4Fragment(); 101 } 102 103 104 // Overwrite data structure (avoids creating/copying temporaries) 105 106 void G4InuclNuclei::fill(const G4LorentzVector& mom, G4int a, G4int z, 107 G4double exc, G4int model) { 108 setDefinition(makeDefinition(a,z)); 109 setMomentum(mom); 110 setExitationEnergy(exc); 111 clearExitonConfiguration(); 112 setModel(model); 113 } 114 115 void G4InuclNuclei::fill(G4double ekin, G4int a, G4int z, G4double exc, 116 G4int model) { 117 setDefinition(makeDefinition(a,z)); 118 setKineticEnergy(ekin); 119 setExitationEnergy(exc); 120 clearExitonConfiguration(); 121 setModel(model); 122 } 123 124 125 // Change excitation energy while keeping momentum vector constant 126 127 void G4InuclNuclei::setExitationEnergy(G4double e) { 128 G4double ekin = getKineticEnergy(); // Current kinetic energy 129 130 G4double emass = getNucleiMass() + e*MeV/GeV; // From Bertini to G4 units 131 132 // Directly compute new kinetic energy from old 133 G4double ekin_new = std::sqrt(emass*emass + ekin*(2.*getMass()+ekin)) - emass; 134 135 setMass(emass); // Momentum is computed from mass and Ekin 136 setKineticEnergy(ekin_new); 137 } 138 139 48 140 // Convert nuclear configuration to standard GEANT4 pointer 49 141 … … 51 143 // G4ParticleTable::GetIon() uses (Z,A)! 52 144 53 G4ParticleDefinition* 54 G4InuclNuclei::makeDefinition(G4double a, G4double z, G4double exc) { 145 G4ParticleDefinition* G4InuclNuclei::makeDefinition(G4int a, G4int z) { 55 146 G4ParticleTable* pTable = G4ParticleTable::GetParticleTable(); 56 G4ParticleDefinition *pd = pTable->GetIon( G4int(z), G4int(a), exc);147 G4ParticleDefinition *pd = pTable->GetIon(z, a, 0.); 57 148 58 149 // SPECIAL CASE: Non-physical nuclear fragment, for final-state return 59 if (!pd) pd = makeNuclearFragment(a,z,exc); 60 61 return pd; 62 } 150 if (!pd) pd = makeNuclearFragment(a,z); 151 152 return pd; // This could return a null pointer if above fails 153 } 154 155 // Creates a non-standard excited nucleus 63 156 64 157 // Creates a non-physical pseudo-nucleus, for return as final-state fragment … … 66 159 67 160 G4ParticleDefinition* 68 G4InuclNuclei::makeNuclearFragment(G4double a, G4double z, G4double exc) { 69 G4int na=G4int(a), nz=G4int(z), nn=na-nz; // # nucleon, proton, neutron 70 71 // See G4IonTable.hh::GetNucleusEncoding for explanation 72 G4int code = ((100+nz)*1000 + na)*10 + (exc>0.)?1:0; 161 G4InuclNuclei::makeNuclearFragment(G4int a, G4int z) { 162 if (a<=0 || z<0 || a<z) { 163 G4cerr << " >>> G4InuclNuclei::makeNuclearFragment() called with" 164 << " impossible arguments A=" << a << " Z=" << z << G4endl; 165 throw G4HadronicException(__FILE__, __LINE__, 166 "G4InuclNuclei impossible A/Z arguments"); 167 } 168 169 G4int code = G4IonTable::GetNucleusEncoding(z, a); 73 170 74 171 // Use local lookup table (see G4IonTable.hh) to maintain singletons 75 172 // NOTE: G4ParticleDefinitions don't need to be explicitly deleted 76 173 // (see comments in G4IonTable.cc::~G4IonTable) 174 175 // If correct nucleus already created return it 77 176 static std::map<G4int, G4ParticleDefinition*> fragmentList; 78 79 177 if (fragmentList.find(code) != fragmentList.end()) return fragmentList[code]; 80 178 81 179 // Name string follows format in G4IonTable.cc::GetIonName(Z,A,E) 82 std::stringstream zstr, astr, estr; 83 zstr << nz; 84 astr << na; 85 estr << G4int(1000*exc+0.5); // keV in integer form 86 180 std::stringstream zstr, astr; 181 zstr << z; 182 astr << a; 183 87 184 G4String name = "Z" + zstr.str() + "A" + astr.str(); 88 if (exc>0.) name += "["+estr.str()+"]"; 89 90 // Simple minded mass calculation use constants in CLHEP (all in MeV) 91 G4double mass = nz*proton_mass_c2 + nn*neutron_mass_c2 92 + G4NucleiProperties::GetBindingEnergy(G4lrint(a),G4lrint(z)) + exc; 93 185 186 G4double mass = getNucleiMass(a,z) *GeV/MeV; // From Bertini to GEANT4 units 187 94 188 // Arguments for constructor are as follows 95 189 // name mass width charge … … 99 193 // stable lifetime decay table 100 194 // shortlived subType anti_encoding Excitation-energy 101 195 102 196 G4cout << " >>> G4InuclNuclei creating temporary fragment for evaporation " 103 197 << "with non-standard PDGencoding." << G4endl; 104 198 105 199 G4Ions* fragPD = new G4Ions(name, mass, 0., z*eplus, 106 0, +1, 0,200 0, +1, 0, 107 201 0, 0, 0, 108 "nucleus", 0, na, code,202 "nucleus", 0, a, code, 109 203 true, 0., 0, 110 true, "generic", 0, exc);204 true, "generic", 0, 0.); 111 205 fragPD->SetAntiPDGEncoding(0); 112 206 113 fragmentList[code] = fragPD; // Store in table for next lookup 114 return fragPD; 115 } 116 117 G4double G4InuclNuclei::getNucleiMass(G4double a, G4double z) { 118 G4ParticleDefinition* pd = makeDefinition(a,z); 119 return pd ? pd->GetPDGMass()*MeV/GeV : 0.; // From G4 to Bertini units 207 return (fragmentList[code] = fragPD); // Store in table for next lookup 208 } 209 210 G4double G4InuclNuclei::getNucleiMass(G4int a, G4int z, G4double exc) { 211 // Simple minded mass calculation use constants in CLHEP (all in MeV) 212 G4double mass = G4NucleiProperties::GetNuclearMass(a,z) + exc; 213 214 return mass*MeV/GeV; // Convert from GEANT4 to Bertini units 120 215 } 121 216 122 217 // Assignment operator for use with std::sort() 123 218 G4InuclNuclei& G4InuclNuclei::operator=(const G4InuclNuclei& right) { 124 exitationEnergy = right.exitationEnergy;125 219 theExitonConfiguration = right.theExitonConfiguration; 126 220 G4InuclParticle::operator=(right); 127 221 return *this; 128 222 } 223 224 // Dump particle properties for diagnostics 225 226 void G4InuclNuclei::printParticle() const { 227 G4InuclParticle::printParticle(); 228 G4cout << " Nucleus: " << getDefinition()->GetParticleName() 229 << " A " << getA() << " Z " << getZ() << " mass " << getMass() 230 << " Eex (MeV) " << getExitationEnergy() << G4endl; 231 }
Note: See TracChangeset
for help on using the changeset viewer.