Geant4_10
G4RDeIonisationCrossSectionHandler.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id$
27 // GEANT4 tag $Name: geant4-09-01-ref-00 $
28 //
29 // -------------------------------------------------------------------
30 //
31 // GEANT4 Class file
32 //
33 //
34 // File name: G4RDeIonisationCrossSectionHandler
35 //
36 // Author: V.Ivanchenko (Vladimir.Ivanchenko@cern.ch)
37 //
38 // Creation date: 25 Sept 2001
39 //
40 // Modifications:
41 // 10 Oct 2001 M.G. Pia Revision to improve code quality and consistency with design
42 // 19 Jul 2002 VI Create composite data set for material
43 // 21 Jan 2003 V.Ivanchenko Cut per region
44 //
45 // -------------------------------------------------------------------
46 
48 #include "G4PhysicalConstants.hh"
49 #include "G4SystemOfUnits.hh"
50 #include "G4RDVEnergySpectrum.hh"
51 #include "G4DataVector.hh"
53 #include "G4RDVDataSetAlgorithm.hh"
56 #include "G4RDVEMDataSet.hh"
57 #include "G4RDEMDataSet.hh"
58 #include "G4Material.hh"
59 #include "G4ProductionCutsTable.hh"
60 
61 
64  G4double emin, G4double emax, G4int nbin)
66  theParam(spec)
67 {
68  G4RDVCrossSectionHandler::Initialise(alg, emin, emax, nbin);
69  interp = new G4RDLinLogLogInterpolation();
70 }
71 
72 
74 {
75  delete interp;
76 }
77 
78 
80  const G4DataVector& energyVector,
81  const G4DataVector* energyCuts)
82 {
83  G4int verbose = 0;
84  std::vector<G4RDVEMDataSet*>* set = new std::vector<G4RDVEMDataSet*>;
85 
86  G4DataVector* energies;
87  G4DataVector* cs;
88  G4int nOfBins = energyVector.size();
89 
90  const G4ProductionCutsTable* theCoupleTable=
92  size_t numOfCouples = theCoupleTable->GetTableSize();
93 
94  for (size_t m=0; m<numOfCouples; m++) {
95 
96  const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(m);
97  const G4Material* material= couple->GetMaterial();
98  const G4ElementVector* elementVector = material->GetElementVector();
99  const G4double* nAtomsPerVolume = material->GetAtomicNumDensityVector();
100  G4int nElements = material->GetNumberOfElements();
101 
102  if(verbose > 0) {
103  G4cout << "eIonisation CS for " << m << "th material "
104  << material->GetName()
105  << " eEl= " << nElements << G4endl;
106  }
107 
108  G4double tcut = (*energyCuts)[m];
109 
110  G4RDVDataSetAlgorithm* algo = interp->Clone();
111  G4RDVEMDataSet* setForMat = new G4RDCompositeEMDataSet(algo,1.,1.);
112 
113  for (G4int i=0; i<nElements; i++) {
114 
115  G4int Z = (G4int) (*elementVector)[i]->GetZ();
116  G4int nShells = NumberOfComponents(Z);
117  energies = new G4DataVector;
118  cs = new G4DataVector;
119  G4double density = nAtomsPerVolume[i];
120 
121  for (G4int bin=0; bin<nOfBins; bin++) {
122 
123  G4double e = energyVector[bin];
124  energies->push_back(e);
125  G4double value = 0.0;
126 
127  if(e > tcut) {
128  for (G4int n=0; n<nShells; n++) {
129  G4double cross = FindValue(Z, e, n);
130  G4double p = theParam->Probability(Z, tcut, e, e, n);
131  value += cross * p * density;
132 
133  if(verbose>0 && m == 0 && e>=1. && e<=0.) {
134  G4cout << "G4eIonCrossSH: e(MeV)= " << e/MeV
135  << " n= " << n
136  << " cross= " << cross
137  << " p= " << p
138  << " value= " << value
139  << " tcut(MeV)= " << tcut/MeV
140  << " rho= " << density
141  << " Z= " << Z
142  << G4endl;
143  }
144 
145  }
146  }
147  cs->push_back(value);
148  }
149  G4RDVDataSetAlgorithm* algo = interp->Clone();
150  G4RDVEMDataSet* elSet = new G4RDEMDataSet(i,energies,cs,algo,1.,1.);
151  setForMat->AddComponent(elSet);
152  }
153  set->push_back(setForMat);
154  }
155 
156  return set;
157 }
158 
159 
virtual G4RDVDataSetAlgorithm * Clone() const =0
std::vector< G4Element * > G4ElementVector
void Initialise(G4RDVDataSetAlgorithm *interpolation=0, G4double minE=250 *CLHEP::eV, G4double maxE=100 *CLHEP::GeV, G4int numberOfBins=200, G4double unitE=CLHEP::MeV, G4double unitData=CLHEP::barn, G4int minZ=1, G4int maxZ=99)
const char * p
Definition: xmltok.h:285
const G4String & GetName() const
Definition: G4Material.hh:176
float bin[41]
Definition: plottest35.C:14
G4double FindValue(G4int Z, G4double e) const
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
string material
Definition: eplot.py:19
G4double density
Definition: TRTMaterials.hh:39
Char_t n[5]
G4GLOB_DLL std::ostream G4cout
Float_t Z
Definition: plot.C:39
std::vector< G4RDVEMDataSet * > * BuildCrossSectionsForMaterials(const G4DataVector &energyVector, const G4DataVector *energyCuts)
const G4double * GetAtomicNumDensityVector() const
Definition: G4Material.hh:214
static G4ProductionCutsTable * GetProductionCutsTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4RDeIonisationCrossSectionHandler(const G4RDVEnergySpectrum *spec, G4RDVDataSetAlgorithm *alg, G4double emin, G4double emax, G4int nbin)
const XML_Char int const XML_Char * value
Definition: expat.h:331
#define G4endl
Definition: G4ios.hh:61
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
G4int NumberOfComponents(G4int Z) const
double G4double
Definition: G4Types.hh:76
virtual void AddComponent(G4RDVEMDataSet *dataSet)=0
const G4Material * GetMaterial() const
virtual G4double Probability(G4int Z, G4double minKineticEnergy, G4double maxKineticEnergy, G4double kineticEnergy, G4int shell=0, const G4ParticleDefinition *pd=0) const =0