Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4NistMaterialBuilder Class Reference

#include <G4NistMaterialBuilder.hh>

Public Member Functions

 G4NistMaterialBuilder (G4NistElementBuilder *, G4int verb=0)
 
 ~G4NistMaterialBuilder ()
 
G4MaterialFindMaterial (const G4String &name) const
 
G4MaterialFindOrBuildMaterial (const G4String &name, G4bool isotopes=true, G4bool warning=true)
 
G4MaterialFindSimpleMaterial (G4int Z) const
 
G4MaterialFindOrBuildSimpleMaterial (G4int Z, G4bool warning)
 
G4MaterialConstructNewMaterial (const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4double dens, G4bool isotopes=true, G4State state=kStateSolid, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
 
G4MaterialConstructNewMaterial (const G4String &name, const std::vector< G4String > &elm, const std::vector< G4double > &weight, G4double dens, G4bool isotopes=true, G4State state=kStateSolid, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
 
G4MaterialConstructNewGasMaterial (const G4String &name, const G4String &nameDB, G4double temp, G4double pres, G4bool isotopes=true)
 
G4MaterialConstructNewIdealGasMaterial (const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4bool isotopes=true, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
 
void SetVerbose (G4int val)
 
void ListMaterials (const G4String &) const
 
void ListNistSimpleMaterials () const
 
void ListNistCompoundMaterials () const
 
void ListHepMaterials () const
 
void ListSpaceMaterials () const
 
void ListBioChemicalMaterials () const
 
const std::vector< G4String > & GetMaterialNames () const
 
G4double GetMeanIonisationEnergy (G4int index) const
 
G4double GetNominalDensity (G4int index) const
 

Detailed Description

Definition at line 70 of file G4NistMaterialBuilder.hh.

Constructor & Destructor Documentation

G4NistMaterialBuilder::G4NistMaterialBuilder ( G4NistElementBuilder eb,
G4int  verb = 0 
)

Definition at line 86 of file G4NistMaterialBuilder.cc.

87 : elmBuilder(eb),
88  verbose(vb),
89  nMaterials(0),
90  nComponents(0),
91  nCurrent(0)
92 {
93  Initialise();
94 }
G4NistMaterialBuilder::~G4NistMaterialBuilder ( )

Definition at line 98 of file G4NistMaterialBuilder.cc.

99 {}

Member Function Documentation

G4Material * G4NistMaterialBuilder::ConstructNewGasMaterial ( const G4String name,
const G4String nameDB,
G4double  temp,
G4double  pres,
G4bool  isotopes = true 
)

Definition at line 345 of file G4NistMaterialBuilder.cc.

351 {
352  // Material name is in DB
353  G4Material* mat = FindOrBuildMaterial(name);
354  if(mat) {
355  G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:"
356  << " WARNING: the material <" << name
357  << "> is already exist" << G4endl;
358  G4cout << " New material will NOT be built!"
359  << G4endl;
360  return mat;
361  }
362 
363  G4Material* bmat = FindOrBuildMaterial(nameDB);
364  if(!bmat) {
365  G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:"
366  << " WARNING: the Name <" << nameDB
367  << "> is NOT in the DB: no new gas will be constructed"
368  << G4endl;
369  return 0;
370  }
371  if(bmat->GetState() != kStateGas) {
372  G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:"
373  << " WARNING: <" << nameDB
374  << "> is NOT a gas - no new gas will be constructed"
375  << G4endl;
376  return 0;
377  }
378 
379  G4double dens = bmat->GetDensity()*pres*bmat->GetTemperature()
380  /(temp*bmat->GetPressure());
381  mat = new G4Material(name,dens,bmat,kStateGas,temp,pres);
382 
383  if (verbose>1) {
384  G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial: done" << G4endl;
385  G4cout << &mat << G4endl;
386  }
387  return mat;
388 }
G4double GetPressure() const
Definition: G4Material.hh:183
G4double GetDensity() const
Definition: G4Material.hh:180
G4GLOB_DLL std::ostream G4cout
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=true)
G4double GetTemperature() const
Definition: G4Material.hh:182
#define G4endl
Definition: G4ios.hh:61
G4State GetState() const
Definition: G4Material.hh:181
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4Material * G4NistMaterialBuilder::ConstructNewIdealGasMaterial ( const G4String name,
const std::vector< G4String > &  elm,
const std::vector< G4int > &  nbAtoms,
G4bool  isotopes = true,
G4double  temp = NTP_Temperature,
G4double  pressure = CLHEP::STP_Pressure 
)

Definition at line 392 of file G4NistMaterialBuilder.cc.

399 {
400  G4State state = kStateGas;
401 
402  // Material is in DB
403  G4Material* mat = FindOrBuildMaterial(name);
404  if(mat) {
405  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
406  << " WARNING: the material <" << name
407  << "> is already exist" << G4endl;
408  G4cout << " New material will NOT be built!"
409  << G4endl;
410  return mat;
411  }
412 
413  // Material not in DB
414  G4int els = elm.size();
415  if(els == 0) {
416  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
417  << " WARNING: empty list of elements for " << name
418  << G4endl;
419  G4cout << " New material will NOT be built!"
420  << G4endl;
421  return 0;
422  }
423 
424  // add parameters of material into internal vectors
425  // density in g/cm3, mean ionisation potential is not defined
426  G4bool stp = true;
427  if(temp != NTP_Temperature && pres != STP_Pressure)
428  { stp = false; }
429 
430  G4double massPerMole = 0;
431 
432  G4int Z = 0;
433  for (G4int i=0; i<els; ++i) {
434  Z = elmBuilder->GetZ(elm[i]);
435  massPerMole += nbAtoms[i]*elmBuilder->GetAtomicMassAmu(Z)*CLHEP::amu_c2;
436  }
437 
438  G4double dens = massPerMole/(CLHEP::Avogadro*CLHEP::k_Boltzmann*temp/pres);
439 
440  if (els == 1) { AddMaterial(name,dens,Z,0.,els,state,stp); }
441  else {
442  AddMaterial(name,dens,0,0.,els,state,stp);
443  for (G4int i=0; i<els; ++i) {
444  AddElementByAtomCount(elmBuilder->GetZ(elm[i]), nbAtoms[i]);
445  }
446  }
447 
448  if(!stp) { AddGas(name,temp,pres); }
449 
450  return BuildMaterial(nMaterials-1);
451 }
static constexpr double k_Boltzmann
G4State
Definition: G4Material.hh:114
static constexpr double STP_Pressure
G4double GetAtomicMassAmu(const G4String &symb) const
int G4int
Definition: G4Types.hh:78
static constexpr double Avogadro
G4GLOB_DLL std::ostream G4cout
G4int GetZ(const G4String &symb) const
bool G4bool
Definition: G4Types.hh:79
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=true)
static constexpr double amu_c2
static const G4double NTP_Temperature
Definition: G4Material.hh:116
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4Material * G4NistMaterialBuilder::ConstructNewMaterial ( const G4String name,
const std::vector< G4String > &  elm,
const std::vector< G4int > &  nbAtoms,
G4double  dens,
G4bool  isotopes = true,
G4State  state = kStateSolid,
G4double  temp = NTP_Temperature,
G4double  pressure = CLHEP::STP_Pressure 
)

Definition at line 246 of file G4NistMaterialBuilder.cc.

255 {
256  // Material is in DB
257  G4Material* mat = FindOrBuildMaterial(name);
258  if(mat) {
259  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
260  << " WARNING: the material <" << name
261  << "> is already exist" << G4endl;
262  G4cout << " New material will NOT be built!"
263  << G4endl;
264  return mat;
265  }
266 
267  // Material not in DB
268  G4int els = elm.size();
269  if(els == 0) {
270  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
271  << " WARNING: empty list of elements for " << name
272  << G4endl;
273  G4cout << " New material will NOT be built!"
274  << G4endl;
275  return 0;
276  }
277 
278  // add parameters of material into internal vectors
279  // density in g/cm3, mean ionisation potential is not defined
280  G4bool stp = true;
281  if(state == kStateGas && (temp != NTP_Temperature || pres != STP_Pressure))
282  { stp = false; }
283 
284  AddMaterial(name,dens*cm3/g,0,0.,els,state,stp);
285  if(!stp) { AddGas(name,temp,pres); }
286 
287  for (G4int i=0; i<els; ++i) {
288  AddElementByAtomCount(elmBuilder->GetZ(elm[i]), nbAtoms[i]);
289  }
290 
291  return BuildMaterial(nMaterials-1);
292 }
static constexpr double STP_Pressure
static constexpr double g
Definition: G4SIunits.hh:183
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4int GetZ(const G4String &symb) const
bool G4bool
Definition: G4Types.hh:79
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=true)
static constexpr double cm3
Definition: G4SIunits.hh:121
static const G4double NTP_Temperature
Definition: G4Material.hh:116
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4Material * G4NistMaterialBuilder::ConstructNewMaterial ( const G4String name,
const std::vector< G4String > &  elm,
const std::vector< G4double > &  weight,
G4double  dens,
G4bool  isotopes = true,
G4State  state = kStateSolid,
G4double  temp = NTP_Temperature,
G4double  pressure = CLHEP::STP_Pressure 
)

