Geant4  10.02.p03
G4ScreenedCoulombCrossSection Class Referenceabstract

#include <G4ScreenedNuclearRecoil.hh>

Inheritance diagram for G4ScreenedCoulombCrossSection:
Collaboration diagram for G4ScreenedCoulombCrossSection:

Public Types

enum  { nMassMapElements =116 }
 
typedef std::map< G4int, G4ScreeningTablesScreeningMap
 
typedef std::map< G4int, class G4ParticleDefinition * > ParticleCache
 

Public Member Functions

 G4ScreenedCoulombCrossSection ()
 
 G4ScreenedCoulombCrossSection (const G4ScreenedCoulombCrossSection &src)
 
virtual ~G4ScreenedCoulombCrossSection ()
 
virtual void LoadData (G4String screeningKey, G4int z1, G4double m1, G4double recoilCutoff)=0
 
void BuildMFPTables (void)
 
virtual G4ScreenedCoulombCrossSectioncreate ()=0
 
const G4ScreeningTablesGetScreening (G4int Z)
 
void SetVerbosity (G4int v)
 
G4ParticleDefinitionSelectRandomUnweightedTarget (const G4MaterialCutsCouple *couple)
 
G4double standardmass (G4int z1)
 
const G4_c2_functionoperator[] (G4int materialIndex)
 

Protected Attributes

ScreeningMap screeningData
 
ParticleCache targetMap
 
G4int verbosity
 
std::map< G4int, G4_c2_const_ptrsigmaMap
 
std::map< G4int, G4_c2_const_ptrMFPTables
 

Static Private Attributes

static const G4double massmap [nMassMapElements+1]
 

Additional Inherited Members

Detailed Description

Definition at line 100 of file G4ScreenedNuclearRecoil.hh.

Member Typedef Documentation

◆ ParticleCache

◆ ScreeningMap

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
nMassMapElements 

Definition at line 134 of file G4ScreenedNuclearRecoil.hh.

Constructor & Destructor Documentation

◆ G4ScreenedCoulombCrossSection() [1/2]

G4ScreenedCoulombCrossSection::G4ScreenedCoulombCrossSection ( )
inline

Definition at line 104 of file G4ScreenedNuclearRecoil.hh.

◆ G4ScreenedCoulombCrossSection() [2/2]

G4ScreenedCoulombCrossSection::G4ScreenedCoulombCrossSection ( const G4ScreenedCoulombCrossSection src)
inline

◆ ~G4ScreenedCoulombCrossSection()

G4ScreenedCoulombCrossSection::~G4ScreenedCoulombCrossSection ( )
virtual

Definition at line 129 of file G4ScreenedNuclearRecoil.cc.

130 {
131  screeningData.clear();
132  MFPTables.clear();
133 }
std::map< G4int, G4_c2_const_ptr > MFPTables

Member Function Documentation

◆ BuildMFPTables()

void G4ScreenedCoulombCrossSection::BuildMFPTables ( void  )

Definition at line 247 of file G4ScreenedNuclearRecoil.cc.

