Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4tgbMaterialMixtureByWeight Class Reference

#include <G4tgbMaterialMixtureByWeight.hh>

+ Inheritance diagram for G4tgbMaterialMixtureByWeight:

Public Member Functions

 G4tgbMaterialMixtureByWeight ()
 
 G4tgbMaterialMixtureByWeight (G4tgrMaterial *tgr)
 
 ~G4tgbMaterialMixtureByWeight ()
 
G4MaterialBuildG4Material ()
 
- Public Member Functions inherited from G4tgbMaterialMixture
 G4tgbMaterialMixture ()
 
virtual ~G4tgbMaterialMixture ()
 
virtual const G4StringGetComponent (G4int i) const
 
virtual G4double GetFraction (G4int i) const
 
G4tgbMaterialMixtureoperator= (const G4tgbMaterialMixture &)
 
- Public Member Functions inherited from G4tgbMaterial
 G4tgbMaterial ()
 
virtual ~G4tgbMaterial ()
 
 G4tgbMaterial (G4tgrMaterial *tgr)
 
virtual G4MaterialBuildG4Material ()=0
 
const G4StringGetName () const
 
G4double GetDensity () const
 
G4int GetNumberOfMaterials () const
 
G4double GetA () const
 
G4double GetZ () const
 
const G4StringGetType () const
 
G4tgrMaterialGetTgrMate () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4tgbMaterialMixture
virtual void TransformToFractionsByWeight ()
 
- Protected Attributes inherited from G4tgbMaterial
G4tgrMaterialtheTgrMate
 
G4MaterialtheG4Mate
 

Detailed Description

Definition at line 50 of file G4tgbMaterialMixtureByWeight.hh.

Constructor & Destructor Documentation

◆ G4tgbMaterialMixtureByWeight() [1/2]

G4tgbMaterialMixtureByWeight::G4tgbMaterialMixtureByWeight ( )

Definition at line 44 of file G4tgbMaterialMixtureByWeight.cc.

45{
46}

◆ G4tgbMaterialMixtureByWeight() [2/2]

G4tgbMaterialMixtureByWeight::G4tgbMaterialMixtureByWeight ( G4tgrMaterial tgr)

Definition at line 56 of file G4tgbMaterialMixtureByWeight.cc.

57{
58 theTgrMate = hg;
59}
G4tgrMaterial * theTgrMate

◆ ~G4tgbMaterialMixtureByWeight()

G4tgbMaterialMixtureByWeight::~G4tgbMaterialMixtureByWeight ( )

Definition at line 50 of file G4tgbMaterialMixtureByWeight.cc.

51{
52}

Member Function Documentation

◆ BuildG4Material()

G4Material * G4tgbMaterialMixtureByWeight::BuildG4Material ( )
virtual

Implements G4tgbMaterial.

Definition at line 63 of file G4tgbMaterialMixtureByWeight.cc.

64{
65 //----- construct new G4Material with component materials (a mixture)
72#ifdef G4VERBOSE
74 {
75 G4cout << " G4tgbMaterialMixtureByWeight::BuildG4Material() -"
76 << " Constructing new G4Material:"
77 << " " << theTgrMate->GetName()
78 << " " << theTgrMate->GetDensity()/g*cm3
80 << " " << theTgrMate->GetState()
81 << " " << theTgrMate->GetTemperature()
82 << " " << theTgrMate->GetPressure() << G4endl;
83 }
84#endif
85
86 //--- Add components
87 G4Element* compElem;
88 G4Material* compMate;
90
91 for( G4int ii = 0; ii < theTgrMate->GetNumberOfComponents(); ii++)
92 {
93 // Look if this component is an element
94 compElem = mf->FindOrBuildG4Element( GetComponent(ii), false );
95 if( compElem != 0 )
96 {
97 mate->AddElement( compElem, GetFraction( ii ) );
98 }
99 else // If it is not an element, it must be a material
100 {
101 compMate = mf->FindOrBuildG4Material( GetComponent(ii) );
102 if( compMate != 0 )
103 {
104 // If it is a material add it by weight fraction
105 mate->AddMaterial( compMate, GetFraction( ii ) );
106 }
107 else
108 {
109 G4String ErrMessage = "Component " + GetComponent(ii)
110 + " of material " + theTgrMate->GetName()
111 + "\n" + "is not an element nor a material !";
112 G4Exception("G4tgbMaterialMixtureByWeight::BuildG4Material()",
113 "InvalidSetup", FatalException, ErrMessage);
114 }
115 }
116 }
117
118#ifdef G4VERBOSE
120 {
121 G4cout << " Constructing new G4Material by weight: " << *mate << G4endl;
122 G4cout << " TEMPERATURE " << mate->GetTemperature()/kelvin
123 << " kelvin " << G4endl;
124 }
125#endif
126
127 return mate;
128}
@ FatalException
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4double GetTemperature() const
Definition: G4Material.hh:181
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:341
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:447
G4Element * FindOrBuildG4Element(const G4String &name, G4bool bMustExist=1)
G4Material * FindOrBuildG4Material(const G4String &name, G4bool bMustExist=1)
static G4tgbMaterialMgr * GetInstance()
virtual G4double GetFraction(G4int i) const
virtual const G4String & GetComponent(G4int i) const
const G4String & GetName() const
G4double GetDensity() const
G4int GetNumberOfComponents() const
G4State GetState() const
G4double GetPressure() const
G4double GetTemperature() const
static G4int GetVerboseLevel()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

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