Definition at line 296 of file G4NistMaterialBuilder.cc.

305 {
306  // Material is in DB
307  G4Material* mat = FindOrBuildMaterial(name);
308  if(mat) {
309  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
310  << " WARNING: the material <" << name
311  << "> is already exist" << G4endl;
312  G4cout << " New material will NOT be built!"
313  << G4endl;
314  return mat;
315  }
316 
317  // Material not in DB
318  G4int els = elm.size();
319  if(els == 0) {
320  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
321  << " WARNING: empty list of elements for " << name
322  << G4endl;
323  G4cout << " New material will NOT be built!"
324  << G4endl;
325  return 0;
326  }
327 
328  // add parameters of material into internal vectors
329  // density in g/cm3, mean ionisation potential is not defined
330  G4bool stp = true;
331  if(state == kStateGas && (temp != NTP_Temperature || pres != STP_Pressure))
332  { stp = false; }
333  AddMaterial(name,dens*cm3/g,0,0.,els,state,stp);
334  if(!stp) { AddGas(name,temp,pres); }
335 
336  for (G4int i=0; i<els; ++i) {
337  AddElementByWeightFraction(elmBuilder->GetZ(elm[i]), w[i]);
338  }
339 
340  return BuildMaterial(nMaterials-1);
341 }
static constexpr double STP_Pressure
static constexpr double g
Definition: G4SIunits.hh:183
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4int GetZ(const G4String &symb) const
bool G4bool
Definition: G4Types.hh:79
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=true)
static constexpr double cm3
Definition: G4SIunits.hh:121
static const G4double NTP_Temperature
Definition: G4Material.hh:116
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4Material * G4NistMaterialBuilder::FindMaterial ( const G4String name) const
inline

