#include <G4CrossSectionHandler.hh>
Inheritance diagram for G4CrossSectionHandler:
Public Member Functions | |
G4CrossSectionHandler () | |
~G4CrossSectionHandler () | |
Protected Member Functions | |
virtual std::vector< G4VEMDataSet * > * | BuildCrossSectionsForMaterials (const G4DataVector &energyVector, const G4DataVector *energyCuts=0) |
Definition at line 57 of file G4CrossSectionHandler.hh.
G4CrossSectionHandler::G4CrossSectionHandler | ( | ) |
G4CrossSectionHandler::~G4CrossSectionHandler | ( | ) |
std::vector< G4VEMDataSet * > * G4CrossSectionHandler::BuildCrossSectionsForMaterials | ( | const G4DataVector & | energyVector, | |
const G4DataVector * | energyCuts = 0 | |||
) | [protected, virtual] |
Implements G4VCrossSectionHandler.
Definition at line 71 of file G4CrossSectionHandler.cc.
References G4VEMDataSet::AddComponent(), G4VDataSetAlgorithm::Clone(), G4VCrossSectionHandler::CreateInterpolation(), G4VCrossSectionHandler::FindValue(), G4Material::GetAtomicNumDensityVector(), G4Material::GetElementVector(), G4MaterialCutsCouple::GetMaterial(), G4ProductionCutsTable::GetMaterialCutsCouple(), G4Material::GetNumberOfElements(), G4ProductionCutsTable::GetProductionCutsTable(), and G4ProductionCutsTable::GetTableSize().
00073 { 00074 G4DataVector* energies; 00075 G4DataVector* data; 00076 00077 G4DataVector* log_energies; 00078 G4DataVector* log_data; 00079 00080 std::vector<G4VEMDataSet*>* matCrossSections = new std::vector<G4VEMDataSet*>; 00081 00082 const G4ProductionCutsTable* theCoupleTable= 00083 G4ProductionCutsTable::GetProductionCutsTable(); 00084 size_t numOfCouples = theCoupleTable->GetTableSize(); 00085 00086 size_t nOfBins = energyVector.size(); 00087 const G4VDataSetAlgorithm* interpolationAlgo = CreateInterpolation(); 00088 00089 for (size_t mLocal=0; mLocal<numOfCouples; mLocal++) 00090 { 00091 const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(mLocal); 00092 const G4Material* material= couple->GetMaterial(); 00093 G4int nElements = material->GetNumberOfElements(); 00094 const G4ElementVector* elementVector = material->GetElementVector(); 00095 const G4double* nAtomsPerVolume = material->GetAtomicNumDensityVector(); 00096 00097 G4VDataSetAlgorithm* algo = interpolationAlgo->Clone(); 00098 00099 G4VEMDataSet* setForMat = new G4CompositeEMDataSet(algo,1.,1.); 00100 00101 for (G4int i=0; i<nElements; i++) { 00102 00103 G4int Z = (G4int) (*elementVector)[i]->GetZ(); 00104 G4double density = nAtomsPerVolume[i]; 00105 00106 energies = new G4DataVector; 00107 data = new G4DataVector; 00108 00109 log_energies = new G4DataVector; 00110 log_data = new G4DataVector; 00111 00112 00113 for (size_t bin=0; bin<nOfBins; bin++) 00114 { 00115 G4double e = energyVector[bin]; 00116 energies->push_back(e); 00117 if (e==0.) e=1e-300; 00118 log_energies->push_back(std::log10(e)); 00119 G4double cross = density*FindValue(Z,e); 00120 data->push_back(cross); 00121 if (cross==0.) cross=1e-300; 00122 log_data->push_back(std::log10(cross)); 00123 } 00124 00125 G4VDataSetAlgorithm* algo1 = interpolationAlgo->Clone(); 00126 00127 // G4VEMDataSet* elSet = new G4EMDataSet(i,energies,data,algo1,1.,1.); 00128 00129 G4VEMDataSet* elSet = new G4EMDataSet(i,energies,data,log_energies,log_data,algo1,1.,1.); 00130 00131 setForMat->AddComponent(elSet); 00132 } 00133 00134 matCrossSections->push_back(setForMat); 00135 } 00136 delete interpolationAlgo; 00137 return matCrossSections; 00138 }