248 {
249  const G4int nmfpvals=200;
250 
251  std::vector<G4double> evals(nmfpvals), mfpvals(nmfpvals);
252 
253  // sum up inverse MFPs per element for each material
254  const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
255  if (materialTable == 0) { return; }
256  //G4Exception("G4ScreenedCoulombCrossSection::BuildMFPTables
257  //- no MaterialTable found)");
258 
260 
261  for (G4int matidx=0; matidx < nMaterials; matidx++) {
262 
263  const G4Material* material= (*materialTable)[matidx];
264  const G4ElementVector &elementVector =
265  *(material->GetElementVector());
266  const G4int nMatElements = material->GetNumberOfElements();
267 
268  const G4Element *element=0;
269  const G4double *atomDensities=material->GetVecNbOfAtomsPerVolume();
270 
271  G4double emin=0, emax=0;
272  // find innermost range of cross section functions
273  for (G4int kel=0 ; kel < nMatElements ; kel++ )
274  {
275  element=elementVector[kel];
276  G4int Z=(G4int)std::floor(element->GetZ()+0.5);
277  const G4_c2_function &ifunc=sigmaMap[Z];
278  if(!kel || ifunc.xmin() > emin) emin=ifunc.xmin();
279  if(!kel || ifunc.xmax() < emax) emax=ifunc.xmax();
280  }
281 
282  G4double logint=std::log(emax/emin) / (nmfpvals-1) ;
283  // logarithmic increment for tables
284 
285  // compute energy scale for interpolator. Force exact values at
286  // both ends to avoid range errors
287  for (G4int i=1; i<nmfpvals-1; i++) evals[i]=emin*std::exp(logint*i);
288  evals.front()=emin;
289  evals.back()=emax;
290 
291  // zero out the inverse mfp sums to start
292  for (G4int eidx=0; eidx < nmfpvals; eidx++) mfpvals[eidx] = 0.0;
293 
294  // sum inverse mfp for each element in this material and for each
295  // energy
296  for (G4int kel=0 ; kel < nMatElements ; kel++ )
297  {
298  element=elementVector[kel];
299  G4int Z=(G4int)std::floor(element->GetZ()+0.5);
300  const G4_c2_function &sigma=sigmaMap[Z];
301  G4double ndens = atomDensities[kel];
302  // compute atom fraction for this element in this material
303 
304  for (G4int eidx=0; eidx < nmfpvals; eidx++) {
305  mfpvals[eidx] += ndens*sigma(evals[eidx]);
306  }
307  }
308 
309  // convert inverse mfp to regular mfp
310  for (G4int eidx=0; eidx < nmfpvals; eidx++) {
311  mfpvals[eidx] = 1.0/mfpvals[eidx];
312  }
313  // and make a new interpolating function out of the sum
314  MFPTables[matidx] = c2.log_log_interpolating_function().load(evals,
315  mfpvals,true,0,true,0);
316  }
317 }
static c2_factory< G4double > c2
float_type xmin() const
return the lower bound of the domain for this function as set by set_domain()
Definition: c2_function.hh:297
std::vector< G4Element * > G4ElementVector
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
std::vector< G4Material * > G4MaterialTable
int G4int
Definition: G4Types.hh:78
string material
Definition: eplot.py:19
std::map< G4int, G4_c2_const_ptr > MFPTables
Float_t Z
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:206
std::map< G4int, G4_c2_const_ptr > sigmaMap
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:596
static const G4double emax
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
float_type xmax() const
return the upper bound of the domain for this function as set by set_domain()
Definition: c2_function.hh:299
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:190
double G4double
Definition: G4Types.hh:76
G4double GetZ() const
Definition: G4Element.hh:131
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create()

virtual G4ScreenedCoulombCrossSection* G4ScreenedCoulombCrossSection::create ( )
pure virtual

Implemented in G4NativeScreenedCoulombCrossSection.

Here is the caller graph for this function:

◆ GetScreening()

const G4ScreeningTables* G4ScreenedCoulombCrossSection::GetScreening ( G4int  Z)
inline

Definition at line 126 of file G4ScreenedNuclearRecoil.hh.

127  { return &(screeningData[Z]); }
Float_t Z
Here is the caller graph for this function:

◆ LoadData()

virtual void G4ScreenedCoulombCrossSection::LoadData ( G4String  screeningKey,
G4int  z1,
G4double  m1,
G4double  recoilCutoff 
)
pure virtual

Implemented in G4NativeScreenedCoulombCrossSection.

Here is the caller graph for this function:

◆ operator[]()

const G4_c2_function* G4ScreenedCoulombCrossSection::operator[] ( G4int  materialIndex)
inline

Definition at line 140 of file G4ScreenedNuclearRecoil.hh.

