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 // >> 23 // $Id: G4eIonisationCrossSectionHandler.cc,v 1.10 2003/06/16 17:00:33 gunter Exp $ >> 24 // GEANT4 tag $Name: geant4-05-02-patch-01 $ 26 // 25 // 27 // ------------------------------------------- 26 // ------------------------------------------------------------------- 28 // 27 // 29 // GEANT4 Class file 28 // GEANT4 Class file 30 // 29 // 31 // 30 // 32 // File name: G4eIonisationCrossSectionHan 31 // File name: G4eIonisationCrossSectionHandler 33 // 32 // 34 // Author: V.Ivanchenko (Vladimir.Ivanc 33 // Author: V.Ivanchenko (Vladimir.Ivanchenko@cern.ch) 35 // 34 // 36 // Creation date: 25 Sept 2001 35 // Creation date: 25 Sept 2001 37 // 36 // 38 // Modifications: 37 // Modifications: 39 // 10 Oct 2001 M.G. Pia Revision to impro 38 // 10 Oct 2001 M.G. Pia Revision to improve code quality and consistency with design 40 // 19 Jul 2002 VI Create composite 39 // 19 Jul 2002 VI Create composite data set for material 41 // 21 Jan 2003 V.Ivanchenko Cut per region 40 // 21 Jan 2003 V.Ivanchenko Cut per region 42 // 28 Jan 2009 L.Pandola Added public meth << 43 // G4LowEnergyIonisa << 44 // 15 Jul 2009 Nicolas A. Karakatsanis << 45 // << 46 // - BuildCrossSecti << 47 // logarithmic val << 48 // It retrieves th << 49 // respective log << 50 // The EM data set << 51 // These initializ << 52 // operations << 53 // << 54 // << 55 // 41 // 56 // ------------------------------------------- 42 // ------------------------------------------------------------------- 57 43 58 #include "G4eIonisationCrossSectionHandler.hh" 44 #include "G4eIonisationCrossSectionHandler.hh" 59 #include "G4SystemOfUnits.hh" << 60 #include "G4VEnergySpectrum.hh" 45 #include "G4VEnergySpectrum.hh" 61 #include "G4DataVector.hh" 46 #include "G4DataVector.hh" 62 #include "G4CompositeEMDataSet.hh" 47 #include "G4CompositeEMDataSet.hh" 63 #include "G4VDataSetAlgorithm.hh" 48 #include "G4VDataSetAlgorithm.hh" 64 #include "G4LinLogLogInterpolation.hh" 49 #include "G4LinLogLogInterpolation.hh" 65 #include "G4SemiLogInterpolation.hh" 50 #include "G4SemiLogInterpolation.hh" 66 #include "G4VEMDataSet.hh" 51 #include "G4VEMDataSet.hh" 67 #include "G4EMDataSet.hh" 52 #include "G4EMDataSet.hh" 68 #include "G4Material.hh" 53 #include "G4Material.hh" 69 #include "G4ProductionCutsTable.hh" 54 #include "G4ProductionCutsTable.hh" 70 55 71 //....oooOO0OOooo........oooOO0OOooo........oo << 56 72 G4eIonisationCrossSectionHandler::G4eIonisati << 57 G4eIonisationCrossSectionHandler::G4eIonisationCrossSectionHandler( 73 const G4VEnergySpectrum* spec, G4VDataSetA 58 const G4VEnergySpectrum* spec, G4VDataSetAlgorithm* alg, 74 G4double emin, G4double emax, G4int nbin) 59 G4double emin, G4double emax, G4int nbin) 75 : G4VCrossSectionHandler(), 60 : G4VCrossSectionHandler(), 76 theParam(spec),verbose(0) << 61 theParam(spec) 77 { 62 { 78 G4VCrossSectionHandler::Initialise(alg, emin 63 G4VCrossSectionHandler::Initialise(alg, emin, emax, nbin); 79 interp = new G4LinLogLogInterpolation(); 64 interp = new G4LinLogLogInterpolation(); 80 } 65 } 81 66 82 //....oooOO0OOooo........oooOO0OOooo........oo << 83 67 84 G4eIonisationCrossSectionHandler::~G4eIonisati 68 G4eIonisationCrossSectionHandler::~G4eIonisationCrossSectionHandler() 85 { 69 { 86 delete interp; 70 delete interp; 87 } 71 } 88 72 89 //....oooOO0OOooo........oooOO0OOooo........oo << 90 73 91 std::vector<G4VEMDataSet*>* G4eIonisationCross 74 std::vector<G4VEMDataSet*>* G4eIonisationCrossSectionHandler::BuildCrossSectionsForMaterials( 92 const G4DataVector& en 75 const G4DataVector& energyVector, 93 const G4DataVector* en 76 const G4DataVector* energyCuts) 94 { 77 { >> 78 G4int verbose = 0; 95 std::vector<G4VEMDataSet*>* set = new std::v 79 std::vector<G4VEMDataSet*>* set = new std::vector<G4VEMDataSet*>; 96 80 97 G4DataVector* energies; 81 G4DataVector* energies; 98 G4DataVector* cs; 82 G4DataVector* cs; 99 << 83 G4int nOfBins = energyVector.size(); 100 G4DataVector* log_energies; << 101 G4DataVector* log_cs; << 102 << 103 std::size_t nOfBins = energyVector.size(); << 104 84 105 const G4ProductionCutsTable* theCoupleTable= 85 const G4ProductionCutsTable* theCoupleTable= 106 G4ProductionCutsTable::GetProductionCu 86 G4ProductionCutsTable::GetProductionCutsTable(); 107 G4int numOfCouples = (G4int)theCoupleTable-> << 87 size_t numOfCouples = theCoupleTable->GetTableSize(); 108 88 109 for (G4int mLocal=0; mLocal<numOfCouples; ++ << 89 for (size_t m=0; m<numOfCouples; m++) { 110 90 111 const G4MaterialCutsCouple* couple = theCo << 91 const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(m); 112 const G4Material* material= couple->GetMat 92 const G4Material* material= couple->GetMaterial(); 113 const G4ElementVector* elementVector = mat 93 const G4ElementVector* elementVector = material->GetElementVector(); 114 const G4double* nAtomsPerVolume = material 94 const G4double* nAtomsPerVolume = material->GetAtomicNumDensityVector(); 115 G4int nElements = (G4int)material->GetNumb << 95 G4int nElements = material->GetNumberOfElements(); 116 96 117 if(verbose > 0) << 97 if(verbose > 0) { 118 { << 98 G4cout << "eIonisation CS for " << m << "th material " 119 G4cout << "eIonisation CS for " << mLocal << << 99 << material->GetName() 120 << material->GetName() << 100 << " eEl= " << nElements << G4endl; 121 << " eEl= " << nElements << G4endl; << 101 } 122 } << 123 102 124 G4double tcut = (*energyCuts)[mLocal]; << 103 G4double tcut = (*energyCuts)[m]; 125 104 126 G4VDataSetAlgorithm* algo = interp->Clone( 105 G4VDataSetAlgorithm* algo = interp->Clone(); 127 G4VEMDataSet* setForMat = new G4CompositeE 106 G4VEMDataSet* setForMat = new G4CompositeEMDataSet(algo,1.,1.); 128 107 129 for (G4int i=0; i<nElements; ++i) { << 108 for (G4int i=0; i<nElements; i++) { 130 109 131 G4int Z = (G4int) (*elementVector)[i]->G 110 G4int Z = (G4int) (*elementVector)[i]->GetZ(); 132 G4int nShells = NumberOfComponents(Z); 111 G4int nShells = NumberOfComponents(Z); 133 << 134 energies = new G4DataVector; 112 energies = new G4DataVector; 135 cs = new G4DataVector; 113 cs = new G4DataVector; 136 << 137 log_energies = new G4DataVector; << 138 log_cs = new G4DataVector; << 139 << 140 G4double density = nAtomsPerVolume[i]; 114 G4double density = nAtomsPerVolume[i]; 141 115 142 for (std::size_t bin=0; bin<nOfBins; ++b << 116 for (G4int bin=0; bin<nOfBins; bin++) { 143 117 144 G4double e = energyVector[bin]; 118 G4double e = energyVector[bin]; 145 energies->push_back(e); 119 energies->push_back(e); 146 log_energies->push_back(std::log10(e)) << 147 G4double value = 0.0; 120 G4double value = 0.0; 148 G4double log_value = -300; << 149 121 150 if(e > tcut) { 122 if(e > tcut) { 151 for (G4int n=0; n<nShells; n++) { 123 for (G4int n=0; n<nShells; n++) { 152 G4double cross = FindValue(Z, e, n 124 G4double cross = FindValue(Z, e, n); 153 G4double p = theParam->Probability 125 G4double p = theParam->Probability(Z, tcut, e, e, n); 154 value += cross * p * density; 126 value += cross * p * density; 155 127 156 if(verbose>0 && mLocal == 0 && e>=1. && << 128 if(verbose>0 && m == 0 && e>=1. && e<=0.) { 157 { << 158 G4cout << "G4eIonCrossSH: e(MeV) 129 G4cout << "G4eIonCrossSH: e(MeV)= " << e/MeV 159 << " n= " << n 130 << " n= " << n 160 << " cross= " << cross 131 << " cross= " << cross 161 << " p= " << p 132 << " p= " << p 162 << " value= " << value 133 << " value= " << value 163 << " tcut(MeV)= " << tcut 134 << " tcut(MeV)= " << tcut/MeV 164 << " rho= " << density 135 << " rho= " << density 165 << " Z= " << Z 136 << " Z= " << Z 166 << G4endl; 137 << G4endl; 167 } << 138 } >> 139 168 } 140 } 169 if (value == 0.) value = 1e-300; << 170 log_value = std::log10(value); << 171 } 141 } 172 cs->push_back(value); 142 cs->push_back(value); 173 log_cs->push_back(log_value); << 174 } 143 } 175 G4VDataSetAlgorithm* algoLocal = interp- << 144 G4VDataSetAlgorithm* algo = interp->Clone(); 176 G4VEMDataSet* elSet = new G4EMDataSet(i, << 145 G4VEMDataSet* elSet = new G4EMDataSet(i,energies,cs,algo,1.,1.); 177 << 178 setForMat->AddComponent(elSet); 146 setForMat->AddComponent(elSet); 179 } 147 } 180 set->push_back(setForMat); 148 set->push_back(setForMat); 181 } 149 } 182 150 183 return set; 151 return set; 184 } 152 } 185 153 186 //....oooOO0OOooo........oooOO0OOooo........oo << 187 154 188 G4double G4eIonisationCrossSectionHandler::Get << 189 G4double cutEnergy, << 190 G4int Z) << 191 { << 192 G4int nShells = NumberOfComponents(Z); << 193 G4double value = 0.; << 194 if(energy > cutEnergy) << 195 { << 196 for (G4int n=0; n<nShells; ++n) { << 197 G4double cross = FindValue(Z, energy, n); << 198 G4double p = theParam->Probability(Z, cutEne << 199 value += cross * p; << 200 } << 201 } << 202 return value; << 203 } << 204 155