Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4NistMaterialBuilder Class Reference

#include <G4NistMaterialBuilder.hh>

Public Member Functions

 G4NistMaterialBuilder (G4NistElementBuilder *, G4int verb=0)
 
 ~G4NistMaterialBuilder ()
 
G4MaterialFindOrBuildMaterial (const G4String &name, G4bool isotopes=true, G4bool warning=true)
 
G4MaterialConstructNewMaterial (const G4String &name, const std::vector< G4String > &elm, const std::vector< G4int > &nbAtoms, G4double dens, G4bool isotopes=true, G4State state=kStateSolid, G4double temp=CLHEP::STP_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=CLHEP::STP_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=CLHEP::STP_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
 

Detailed Description

Definition at line 69 of file G4NistMaterialBuilder.hh.

Constructor & Destructor Documentation

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

Definition at line 82 of file G4NistMaterialBuilder.cc.

83 : elmBuilder(eb),
84  verbose(vb),
85  nMaterials(0),
86  nComponents(0),
87  nCurrent(0),
88  first(true)
89 {
90  Initialise();
91 }
G4NistMaterialBuilder::~G4NistMaterialBuilder ( )

Definition at line 95 of file G4NistMaterialBuilder.cc.

96 {}

Member Function Documentation

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

Definition at line 333 of file G4NistMaterialBuilder.cc.

References FindOrBuildMaterial(), G4cout, G4endl, G4Material::GetDensity(), G4Material::GetState(), kStateGas, python.hepunit::STP_Pressure, and python.hepunit::STP_Temperature.

Referenced by G4NistManager::ConstructNewGasMaterial().

339 {
340  // Material name is in DB
341  G4Material* mat = FindOrBuildMaterial(name);
342  if(mat) {
343  G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:"
344  << " WARNING: the material <" << name
345  << "> is already exist" << G4endl;
346  G4cout << " New material will NOT be built!"
347  << G4endl;
348  return mat;
349  }
350 
351  G4Material* bmat = FindOrBuildMaterial(nameDB);
352  if(!bmat) {
353  G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:"
354  << " WARNING: the Name <" << nameDB
355  << "> is NOT in the DB: no new gas will be constructed"
356  << G4endl;
357  return 0;
358  }
359  if(bmat->GetState() != kStateGas) {
360  G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial:"
361  << " WARNING: <" << nameDB
362  << "> is NOT a gas - no new gas will be constructed"
363  << G4endl;
364  return 0;
365  }
366 
367  G4double dens = bmat->GetDensity()*pres*STP_Temperature/(temp*STP_Pressure);
368  mat = new G4Material(name,dens,bmat,kStateGas,temp,pres);
369 
370  if (verbose>1) {
371  G4cout << "G4NistMaterialBuilder::ConstructNewGasMaterial: done" << G4endl;
372  G4cout << &mat << G4endl;
373  }
374  return mat;
375 }
G4double GetDensity() const
Definition: G4Material.hh:178
float STP_Temperature
Definition: hepunit.py:302
G4GLOB_DLL std::ostream G4cout
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=true)
#define G4endl
Definition: G4ios.hh:61
G4State GetState() const
Definition: G4Material.hh:179
double G4double
Definition: G4Types.hh:76
int STP_Pressure
Definition: hepunit.py:303
G4Material * G4NistMaterialBuilder::ConstructNewIdealGasMaterial ( const G4String name,
const std::vector< G4String > &  elm,
const std::vector< G4int > &  nbAtoms,
G4bool  isotopes = true,
G4double  temp = CLHEP::STP_Temperature,
G4double  pressure = CLHEP::STP_Pressure 
)

Definition at line 379 of file G4NistMaterialBuilder.cc.

References python.hepunit::amu_c2, python.hepunit::Avogadro, FindOrBuildMaterial(), G4cout, G4endl, G4NistElementBuilder::GetAtomicMassAmu(), G4NistElementBuilder::GetZ(), python.hepunit::k_Boltzmann, kStateGas, python.hepunit::STP_Pressure, and python.hepunit::STP_Temperature.

Referenced by G4NistManager::ConstructNewIdealGasMaterial().