140  {
141  return MFPTables.find(materialIndex)!=MFPTables.end() ?
142  &(MFPTables[materialIndex].get()) : (G4_c2_function *)0;
143  }
std::map< G4int, G4_c2_const_ptr > MFPTables

◆ SelectRandomUnweightedTarget()

G4ParticleDefinition * G4ScreenedCoulombCrossSection::SelectRandomUnweightedTarget ( const G4MaterialCutsCouple couple)

Definition at line 166 of file G4ScreenedNuclearRecoil.cc.

168 {
169  // Select randomly an element within the material, according to number
170  // density only
171  const G4Material* material = couple->GetMaterial();
172  G4int nMatElements = material->GetNumberOfElements();
173  const G4ElementVector* elementVector = material->GetElementVector();
174  const G4Element *element=0;
176 
177  // Special case: the material consists of one element
178  if (nMatElements == 1)
179  {
180  element= (*elementVector)[0];
181  }
182  else
183  {
184  // Composite material
185  G4double random = G4UniformRand() * material->GetTotNbOfAtomsPerVolume();
186  G4double nsum=0.0;
187  const G4double *atomDensities=material->GetVecNbOfAtomsPerVolume();
188 
189  for (G4int k=0 ; k < nMatElements ; k++ )
190  {
191  nsum+=atomDensities[k];
192  element= (*elementVector)[k];
193  if (nsum >= random) break;
194  }
195  }
196 
197  G4int N=0;
198  G4int Z=(G4int)std::floor(element->GetZ()+0.5);
199 
200  G4int nIsotopes=element->GetNumberOfIsotopes();
201  if(!nIsotopes) {
202  if(Z<=92) {
203  // we have no detailed material isotopic info available,
204  // so use G4StableIsotopes table up to Z=92
205  static G4StableIsotopes theIso;
206  // get a stable isotope table for default results
207  nIsotopes=theIso.GetNumberOfIsotopes(Z);
208  G4double random = 100.0*G4UniformRand();
209  // values are expressed as percent, sum is 100
210  G4int tablestart=theIso.GetFirstIsotope(Z);
211  G4double asum=0.0;
212  for(G4int i=0; i<nIsotopes; i++) {
213  asum+=theIso.GetAbundance(i+tablestart);
214  N=theIso.GetIsotopeNucleonCount(i+tablestart);
215  if(asum >= random) break;
216  }
217  } else {
218  // too heavy for stable isotope table, just use mean mass
219  N=(G4int)std::floor(element->GetN()+0.5);
220  }
221  } else {
222  G4int i;
223  const G4IsotopeVector *isoV=element->GetIsotopeVector();
224  G4double random = G4UniformRand();
225  G4double *abundance=element->GetRelativeAbundanceVector();
226  G4double asum=0.0;
227  for(i=0; i<nIsotopes; i++) {
228  asum+=abundance[i];
229  N=(*isoV)[i]->GetN();
230  if(asum >= random) break;
231  }
232  }
233 
234  // get the official definition of this nucleus, to get the correct
235  // value of A note that GetIon is very slow, so we will cache ones
236  // we have already found ourselves.
237  ParticleCache::iterator p=targetMap.find(Z*1000+N);
238  if (p != targetMap.end()) {
239  target=(*p).second;
240  } else{
241  target=G4IonTable::GetIonTable()->GetIon(Z, N, 0.0);
242  targetMap[Z*1000+N]=target;
243  }
244  return target;
245 }
std::vector< G4Isotope * > G4IsotopeVector
std::vector< G4Element * > G4ElementVector
const G4Material * GetMaterial() const
G4int GetFirstIsotope(G4int Z)
G4double GetTotNbOfAtomsPerVolume() const
Definition: G4Material.hh:209
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:491
int G4int
Definition: G4Types.hh:78
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
G4double GetN() const
Definition: G4Element.hh:134
string material
Definition: eplot.py:19
#define G4UniformRand()
Definition: Randomize.hh:97
Float_t Z
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:206
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:78
G4int GetNumberOfIsotopes(G4int Z)
G4int GetIsotopeNucleonCount(G4int number)
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
cout<< "-> Edep in the target
Definition: analysis.C:54
**D E S C R I P T I O N
G4double GetAbundance(G4int number)
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:190
double G4double
Definition: G4Types.hh:76
G4double GetZ() const
Definition: G4Element.hh:131
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetVerbosity()

