Geant4  10.00.p03
G4Material.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: G4Material.cc 81839 2014-06-06 08:47:44Z gcosmo $
27 //
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 //
30 // 26-06-96, Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban
31 // 10-07-96, new data members added by L.Urban
32 // 12-12-96, new data members added by L.Urban
33 // 20-01-97, aesthetic rearrangement. RadLength calculation modified.
34 // Data members Zeff and Aeff REMOVED (i.e. passed to the Elements).
35 // (local definition of Zeff in DensityEffect and FluctModel...)
36 // Vacuum defined as a G4State. Mixture flag removed, M.Maire.
37 // 29-01-97, State=Vacuum automatically set density=0 in the contructors.
38 // Subsequent protections have been put in the calculation of
39 // MeanExcEnergy, ShellCorrectionVector, DensityEffect, M.Maire.
40 // 11-02-97, ComputeDensityEffect() rearranged, M.Maire.
41 // 20-03-97, corrected initialization of pointers, M.Maire.
42 // 28-05-98, the kState=kVacuum has been removed.
43 // automatic check for a minimal density, M.Maire
44 // 12-06-98, new method AddMaterial() allowing mixture of materials, M.Maire
45 // 09-07-98, ionisation parameters removed from the class, M.Maire
46 // 05-10-98, change names: NumDensity -> NbOfAtomsPerVolume
47 // 18-11-98, new interface to SandiaTable
48 // 19-01-99 enlarge tolerance on test of coherence of gas conditions
49 // 19-07-99, Constructors with chemicalFormula added by V.Ivanchenko
50 // 16-01-01, Nuclear interaction length, M.Maire
51 // 12-03-01, G4bool fImplicitElement;
52 // copy constructor and assignement operator revised (mma)
53 // 03-05-01, flux.precision(prec) at begin/end of operator<<
54 // 17-07-01, migration to STL. M. Verderi.
55 // 14-09-01, Suppression of the data member fIndexInTable
56 // 26-02-02, fIndexInTable renewed
57 // 16-04-02, G4Exception put in constructor with chemical formula
58 // 06-05-02, remove the check of the ideal gas state equation
59 // 06-08-02, remove constructors with chemical formula (mma)
60 // 22-01-04, proper STL handling of theElementVector (Hisaya)
61 // 30-03-05, warning in GetMaterial(materialName)
62 // 09-03-06, minor change of printout (V.Ivanchenko)
63 // 10-01-07, compute fAtomVector in the case of mass fraction (V.Ivanchenko)
64 // 27-07-07, improve destructor (V.Ivanchenko)
65 // 18-10-07, move definition of material index to InitialisePointers (V.Ivanchenko)
66 // 13-08-08, do not use fixed size arrays (V.Ivanchenko)
67 // 26-10-11, new scheme for G4Exception (mma)
68 // 13-04-12, map<G4Material*,G4double> fMatComponents, filled in AddMaterial()
69 // 21-04-12, fMassOfMolecule, computed for AtomsCount (mma)
70 //
71 //
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
74 #include <iomanip>
75 
76 #include "G4Material.hh"
77 #include "G4NistManager.hh"
78 #include "G4UnitsTable.hh"
79 #include "G4PhysicalConstants.hh"
80 #include "G4SystemOfUnits.hh"
81 
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
86 // Constructor to create a material from scratch
87 
90  G4State state, G4double temp, G4double pressure)
91  : fName(name)
92 {
94 
95  if (density < universe_mean_density)
96  {
97  G4cout << " G4Material WARNING:"
98  << " define a material with density=0 is not allowed. \n"
99  << " The material " << name << " will be constructed with the"
100  << " default minimal density: " << universe_mean_density/(g/cm3)
101  << "g/cm3" << G4endl;
102  density = universe_mean_density;
103  }
104 
105  fDensity = density;
106  fState = state;
107  fTemp = temp;
108  fPressure = pressure;
109 
110  // Initialize theElementVector allocating one
111  // element corresponding to this material
114  fImplicitElement = true;
116 
117  const std::vector<G4String> elmnames =
119  G4String enam, snam;
120  G4int iz = G4lrint(z);
121  if(iz < (G4int)elmnames.size()) {
122  snam = elmnames[iz];
123  enam = snam;
124  } else {
125  enam = "ELM_" + name;
126  snam = name;
127  }
128  theElementVector->push_back(new G4Element(enam, snam, z, a));
129 
130  fMassFractionVector = new G4double[1];
131  fMassFractionVector[0] = 1. ;
132  fMassOfMolecule = a/Avogadro;
133 
134  if (fState == kStateUndefined)
135  {
136  if (fDensity > kGasThreshold) { fState = kStateSolid; }
137  else { fState = kStateGas; }
138  }
139 
141 }
142 
143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144 
145 // Constructor to create a material from a List of constituents
146 // (elements and/or materials) added with AddElement or AddMaterial
147 
150  G4State state, G4double temp, G4double pressure)
151  : fName(name)
152 {
154 
155  if (density < universe_mean_density)
156  {
157  G4cout << "--- Warning from G4Material::G4Material()"
158  << " define a material with density=0 is not allowed. \n"
159  << " The material " << name << " will be constructed with the"
160  << " default minimal density: " << universe_mean_density/(g/cm3)
161  << "g/cm3" << G4endl;
162  density = universe_mean_density;
163  }
164 
165  fDensity = density;
166  fState = state;
167  fTemp = temp;
168  fPressure = pressure;
169 
175 
176  if (fState == kStateUndefined)
177  {
178  if (fDensity > kGasThreshold) { fState = kStateSolid; }
179  else { fState = kStateGas; }
180  }
181 }
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
184 
185 // Constructor to create a material from base material
186 
188  const G4Material* bmat,
189  G4State state, G4double temp, G4double pressure)
190  : fName(name)
191 {
193 
194  if (density < universe_mean_density)
195  {
196  G4cout << "--- Warning from G4Material::G4Material()"
197  << " define a material with density=0 is not allowed. \n"
198  << " The material " << name << " will be constructed with the"
199  << " default minimal density: " << universe_mean_density/(g/cm3)
200  << "g/cm3" << G4endl;
201  density = universe_mean_density;
202  }
203 
204  fDensity = density;
205  fState = state;
206  fTemp = temp;
207  fPressure = pressure;
208 
209  fBaseMaterial = bmat;
212 
216 
218 
220 }
221 
222 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
223 
224 // Fake default constructor - sets only member data and allocates memory
225 // for usage restricted to object persistency
226 
228  : fChemicalFormula(""), fDensity(0.0), fState(kStateUndefined), fTemp(0.0),
229  fPressure(0.0), maxNbComponents(0), fArrayLength(0), fNumberOfComponents(0),
230  fNumberOfElements(0), theElementVector(0), fImplicitElement(false),
231  fMassFractionVector(0), fAtomsVector(0), fMaterialPropertiesTable(0),
232  fIndexInTable(0), VecNbOfAtomsPerVolume(0), TotNbOfAtomsPerVolume(0),
233  TotNbOfElectPerVolume(0), fRadlen(0.0), fNuclInterLen(0.0),
234  fIonisation(0), fSandiaTable(0), fBaseMaterial(0), fMassOfMolecule(0.0)
235 {
236 }
237 
238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
239 
241 {
242  // G4cout << "### Destruction of material " << fName << " started" <<G4endl;
243  if(!fBaseMaterial) {
244  if (theElementVector) { delete theElementVector; }
245  if (fMassFractionVector) { delete [] fMassFractionVector; }
246  if (fAtomsVector) { delete [] fAtomsVector; }
247  if (fSandiaTable) { delete fSandiaTable; }
248  }
249  if (fIonisation) { delete fIonisation; }
250  if (VecNbOfAtomsPerVolume) { delete [] VecNbOfAtomsPerVolume; }
251 
252  // Remove this material from theMaterialTable.
253  //
255 }
256 
257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
258 
260 {
261  theElementVector = 0;
263  fAtomsVector = 0;
265 
267  fBaseMaterial = 0;
268 
269  fImplicitElement = false;
270  fChemicalFormula = "";
271 
272  // initilized data members
273  fDensity = 0.0;
275  fTemp = 0.0;
276  fPressure = 0.0;
277  maxNbComponents = 0;
278  fArrayLength = 0;
281  fRadlen = 0.0;
282  fNuclInterLen = 0.0;
283  fMassOfMolecule = 0.0;
284 
285  fIonisation = 0;
286  fSandiaTable = 0;
287 
288  // Store in the static Table of Materials
290  for(size_t i=0; i<fIndexInTable; ++i) {
291  if(theMaterialTable[i]->GetName() == fName) {
292  G4cout << "G4Material WARNING: duplicate name of material "
293  << fName << G4endl;
294  break;
295  }
296  }
297  theMaterialTable.push_back(this);
298 }
299 
300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
301 
303 {
304  // Header routine to compute various properties of material.
305  //
306 
307  // Number of atoms per volume (per element), total nb of electrons per volume
308  G4double Zi, Ai;
310  if (VecNbOfAtomsPerVolume) { delete [] VecNbOfAtomsPerVolume; }
313  for (size_t i=0; i<fNumberOfElements; ++i) {
314  Zi = (*theElementVector)[i]->GetZ();
315  Ai = (*theElementVector)[i]->GetA();
319  }
320 
323 
324  if (fIonisation) { delete fIonisation; }
325  fIonisation = new G4IonisParamMat(this);
326  if (fSandiaTable) { delete fSandiaTable; }
327  fSandiaTable = new G4SandiaTable(this);
328 }
329 
330 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
331 
333 {
337 
341  const_cast<G4double*>(fBaseMaterial->GetFractionVector());
342  fAtomsVector = const_cast<G4int*>(fBaseMaterial->GetAtomsVector());
343 
345  if (VecNbOfAtomsPerVolume) { delete [] VecNbOfAtomsPerVolume; }
347  for (size_t i=0; i<fNumberOfElements; ++i) {
348  VecNbOfAtomsPerVolume[i] = factor*v[i];
349  }
350  fRadlen = fBaseMaterial->GetRadlen()/factor;
352  if (fIonisation) { delete fIonisation; }
353  fIonisation = new G4IonisParamMat(this);
354 
357 }
358 
359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
360 
361 // AddElement -- composition by atom count
362 
363 void G4Material::AddElement(G4Element* element, G4int nAtoms)
364 {
365  // initialization
366  if ( fNumberOfElements == 0 ) {
369  }
370 
371  // filling ...
373  theElementVector->push_back(element);
376  } else {
377  G4cout << "G4Material::AddElement ERROR for " << fName << " nElement= "
379  G4Exception ("G4Material::AddElement()", "mat031", FatalException,
380  "Attempt to add more than the declared number of elements.");
381  }
382  // filled.
384  // compute proportion by mass
385  size_t i=0;
386  G4double Amol = 0.;
387  for (i=0; i<fNumberOfElements; ++i) {
388  G4double w = fAtomsVector[i]*(*theElementVector)[i]->GetA();
389  Amol += w;
390  fMassFractionVector[i] = w;
391  }
392  for (i=0; i<fNumberOfElements; ++i) {
393  fMassFractionVector[i] /= Amol;
394  }
395 
396  fMassOfMolecule = Amol/Avogadro;
398  }
399 }
400 
401 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
402 
403 // AddElement -- composition by fraction of mass
404 
405 void G4Material::AddElement(G4Element* element, G4double fraction)
406 {
407  if(fraction < 0.0 || fraction > 1.0) {
408  G4cout << "G4Material::AddElement ERROR for " << fName << " and "
409  << element->GetName() << " mass fraction= " << fraction
410  << " is wrong " << G4endl;
411  G4Exception ("G4Material::AddElement()", "mat032", FatalException,
412  "Attempt to add element with wrong mass fraction");
413  }
414  // initialization
415  if (fNumberOfComponents == 0) {
418  }
419  // filling ...
421  size_t el = 0;
422  while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) { ++el; }
423  if (el<fNumberOfElements) fMassFractionVector[el] += fraction;
424  else {
425  theElementVector->push_back(element);
426  fMassFractionVector[el] = fraction;
428  // element->increaseCountUse();
429  }
431  } else {
432  G4cout << "G4Material::AddElement ERROR for " << fName << " nElement= "
434  G4Exception ("G4Material::AddElement()", "mat033", FatalException,
435  "Attempt to add more than the declared number of elements.");
436  }
437 
438  // filled.
440 
441  size_t i=0;
442  G4double Zmol(0.), Amol(0.);
443  // check sum of weights -- OK?
444  G4double wtSum(0.0);
445  for (i=0; i<fNumberOfElements; ++i) {
446  wtSum += fMassFractionVector[i];
447  Zmol += fMassFractionVector[i]*(*theElementVector)[i]->GetZ();
448  Amol += fMassFractionVector[i]*(*theElementVector)[i]->GetA();
449  }
450  if (std::fabs(1.-wtSum) > perThousand) {
451  G4cerr << "WARNING !! for " << fName << " sum of fractional masses "
452  << wtSum << " is not 1 - results may be wrong"
453  << G4endl;
454  }
455  for (i=0; i<fNumberOfElements; ++i) {
456  fAtomsVector[i] =
458  }
459 
461  }
462 }
463 
464 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
465 
466 // AddMaterial -- composition by fraction of mass
467 
468 void G4Material::AddMaterial(G4Material* material, G4double fraction)
469 {
470  if(fraction < 0.0 || fraction > 1.0) {
471  G4cout << "G4Material::AddMaterial ERROR for " << fName << " and "
472  << material->GetName() << " mass fraction= " << fraction
473  << " is wrong ";
474  G4Exception ("G4Material::AddMaterial()", "mat034", FatalException,
475  "Attempt to add material with wrong mass fraction");
476  }
477  // initialization
478  if (fNumberOfComponents == 0) {
481  }
482 
483  size_t nelm = material->GetNumberOfElements();
484 
485  // arrays should be extended
486  if(nelm > 1) {
487  G4int nold = fArrayLength;
488  fArrayLength += nelm - 1;
489  G4double* v1 = new G4double[fArrayLength];
490  G4int* i1 = new G4int[fArrayLength];
491  for(G4int i=0; i<nold; ++i) {
492  v1[i] = fMassFractionVector[i];
493  i1[i] = fAtomsVector[i];
494  }
495  delete [] fAtomsVector;
496  delete [] fMassFractionVector;
497  fMassFractionVector = v1;
498  fAtomsVector = i1;
499  }
500 
501  // filling ...
503  for (size_t elm=0; elm<nelm; ++elm)
504  {
505  G4Element* element = (*(material->GetElementVector()))[elm];
506  size_t el = 0;
507  while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) el++;
508  if (el < fNumberOfElements) fMassFractionVector[el] += fraction
509  *(material->GetFractionVector())[elm];
510  else {
511  theElementVector->push_back(element);
512  fMassFractionVector[el] = fraction
513  *(material->GetFractionVector())[elm];
515  //element->increaseCountUse();
516  }
517  }
520  fMatComponents[material] = fraction;
521 
522  } else {
523  G4cout << "G4Material::AddMaterial ERROR for " << fName << " nElement= "
525  G4Exception ("G4Material::AddMaterial()", "mat035", FatalException,
526  "Attempt to add more than the declared number of components.");
527  }
528 
529  // filled.
531  size_t i=0;
532  G4double Zmol(0.), Amol(0.);
533  // check sum of weights -- OK?
534  G4double wtSum(0.0);
535  for (i=0; i<fNumberOfElements; ++i) {
536  wtSum += fMassFractionVector[i];
537  Zmol += fMassFractionVector[i]*(*theElementVector)[i]->GetZ();
538  Amol += fMassFractionVector[i]*(*theElementVector)[i]->GetA();
539  }
540  if (std::fabs(1.-wtSum) > perThousand) {
541  G4cout << "G4Material::AddMaterial WARNING !! for " << fName
542  << " sum of fractional masses "
543  << wtSum << " is not 1 - results may be wrong"
544  << G4endl;
545  }
546  for (i=0; i<fNumberOfElements; ++i) {
547  fAtomsVector[i] =
549  }
550 
552  }
553 }
554 
555 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
556 
558 {
559  G4double radinv = 0.0 ;
560  for (size_t i=0;i<fNumberOfElements;++i) {
561  radinv += VecNbOfAtomsPerVolume[i]*((*theElementVector)[i]->GetfRadTsai());
562  }
563  fRadlen = (radinv <= 0.0 ? DBL_MAX : 1./radinv);
564 }
565 
566 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
567 
569 {
570  static const G4double lambda0 = 35*CLHEP::g/CLHEP::cm2;
571  G4double NILinv = 0.0;
572  for (size_t i=0; i<fNumberOfElements; ++i) {
573  G4int Z = G4lrint( (*theElementVector)[i]->GetZ());
574  G4double A = (*theElementVector)[i]->GetN();
575  if(1 == Z) {
576  NILinv += VecNbOfAtomsPerVolume[i]*A;
577  } else {
578  NILinv += VecNbOfAtomsPerVolume[i]*std::pow(A, 0.6666666667);
579  }
580  }
581  NILinv *= amu/lambda0;
582  fNuclInterLen = (NILinv <= 0.0 ? DBL_MAX : 1./NILinv);
583 }
584 
585 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
586 
588 {
589  return &theMaterialTable;
590 }
591 
592 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
593 
595 {
596  return theMaterialTable.size();
597 }
598 
599 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
600 
601 G4Material*
602 G4Material::GetMaterial(const G4String& materialName, G4bool warning)
603 {
604  // search the material by its name
605  for (size_t J=0 ; J<theMaterialTable.size() ; ++J)
606  {
607  if (theMaterialTable[J]->GetName() == materialName)
608  { return theMaterialTable[J]; }
609  }
610 
611  // the material does not exist in the table
612  if (warning) {
613  G4cout << "G4Material::GetMaterial() WARNING: The material: "
614  << materialName
615  << " does not exist in the table. Return NULL pointer."
616  << G4endl;
617  }
618  return 0;
619 }
620 
621 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
622 
624 {
626  *this = right;
627 }
628 
629 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
630 
632 {
633  if (fNumberOfElements > 1) {
634  G4cout << "G4Material ERROR in GetZ. The material: " << fName
635  << " is a mixture.";
636  G4Exception ("G4Material::GetZ()", "mat036", FatalException,
637  "the Atomic number is not well defined." );
638  }
639  return (*theElementVector)[0]->GetZ();
640 }
641 
642 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
643 
645 {
646  if (fNumberOfElements > 1) {
647  G4cout << "G4Material ERROR in GetA. The material: " << fName
648  << " is a mixture.";
649  G4Exception ("G4Material::GetA()", "mat037", FatalException,
650  "the Atomic mass is not well defined." );
651  }
652  return (*theElementVector)[0]->GetA();
653 }
654 
655 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
656 
658 {
659  if (this != &right)
660  {
661  fName = right.fName;
663  fDensity = right.fDensity;
664  fState = right.fState;
665  fTemp = right.fTemp;
666  fPressure = right.fPressure;
667 
668  if(!fBaseMaterial) {
669  if (theElementVector) { delete theElementVector; }
670  if (fMassFractionVector) { delete [] fMassFractionVector; }
671  if (fAtomsVector) { delete [] fAtomsVector; }
672  if (fIonisation) { delete fIonisation; }
673  if (fSandiaTable) { delete fSandiaTable; }
674  }
675 
676  if (VecNbOfAtomsPerVolume) { delete [] VecNbOfAtomsPerVolume; }
677 
682 
687 
688  if(fBaseMaterial) {
690 
691  } else {
695  for (size_t i=0; i<fNumberOfElements; ++i) {
696  (*theElementVector)[i] = (*right.theElementVector)[i];
698  fAtomsVector[i] = right.fAtomsVector[i];
699  }
701  }
702  }
703  return *this;
704 }
705 
706 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
707 
709 {
710  return (this == (G4Material *) &right);
711 }
712 
713 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
714 
716 {
717  return (this != (G4Material *) &right);
718 }
719 
720 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
721 
722 std::ostream& operator<<(std::ostream& flux, G4Material* material)
723 {
724  std::ios::fmtflags mode = flux.flags();
725  flux.setf(std::ios::fixed,std::ios::floatfield);
726  G4long prec = flux.precision(3);
727 
728  flux
729  << " Material: " << std::setw(8) << material->fName
730  << " " << material->fChemicalFormula << " "
731  << " density: " << std::setw(6) << std::setprecision(3)
732  << G4BestUnit(material->fDensity,"Volumic Mass")
733  << " RadL: " << std::setw(7) << std::setprecision(3)
734  << G4BestUnit(material->fRadlen,"Length")
735  << " Nucl.Int.Length: " << std::setw(7) << std::setprecision(3)
736  << G4BestUnit(material->fNuclInterLen,"Length") <<"\n" << std::setw(30)
737  << " Imean: " << std::setw(7) << std::setprecision(3)
738  << G4BestUnit(material->GetIonisation()->GetMeanExcitationEnergy(),"Energy");
739 
740  if(material->fState == kStateGas) {
741  flux
742  << " temperature: " << std::setw(6) << std::setprecision(2)
743  << (material->fTemp)/kelvin << " K"
744  << " pressure: " << std::setw(6) << std::setprecision(2)
745  << (material->fPressure)/atmosphere << " atm";
746  }
747  flux << "\n";
748 
749  for (size_t i=0; i<material->fNumberOfElements; i++) {
750  flux
751  << "\n ---> " << (*(material->theElementVector))[i]
752  << "\n ElmMassFraction: "
753  << std::setw(6)<< std::setprecision(2)
754  << (material->fMassFractionVector[i])/perCent << " %"
755  << " ElmAbundance " << std::setw(6)<< std::setprecision(2)
756  << 100*(material->VecNbOfAtomsPerVolume[i])
757  /(material->TotNbOfAtomsPerVolume)
758  << " % \n";
759  }
760  flux.precision(prec);
761  flux.setf(mode,std::ios::floatfield);
762 
763  return flux;
764 }
765 
766 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
767 
768 std::ostream& operator<<(std::ostream& flux, G4Material& material)
769 {
770  flux << &material;
771  return flux;
772 }
773 
774 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
775 
776 std::ostream& operator<<(std::ostream& flux, G4MaterialTable MaterialTable)
777 {
778  //Dump info for all known materials
779  flux << "\n***** Table : Nb of materials = " << MaterialTable.size()
780  << " *****\n" << G4endl;
781 
782  for (size_t i=0; i<MaterialTable.size(); ++i) {
783  flux << MaterialTable[i] << G4endl << G4endl;
784  }
785 
786  return flux;
787 }
788 
789 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4MaterialTable theMaterialTable
Definition: G4Material.hh:329
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:224
void InitializePointers()
Definition: G4Material.cc:259
G4double GetZ() const
Definition: G4Material.cc:631
G4int operator==(const G4Material &) const
Definition: G4Material.cc:708
static const double cm2
Definition: G4SIunits.hh:107
G4double GetTotNbOfElectPerVolume() const
Definition: G4Material.hh:210
std::vector< G4Element * > G4ElementVector
G4String fName
Definition: G4AttUtils.hh:55
void CopyPointersOfBaseMaterial()
Definition: G4Material.cc:332
const G4Material * fBaseMaterial
Definition: G4Material.hh:348
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:468
G4State
Definition: G4Material.hh:114
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:602
G4double z
Definition: TRTMaterials.hh:39
const G4String & GetChemicalFormula() const
Definition: G4Material.hh:177
G4double fMassOfMolecule
Definition: G4Material.hh:349
void SetMeanExcitationEnergy(G4double value)
G4String name
Definition: TRTMaterials.hh:40
const G4String & GetName() const
Definition: G4Material.hh:176
G4ElementVector * theElementVector
Definition: G4Material.hh:321
size_t fIndexInTable
Definition: G4Material.hh:330
const std::vector< G4String > & GetNistElementNames() const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable
G4double GetDensity() const
Definition: G4Material.hh:178
long G4long
Definition: G4Types.hh:80
G4double a
Definition: TRTMaterials.hh:39
static const double perThousand
Definition: G4SIunits.hh:297
G4double fDensity
Definition: G4Material.hh:309
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4IonisParamMat * fIonisation
Definition: G4Material.hh:343
G4int nComponents
Definition: TRTMaterials.hh:41
void ComputeDerivedQuantities()
Definition: G4Material.cc:302
G4double * fMassFractionVector
Definition: G4Material.hh:323
size_t fNumberOfElements
Definition: G4Material.hh:320
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
size_t fNumberOfComponents
Definition: G4Material.hh:318
static G4NistManager * Instance()
std::ostream & operator<<(std::ostream &flux, G4Material *material)
Definition: G4Material.cc:722
G4Material(const G4String &name, G4double z, G4double a, G4double density, G4State state=kStateUndefined, G4double temp=CLHEP::STP_Temperature, G4double pressure=CLHEP::STP_Pressure)
Definition: G4Material.cc:88
G4int maxNbComponents
Definition: G4Material.hh:316
G4bool fImplicitElement
Definition: G4Material.hh:322
G4SandiaTable * GetSandiaTable() const
Definition: G4Material.hh:227
G4SandiaTable * fSandiaTable
Definition: G4Material.hh:344
G4double density
Definition: TRTMaterials.hh:39
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:204
static const double prec
Definition: RanecuEngine.cc:51
G4GLOB_DLL std::ostream G4cout
G4double TotNbOfAtomsPerVolume
Definition: G4Material.hh:338
bool G4bool
Definition: G4Types.hh:79
G4double iz
Definition: TRTMaterials.hh:39
G4MaterialPropertiesTable * fMaterialPropertiesTable
Definition: G4Material.hh:326
G4int * fAtomsVector
Definition: G4Material.hh:324
static const double cm3
Definition: G4SIunits.hh:108
G4double fRadlen
Definition: G4Material.hh:340
static const double perCent
Definition: G4SIunits.hh:296
G4double fNuclInterLen
Definition: G4Material.hh:341
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:594
static const G4double A[nN]
G4double GetRadlen() const
Definition: G4Material.hh:218
G4int fArrayLength
Definition: G4Material.hh:317
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static const double kelvin
Definition: G4SIunits.hh:260
G4double GetA() const
Definition: G4Material.cc:644
G4String fChemicalFormula
Definition: G4Material.hh:308
G4double GetTotNbOfAtomsPerVolume() const
Definition: G4Material.hh:207
int G4lrint(double ad)
Definition: templates.hh:163
G4int operator!=(const G4Material &) const
Definition: G4Material.cc:715
void ComputeNuclearInterLength()
Definition: G4Material.cc:568
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:250
G4double GetMassOfMolecule() const
Definition: G4Material.hh:240
static const double g
Definition: G4SIunits.hh:162
G4double TotNbOfElectPerVolume
Definition: G4Material.hh:339
const G4Material & operator=(const G4Material &)
Definition: G4Material.cc:657
static const double atmosphere
Definition: G4SIunits.hh:216
G4State fState
Definition: G4Material.hh:311
const G4int * GetAtomsVector() const
Definition: G4Material.hh:196
G4double GetMeanExcitationEnergy() const
#define G4endl
Definition: G4ios.hh:61
G4double fTemp
Definition: G4Material.hh:313
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:363
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
void ComputeRadiationLength()
Definition: G4Material.cc:557
double G4double
Definition: G4Types.hh:76
const G4String & GetName() const
Definition: G4Element.hh:127
G4double fPressure
Definition: G4Material.hh:314
std::map< G4Material *, G4double > fMatComponents
Definition: G4Material.hh:350
const G4double * GetFractionVector() const
Definition: G4Material.hh:192
#define DBL_MAX
Definition: templates.hh:83
virtual ~G4Material()
Definition: G4Material.cc:240
G4double * VecNbOfAtomsPerVolume
Definition: G4Material.hh:337
G4double GetNuclearInterLength() const
Definition: G4Material.hh:221
G4String fName
Definition: G4Material.hh:307
G4GLOB_DLL std::ostream G4cerr