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
0045 #include "G4RDeIonisationCrossSectionHandler.hh"
0046 #include "G4PhysicalConstants.hh"
0047 #include "G4SystemOfUnits.hh"
0048 #include "G4RDVEnergySpectrum.hh"
0049 #include "G4DataVector.hh"
0050 #include "G4RDCompositeEMDataSet.hh"
0051 #include "G4RDVDataSetAlgorithm.hh"
0052 #include "G4RDLinLogLogInterpolation.hh"
0053 #include "G4RDSemiLogInterpolation.hh"
0054 #include "G4RDVEMDataSet.hh"
0055 #include "G4RDEMDataSet.hh"
0056 #include "G4Material.hh"
0057 #include "G4ProductionCutsTable.hh"
0058
0059
0060 G4RDeIonisationCrossSectionHandler::G4RDeIonisationCrossSectionHandler(
0061 const G4RDVEnergySpectrum* spec, G4RDVDataSetAlgorithm* alg,
0062 G4double emin, G4double emax, G4int nbin)
0063 : G4RDVCrossSectionHandler(),
0064 theParam(spec)
0065 {
0066 G4RDVCrossSectionHandler::Initialise(alg, emin, emax, nbin);
0067 interp = new G4RDLinLogLogInterpolation();
0068 }
0069
0070
0071 G4RDeIonisationCrossSectionHandler::~G4RDeIonisationCrossSectionHandler()
0072 {
0073 delete interp;
0074 }
0075
0076
0077 std::vector<G4RDVEMDataSet*>* G4RDeIonisationCrossSectionHandler::BuildCrossSectionsForMaterials(
0078 const G4DataVector& energyVector,
0079 const G4DataVector* energyCuts)
0080 {
0081 G4int verbose = 0;
0082 std::vector<G4RDVEMDataSet*>* set = new std::vector<G4RDVEMDataSet*>;
0083
0084 G4DataVector* energies;
0085 G4DataVector* cs;
0086 G4int nOfBins = energyVector.size();
0087
0088 const G4ProductionCutsTable* theCoupleTable=
0089 G4ProductionCutsTable::GetProductionCutsTable();
0090 size_t numOfCouples = theCoupleTable->GetTableSize();
0091
0092 for (size_t m=0; m<numOfCouples; m++) {
0093
0094 const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(m);
0095 const G4Material* material= couple->GetMaterial();
0096 const G4ElementVector* elementVector = material->GetElementVector();
0097 const G4double* nAtomsPerVolume = material->GetAtomicNumDensityVector();
0098 G4int nElements = material->GetNumberOfElements();
0099
0100 if(verbose > 0) {
0101 G4cout << "eIonisation CS for " << m << "th material "
0102 << material->GetName()
0103 << " eEl= " << nElements << G4endl;
0104 }
0105
0106 G4double tcut = (*energyCuts)[m];
0107
0108 G4RDVDataSetAlgorithm* algo = interp->Clone();
0109 G4RDVEMDataSet* setForMat = new G4RDCompositeEMDataSet(algo,1.,1.);
0110
0111 for (G4int i=0; i<nElements; i++) {
0112
0113 G4int Z = (G4int) (*elementVector)[i]->GetZ();
0114 G4int nShells = NumberOfComponents(Z);
0115 energies = new G4DataVector;
0116 cs = new G4DataVector;
0117 G4double density = nAtomsPerVolume[i];
0118
0119 for (G4int bin=0; bin<nOfBins; bin++) {
0120
0121 G4double e = energyVector[bin];
0122 energies->push_back(e);
0123 G4double value = 0.0;
0124
0125 if(e > tcut) {
0126 for (G4int n=0; n<nShells; n++) {
0127 G4double cross = FindValue(Z, e, n);
0128 G4double p = theParam->Probability(Z, tcut, e, e, n);
0129 value += cross * p * density;
0130
0131 if(verbose>0 && m == 0 && e>=1. && e<=0.) {
0132 G4cout << "G4eIonCrossSH: e(MeV)= " << e/MeV
0133 << " n= " << n
0134 << " cross= " << cross
0135 << " p= " << p
0136 << " value= " << value
0137 << " tcut(MeV)= " << tcut/MeV
0138 << " rho= " << density
0139 << " Z= " << Z
0140 << G4endl;
0141 }
0142
0143 }
0144 }
0145 cs->push_back(value);
0146 }
0147 G4RDVDataSetAlgorithm* algo = interp->Clone();
0148 G4RDVEMDataSet* elSet = new G4RDEMDataSet(i,energies,cs,algo,1.,1.);
0149 setForMat->AddComponent(elSet);
0150 }
0151 set->push_back(setForMat);
0152 }
0153
0154 return set;
0155 }
0156
0157