Geant4  10.01.p01
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 88957 2015-03-16 16:46:05Z 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 (G4int 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 (G4int i=0; i<fNumberOfElements; ++i) {
348  VecNbOfAtomsPerVolume[i] = factor*v[i];
349  }
352 
353  if (fIonisation) { delete fIonisation; }
354  fIonisation = new G4IonisParamMat(this);
355 
358 }
359 
360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
361 
362 // AddElement -- composition by atom count
363 
364 void G4Material::AddElement(G4Element* element, G4int nAtoms)
365 {
366  // initialization
367  if ( fNumberOfElements == 0 ) {
370  }
371 
372  // filling ...
374  theElementVector->push_back(element);
377  } else {
378  G4cout << "G4Material::AddElement ERROR for " << fName << " nElement= "
380  G4Exception ("G4Material::AddElement()", "mat031", FatalException,
381  "Attempt to add more than the declared number of elements.");
382  }
383  // filled.
385  // compute proportion by mass
386  G4int i=0;
387  G4double Amol = 0.;
388  for (i=0; i<fNumberOfElements; ++i) {
389  G4double w = fAtomsVector[i]*(*theElementVector)[i]->GetA();
390  Amol += w;
391  fMassFractionVector[i] = w;
392  }
393  for (i=0; i<fNumberOfElements; ++i) {
394  fMassFractionVector[i] /= Amol;
395  }
396 
397  fMassOfMolecule = Amol/Avogadro;
399  }
400 }
401 
402 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
403 
404 // AddElement -- composition by fraction of mass
405 
406 void G4Material::AddElement(G4Element* element, G4double fraction)
407 {
408  if(fraction < 0.0 || fraction > 1.0) {
409  G4cout << "G4Material::AddElement ERROR for " << fName << " and "
410  << element->GetName() << " mass fraction= " << fraction
411  << " is wrong " << G4endl;
412  G4Exception ("G4Material::AddElement()", "mat032", FatalException,
413  "Attempt to add element with wrong mass fraction");
414  }
415  // initialization
416  if (fNumberOfComponents == 0) {
419  }
420  // filling ...
422  G4int el = 0;
423  while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) { ++el; }
424  if (el<fNumberOfElements) fMassFractionVector[el] += fraction;
425  else {
426  theElementVector->push_back(element);
427  fMassFractionVector[el] = fraction;
429  // element->increaseCountUse();
430  }
432  } else {
433  G4cout << "G4Material::AddElement ERROR for " << fName << " nElement= "
435  G4Exception ("G4Material::AddElement()", "mat033", FatalException,
436  "Attempt to add more than the declared number of elements.");
437  }
438 
439  // filled.
441 
442  G4int i=0;
443  G4double Zmol(0.), Amol(0.);
444  // check sum of weights -- OK?
445  G4double wtSum(0.0);
446  for (i=0; i<fNumberOfElements; ++i) {
447  wtSum += fMassFractionVector[i];
448  Zmol += fMassFractionVector[i]*(*theElementVector)[i]->GetZ();
449  Amol += fMassFractionVector[i]*(*theElementVector)[i]->GetA();
450  }
451  if (std::fabs(1.-wtSum) > perThousand) {
452  G4cerr << "WARNING !! for " << fName << " sum of fractional masses "
453  << wtSum << " is not 1 - results may be wrong"
454  << G4endl;
455  }
456  for (i=0; i<fNumberOfElements; ++i) {
457  fAtomsVector[i] =
459  }
460 
462  }
463 }
464 
465 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
466 
467 // AddMaterial -- composition by fraction of mass
468 
469 void G4Material::AddMaterial(G4Material* material, G4double fraction)
470 {
471  if(fraction < 0.0 || fraction > 1.0) {
472  G4cout << "G4Material::AddMaterial ERROR for " << fName << " and "
473  << material->GetName() << " mass fraction= " << fraction
474  << " is wrong ";
475  G4Exception ("G4Material::AddMaterial()", "mat034", FatalException,
476  "Attempt to add material with wrong mass fraction");
477  }
478  // initialization
479  if (fNumberOfComponents == 0) {
482  }
483 
484  G4int nelm = material->GetNumberOfElements();
485 
486  // arrays should be extended
487  if(nelm > 1) {
488  G4int nold = fArrayLength;
489  fArrayLength += nelm - 1;
490  G4double* v1 = new G4double[fArrayLength];
491  G4int* i1 = new G4int[fArrayLength];
492  for(G4int i=0; i<nold; ++i) {
493  v1[i] = fMassFractionVector[i];
494  i1[i] = fAtomsVector[i];
495  }
496  delete [] fAtomsVector;
497  delete [] fMassFractionVector;
498  fMassFractionVector = v1;
499  fAtomsVector = i1;
500  }
501 
502  // filling ...
504  for (G4int elm=0; elm<nelm; ++elm)
505  {
506  G4Element* element = (*(material->GetElementVector()))[elm];
507  G4int el = 0;
508  while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) el++;
509  if (el < fNumberOfElements) fMassFractionVector[el] += fraction
510  *(material->GetFractionVector())[elm];
511  else {
512  theElementVector->push_back(element);
513  fMassFractionVector[el] = fraction
514  *(material->GetFractionVector())[elm];
516  //element->increaseCountUse();
517  }
518  }
521  fMatComponents[material] = fraction;
522 
523  } else {
524  G4cout << "G4Material::AddMaterial ERROR for " << fName << " nElement= "
526  G4Exception ("G4Material::AddMaterial()", "mat035", FatalException,
527  "Attempt to add more than the declared number of components.");
528  }
529 
530  // filled.
532  G4int i=0;
533  G4double Zmol(0.), Amol(0.);
534  // check sum of weights -- OK?
535  G4double wtSum(0.0);
536  for (i=0; i<fNumberOfElements; ++i) {
537  wtSum += fMassFractionVector[i];
538  Zmol += fMassFractionVector[i]*(*theElementVector)[i]->GetZ();
539  Amol += fMassFractionVector[i]*(*theElementVector)[i]->GetA();
540  }
541  if (std::fabs(1.-wtSum) > perThousand) {
542  G4cout << "G4Material::AddMaterial WARNING !! for " << fName
543  << " sum of fractional masses "
544  << wtSum << " is not 1 - results may be wrong"
545  << G4endl;
546  }
547  for (i=0; i<fNumberOfElements; ++i) {
548  fAtomsVector[i] =
550  }
551 
553  }
554 }
555 
556 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
557 
559 {
560  G4double radinv = 0.0 ;
561  for (G4int i=0;i<fNumberOfElements;++i) {
562  radinv += VecNbOfAtomsPerVolume[i]*((*theElementVector)[i]->GetfRadTsai());
563  }
564  fRadlen = (radinv <= 0.0 ? DBL_MAX : 1./radinv);
565 }
566 
567 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
568 
570 {
571  static const G4double lambda0 = 35*CLHEP::g/CLHEP::cm2;
572  G4double NILinv = 0.0;
573  for (G4int i=0; i<fNumberOfElements; ++i) {
574  G4int Z = G4lrint( (*theElementVector)[i]->GetZ());
575  G4double A = (*theElementVector)[i]->GetN();
576  if(1 == Z) {
577  NILinv += VecNbOfAtomsPerVolume[i]*A;
578  } else {
579  NILinv += VecNbOfAtomsPerVolume[i]*std::pow(A, 0.6666666667);
580  }
581  }
582  NILinv *= amu/lambda0;
583  fNuclInterLen = (NILinv <= 0.0 ? DBL_MAX : 1./NILinv);
584 }
585 
586 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
587 
589 {
590  return &theMaterialTable;
591 }
592 
593 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
594 
596 {
597  return theMaterialTable.size();
598 }
599 
600 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
601 
602 G4Material*
603 G4Material::GetMaterial(const G4String& materialName, G4bool warning)
604 {
605  // search the material by its name
606  for (size_t J=0 ; J<theMaterialTable.size() ; ++J)
607  {
608  if (theMaterialTable[J]->GetName() == materialName)
609  { return theMaterialTable[J]; }
610  }
611 
612  // the material does not exist in the table
613  if (warning) {
614  G4cout << "G4Material::GetMaterial() WARNING: The material: "
615  << materialName
616  << " does not exist in the table. Return NULL pointer."
617  << G4endl;
618  }
619  return 0;
620 }
621 
622 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
623 /*
624 G4Material::G4Material(const G4Material& right)
625 {
626  InitializePointers();
627  *this = right;
628 }
629 */
630 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
631 
633 {
634  if (fNumberOfElements > 1) {
635  G4cout << "G4Material ERROR in GetZ. The material: " << fName
636  << " is a mixture.";
637  G4Exception ("G4Material::GetZ()", "mat036", FatalException,
638  "the Atomic number is not well defined." );
639  }
640  return (*theElementVector)[0]->GetZ();
641 }
642 
643 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
644 
646 {
647  if (fNumberOfElements > 1) {
648  G4cout << "G4Material ERROR in GetA. The material: " << fName
649  << " is a mixture.";
650  G4Exception ("G4Material::GetA()", "mat037", FatalException,
651  "the Atomic mass is not well defined." );
652  }
653  return (*theElementVector)[0]->GetA();
654 }
655 
656 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
657 /*
658 const G4Material& G4Material::operator=(const G4Material& right)
659 {
660  if (this != &right)
661  {
662  fName = right.fName;
663  fChemicalFormula = right.fChemicalFormula;
664  fDensity = right.fDensity;
665  fState = right.fState;
666  fTemp = right.fTemp;
667  fPressure = right.fPressure;
668 
669  if(!fBaseMaterial) {
670  if (theElementVector) { delete theElementVector; }
671  if (fMassFractionVector) { delete [] fMassFractionVector; }
672  if (fAtomsVector) { delete [] fAtomsVector; }
673  if (fIonisation) { delete fIonisation; }
674  if (fSandiaTable) { delete fSandiaTable; }
675  }
676 
677  if (VecNbOfAtomsPerVolume) { delete [] VecNbOfAtomsPerVolume; }
678 
679  maxNbComponents = right.maxNbComponents;
680  fNumberOfComponents = right.fNumberOfComponents;
681  fNumberOfElements = right.fNumberOfElements;
682  fImplicitElement = right.fImplicitElement;
683 
684  fMaterialPropertiesTable = right.fMaterialPropertiesTable;
685  fBaseMaterial = right.fBaseMaterial;
686  fMassOfMolecule= right.fMassOfMolecule;
687  fMatComponents= right.fMatComponents;
688 
689  if(fBaseMaterial) {
690  CopyPointersOfBaseMaterial();
691 
692  } else {
693  theElementVector = new G4ElementVector((unsigned int)fNumberOfElements,0);
694  fMassFractionVector = new G4double[fNumberOfElements];
695  fAtomsVector = new G4int[fNumberOfElements];
696  for (G4int i=0; i<fNumberOfElements; ++i) {
697  (*theElementVector)[i] = (*right.theElementVector)[i];
698  fMassFractionVector[i] = right.fMassFractionVector[i];
699  fAtomsVector[i] = right.fAtomsVector[i];
700  }
701  ComputeDerivedQuantities();
702  }
703  }
704  return *this;
705 }
706 */
707 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
708 
710 {
711  return (this == (G4Material *) &right);
712 }
713 
714 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
715 
717 {
718  return (this != (G4Material *) &right);
719 }
720 
721 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
722 
723 std::ostream& operator<<(std::ostream& flux, const G4Material* material)
724 {
725  std::ios::fmtflags mode = flux.flags();
726  flux.setf(std::ios::fixed,std::ios::floatfield);
727  G4long prec = flux.precision(3);
728 
729  flux
730  << " Material: " << std::setw(8) << material->fName
731  << " " << material->fChemicalFormula << " "
732  << " density: " << std::setw(6) << std::setprecision(3)
733  << G4BestUnit(material->fDensity,"Volumic Mass")
734  << " RadL: " << std::setw(7) << std::setprecision(3)
735  << G4BestUnit(material->fRadlen,"Length")
736  << " Nucl.Int.Length: " << std::setw(7) << std::setprecision(3)
737  << G4BestUnit(material->fNuclInterLen,"Length")
738  << "\n" << std::setw(30)
739  << " Imean: " << std::setw(7) << std::setprecision(3)
741  "Energy");
742 
743  if(material->fState == kStateGas) {
744  flux
745  << " temperature: " << std::setw(6) << std::setprecision(2)
746  << (material->fTemp)/kelvin << " K"
747  << " pressure: " << std::setw(6) << std::setprecision(2)
748  << (material->fPressure)/atmosphere << " atm";
749  }
750  flux << "\n";
751 
752  for (G4int i=0; i<material->fNumberOfElements; i++) {
753  flux
754  << "\n ---> " << (*(material->theElementVector))[i]
755  << "\n ElmMassFraction: "
756  << std::setw(6)<< std::setprecision(2)
757  << (material->fMassFractionVector[i])/perCent << " %"
758  << " ElmAbundance " << std::setw(6)<< std::setprecision(2)
759  << 100*(material->VecNbOfAtomsPerVolume[i])
760  /(material->TotNbOfAtomsPerVolume)
761  << " % \n";
762  }
763  flux.precision(prec);
764  flux.setf(mode,std::ios::floatfield);
765 
766  return flux;
767 }
768 
769 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
770 
771 std::ostream& operator<<(std::ostream& flux, const G4Material& material)
772 {
773  flux << &material;
774  return flux;
775 }
776 
777 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
778 
779 std::ostream& operator<<(std::ostream& flux, G4MaterialTable MaterialTable)
780 {
781  //Dump info for all known materials
782  flux << "\n***** Table : Nb of materials = " << MaterialTable.size()
783  << " *****\n" << G4endl;
784 
785  for (size_t i=0; i<MaterialTable.size(); ++i) {
786  flux << MaterialTable[i] << G4endl << G4endl;
787  }
788 
789  return flux;
790 }
791 
792 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4MaterialTable theMaterialTable
Definition: G4Material.hh:330
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:226
void InitializePointers()
Definition: G4Material.cc:259
G4double GetZ() const
Definition: G4Material.cc:632
G4int operator==(const G4Material &) const
Definition: G4Material.cc:709
static const double cm2
Definition: G4SIunits.hh:107
G4double GetTotNbOfElectPerVolume() const
Definition: G4Material.hh:212
std::vector< G4Element * > G4ElementVector
G4String fName
Definition: G4AttUtils.hh:55
void CopyPointersOfBaseMaterial()
Definition: G4Material.cc:332
G4int fNumberOfElements
Definition: G4Material.hh:321
const G4Material * fBaseMaterial
Definition: G4Material.hh:349
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:469
G4State
Definition: G4Material.hh:114
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:603
G4double z
Definition: TRTMaterials.hh:39
const G4String & GetChemicalFormula() const
Definition: G4Material.hh:179
G4double fMassOfMolecule
Definition: G4Material.hh:350
void SetMeanExcitationEnergy(G4double value)
G4String name
Definition: TRTMaterials.hh:40
const G4String & GetName() const
Definition: G4Material.hh:178
G4ElementVector * theElementVector
Definition: G4Material.hh:322
size_t fIndexInTable
Definition: G4Material.hh:331
const std::vector< G4String > & GetNistElementNames() const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:588
std::vector< G4Material * > G4MaterialTable
G4double GetDensity() const
Definition: G4Material.hh:180
long G4long
Definition: G4Types.hh:80
G4int fNumberOfComponents
Definition: G4Material.hh:319
G4double a
Definition: TRTMaterials.hh:39
static const double perThousand
Definition: G4SIunits.hh:297
G4double fDensity
Definition: G4Material.hh:310
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4IonisParamMat * fIonisation
Definition: G4Material.hh:344
G4int nComponents
Definition: TRTMaterials.hh:41
void ComputeDerivedQuantities()
Definition: G4Material.cc:302
G4double * fMassFractionVector
Definition: G4Material.hh:324
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:190
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
G4int maxNbComponents
Definition: G4Material.hh:317
G4bool fImplicitElement
Definition: G4Material.hh:323
G4SandiaTable * GetSandiaTable() const
Definition: G4Material.hh:229
G4SandiaTable * fSandiaTable
Definition: G4Material.hh:345
G4double density
Definition: TRTMaterials.hh:39
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:206
static const double prec
Definition: RanecuEngine.cc:58
G4GLOB_DLL std::ostream G4cout
G4double TotNbOfAtomsPerVolume
Definition: G4Material.hh:339
bool G4bool
Definition: G4Types.hh:79
G4double iz
Definition: TRTMaterials.hh:39
G4MaterialPropertiesTable * fMaterialPropertiesTable
Definition: G4Material.hh:327
G4int * fAtomsVector
Definition: G4Material.hh:325
static const double cm3
Definition: G4SIunits.hh:108
G4double fRadlen
Definition: G4Material.hh:341
static const double perCent
Definition: G4SIunits.hh:296
G4double fNuclInterLen
Definition: G4Material.hh:342
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:595
static const G4double A[nN]
G4double GetRadlen() const
Definition: G4Material.hh:220
G4Material(const G4String &name, G4double z, G4double a, G4double density, G4State state=kStateUndefined, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
Definition: G4Material.cc:88
G4int fArrayLength
Definition: G4Material.hh:318
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:645
G4String fChemicalFormula
Definition: G4Material.hh:309
G4double GetTotNbOfAtomsPerVolume() const
Definition: G4Material.hh:209
std::ostream & operator<<(std::ostream &flux, const G4Material *material)
Definition: G4Material.cc:723
static const G4double factor
int G4lrint(double ad)
Definition: templates.hh:163
G4int operator!=(const G4Material &) const
Definition: G4Material.cc:716
void ComputeNuclearInterLength()
Definition: G4Material.cc:569
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
G4double GetMassOfMolecule() const
Definition: G4Material.hh:242
static const double g
Definition: G4SIunits.hh:162
G4double TotNbOfElectPerVolume
Definition: G4Material.hh:340
static const double atmosphere
Definition: G4SIunits.hh:216
G4State fState
Definition: G4Material.hh:312
const G4int * GetAtomsVector() const
Definition: G4Material.hh:198
G4double GetMeanExcitationEnergy() const
#define G4endl
Definition: G4ios.hh:61
G4double fTemp
Definition: G4Material.hh:314
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:364
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
void ComputeRadiationLength()
Definition: G4Material.cc:558
double G4double
Definition: G4Types.hh:76
const G4String & GetName() const
Definition: G4Element.hh:127
G4double fPressure
Definition: G4Material.hh:315
std::map< G4Material *, G4double > fMatComponents
Definition: G4Material.hh:351
const G4double * GetFractionVector() const
Definition: G4Material.hh:194
#define DBL_MAX
Definition: templates.hh:83
virtual ~G4Material()
Definition: G4Material.cc:240
G4double * VecNbOfAtomsPerVolume
Definition: G4Material.hh:338
G4double GetNuclearInterLength() const
Definition: G4Material.hh:223
G4String fName
Definition: G4Material.hh:308
G4GLOB_DLL std::ostream G4cerr