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10.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 /examples/advanced/eRosita/physics/src/G4RDeIonisationCrossSectionHandler.cc (Version 11.3.0) and /examples/advanced/eRosita/physics/src/G4RDeIonisationCrossSectionHandler.cc (Version 10.0)


  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$
                                                   >>  27 // GEANT4 tag $Name: geant4-09-01-ref-00 $
 26 //                                                 28 //
 27 // -------------------------------------------     29 // -------------------------------------------------------------------
 28 //                                                 30 //
 29 // GEANT4 Class file                               31 // GEANT4 Class file
 30 //                                                 32 //
 31 //                                                 33 //
 32 // File name:     G4RDeIonisationCrossSectionH     34 // File name:     G4RDeIonisationCrossSectionHandler
 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 //                                                 44 //
 43 // -------------------------------------------     45 // -------------------------------------------------------------------
 44                                                    46 
 45 #include "G4RDeIonisationCrossSectionHandler.h     47 #include "G4RDeIonisationCrossSectionHandler.hh"
 46 #include "G4PhysicalConstants.hh"                  48 #include "G4PhysicalConstants.hh"
 47 #include "G4SystemOfUnits.hh"                      49 #include "G4SystemOfUnits.hh"
 48 #include "G4RDVEnergySpectrum.hh"                  50 #include "G4RDVEnergySpectrum.hh"
 49 #include "G4DataVector.hh"                         51 #include "G4DataVector.hh"
 50 #include "G4RDCompositeEMDataSet.hh"               52 #include "G4RDCompositeEMDataSet.hh"
 51 #include "G4RDVDataSetAlgorithm.hh"                53 #include "G4RDVDataSetAlgorithm.hh"
 52 #include "G4RDLinLogLogInterpolation.hh"           54 #include "G4RDLinLogLogInterpolation.hh"
 53 #include "G4RDSemiLogInterpolation.hh"             55 #include "G4RDSemiLogInterpolation.hh"
 54 #include "G4RDVEMDataSet.hh"                       56 #include "G4RDVEMDataSet.hh"
 55 #include "G4RDEMDataSet.hh"                        57 #include "G4RDEMDataSet.hh"
 56 #include "G4Material.hh"                           58 #include "G4Material.hh"
 57 #include "G4ProductionCutsTable.hh"                59 #include "G4ProductionCutsTable.hh"
 58                                                    60 
 59                                                    61 
 60 G4RDeIonisationCrossSectionHandler::G4RDeIonis     62 G4RDeIonisationCrossSectionHandler::G4RDeIonisationCrossSectionHandler(
 61     const G4RDVEnergySpectrum* spec, G4RDVData     63     const G4RDVEnergySpectrum* spec, G4RDVDataSetAlgorithm* alg,
 62     G4double emin, G4double emax, G4int nbin)      64     G4double emin, G4double emax, G4int nbin)
 63  :  G4RDVCrossSectionHandler(),                    65  :  G4RDVCrossSectionHandler(),
 64     theParam(spec)                                 66     theParam(spec)
 65 {                                                  67 {
 66   G4RDVCrossSectionHandler::Initialise(alg, em     68   G4RDVCrossSectionHandler::Initialise(alg, emin, emax, nbin);
 67   interp = new G4RDLinLogLogInterpolation();       69   interp = new G4RDLinLogLogInterpolation();
 68 }                                                  70 }
 69                                                    71 
 70                                                    72 
 71 G4RDeIonisationCrossSectionHandler::~G4RDeIoni     73 G4RDeIonisationCrossSectionHandler::~G4RDeIonisationCrossSectionHandler()
 72 {                                                  74 {
 73   delete interp;                                   75   delete interp;
 74 }                                                  76 }
 75                                                    77 
 76                                                    78 
 77 std::vector<G4RDVEMDataSet*>* G4RDeIonisationC     79 std::vector<G4RDVEMDataSet*>* G4RDeIonisationCrossSectionHandler::BuildCrossSectionsForMaterials(
 78                         const G4DataVector& en     80                         const G4DataVector& energyVector,
 79                         const G4DataVector* en     81                         const G4DataVector* energyCuts)
 80 {                                                  82 {
 81   G4int verbose = 0;                               83   G4int verbose = 0;
 82   std::vector<G4RDVEMDataSet*>* set = new std:     84   std::vector<G4RDVEMDataSet*>* set = new std::vector<G4RDVEMDataSet*>;
 83                                                    85 
 84   G4DataVector* energies;                          86   G4DataVector* energies;
 85   G4DataVector* cs;                                87   G4DataVector* cs;
 86   G4int nOfBins = energyVector.size();             88   G4int nOfBins = energyVector.size();
 87                                                    89 
 88   const G4ProductionCutsTable* theCoupleTable=     90   const G4ProductionCutsTable* theCoupleTable=
 89         G4ProductionCutsTable::GetProductionCu     91         G4ProductionCutsTable::GetProductionCutsTable();
 90   size_t numOfCouples = theCoupleTable->GetTab     92   size_t numOfCouples = theCoupleTable->GetTableSize();
 91                                                    93 
 92   for (size_t m=0; m<numOfCouples; m++) {          94   for (size_t m=0; m<numOfCouples; m++) {
 93                                                    95 
 94     const G4MaterialCutsCouple* couple = theCo     96     const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(m);
 95     const G4Material* material= couple->GetMat     97     const G4Material* material= couple->GetMaterial();
 96     const G4ElementVector* elementVector = mat     98     const G4ElementVector* elementVector = material->GetElementVector();
 97     const G4double* nAtomsPerVolume = material     99     const G4double* nAtomsPerVolume = material->GetAtomicNumDensityVector();
 98     G4int nElements = material->GetNumberOfEle    100     G4int nElements = material->GetNumberOfElements();
 99                                                   101 
100     if(verbose > 0) {                             102     if(verbose > 0) {
101       G4cout << "eIonisation CS for " << m <<     103       G4cout << "eIonisation CS for " << m << "th material "
102              << material->GetName()               104              << material->GetName()
103              << "  eEl= " << nElements << G4en    105              << "  eEl= " << nElements << G4endl;
104     }                                             106     }
105                                                   107 
106     G4double tcut  = (*energyCuts)[m];            108     G4double tcut  = (*energyCuts)[m];
107                                                   109 
108     G4RDVDataSetAlgorithm* algo = interp->Clon    110     G4RDVDataSetAlgorithm* algo = interp->Clone();
109     G4RDVEMDataSet* setForMat = new G4RDCompos    111     G4RDVEMDataSet* setForMat = new G4RDCompositeEMDataSet(algo,1.,1.);
110                                                   112 
111     for (G4int i=0; i<nElements; i++) {           113     for (G4int i=0; i<nElements; i++) {
112                                                   114 
113       G4int Z = (G4int) (*elementVector)[i]->G    115       G4int Z = (G4int) (*elementVector)[i]->GetZ();
114       G4int nShells = NumberOfComponents(Z);      116       G4int nShells = NumberOfComponents(Z);
115       energies = new G4DataVector;                117       energies = new G4DataVector;
116       cs       = new G4DataVector;                118       cs       = new G4DataVector;
117       G4double density = nAtomsPerVolume[i];      119       G4double density = nAtomsPerVolume[i];
118                                                   120 
119       for (G4int bin=0; bin<nOfBins; bin++) {     121       for (G4int bin=0; bin<nOfBins; bin++) {
120                                                   122 
121         G4double e = energyVector[bin];           123         G4double e = energyVector[bin];
122         energies->push_back(e);                   124         energies->push_back(e);
123         G4double value = 0.0;                     125         G4double value = 0.0;
124                                                   126 
125         if(e > tcut) {                            127         if(e > tcut) {
126           for (G4int n=0; n<nShells; n++) {       128           for (G4int n=0; n<nShells; n++) {
127             G4double cross = FindValue(Z, e, n    129             G4double cross = FindValue(Z, e, n);
128             G4double p = theParam->Probability    130             G4double p = theParam->Probability(Z, tcut, e, e, n);
129             value += cross * p * density;         131             value += cross * p * density;
130                                                   132 
131             if(verbose>0 && m == 0 && e>=1. &&    133             if(verbose>0 && m == 0 && e>=1. && e<=0.) {
132               G4cout << "G4eIonCrossSH: e(MeV)    134               G4cout << "G4eIonCrossSH: e(MeV)= " << e/MeV
133                      << " n= " << n               135                      << " n= " << n
134                      << " cross= " << cross       136                      << " cross= " << cross
135                      << " p= " << p               137                      << " p= " << p
136                      << " value= " << value       138                      << " value= " << value
137                      << " tcut(MeV)= " << tcut    139                      << " tcut(MeV)= " << tcut/MeV
138                      << " rho= " << density       140                      << " rho= " << density
139                      << " Z= " << Z               141                      << " Z= " << Z
140                      << G4endl;                   142                      << G4endl;
141       }                                           143       }
142                                                   144 
143     }                                             145     }
144   }                                               146   }
145         cs->push_back(value);                     147         cs->push_back(value);
146       }                                           148       }
147       G4RDVDataSetAlgorithm* algo = interp->Cl    149       G4RDVDataSetAlgorithm* algo = interp->Clone();
148       G4RDVEMDataSet* elSet = new G4RDEMDataSe    150       G4RDVEMDataSet* elSet = new G4RDEMDataSet(i,energies,cs,algo,1.,1.);
149       setForMat->AddComponent(elSet);             151       setForMat->AddComponent(elSet);
150     }                                             152     }
151     set->push_back(setForMat);                    153     set->push_back(setForMat);
152   }                                               154   }
153                                                   155 
154   return set;                                     156   return set;
155 }                                                 157 }
156                                                   158 
157                                                   159 
158                                                   160