void G4ScreenedCoulombCrossSection::SetVerbosity ( G4int  v)
inline

Definition at line 128 of file G4ScreenedNuclearRecoil.hh.

Here is the caller graph for this function:

◆ standardmass()

G4double G4ScreenedCoulombCrossSection::standardmass ( G4int  z1)
inline

Definition at line 136 of file G4ScreenedNuclearRecoil.hh.

137  { return z1 <= nMassMapElements ? massmap[z1] : 2.5*z1; }
static const G4double massmap[nMassMapElements+1]

Member Data Documentation

◆ massmap

const G4double G4ScreenedCoulombCrossSection::massmap
staticprivate
Initial value:
={
0, 1.007940, 4.002602, 6.941000, 9.012182, 10.811000, 12.010700,
14.006700, 15.999400, 18.998403, 20.179700, 22.989770, 24.305000, 26.981538,
28.085500,
30.973761, 32.065000, 35.453000, 39.948000, 39.098300, 40.078000, 44.955910,
47.867000,
50.941500, 51.996100, 54.938049, 55.845000, 58.933200, 58.693400, 63.546000,
65.409000,
69.723000, 72.640000, 74.921600, 78.960000, 79.904000, 83.798000, 85.467800,
87.620000,
88.905850, 91.224000, 92.906380, 95.940000, 98.000000, 101.070000, 102.905500,
106.420000,
107.868200, 112.411000, 114.818000, 118.710000, 121.760000, 127.600000,
126.904470, 131.293000,
132.905450, 137.327000, 138.905500, 140.116000, 140.907650, 144.240000,
145.000000, 150.360000,
151.964000, 157.250000, 158.925340, 162.500000, 164.930320, 167.259000,
168.934210, 173.040000,
174.967000, 178.490000, 180.947900, 183.840000, 186.207000, 190.230000,
192.217000, 195.078000,
196.966550, 200.590000, 204.383300, 207.200000, 208.980380, 209.000000,
210.000000, 222.000000,
223.000000, 226.000000, 227.000000, 232.038100, 231.035880, 238.028910,
237.000000, 244.000000,
243.000000, 247.000000, 247.000000, 251.000000, 252.000000, 257.000000,
258.000000, 259.000000,
262.000000, 261.000000, 262.000000, 266.000000, 264.000000, 277.000000,
268.000000, 281.000000,
272.000000, 285.000000, 282.500000, 289.000000, 287.500000, 292.000000}

Definition at line 154 of file G4ScreenedNuclearRecoil.hh.

◆ MFPTables

std::map<G4int, G4_c2_const_ptr > G4ScreenedCoulombCrossSection::MFPTables
protected

Definition at line 151 of file G4ScreenedNuclearRecoil.hh.

◆ screeningData

ScreeningMap G4ScreenedCoulombCrossSection::screeningData
protected

Definition at line 146 of file G4ScreenedNuclearRecoil.hh.

◆ sigmaMap

std::map<G4int, G4_c2_const_ptr > G4ScreenedCoulombCrossSection::sigmaMap
protected

Definition at line 149 of file G4ScreenedNuclearRecoil.hh.

◆ targetMap

ParticleCache G4ScreenedCoulombCrossSection::targetMap
protected

Definition at line 147 of file G4ScreenedNuclearRecoil.hh.

◆ verbosity

G4int G4ScreenedCoulombCrossSection::verbosity
protected

Definition at line 148 of file G4ScreenedNuclearRecoil.hh.


The documentation for this class was generated from the following files: