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 // 23 // 27 // ------------------------------------------- 24 // ------------------------------------------------------------------- 28 // GEANT 4 class implementation file 25 // GEANT 4 class implementation file 29 // 26 // 30 // CERN, Geneva, Switzerland 27 // CERN, Geneva, Switzerland 31 // 28 // 32 // File name: G4NeutronField.cc 29 // File name: G4NeutronField.cc 33 // 30 // 34 // Author: Alessandro Brunengo (Al 31 // Author: Alessandro Brunengo (Alessandro.Brunengo@ge.infn.it) 35 // 32 // 36 // Creation date: 5 June 2000 33 // Creation date: 5 June 2000 37 // ------------------------------------------- 34 // ------------------------------------------------------------------- 38 << 39 #include "G4NeutronField.hh" 35 #include "G4NeutronField.hh" 40 #include "G4PhysicalConstants.hh" << 36 #include "G4NucleiPropertiesTable.hh" 41 #include "G4SystemOfUnits.hh" << 42 #include "G4VNuclearDensity.hh" 37 #include "G4VNuclearDensity.hh" 43 #include "G4FermiMomentum.hh" 38 #include "G4FermiMomentum.hh" 44 39 >> 40 45 G4NeutronField::G4NeutronField(G4V3DNucleus * 41 G4NeutronField::G4NeutronField(G4V3DNucleus * aNucleus) : 46 G4VNuclearField(aNucleus), theDensity(theN 42 G4VNuclearField(aNucleus), theDensity(theNucleus->GetNuclearDensity()) 47 { 43 { 48 theA = theNucleus->GetMassNumber(); 44 theA = theNucleus->GetMassNumber(); 49 theZ = theNucleus->GetCharge(); 45 theZ = theNucleus->GetCharge(); 50 theFermi.Init(theA, theZ); 46 theFermi.Init(theA, theZ); 51 theR = 2.*theNucleus->GetOuterRadius(); 47 theR = 2.*theNucleus->GetOuterRadius(); 52 for (G4double aR=0.;aR<theR; aR+=0.3*fermi) << 48 G4double aR=0; >> 49 while(aR<theR) 53 { 50 { 54 G4ThreeVector aPosition(0,0,aR); 51 G4ThreeVector aPosition(0,0,aR); 55 G4double density = GetDensity(aPosition); 52 G4double density = GetDensity(aPosition); 56 G4double fermiMom = GetFermiMomentum(densi 53 G4double fermiMom = GetFermiMomentum(density); 57 theFermiMomBuffer.push_back(fermiMom); 54 theFermiMomBuffer.push_back(fermiMom); >> 55 aR+=0.3*fermi; 58 } 56 } 59 { 57 { 60 G4ThreeVector aPosition(0,0,theR); 58 G4ThreeVector aPosition(0,0,theR); 61 G4double density = GetDensity(aPosition); 59 G4double density = GetDensity(aPosition); 62 G4double fermiMom = GetFermiMomentum(density 60 G4double fermiMom = GetFermiMomentum(density); 63 theFermiMomBuffer.push_back(fermiMom); 61 theFermiMomBuffer.push_back(fermiMom); 64 } 62 } 65 { 63 { 66 G4ThreeVector aPosition(0,0,theR+0.001*fermi 64 G4ThreeVector aPosition(0,0,theR+0.001*fermi); 67 theFermiMomBuffer.push_back(0); 65 theFermiMomBuffer.push_back(0); 68 } 66 } 69 { 67 { 70 G4ThreeVector aPosition(0,0,1.*m); 68 G4ThreeVector aPosition(0,0,1.*m); 71 theFermiMomBuffer.push_back(0); 69 theFermiMomBuffer.push_back(0); 72 } 70 } 73 } 71 } 74 72 75 G4NeutronField::~G4NeutronField() 73 G4NeutronField::~G4NeutronField() 76 { } 74 { } 77 75 >> 76 >> 77 const G4NeutronField & G4NeutronField::operator=(const G4NeutronField &) >> 78 { >> 79 throw G4HadronicException(__FILE__, __LINE__, "G4NeutronField::operator= meant not to be accessible"); >> 80 return *this; >> 81 } >> 82 >> 83 >> 84 G4int G4NeutronField::operator==(const G4NeutronField &) const >> 85 { >> 86 throw G4HadronicException(__FILE__, __LINE__, "G4NeutronField::operator== meant not to be accessible"); >> 87 return 0; >> 88 } >> 89 >> 90 >> 91 G4int G4NeutronField::operator!=(const G4NeutronField &) const >> 92 { >> 93 throw G4HadronicException(__FILE__, __LINE__, "G4NeutronField::operator!= meant not to be accessible"); >> 94 return 1; >> 95 } >> 96 >> 97 78 G4double G4NeutronField::GetField(const G4Thre 98 G4double G4NeutronField::GetField(const G4ThreeVector & aPosition) 79 { 99 { 80 G4double x = aPosition.mag(); 100 G4double x = aPosition.mag(); 81 unsigned int index = static_cast<unsigned in << 101 G4int index = static_cast<G4int>(x/(0.3*fermi) ); 82 if( (index+2) > theFermiMomBuffer.size()) re << 102 if(index+2> static_cast<G4int>(theFermiMomBuffer.size())) return theFermiMomBuffer.back(); 83 G4double y1 = theFermiMomBuffer[index]; 103 G4double y1 = theFermiMomBuffer[index]; 84 G4double y2 = theFermiMomBuffer[index+1]; 104 G4double y2 = theFermiMomBuffer[index+1]; 85 G4double x1 = (0.3*fermi)*index; 105 G4double x1 = (0.3*fermi)*index; 86 G4double x2 = (0.3*fermi)*(index+1); 106 G4double x2 = (0.3*fermi)*(index+1); 87 G4double fermiMom = y1 + (x-x1)*(y2-y1)/(x2- 107 G4double fermiMom = y1 + (x-x1)*(y2-y1)/(x2-x1); 88 return -1*(fermiMom*fermiMom)/(2*neutron_mas 108 return -1*(fermiMom*fermiMom)/(2*neutron_mass_c2); 89 } 109 } >> 110 >> 111 90 112 91 G4double G4NeutronField::GetBarrier() 113 G4double G4NeutronField::GetBarrier() 92 { 114 { 93 /* 115 /* 94 * G4double A = theNucleus->GetMassNumber(); 116 * G4double A = theNucleus->GetMassNumber(); 95 * G4double Z = theNucleus->GetCharge(); 117 * G4double Z = theNucleus->GetCharge(); 96 * 118 * 97 * return G4NucleiPropertiesTable::GetBindin 119 * return G4NucleiPropertiesTable::GetBindingEnergy(Z, A)/A; 98 */ 120 */ 99 return 0.; 121 return 0.; 100 } 122 } 101 123 102 124 103 125 104 126 105 127 106 128 107 129