Changeset 1315 for trunk/source/processes/hadronic/util/src
- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- Location:
- trunk/source/processes/hadronic/util/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/util/src/G4HadronicWhiteBoard.cc
r819 r1315 49 49 G4double G4HadronicWhiteBoard::GetPy(){return thePy;} 50 50 G4double G4HadronicWhiteBoard::GetPz(){return thePz;} 51 G4 doubleG4HadronicWhiteBoard::GetA(){return theA;}52 G4 doubleG4HadronicWhiteBoard::GetZ(){return theZ;}51 G4int G4HadronicWhiteBoard::GetA(){return theA;} 52 G4int G4HadronicWhiteBoard::GetZ(){return theZ;} 53 53 54 54 … … 68 68 { 69 69 theTarget = aTarget; 70 theA = theTarget.Get N();71 theZ = theTarget.GetZ ();70 theA = theTarget.GetA_asInt(); 71 theZ = theTarget.GetZ_asInt(); 72 72 } 73 73 -
trunk/source/processes/hadronic/util/src/G4LightMedia.cc
r819 r1315 44 44 G4ParticleDefinition* aPiZero = G4PionZero::PionZero(); 45 45 46 const G4double atomicNumber = targetNucleus.GetZ();46 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 47 47 48 48 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 83 83 G4ParticleDefinition* aKaonZL = G4KaonZeroLong::KaonZeroLong(); 84 84 85 const G4double atomicNumber = targetNucleus.GetZ();85 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 86 86 87 87 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 117 117 G4ParticleDefinition* aKaonZL = G4KaonZeroLong::KaonZeroLong(); 118 118 119 const G4double atomicNumber = targetNucleus.GetZ();119 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 120 120 121 121 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 176 176 G4ParticleDefinition* aNeutron = G4Neutron::Neutron(); 177 177 178 const G4double atomicNumber = targetNucleus.GetZ();178 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 179 179 180 180 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 203 203 G4ParticleDefinition* anAntiNeutron = G4AntiNeutron::AntiNeutron(); 204 204 205 const G4double atomicNumber = targetNucleus.GetZ();205 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 206 206 207 207 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 229 229 G4ParticleDefinition* aProton = G4Proton::Proton(); 230 230 231 const G4double atomicNumber = targetNucleus.GetZ();231 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 232 232 233 233 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 256 256 G4ParticleDefinition* anAntiProton = G4AntiProton::AntiProton(); 257 257 258 const G4double atomicNumber = targetNucleus.GetZ();258 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 259 259 260 260 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 286 286 G4ParticleDefinition* aSigmaZero = G4SigmaZero::SigmaZero(); 287 287 288 const G4double atomicNumber = targetNucleus.GetZ();288 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 289 289 290 290 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 364 364 G4ParticleDefinition* anAntiSigmaZero = G4AntiSigmaZero::AntiSigmaZero(); 365 365 366 const G4double atomicNumber = targetNucleus.GetZ();366 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 367 367 368 368 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 443 443 G4ParticleDefinition* aSigmaZero = G4SigmaZero::SigmaZero(); 444 444 445 const G4double atomicNumber = targetNucleus.GetZ();445 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 446 446 447 447 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 505 505 G4ParticleDefinition* aSigmaZero = G4SigmaZero::SigmaZero(); 506 506 507 const G4double atomicNumber = targetNucleus.GetZ();507 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 508 508 509 509 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 567 567 G4ParticleDefinition* anAntiSigmaZero = G4AntiSigmaZero::AntiSigmaZero(); 568 568 569 const G4double atomicNumber = targetNucleus.GetZ();569 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 570 570 571 571 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 626 626 G4ParticleDefinition* anAntiSigmaZero = G4AntiSigmaZero::AntiSigmaZero(); 627 627 628 const G4double atomicNumber = targetNucleus.GetZ();628 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 629 629 630 630 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 689 689 G4ParticleDefinition* aXiMinus = G4XiMinus::XiMinus(); 690 690 691 const G4double atomicNumber = targetNucleus.GetZ();691 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 692 692 693 693 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 773 773 G4ParticleDefinition* aXiZero = G4XiZero::XiZero(); 774 774 775 const G4double atomicNumber = targetNucleus.GetZ();775 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 776 776 777 777 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 862 862 G4ParticleDefinition* aXiMinus = G4XiMinus::XiMinus(); 863 863 864 const G4double atomicNumber = targetNucleus.GetZ();864 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 865 865 866 866 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 950 950 G4ParticleDefinition* aXiZero = G4XiZero::XiZero(); 951 951 952 const G4double atomicNumber = targetNucleus.GetZ();952 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 953 953 954 954 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 1036 1036 G4ParticleDefinition* aXiZero = G4XiZero::XiZero(); 1037 1037 1038 const G4double atomicNumber = targetNucleus.GetZ();1038 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 1039 1039 1040 1040 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); … … 1137 1137 G4ParticleDefinition* aXiZero = G4XiZero::XiZero(); 1138 1138 1139 const G4double atomicNumber = targetNucleus.GetZ();1139 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 1140 1140 1141 1141 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle(); -
trunk/source/processes/hadronic/util/src/G4Nucleus.cc
r819 r1315 38 38 // HPW added utilities for low energy neutron transport. (12.04.1998) 39 39 // M.G. Pia, 2 Oct 1998: modified GetFermiMomentum to avoid memory leaks 40 // G.Folger, spring 2010: add integer A/Z interface 40 41 41 42 #include "G4Nucleus.hh" … … 57 58 58 59 G4Nucleus::G4Nucleus( const G4double A, const G4double Z ) 60 { 61 SetParameters( A, Z ); 62 pnBlackTrackEnergy = 0.0; 63 dtaBlackTrackEnergy = 0.0; 64 pnBlackTrackEnergyfromAnnihilation = 0.0; 65 dtaBlackTrackEnergyfromAnnihilation = 0.0; 66 excitationEnergy = 0.0; 67 momentum = G4ThreeVector(0.,0.,0.); 68 fermiMomentum = 1.52*hbarc/fermi; 69 theTemp = 293.16*kelvin; 70 } 71 72 G4Nucleus::G4Nucleus( const G4int A, const G4int Z ) 59 73 { 60 74 SetParameters( A, Z ); … … 136 150 { 137 151 G4double random = G4UniformRand(); 138 G4double sum = 0;152 G4double sum = aMaterial->GetTotNbOfAtomsPerVolume(); 139 153 const G4ElementVector *theElementVector = aMaterial->GetElementVector(); 140 unsigned int i; 141 for(i=0; i<aMaterial->GetNumberOfElements(); ++i ) 142 { 143 sum += aMaterial->GetAtomicNumDensityVector()[i]; 144 } 145 G4double running = 0; 146 for(i=0; i<aMaterial->GetNumberOfElements(); ++i ) 147 { 148 running += aMaterial->GetAtomicNumDensityVector()[i]; 149 if( running/sum > random ) { 150 aEff = (*theElementVector)[i]->GetA()*mole/g; 151 zEff = (*theElementVector)[i]->GetZ(); 154 G4double running(0); 155 G4Element* element(0); 156 for(unsigned int i=0; i<aMaterial->GetNumberOfElements(); ++i ) 157 { 158 running += aMaterial->GetVecNbOfAtomsPerVolume()[i]; 159 if( running > random*sum ) { 160 element=(*theElementVector)[i]; 152 161 break; 153 162 } 154 163 } 164 if ( element->GetNumberOfIsotopes() > 0 ) { 165 G4double randomAbundance = G4UniformRand(); 166 G4double sumAbundance = element->GetRelativeAbundanceVector()[0]; 167 unsigned int iso=0; 168 while ( iso < element->GetNumberOfIsotopes() && 169 sumAbundance < randomAbundance ) { 170 ++iso; 171 sumAbundance += element->GetRelativeAbundanceVector()[iso]; 172 } 173 theA=element->GetIsotope(iso)->GetN(); 174 theZ=element->GetIsotope(iso)->GetZ(); 175 aEff=theA; 176 zEff=theZ; 177 } else { 178 aEff = element->GetN(); 179 zEff = element->GetZ(); 180 theZ = G4int(zEff + 0.5); 181 theA = G4int(aEff + 0.5); 182 } 155 183 } 156 184 … … 158 186 G4Nucleus::SetParameters( const G4double A, const G4double Z ) 159 187 { 160 G4int myZ = G4int(Z + 0.5); 161 G4int myA = G4int(A + 0.5); 162 if( myA<1 || myZ<0 || myZ>myA ) 188 theZ = G4int(Z + 0.5); 189 theA = G4int(A + 0.5); 190 if( theA<1 || theZ<0 || theZ>theA ) 191 { 192 throw G4HadronicException(__FILE__, __LINE__, 193 "G4Nucleus::SetParameters called with non-physical parameters"); 194 } 195 aEff = A; // atomic weight 196 zEff = Z; // atomic number 197 } 198 199 void 200 G4Nucleus::SetParameters( const G4int A, const G4int Z ) 201 { 202 theZ = Z; 203 theA = A; 204 if( theA<1 || theZ<0 || theZ>theA ) 163 205 { 164 206 throw G4HadronicException(__FILE__, __LINE__, … … 184 226 G4double 185 227 G4Nucleus::AtomicMass( const G4double A, const G4double Z ) const 228 { 229 // Now returns (atomic mass - electron masses) 230 return G4NucleiProperties::GetNuclearMass(A, Z); 231 } 232 233 G4double 234 G4Nucleus::AtomicMass( const G4int A, const G4int Z ) const 186 235 { 187 236 // Now returns (atomic mass - electron masses) -
trunk/source/processes/hadronic/util/src/G4ReactionDynamics.cc
r962 r1315 184 184 veryForward = true; 185 185 } 186 const G4double atomicWeight = targetNucleus.GetN();187 const G4double atomicNumber = targetNucleus.GetZ();186 const G4double atomicWeight = G4double(targetNucleus.GetA_asInt()); 187 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 188 188 const G4double protonMass = aProton->GetPDGMass()/MeV; 189 189 … … 1124 1124 1125 1125 G4int PinNucleus = std::max(0, 1126 G4int(targetNucleus.GetZ()) - protonsInFinalState);1126 targetNucleus.GetZ_asInt() - protonsInFinalState); 1127 1127 G4int NinNucleus = std::max(0, 1128 G4int(targetNucleus.GetN()-targetNucleus.GetZ()) - neutronsInFinalState);1128 targetNucleus.GetN_asInt() - neutronsInFinalState); 1129 1129 1130 1130 pseudoParticle[3].SetMomentum( 0.0, 0.0, pOriginal*GeV ); … … 1356 1356 for (G4int i = 0; i < vecLen; i++) eAvailable -= vec[i]->GetMass()/GeV; 1357 1357 1358 const G4double atomicWeight = targetNucleus.GetN();1359 const G4double atomicNumber = targetNucleus.GetZ();1358 const G4double atomicWeight = G4double(targetNucleus.GetA_asInt()); 1359 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 1360 1360 const G4double pOriginal = modifiedOriginal.GetTotalMomentum()/GeV; 1361 1361 … … 1502 1502 } 1503 1503 1504 const G4double atomicWeight = targetNucleus.GetN();1505 const G4double atomicNumber = targetNucleus.GetZ();1504 const G4double atomicWeight = G4double(targetNucleus.GetA_asInt()); 1505 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 1506 1506 // 1507 1507 // particles have been distributed in forward and backward hemispheres … … 2033 2033 2034 2034 G4int PinNucleus = std::max(0, 2035 G4int(targetNucleus.GetZ()) - protonsInFinalState);2035 targetNucleus.GetZ_asInt() - protonsInFinalState); 2036 2036 G4int NinNucleus = std::max(0, 2037 G4int(targetNucleus.GetN()-targetNucleus.GetZ()) - neutronsInFinalState);2037 targetNucleus.GetN_asInt() - neutronsInFinalState); 2038 2038 // 2039 2039 // for various reasons, the energy balance is not sufficient, … … 2270 2270 2271 2271 targetMass = targetParticle.GetMass()/GeV; 2272 const G4double atomicWeight = targetNucleus.GetN();2272 const G4double atomicWeight = G4double(targetNucleus.GetA_asInt()); 2273 2273 2274 2274 G4double etCurrent = currentParticle.GetTotalEnergy()/GeV; … … 2430 2430 2431 2431 G4int PinNucleus = std::max(0, 2432 G4int(targetNucleus.GetZ()) - protonsInFinalState);2432 targetNucleus.GetZ_asInt() - protonsInFinalState); 2433 2433 G4int NinNucleus = std::max(0, 2434 G4int(targetNucleus.GetN()-targetNucleus.GetZ()) - neutronsInFinalState);2434 targetNucleus.GetN_asInt() - neutronsInFinalState); 2435 2435 2436 2436 // DEBUGGING --> DumpFrames::DumpFrame(vec, vecLen); … … 2820 2820 // inclusive distributions, but it is necessary for momentum conservation 2821 2821 // 2822 const G4double atomicWeight = targetNucleus.GetN();2822 const G4double atomicWeight = G4double(targetNucleus.GetA_asInt()); 2823 2823 const G4double logWeight = std::log(atomicWeight); 2824 2824 … … 3096 3096 3097 3097 const G4double ekOriginal = modifiedOriginal.GetKineticEnergy()/MeV; 3098 const G4double atomicWeight = targetNucleus.GetN();3099 const G4double atomicNumber = targetNucleus.GetZ();3098 const G4double atomicWeight = G4double(targetNucleus.GetA_asInt()); 3099 const G4double atomicNumber = G4double(targetNucleus.GetZ_asInt()); 3100 3100 3101 3101 const G4double ika1 = 3.6; … … 3836 3836 if( currentParticle.GetDefinition() == aNeutron ) 3837 3837 { 3838 const G4double A = targetNucleus.GetN(); // atomic weight3838 const G4double A = G4double(targetNucleus.GetA_asInt()); // atomic weight 3839 3839 if( G4UniformRand() > ((A-1.0)/230.0)*((A-1.0)/230.0) ) 3840 3840 qval[0] = 0.0;
Note: See TracChangeset
for help on using the changeset viewer.