Definition at line 249 of file G4NistMaterialBuilder.hh.

250 {
251  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
252  size_t nmat = theMaterialTable->size();
253  G4Material* ptr = nullptr;
254  for(size_t i=0; i<nmat; ++i) {
255  if(name == ((*theMaterialTable)[i])->GetName()) {
256  ptr = (*theMaterialTable)[i];
257  break;
258  }
259  }
260  return ptr;
261 }
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable

Here is the call graph for this function:

Here is the caller graph for this function:

G4Material * G4NistMaterialBuilder::FindOrBuildMaterial ( const G4String name,
G4bool  isotopes = true,
G4bool  warning = true 
)

Definition at line 103 of file G4NistMaterialBuilder.cc.

105 {
106  if(verbose > 1) {
107  G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial "
108  << matname << G4endl;
109  }
110  G4Material* mat = FindMaterial(matname);
111  if(mat != nullptr) { return mat; }
112  G4String name = matname;
113  if(name == "G4_NYLON-6/6" || name == "G4_NYLON-6/10") {
114  if("G4_NYLON-6/6" == matname) { name = "G4_NYLON-6-6"; }
115  else { name = "G4_NYLON-6-10";}
116  mat = FindMaterial(name);
117  }
118  return (mat == nullptr) ? BuildNistMaterial(name, warning) : mat;
119 }
G4Material * FindMaterial(const G4String &name) const
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4Material * G4NistMaterialBuilder::FindOrBuildSimpleMaterial ( G4int  Z,
G4bool  warning 
)

Definition at line 161 of file G4NistMaterialBuilder.cc.

162 {
164  if(mat == nullptr) {
165  mat = BuildNistMaterial(names[Z], warn);
166  }
167  return mat;
168 }
G4Material * FindSimpleMaterial(G4int Z) const

Here is the call graph for this function:

Here is the caller graph for this function:

G4Material * G4NistMaterialBuilder::FindSimpleMaterial ( G4int  Z) const
inline

Definition at line 264 of file G4NistMaterialBuilder.hh.

265 {
266  return (Z>0 && Z<nElementary) ? FindMaterial(names[Z]) : nullptr;
267 }
G4Material * FindMaterial(const G4String &name) const

Here is the call graph for this function:

Here is the caller graph for this function:

const std::vector< G4String > & G4NistMaterialBuilder::GetMaterialNames ( ) const
inline

Definition at line 231 of file G4NistMaterialBuilder.hh.

232 {
233  return names;
234 }

Here is the caller graph for this function:

G4double G4NistMaterialBuilder::GetMeanIonisationEnergy ( G4int  index) const
inline

Definition at line 237 of file G4NistMaterialBuilder.hh.

