File indexing completed on 2025-01-31 09:22:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #include "G4RDCrossSectionHandler.hh"
0039 #include "G4RDVDataSetAlgorithm.hh"
0040 #include "G4RDVEMDataSet.hh"
0041 #include "G4RDEMDataSet.hh"
0042 #include "G4RDCompositeEMDataSet.hh"
0043 #include "G4RDShellEMDataSet.hh"
0044 #include "G4ProductionCutsTable.hh"
0045 #include "G4Material.hh"
0046 #include "G4Element.hh"
0047 #include "Randomize.hh"
0048 #include <map>
0049 #include <vector>
0050
0051 #include "G4RDLogLogInterpolation.hh"
0052
0053 G4RDCrossSectionHandler::G4RDCrossSectionHandler()
0054 { }
0055
0056 G4RDCrossSectionHandler::~G4RDCrossSectionHandler()
0057 { }
0058
0059 std::vector<G4RDVEMDataSet*>*
0060 G4RDCrossSectionHandler::BuildCrossSectionsForMaterials(const G4DataVector& energyVector,
0061 const G4DataVector*)
0062 {
0063 G4DataVector* energies;
0064 G4DataVector* data;
0065
0066 std::vector<G4RDVEMDataSet*>* matCrossSections = new std::vector<G4RDVEMDataSet*>;
0067
0068 const G4ProductionCutsTable* theCoupleTable=
0069 G4ProductionCutsTable::GetProductionCutsTable();
0070 size_t numOfCouples = theCoupleTable->GetTableSize();
0071
0072 size_t nOfBins = energyVector.size();
0073 const G4RDVDataSetAlgorithm* interpolationAlgo = CreateInterpolation();
0074
0075 for (size_t m=0; m<numOfCouples; m++)
0076 {
0077 const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(m);
0078 const G4Material* material= couple->GetMaterial();
0079 G4int nElements = material->GetNumberOfElements();
0080 const G4ElementVector* elementVector = material->GetElementVector();
0081 const G4double* nAtomsPerVolume = material->GetAtomicNumDensityVector();
0082
0083 G4RDVDataSetAlgorithm* algo = interpolationAlgo->Clone();
0084
0085 G4RDVEMDataSet* setForMat = new G4RDCompositeEMDataSet(algo,1.,1.);
0086
0087 for (G4int i=0; i<nElements; i++) {
0088
0089 G4int Z = (G4int) (*elementVector)[i]->GetZ();
0090 G4double density = nAtomsPerVolume[i];
0091
0092 energies = new G4DataVector;
0093 data = new G4DataVector;
0094
0095
0096 for (size_t bin=0; bin<nOfBins; bin++)
0097 {
0098 G4double e = energyVector[bin];
0099 energies->push_back(e);
0100 G4double cross = density*FindValue(Z,e);
0101 data->push_back(cross);
0102 }
0103
0104 G4RDVDataSetAlgorithm* algo1 = interpolationAlgo->Clone();
0105 G4RDVEMDataSet* elSet = new G4RDEMDataSet(i,energies,data,algo1,1.,1.);
0106 setForMat->AddComponent(elSet);
0107 }
0108
0109 matCrossSections->push_back(setForMat);
0110 }
0111 return matCrossSections;
0112 }
0113