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

#include <G4tgbMaterialMixtureByWeight.hh>

Inheritance diagram for G4tgbMaterialMixtureByWeight:
G4tgbMaterialMixture G4tgbMaterial

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)
 
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::G4tgbMaterialMixtureByWeight ( )

Definition at line 44 of file G4tgbMaterialMixtureByWeight.cc.

45 {
46 }
G4tgbMaterialMixtureByWeight::G4tgbMaterialMixtureByWeight ( G4tgrMaterial tgr)

Definition at line 56 of file G4tgbMaterialMixtureByWeight.cc.

References G4tgbMaterial::theTgrMate.

57 {
58  theTgrMate = hg;
59 }
G4tgrMaterial * theTgrMate
G4tgbMaterialMixtureByWeight::~G4tgbMaterialMixtureByWeight ( )

Definition at line 50 of file G4tgbMaterialMixtureByWeight.cc.

51 {
52 }

Member Function Documentation

G4Material * G4tgbMaterialMixtureByWeight::BuildG4Material ( )
virtual

Implements G4tgbMaterial.

Definition at line 63 of file G4tgbMaterialMixtureByWeight.cc.

References G4Material::AddElement(), G4Material::AddMaterial(), python.hepunit::cm3, FatalException, G4tgbMaterialMgr::FindOrBuildG4Element(), G4tgbMaterialMgr::FindOrBuildG4Material(), g(), G4cout, G4endl, G4Exception(), G4tgbMaterialMixture::GetComponent(), G4tgrMaterial::GetDensity(), G4tgbMaterialMixture::GetFraction(), G4tgbMaterialMgr::GetInstance(), G4tgrMaterial::GetName(), G4tgrMaterial::GetNumberOfComponents(), G4tgrMaterial::GetPressure(), G4tgrMaterial::GetState(), G4tgrMaterial::GetTemperature(), G4Material::GetTemperature(), G4tgrMessenger::GetVerboseLevel(), python.hepunit::kelvin, and G4tgbMaterial::theTgrMate.

64 {
65  //----- construct new G4Material with component materials (a mixture)
66  G4Material* mate = new G4Material( theTgrMate->GetName(),
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 }
G4double GetDensity() const
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:450
int G4int
Definition: G4Types.hh:78
G4Element * FindOrBuildG4Element(const G4String &name, G4bool bMustExist=1)
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4double GetPressure() const
const G4String & GetName() const
G4GLOB_DLL std::ostream G4cout
G4tgrMaterial * theTgrMate
static G4int GetVerboseLevel()
G4Material * FindOrBuildG4Material(const G4String &name, G4bool bMustExist=1)
G4int GetNumberOfComponents() const
virtual const G4String & GetComponent(G4int i) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double GetTemperature() const
Definition: G4Material.hh:180
#define G4endl
Definition: G4ios.hh:61
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:345
G4double GetTemperature() const
virtual G4double GetFraction(G4int i) const
G4State GetState() const
static G4tgbMaterialMgr * GetInstance()

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