238 {
239  return (index >= 0 && index < nMaterials) ? ionPotentials[index] : 10.0*index;
240 }

Here is the caller graph for this function:

G4double G4NistMaterialBuilder::GetNominalDensity ( G4int  index) const
inline

Definition at line 243 of file G4NistMaterialBuilder.hh.

244 {
245  return (index >= 0 && index < nMaterials) ? densities[index] : 0.0;
246 }

Here is the caller graph for this function:

void G4NistMaterialBuilder::ListBioChemicalMaterials ( ) const

Definition at line 592 of file G4NistMaterialBuilder.cc.

593 {
594  G4cout << "=============================================================" << G4endl;
595  G4cout << "### Bio-Chemical Materials ##" << G4endl;
596  G4cout << "=============================================================" << G4endl;
597  G4cout << " Ncomp Name density(g/cm^3) I(eV) ChFormula" << G4endl;
598  G4cout << "=============================================================" << G4endl;
599  for (G4int i=nSpace; i<nMaterials; ++i) {DumpMix(i);}
600  G4cout << "=============================================================" << G4endl;
601 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4NistMaterialBuilder::ListHepMaterials ( ) const

Definition at line 568 of file G4NistMaterialBuilder.cc.

569 {
570  G4cout << "=============================================================" << G4endl;
571  G4cout << "### HEP & Nuclear Materials ##" << G4endl;
572  G4cout << "=============================================================" << G4endl;
573  G4cout << " Ncomp Name density(g/cm^3) I(eV) ChFormula" << G4endl;
574  G4cout << "=============================================================" << G4endl;
575  for (G4int i=nNIST; i<nHEP; ++i) {DumpMix(i);}
576 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4NistMaterialBuilder::ListMaterials ( const G4String mnam) const

Definition at line 520 of file G4NistMaterialBuilder.cc.

521 {
522  if (mnam == "simple") { ListNistSimpleMaterials(); }
523  else if (mnam == "compound") { ListNistCompoundMaterials(); }
524  else if (mnam == "hep") { ListHepMaterials(); }
525  else if (mnam == "space") { ListSpaceMaterials(); }
526  else if (mnam == "bio") { ListBioChemicalMaterials(); }
527 
528  else if (mnam == "all") {
534 
535  } else {
536  G4cout << "### G4NistMaterialBuilder::ListMaterials: Warning "
537  << mnam << " list is not known" << G4endl;
538  }
539 }
void ListBioChemicalMaterials() const
G4GLOB_DLL std::ostream G4cout
void ListNistCompoundMaterials() const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4NistMaterialBuilder::ListNistCompoundMaterials ( ) const

Definition at line 555 of file G4NistMaterialBuilder.cc.

556 {
557  G4cout << "=============================================================" << G4endl;
558  G4cout << "### Compound Materials from the NIST Data Base ##" << G4endl;
559  G4cout << "=============================================================" << G4endl;
560  G4cout << " Ncomp Name density(g/cm^3) I(eV) ChFormula" << G4endl;
561  G4cout << "=============================================================" << G4endl;
562  for (G4int i=nElementary; i<nNIST; ++i) {DumpMix(i);}
563  DumpMix(0);
564 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4NistMaterialBuilder::ListNistSimpleMaterials ( ) const

Definition at line 543 of file G4NistMaterialBuilder.cc.

544 {
545  G4cout << "=======================================================" << G4endl;
546  G4cout << "### Simple Materials from the NIST Data Base ###" << G4endl;
547  G4cout << "=======================================================" << G4endl;
548  G4cout << " Z Name density(g/cm^3) I(eV) " << G4endl;
549  G4cout << "=======================================================" << G4endl;
550  for (G4int i=1; i<nElementary; ++i) {DumpElm(i);}
551 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4NistMaterialBuilder::ListSpaceMaterials ( ) const

Definition at line 580 of file G4NistMaterialBuilder.cc.

581 {
582  G4cout << "=============================================================" << G4endl;
583  G4cout << "### Space ISS Materials ##" << G4endl;
584  G4cout << "=============================================================" << G4endl;
585  G4cout << " Ncomp Name density(g/cm^3) I(eV) ChFormula" << G4endl;
586  G4cout << "=============================================================" << G4endl;
587  for (G4int i=nHEP; i<nSpace; ++i) {DumpMix(i);}
588 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4NistMaterialBuilder::SetVerbose ( G4int  val)

Definition at line 512 of file G4NistMaterialBuilder.cc.

513 {
514  verbose = val;
515  elmBuilder->SetVerbose(verbose);
516 }

Here is the call graph for this function:

Here is the caller graph for this function:


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