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.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/lowenergy/src/G4eIonisationCrossSectionHandler.cc (Version 11.3.0) and /processes/electromagnetic/lowenergy/src/G4eIonisationCrossSectionHandler.cc (Version 9.5.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4eIonisationCrossSectionHandler.cc,v 1.15 2009-09-27 10:47:42 sincerti Exp $
                                                   >>  27 // GEANT4 tag $Name: not supported by cvs2svn $
 26 //                                                 28 //
 27 // -------------------------------------------     29 // -------------------------------------------------------------------
 28 //                                                 30 //
 29 // GEANT4 Class file                               31 // GEANT4 Class file
 30 //                                                 32 //
 31 //                                                 33 //
 32 // File name:     G4eIonisationCrossSectionHan     34 // File name:     G4eIonisationCrossSectionHandler
 33 //                                                 35 //
 34 // Author:        V.Ivanchenko (Vladimir.Ivanc     36 // Author:        V.Ivanchenko (Vladimir.Ivanchenko@cern.ch)
 35 //                                                 37 // 
 36 // Creation date: 25 Sept 2001                     38 // Creation date: 25 Sept 2001
 37 //                                                 39 //
 38 // Modifications:                                  40 // Modifications: 
 39 // 10 Oct 2001  M.G. Pia     Revision to impro     41 // 10 Oct 2001  M.G. Pia     Revision to improve code quality and consistency with design
 40 // 19 Jul 2002   VI          Create composite      42 // 19 Jul 2002   VI          Create composite data set for material
 41 // 21 Jan 2003  V.Ivanchenko Cut per region        43 // 21 Jan 2003  V.Ivanchenko Cut per region
 42 // 28 Jan 2009  L.Pandola    Added public meth     44 // 28 Jan 2009  L.Pandola    Added public method to make a easier migration of 
 43 //                           G4LowEnergyIonisa     45 //                           G4LowEnergyIonisation to G4LivermoreIonisationModel
 44 // 15 Jul 2009   Nicolas A. Karakatsanis           46 // 15 Jul 2009   Nicolas A. Karakatsanis
 45 //                                                 47 //
 46 //                           - BuildCrossSecti     48 //                           - BuildCrossSectionForMaterials method was revised in order to calculate the 
 47 //                             logarithmic val     49 //                             logarithmic values of the loaded data. 
 48 //                             It retrieves th     50 //                             It retrieves the data values from the G4EMLOW data files but, then, calculates the
 49 //                             respective log      51 //                             respective log values and loads them to seperate data structures.
 50 //                             The EM data set     52 //                             The EM data sets, initialized this way, contain both non-log and log values.
 51 //                             These initializ     53 //                             These initialized data sets can enhance the computing performance of data interpolation
 52 //                             operations          54 //                             operations
 53 //                                                 55 //
 54 //                                                 56 //
 55 //                                                 57 //
 56 // -------------------------------------------     58 // -------------------------------------------------------------------
 57                                                    59 
 58 #include "G4eIonisationCrossSectionHandler.hh"     60 #include "G4eIonisationCrossSectionHandler.hh"
 59 #include "G4SystemOfUnits.hh"                  << 
 60 #include "G4VEnergySpectrum.hh"                    61 #include "G4VEnergySpectrum.hh"
 61 #include "G4DataVector.hh"                         62 #include "G4DataVector.hh"
 62 #include "G4CompositeEMDataSet.hh"                 63 #include "G4CompositeEMDataSet.hh"
 63 #include "G4VDataSetAlgorithm.hh"                  64 #include "G4VDataSetAlgorithm.hh"
 64 #include "G4LinLogLogInterpolation.hh"             65 #include "G4LinLogLogInterpolation.hh"
 65 #include "G4SemiLogInterpolation.hh"               66 #include "G4SemiLogInterpolation.hh"
 66 #include "G4VEMDataSet.hh"                         67 #include "G4VEMDataSet.hh"
 67 #include "G4EMDataSet.hh"                          68 #include "G4EMDataSet.hh"
 68 #include "G4Material.hh"                           69 #include "G4Material.hh"
 69 #include "G4ProductionCutsTable.hh"                70 #include "G4ProductionCutsTable.hh"
 70                                                    71 
 71 //....oooOO0OOooo........oooOO0OOooo........oo <<  72 
 72  G4eIonisationCrossSectionHandler::G4eIonisati <<  73 G4eIonisationCrossSectionHandler::G4eIonisationCrossSectionHandler(
 73     const G4VEnergySpectrum* spec, G4VDataSetA     74     const G4VEnergySpectrum* spec, G4VDataSetAlgorithm* alg,
 74     G4double emin, G4double emax, G4int nbin)      75     G4double emin, G4double emax, G4int nbin)
 75  :  G4VCrossSectionHandler(),                      76  :  G4VCrossSectionHandler(),
 76     theParam(spec),verbose(0)                      77     theParam(spec),verbose(0)
 77 {                                                  78 {
 78   G4VCrossSectionHandler::Initialise(alg, emin     79   G4VCrossSectionHandler::Initialise(alg, emin, emax, nbin);
 79   interp = new G4LinLogLogInterpolation();         80   interp = new G4LinLogLogInterpolation();
 80 }                                                  81 }
 81                                                    82 
 82 //....oooOO0OOooo........oooOO0OOooo........oo << 
 83                                                    83 
 84 G4eIonisationCrossSectionHandler::~G4eIonisati     84 G4eIonisationCrossSectionHandler::~G4eIonisationCrossSectionHandler()
 85 {                                                  85 {
 86   delete interp;                                   86   delete interp;
 87 }                                                  87 }
 88                                                    88 
 89 //....oooOO0OOooo........oooOO0OOooo........oo << 
 90                                                    89 
 91 std::vector<G4VEMDataSet*>* G4eIonisationCross     90 std::vector<G4VEMDataSet*>* G4eIonisationCrossSectionHandler::BuildCrossSectionsForMaterials(
 92                         const G4DataVector& en     91                         const G4DataVector& energyVector,
 93                         const G4DataVector* en     92                         const G4DataVector* energyCuts)
 94 {                                                  93 {
 95   std::vector<G4VEMDataSet*>* set = new std::v     94   std::vector<G4VEMDataSet*>* set = new std::vector<G4VEMDataSet*>;
 96                                                    95 
 97   G4DataVector* energies;                          96   G4DataVector* energies;
 98   G4DataVector* cs;                                97   G4DataVector* cs;
 99                                                    98 
100   G4DataVector* log_energies;                      99   G4DataVector* log_energies;
101   G4DataVector* log_cs;                           100   G4DataVector* log_cs;
102                                                   101 
103   std::size_t nOfBins = energyVector.size();   << 102   G4int nOfBins = energyVector.size();
104                                                   103 
105   const G4ProductionCutsTable* theCoupleTable=    104   const G4ProductionCutsTable* theCoupleTable=
106         G4ProductionCutsTable::GetProductionCu    105         G4ProductionCutsTable::GetProductionCutsTable();
107   G4int numOfCouples = (G4int)theCoupleTable-> << 106   size_t numOfCouples = theCoupleTable->GetTableSize();
108                                                   107 
109   for (G4int mLocal=0; mLocal<numOfCouples; ++ << 108   for (size_t m=0; m<numOfCouples; m++) {
110                                                   109 
111     const G4MaterialCutsCouple* couple = theCo << 110     const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(m);
112     const G4Material* material= couple->GetMat    111     const G4Material* material= couple->GetMaterial();
113     const G4ElementVector* elementVector = mat    112     const G4ElementVector* elementVector = material->GetElementVector();
114     const G4double* nAtomsPerVolume = material    113     const G4double* nAtomsPerVolume = material->GetAtomicNumDensityVector();
115     G4int nElements = (G4int)material->GetNumb << 114     G4int nElements = material->GetNumberOfElements();
116                                                   115 
117     if(verbose > 0)                               116     if(verbose > 0) 
118       {                                           117       {
119   G4cout << "eIonisation CS for " << mLocal << << 118   G4cout << "eIonisation CS for " << m << "th material "
120          << material->GetName()                   119          << material->GetName()
121          << "  eEl= " << nElements << G4endl;     120          << "  eEl= " << nElements << G4endl;
122       }                                           121       }
123                                                   122 
124     G4double tcut  = (*energyCuts)[mLocal];    << 123     G4double tcut  = (*energyCuts)[m];
125                                                   124 
126     G4VDataSetAlgorithm* algo = interp->Clone(    125     G4VDataSetAlgorithm* algo = interp->Clone();
127     G4VEMDataSet* setForMat = new G4CompositeE    126     G4VEMDataSet* setForMat = new G4CompositeEMDataSet(algo,1.,1.);
128                                                   127 
129     for (G4int i=0; i<nElements; ++i) {        << 128     for (G4int i=0; i<nElements; i++) {
130                                                   129 
131       G4int Z = (G4int) (*elementVector)[i]->G    130       G4int Z = (G4int) (*elementVector)[i]->GetZ();
132       G4int nShells = NumberOfComponents(Z);      131       G4int nShells = NumberOfComponents(Z);
133                                                   132 
134       energies = new G4DataVector;                133       energies = new G4DataVector;
135       cs       = new G4DataVector;                134       cs       = new G4DataVector;
136                                                   135 
137       log_energies = new G4DataVector;            136       log_energies = new G4DataVector;
138       log_cs       = new G4DataVector;            137       log_cs       = new G4DataVector;
139                                                   138 
140       G4double density = nAtomsPerVolume[i];      139       G4double density = nAtomsPerVolume[i];
141                                                   140 
142       for (std::size_t bin=0; bin<nOfBins; ++b << 141       for (G4int bin=0; bin<nOfBins; bin++) {
143                                                   142 
144         G4double e = energyVector[bin];           143         G4double e = energyVector[bin];
145         energies->push_back(e);                   144         energies->push_back(e);
146         log_energies->push_back(std::log10(e))    145         log_energies->push_back(std::log10(e));
147         G4double value = 0.0;                     146         G4double value = 0.0;
148         G4double log_value = -300;                147         G4double log_value = -300;
149                                                   148 
150         if(e > tcut) {                            149         if(e > tcut) {
151           for (G4int n=0; n<nShells; n++) {       150           for (G4int n=0; n<nShells; n++) {
152             G4double cross = FindValue(Z, e, n    151             G4double cross = FindValue(Z, e, n);
153             G4double p = theParam->Probability    152             G4double p = theParam->Probability(Z, tcut, e, e, n);
154             value += cross * p * density;         153             value += cross * p * density;
155                                                   154 
156       if(verbose>0 && mLocal == 0 && e>=1. &&  << 155       if(verbose>0 && m == 0 && e>=1. && e<=0.) 
157       {                                           156       {
158               G4cout << "G4eIonCrossSH: e(MeV)    157               G4cout << "G4eIonCrossSH: e(MeV)= " << e/MeV
159                      << " n= " << n               158                      << " n= " << n
160                      << " cross= " << cross       159                      << " cross= " << cross
161                      << " p= " << p               160                      << " p= " << p
162                      << " value= " << value       161                      << " value= " << value
163                      << " tcut(MeV)= " << tcut    162                      << " tcut(MeV)= " << tcut/MeV
164                      << " rho= " << density       163                      << " rho= " << density
165                      << " Z= " << Z               164                      << " Z= " << Z
166                      << G4endl;                   165                      << G4endl;
167         }                                         166         }
                                                   >> 167 
168     }                                             168     }
169           if (value == 0.) value = 1e-300;        169           if (value == 0.) value = 1e-300;
170           log_value = std::log10(value);          170           log_value = std::log10(value);
171   }                                               171   }
172         cs->push_back(value);                     172         cs->push_back(value);
173         log_cs->push_back(log_value);             173         log_cs->push_back(log_value);
174       }                                           174       }
175       G4VDataSetAlgorithm* algoLocal = interp- << 175       G4VDataSetAlgorithm* algo = interp->Clone();
176       G4VEMDataSet* elSet = new G4EMDataSet(i, << 176 
                                                   >> 177       //G4VEMDataSet* elSet = new G4EMDataSet(i,energies,cs,algo,1.,1.);
                                                   >> 178 
                                                   >> 179       G4VEMDataSet* elSet = new G4EMDataSet(i,energies,cs,log_energies,log_cs,algo,1.,1.);
177                                                   180 
178       setForMat->AddComponent(elSet);             181       setForMat->AddComponent(elSet);
179     }                                             182     }
180     set->push_back(setForMat);                    183     set->push_back(setForMat);
181   }                                               184   }
182                                                   185 
183   return set;                                     186   return set;
184 }                                                 187 }
185                                                   188 
186 //....oooOO0OOooo........oooOO0OOooo........oo << 
187                                                << 
188 G4double G4eIonisationCrossSectionHandler::Get    189 G4double G4eIonisationCrossSectionHandler::GetCrossSectionAboveThresholdForElement(G4double energy,
189                        G4double cutEnergy,        190                        G4double cutEnergy,
190                        G4int Z)                   191                        G4int Z)
191 {                                                 192 {
192   G4int nShells = NumberOfComponents(Z);          193   G4int nShells = NumberOfComponents(Z);
193   G4double value = 0.;                            194   G4double value = 0.;
194   if(energy > cutEnergy)                          195   if(energy > cutEnergy) 
195     {                                             196     {
196       for (G4int n=0; n<nShells; ++n) {        << 197       for (G4int n=0; n<nShells; n++) {
197   G4double cross = FindValue(Z, energy, n);       198   G4double cross = FindValue(Z, energy, n);
198   G4double p = theParam->Probability(Z, cutEne    199   G4double p = theParam->Probability(Z, cutEnergy, energy, energy, n);
199   value += cross * p;                             200   value += cross * p;
200       }                                           201       }
201     }                                             202     }
202   return value;                                   203   return value;
203 }                                                 204 }
204                                                   205