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
0039
0040
0041
0042
0043
0044 #include "G4RDBremsstrahlungCrossSectionHandler.hh"
0045 #include "G4RDeBremsstrahlungSpectrum.hh"
0046 #include "G4DataVector.hh"
0047 #include "G4RDCompositeEMDataSet.hh"
0048 #include "G4RDVDataSetAlgorithm.hh"
0049 #include "G4RDSemiLogInterpolation.hh"
0050 #include "G4RDVEMDataSet.hh"
0051 #include "G4RDEMDataSet.hh"
0052 #include "G4Material.hh"
0053 #include "G4ProductionCutsTable.hh"
0054
0055 G4RDBremsstrahlungCrossSectionHandler::G4RDBremsstrahlungCrossSectionHandler(const G4RDVEnergySpectrum* spec,
0056 G4RDVDataSetAlgorithm* )
0057 : theBR(spec)
0058 {
0059 interp = new G4RDSemiLogInterpolation();
0060 }
0061
0062
0063 G4RDBremsstrahlungCrossSectionHandler::~G4RDBremsstrahlungCrossSectionHandler()
0064 {
0065 delete interp;
0066 }
0067
0068
0069 std::vector<G4RDVEMDataSet*>*
0070 G4RDBremsstrahlungCrossSectionHandler::BuildCrossSectionsForMaterials(const G4DataVector& energyVector,
0071 const G4DataVector* energyCuts)
0072 {
0073 std::vector<G4RDVEMDataSet*>* set = new std::vector<G4RDVEMDataSet*>;
0074
0075 G4DataVector* energies;
0076 G4DataVector* cs;
0077 G4int nOfBins = energyVector.size();
0078
0079 const G4ProductionCutsTable* theCoupleTable=
0080 G4ProductionCutsTable::GetProductionCutsTable();
0081 size_t numOfCouples = theCoupleTable->GetTableSize();
0082
0083 for (size_t m=0; m<numOfCouples; m++) {
0084
0085 const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(m);
0086 const G4Material* material= couple->GetMaterial();
0087 const G4ElementVector* elementVector = material->GetElementVector();
0088 const G4double* nAtomsPerVolume = material->GetVecNbOfAtomsPerVolume();
0089 G4int nElements = material->GetNumberOfElements();
0090
0091 G4double tcut = (*energyCuts)[m];
0092
0093 G4RDVDataSetAlgorithm* algo = interp->Clone();
0094 G4RDVEMDataSet* setForMat = new G4RDCompositeEMDataSet(algo,1.,1.);
0095
0096 for (G4int i=0; i<nElements; i++) {
0097
0098 G4int Z = (G4int) ((*elementVector)[i]->GetZ());
0099 energies = new G4DataVector;
0100 cs = new G4DataVector;
0101 G4double density = nAtomsPerVolume[i];
0102
0103 for (G4int bin=0; bin<nOfBins; bin++) {
0104
0105 G4double e = energyVector[bin];
0106 energies->push_back(e);
0107 G4double value = 0.0;
0108
0109 if(e > tcut) {
0110 G4double elemCs = FindValue(Z, e);
0111
0112 value = theBR->Probability(Z, tcut, e, e);
0113
0114 value *= elemCs*density;
0115 }
0116 cs->push_back(value);
0117 }
0118 G4RDVDataSetAlgorithm* algol = interp->Clone();
0119 G4RDVEMDataSet* elSet = new G4RDEMDataSet(i,energies,cs,algol,1.,1.);
0120 setForMat->AddComponent(elSet);
0121 }
0122 set->push_back(setForMat);
0123 }
0124
0125 return set;
0126 }