386 {
387  G4State state = kStateGas;
388 
389  // Material is in DB
390  G4Material* mat = FindOrBuildMaterial(name);
391  if(mat) {
392  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
393  << " WARNING: the material <" << name
394  << "> is already exist" << G4endl;
395  G4cout << " New material will NOT be built!"
396  << G4endl;
397  return mat;
398  }
399 
400  // Material not in DB
401  G4int els = elm.size();
402  if(els == 0) {
403  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
404  << " WARNING: empty list of elements for " << name
405  << G4endl;
406  G4cout << " New material will NOT be built!"
407  << G4endl;
408  return 0;
409  }
410 
411  // add parameters of material into internal vectors
412  // density in g/cm3, mean ionisation potential is not defined
413  G4bool stp = true;
414  if(temp != STP_Temperature && pres != STP_Pressure)
415  { stp = false; }
416 
417  G4double massPerMole = 0;
418 
419  G4int Z = 0;
420  for (G4int i=0; i<els; ++i) {
421  Z = elmBuilder->GetZ(elm[i]);
422  massPerMole += nbAtoms[i] * elmBuilder->GetAtomicMassAmu(Z) * amu_c2;
423  }
424 
425  G4double dens = massPerMole / (Avogadro*k_Boltzmann*temp/pres);
426 
427  if (els == 1) { AddMaterial(name,dens,Z,0.,els,state,stp); }
428  else {
429  AddMaterial(name,dens,0,0.,els,state,stp);
430  for (G4int i=0; i<els; ++i) {
431  AddElementByAtomCount(elmBuilder->GetZ(elm[i]), nbAtoms[i]);
432  }
433  }
434 
435  if(!stp) { AddGas(name,temp,pres); }
436 
437  return BuildMaterial(nMaterials-1);
438 }
G4State
Definition: G4Material.hh:114
float STP_Temperature
Definition: hepunit.py:302
G4double GetAtomicMassAmu(const G4String &symb) const
int G4int
Definition: G4Types.hh:78
float Avogadro
Definition: hepunit.py:253
G4GLOB_DLL std::ostream G4cout
float k_Boltzmann
Definition: hepunit.py:299
G4int GetZ(const G4String &symb) const
bool G4bool
Definition: G4Types.hh:79
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=true)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
float amu_c2
Definition: hepunit.py:277
int STP_Pressure
Definition: hepunit.py:303
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 = CLHEP::STP_Temperature,
G4double  pressure = CLHEP::STP_Pressure 
)

Definition at line 234 of file G4NistMaterialBuilder.cc.

References python.hepunit::cm3, FindOrBuildMaterial(), g(), G4cout, G4endl, G4NistElementBuilder::GetZ(), kStateGas, python.hepunit::STP_Pressure, and python.hepunit::STP_Temperature.

Referenced by G4NistManager::ConstructNewMaterial().

243 {
244  // Material is in DB
245  G4Material* mat = FindOrBuildMaterial(name);
246  if(mat) {
247  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
248  << " WARNING: the material <" << name
249  << "> is already exist" << G4endl;
250  G4cout << " New material will NOT be built!"
251  << G4endl;
252  return mat;
253  }
254 
255  // Material not in DB
256  G4int els = elm.size();
257  if(els == 0) {
258  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
259  << " WARNING: empty list of elements for " << name
260  << G4endl;
261  G4cout << " New material will NOT be built!"
262  << G4endl;
263  return 0;
264  }
265 
266  // add parameters of material into internal vectors
267  // density in g/cm3, mean ionisation potential is not defined
268  G4bool stp = true;
269  if(state == kStateGas && temp != STP_Temperature && pres != STP_Pressure)
270  { stp = false; }
271 
272  AddMaterial(name,dens*cm3/g,0,0.,els,state,stp);
273  if(!stp) { AddGas(name,temp,pres); }
274 
275  for (G4int i=0; i<els; ++i) {
276  AddElementByAtomCount(elmBuilder->GetZ(elm[i]), nbAtoms[i]);
277  }
278 
279  return BuildMaterial(nMaterials-1);
280 }
float STP_Temperature
Definition: hepunit.py:302
int G4int
Definition: G4Types.hh:78
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
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)
#define G4endl
Definition: G4ios.hh:61
int STP_Pressure
Definition: hepunit.py:303
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 = CLHEP::STP_Temperature,
G4double  pressure = CLHEP::STP_Pressure 
)

Definition at line 284 of file G4NistMaterialBuilder.cc.

References python.hepunit::cm3, FindOrBuildMaterial(), g(), G4cout, G4endl, G4NistElementBuilder::GetZ(), kStateGas, python.hepunit::STP_Pressure, and python.hepunit::STP_Temperature.

293 {
294  // Material is in DB
295  G4Material* mat = FindOrBuildMaterial(name);
296  if(mat) {
297  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
298  << " WARNING: the material <" << name
299  << "> is already exist" << G4endl;
300  G4cout << " New material will NOT be built!"
301  << G4endl;
302  return mat;
303  }
304 
305  // Material not in DB
306  G4int els = elm.size();
307  if(els == 0) {
308  G4cout << "G4NistMaterialBuilder::ConstructNewMaterial:"
309  << " WARNING: empty list of elements for " << name
310  << G4endl;
311  G4cout << " New material will NOT be built!"
312  << G4endl;
313  return 0;
314  }
315 
316  // add parameters of material into internal vectors
317  // density in g/cm3, mean ionisation potential is not defined
318  G4bool stp = true;
319  if(state == kStateGas && temp != STP_Temperature && pres != STP_Pressure)
320  { stp = false; }
321  AddMaterial(name,dens*cm3/g,0,0.,els,state,stp);
322  if(!stp) { AddGas(name,temp,pres); }
323 
324  for (G4int i=0; i<els; ++i) {
325  AddElementByWeightFraction(elmBuilder->GetZ(elm[i]), w[i]);
326  }
327 
328  return BuildMaterial(nMaterials-1);
329 }
float STP_Temperature
Definition: hepunit.py:302
int G4int
Definition: G4Types.hh:78
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
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)
#define G4endl
Definition: G4ios.hh:61
int STP_Pressure
Definition: hepunit.py:303
G4Material * G4NistMaterialBuilder::FindOrBuildMaterial ( const G4String name,
G4bool  isotopes = true,
G4bool  warning = true 
)

Definition at line 100 of file G4NistMaterialBuilder.cc.

References G4cout, G4endl, and G4Material::GetMaterialTable().

Referenced by ConstructNewGasMaterial(), ConstructNewIdealGasMaterial(), ConstructNewMaterial(), and G4NistManager::FindOrBuildMaterial().

103 {
104  if(first) {
105  if(verbose > 0) {
106  G4cout << "### NIST DataBase for Materials is used" << G4endl;
107  }
108  first = false;
109  }
110 
111  G4String name = matname;
112  if("G4_NYLON-6/6" == matname) { name = "G4_NYLON-6-6"; }
113  if("G4_NYLON-6/10" == matname) { name = "G4_NYLON-6-10";}
114 
115  if(verbose > 1) {
116  G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial " << name << G4endl;
117  }
118  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
119  G4int nmat = theMaterialTable->size();
120 
121  // Check if name inside DB
122  G4Material* mat = 0;
123 
124  for (G4int i=0; i<nMaterials; ++i) {
125 
126  if (name == names[i]) {
127  // Build new Nist material
128  if(matIndex[i] == -1) {
129  if(!iso && (warning || verbose > 0)) {
130  G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial warning for "
131  << name
132  << " - since Geant4 9.6 isotopes are always built" << G4endl;
133  }
134  mat = BuildMaterial(i);
135  }
136  // Nist material was already built
137  else { mat = (*theMaterialTable)[matIndex[i]]; }
138  return mat;
139  }
140  }
141 
142  // Check the list of all materials
143  if (nmat > 0) {
144  for (G4int i=0; i<nmat; ++i) {
145  if(name == ((*theMaterialTable)[i])->GetName()) {
146  mat = (*theMaterialTable)[i];
147  return mat;
148  }
149  }
150  }
151 
152  if( (verbose == 1 && warning) || verbose > 1) {
153  G4cout << "G4NistMaterialBuilder::FindOrBuildMaterial WARNING:"
154  << " material <" << name
155  << "> is not found out" << G4endl;
156  }
157  return mat;
158 }
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
std::vector< G4Material * > G4MaterialTable
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const std::vector< G4String > & G4NistMaterialBuilder::GetMaterialNames ( ) const
inline

Definition at line 218 of file G4NistMaterialBuilder.hh.

Referenced by G4NistManager::GetNistMaterialNames().

219 {
220  return names;
221 }
G4double G4NistMaterialBuilder::GetMeanIonisationEnergy ( G4int  index) const
inline

Definition at line 224 of file G4NistMaterialBuilder.hh.

Referenced by G4NistManager::GetMeanIonisationEnergy().

225 {
226  G4double res = 10*index;
227  if(index >= 0 && index < nMaterials) { res = ionPotentials[index]; }
228  return res;
229 }
double G4double
Definition: G4Types.hh:76
void G4NistMaterialBuilder::ListBioChemicalMaterials ( ) const

Definition at line 578 of file G4NistMaterialBuilder.cc.

References G4cout, and G4endl.

Referenced by ListMaterials().

579 {
580  G4cout << "=============================================================" << G4endl;
581  G4cout << "### Bio-Chemical Materials ##" << G4endl;
582  G4cout << "=============================================================" << G4endl;
583  G4cout << " Ncomp Name density(g/cm^3) I(eV) ChFormula" << G4endl;
584  G4cout << "=============================================================" << G4endl;
585  for (G4int i=nSpace; i<nMaterials; ++i) {DumpMix(i);}
586  G4cout << "=============================================================" << G4endl;
587 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4NistMaterialBuilder::ListHepMaterials ( ) const

Definition at line 554 of file G4NistMaterialBuilder.cc.

References G4cout, and G4endl.

Referenced by ListMaterials().

555 {
556  G4cout << "=============================================================" << G4endl;
557  G4cout << "### HEP & Nuclear Materials ##" << G4endl;
558  G4cout << "=============================================================" << G4endl;
559  G4cout << " Ncomp Name density(g/cm^3) I(eV) ChFormula" << G4endl;
560  G4cout << "=============================================================" << G4endl;
561  for (G4int i=nNIST; i<nHEP; ++i) {DumpMix(i);}
562 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4NistMaterialBuilder::ListMaterials ( const G4String mnam) const

Definition at line 507 of file G4NistMaterialBuilder.cc.

References G4cout, G4endl, ListBioChemicalMaterials(), ListHepMaterials(), ListNistCompoundMaterials(), ListNistSimpleMaterials(), and ListSpaceMaterials().

Referenced by G4NistManager::ListMaterials().

508 {
509  if (mnam == "simple") { ListNistSimpleMaterials(); }
510  else if (mnam == "compound") { ListNistCompoundMaterials(); }
511  else if (mnam == "hep") { ListHepMaterials(); }
512  else if (mnam == "space") { ListSpaceMaterials(); }
513  else if (mnam == "bio") { ListBioChemicalMaterials(); }
514 
515  else if (mnam == "all") {
521 
522  } else {
523  G4cout << "### G4NistMaterialBuilder::ListMaterials: Warning "
524  << mnam << " list is not known" << G4endl;
525  }
526 }
void ListBioChemicalMaterials() const
G4GLOB_DLL std::ostream G4cout
void ListNistCompoundMaterials() const
#define G4endl
Definition: G4ios.hh:61
void G4NistMaterialBuilder::ListNistCompoundMaterials ( ) const

Definition at line 542 of file G4NistMaterialBuilder.cc.

References G4cout, and G4endl.

Referenced by ListMaterials().

543 {
544  G4cout << "=============================================================" << G4endl;
545  G4cout << "### Compound Materials from the NIST Data Base ##" << G4endl;
546  G4cout << "=============================================================" << G4endl;
547  G4cout << " Ncomp Name density(g/cm^3) I(eV) ChFormula" << G4endl;
548  G4cout << "=============================================================" << G4endl;
549  for (G4int i=nElementary; i<nNIST; ++i) {DumpMix(i);}
550 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4NistMaterialBuilder::ListNistSimpleMaterials ( ) const

Definition at line 530 of file G4NistMaterialBuilder.cc.

References G4cout, and G4endl.

Referenced by ListMaterials().

531 {
532  G4cout << "=======================================================" << G4endl;
533  G4cout << "### Simple Materials from the NIST Data Base ###" << G4endl;
534  G4cout << "=======================================================" << G4endl;
535  G4cout << " Z Name density(g/cm^3) I(eV) " << G4endl;
536  G4cout << "=======================================================" << G4endl;
537  for (G4int i=0; i<nElementary; ++i) {DumpElm(i);}
538 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4NistMaterialBuilder::ListSpaceMaterials ( ) const

Definition at line 566 of file G4NistMaterialBuilder.cc.

References G4cout, and G4endl.

Referenced by ListMaterials().

567 {
568  G4cout << "=============================================================" << G4endl;
569  G4cout << "### Space ISS Materials ##" << G4endl;
570  G4cout << "=============================================================" << G4endl;
571  G4cout << " Ncomp Name density(g/cm^3) I(eV) ChFormula" << G4endl;
572  G4cout << "=============================================================" << G4endl;
573  for (G4int i=nHEP; i<nSpace; ++i) {DumpMix(i);}
574 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4NistMaterialBuilder::SetVerbose ( G4int  val)

Definition at line 499 of file G4NistMaterialBuilder.cc.

References G4NistElementBuilder::SetVerbose().

Referenced by G4NistManager::SetVerbose().

500 {
501  verbose = val;
502  elmBuilder->SetVerbose(verbose);
503 }

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