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

#include <G4tgbMaterialMgr.hh>

Public Member Functions

 ~G4tgbMaterialMgr ()
 
void CopyIsotopes ()
 
void CopyElements ()
 
void CopyMaterials ()
 
G4IsotopeFindOrBuildG4Isotope (const G4String &name)
 
G4IsotopeFindBuiltG4Isotope (const G4String &name) const
 
G4tgbIsotopeFindG4tgbIsotope (const G4String &name, G4bool bMustExist=false) const
 
G4ElementFindOrBuildG4Element (const G4String &name, G4bool bMustExist=true)
 
G4ElementFindBuiltG4Element (const G4String &name) const
 
G4tgbElementFindG4tgbElement (const G4String &name, G4bool bMustExist=false) const
 
G4MaterialFindOrBuildG4Material (const G4String &name, G4bool bMustExist=true)
 
G4MaterialFindBuiltG4Material (const G4String &name) const
 
G4tgbMaterialFindG4tgbMaterial (const G4String &name, G4bool bMustExist=false) const
 
const G4msg4isot GetG4IsotopeList () const
 
const G4msg4elem GetG4ElementList () const
 
const G4msg4mate GetG4MaterialList () const
 

Static Public Member Functions

static G4tgbMaterialMgrGetInstance ()
 

Detailed Description

Definition at line 60 of file G4tgbMaterialMgr.hh.

Constructor & Destructor Documentation

◆ ~G4tgbMaterialMgr()

G4tgbMaterialMgr::~G4tgbMaterialMgr ( )

Definition at line 65 of file G4tgbMaterialMgr.cc.

66{
67 for(auto isotcite = theG4tgbIsotopes.cbegin();
68 isotcite != theG4tgbIsotopes.cend(); ++isotcite)
69 {
70 delete(*isotcite).second;
71 }
72 theG4tgbIsotopes.clear();
73
74 for(auto elemcite = theG4tgbElements.cbegin();
75 elemcite != theG4tgbElements.cend(); ++elemcite)
76 {
77 delete(*elemcite).second;
78 }
79 theG4tgbElements.clear();
80
81 for(auto matcite = theG4tgbMaterials.cbegin();
82 matcite != theG4tgbMaterials.cend(); ++matcite)
83 {
84 delete(*matcite).second;
85 }
86 theG4tgbMaterials.clear();
87
88 delete theInstance;
89}

Member Function Documentation

◆ CopyElements()

void G4tgbMaterialMgr::CopyElements ( )

Definition at line 105 of file G4tgbMaterialMgr.cc.

106{
107 const G4mstgrelem tgrElems =
109 for(auto cite = tgrElems.cbegin(); cite != tgrElems.cend(); ++cite)
110 {
111 G4tgrElement* tgr = (*cite).second;
112 G4tgbElement* tgb = new G4tgbElement(tgr);
113 theG4tgbElements[tgb->GetName()] = tgb;
114 }
115}
std::map< G4String, G4tgrElement * > G4mstgrelem
const G4String & GetName() const
const G4mstgrelem & GetElementList() const
static G4tgrMaterialFactory * GetInstance()

Referenced by GetInstance().

◆ CopyIsotopes()

void G4tgbMaterialMgr::CopyIsotopes ( )

Definition at line 92 of file G4tgbMaterialMgr.cc.

93{
94 const G4mstgrisot tgrIsots =
96 for(auto cite = tgrIsots.cbegin(); cite != tgrIsots.cend(); ++cite)
97 {
98 G4tgrIsotope* tgr = (*cite).second;
99 G4tgbIsotope* tgb = new G4tgbIsotope(tgr);
100 theG4tgbIsotopes[tgb->GetName()] = tgb;
101 }
102}
std::map< G4String, G4tgrIsotope * > G4mstgrisot
const G4String & GetName() const
const G4mstgrisot & GetIsotopeList() const

Referenced by GetInstance().

◆ CopyMaterials()

void G4tgbMaterialMgr::CopyMaterials ( )

Definition at line 118 of file G4tgbMaterialMgr.cc.

119{
120 const G4mstgrmate tgrMates =
122 for(auto cite = tgrMates.cbegin(); cite != tgrMates.cend(); ++cite)
123 {
124 G4tgrMaterial* tgr = (*cite).second;
125 G4tgbMaterial* tgb = nullptr;
126 if(tgr->GetType() == "MaterialSimple")
127 {
128 tgb = new G4tgbMaterialSimple(tgr);
129 }
130 else if(tgr->GetType() == "MaterialMixtureByWeight")
131 {
132 tgb = new G4tgbMaterialMixtureByWeight(tgr);
133 }
134 else if(tgr->GetType() == "MaterialMixtureByNoAtoms")
135 {
136 tgb = new G4tgbMaterialMixtureByNoAtoms(tgr);
137 }
138 else if(tgr->GetType() == "MaterialMixtureByVolume")
139 {
140 tgb = new G4tgbMaterialMixtureByVolume(tgr);
141 }
142 else
143 {
144 return;
145 }
146 theG4tgbMaterials[tgb->GetName()] = tgb;
147 }
148}
std::map< G4String, G4tgrMaterial * > G4mstgrmate
const G4String & GetName() const
const G4mstgrmate & GetMaterialList() const
const G4String & GetType() const

Referenced by GetInstance().

◆ FindBuiltG4Element()

G4Element * G4tgbMaterialMgr::FindBuiltG4Element ( const G4String & name) const

Definition at line 310 of file G4tgbMaterialMgr.cc.

311{
312 G4Element* g4elem = nullptr;
313
314 G4msg4elem::const_iterator cite = theG4Elements.find(name);
315 if(cite != theG4Elements.cend())
316 {
317 g4elem = (*cite).second;
318#ifdef G4VERBOSE
320 {
321 G4cout << " G4tgbMaterialMgr::FindBuiltG4Element() - Element: " << name
322 << " = " << g4elem << G4endl;
323 }
324#endif
325 }
326
327 return g4elem;
328}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
const char * name(G4int ptype)

Referenced by FindOrBuildG4Element().

◆ FindBuiltG4Isotope()

G4Isotope * G4tgbMaterialMgr::FindBuiltG4Isotope ( const G4String & name) const

Definition at line 185 of file G4tgbMaterialMgr.cc.

186{
187 G4Isotope* g4isot = nullptr;
188
189 G4msg4isot::const_iterator cite = theG4Isotopes.find(name);
190 if(cite != theG4Isotopes.cend())
191 {
192 g4isot = (*cite).second;
193#ifdef G4VERBOSE
195 {
196 G4cout << " G4tgbMaterialMgr::FindBuiltG4Isotope() - Isotope: " << name
197 << " = " << g4isot << G4endl;
198 }
199#endif
200 }
201
202 return g4isot;
203}

Referenced by FindOrBuildG4Isotope().

◆ FindBuiltG4Material()

G4Material * G4tgbMaterialMgr::FindBuiltG4Material ( const G4String & name) const

Definition at line 428 of file G4tgbMaterialMgr.cc.

429{
430 G4Material* g4mate = nullptr;
431 //---------- look for an existing G4Material
432 G4msg4mate::const_iterator cite = theG4Materials.find(name);
433 if(cite != theG4Materials.cend())
434 {
435 g4mate = (*cite).second;
436#ifdef G4VERBOSE
438 {
439 G4cout << " G4tgbMaterialMgr::FindBuiltG4Material() - Material: " << name
440 << " = " << g4mate << G4endl;
441 }
442#endif
443 }
444
445 return g4mate;
446}

Referenced by FindOrBuildG4Material().

◆ FindG4tgbElement()

G4tgbElement * G4tgbMaterialMgr::FindG4tgbElement ( const G4String & name,
G4bool bMustExist = false ) const

Definition at line 331 of file G4tgbMaterialMgr.cc.

333{
334 G4tgbElement* elem = nullptr;
335
336 G4mstgbelem::const_iterator cite = theG4tgbElements.find(name);
337 if(cite != theG4tgbElements.cend())
338 {
339#ifdef G4VERBOSE
341 {
342 G4cout << " G4tgbMaterialMgr::FindG4tgbElement() -"
343 << " G4tgbElement found: " << ((*cite).second)->GetName()
344 << G4endl;
345 }
346#endif
347 elem = (*cite).second;
348 }
349 if((elem == nullptr) && bMustExist)
350 {
351 G4String ErrMessage = "Element " + name + " not found !";
352 G4Exception("G4tgbMaterialMgr::FindG4tgbElement()", "InvalidSetup",
353 FatalException, ErrMessage);
354 }
355
356 return elem;
357}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define elem(i, j)

Referenced by FindOrBuildG4Element().

◆ FindG4tgbIsotope()

G4tgbIsotope * G4tgbMaterialMgr::FindG4tgbIsotope ( const G4String & name,
G4bool bMustExist = false ) const

Definition at line 206 of file G4tgbMaterialMgr.cc.

208{
209 G4tgbIsotope* isot = nullptr;
210
211 G4mstgbisot::const_iterator cite = theG4tgbIsotopes.find(name);
212 if(cite != theG4tgbIsotopes.cend())
213 {
214#ifdef G4VERBOSE
216 {
217 G4cout << " G4tgbMaterialMgr::FindG4tgbIsotope() -"
218 << " G4tgbIsotope found: " << ((*cite).second)->GetName()
219 << G4endl;
220 }
221#endif
222 isot = (*cite).second;
223 }
224 if((isot == nullptr) && bMustExist)
225 {
226 G4String ErrMessage = "Isotope " + name + " not found !";
227 G4Exception("G4tgbMaterialMgr::FindG4tgbIsotope()", "InvalidSetup",
228 FatalException, ErrMessage);
229 }
230
231 return isot;
232}

Referenced by FindOrBuildG4Isotope().

◆ FindG4tgbMaterial()

G4tgbMaterial * G4tgbMaterialMgr::FindG4tgbMaterial ( const G4String & name,
G4bool bMustExist = false ) const

Definition at line 449 of file G4tgbMaterialMgr.cc.

451{
452 G4tgbMaterial* mate = nullptr;
453 G4mstgbmate::const_iterator cite = theG4tgbMaterials.find(name);
454 if(cite != theG4tgbMaterials.cend())
455 {
456 mate = (*cite).second;
457#ifdef G4VERBOSE
459 {
460 G4cout << " G4tgbMaterialMgr::FindG4tgbMaterial() -"
461 << " G4tgbMaterial found: " << ((*cite).second)->GetName()
462 << " type " << ((*cite).second)->GetName() << G4endl;
463 }
464#endif
465 }
466
467 if((mate == nullptr) && bMustExist)
468 {
469 G4String ErrMessage = "Material " + name + " not found !";
470 G4Exception("G4tgbMaterialMgr::FindG4tgbMaterial()", "InvalidSetup",
471 FatalException, ErrMessage);
472 }
473
474 return mate;
475}

Referenced by FindOrBuildG4Material().

◆ FindOrBuildG4Element()

G4Element * G4tgbMaterialMgr::FindOrBuildG4Element ( const G4String & name,
G4bool bMustExist = true )

Definition at line 235 of file G4tgbMaterialMgr.cc.

237{
238 G4Element* g4elem = FindBuiltG4Element(name);
239 if(g4elem == nullptr)
240 {
241 G4tgbElement* tgbelem = FindG4tgbElement(name, false);
242 if(tgbelem == nullptr)
243 {
244 // If FindG4tgbElement returns nullptr, look for a G4NISTElement
245 G4cout << " G4NistManager::Instance()->FindOrBuildElement( " << G4endl;
247 }
248 else
249 {
250 if(tgbelem->GetType() == "ElementSimple")
251 {
252 g4elem = tgbelem->BuildG4ElementSimple();
253 }
254 else if(tgbelem->GetType() == "ElementFromIsotopes")
255 {
256 g4elem = tgbelem->BuildG4ElementFromIsotopes();
257 }
258 else
259 {
260 G4String ErrMessage =
261 "Element type " + tgbelem->GetType() + " does not exist !";
262 G4Exception("G4tgbMaterialMgr::GetG4Element()", "InvalidSetup",
263 FatalException, ErrMessage);
264 }
265 }
266 // Register it
267 if((g4elem != nullptr))
268 {
269 theG4Elements[g4elem->GetName()] = g4elem;
270#ifdef G4VERBOSE
272 {
273 G4cout << " G4tgbMaterialMgr::FindOrBuildG4Element() - Element: "
274 << name << G4endl;
275 }
276#endif
277 }
278 else
279 {
280 if(bMustExist)
281 {
282 G4String ErrMessage = "Element " + name + " not found !";
283 G4Exception("G4tgbMaterialMgr::FindOrBuildG4Element()", "InvalidSetup",
284 FatalException, ErrMessage);
285 }
286#ifdef G4VERBOSE
288 {
289 G4cout << " G4tgbMaterialMgr::FindOrBuildG4Element() - Element: "
290 << name << " not found " << G4endl;
291 }
292#endif
293 }
294 }
295 else
296 {
297#ifdef G4VERBOSE
299 {
300 G4cout << " G4tgbMaterialMgr::GetG4Element() -"
301 << " G4Element already built: " << g4elem->GetName() << G4endl;
302 }
303#endif
304 }
305
306 return g4elem;
307}
const G4String & GetName() const
Definition G4Element.hh:115
static G4NistManager * Instance()
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
G4Element * BuildG4ElementFromIsotopes()
const G4String & GetType() const
G4Element * BuildG4ElementSimple()
G4tgbElement * FindG4tgbElement(const G4String &name, G4bool bMustExist=false) const
G4Element * FindBuiltG4Element(const G4String &name) const

Referenced by G4tgbMaterialMixtureByNoAtoms::BuildG4Material(), and G4tgbMaterialMixtureByWeight::BuildG4Material().

◆ FindOrBuildG4Isotope()

G4Isotope * G4tgbMaterialMgr::FindOrBuildG4Isotope ( const G4String & name)

Definition at line 151 of file G4tgbMaterialMgr.cc.

152{
153 G4Isotope* g4isot = FindBuiltG4Isotope(name);
154 if(g4isot == nullptr)
155 {
156 G4tgbIsotope* tgbisot = FindG4tgbIsotope(name);
157 // FindG4tgbIsotope never returns nullptr, otherwise if not found, crashes
158 g4isot = tgbisot->BuildG4Isotope();
159 // Register it
160 G4String isotname = g4isot->GetName();
161 theG4Isotopes[isotname] = g4isot;
162 }
163 else
164 {
165#ifdef G4VERBOSE
167 {
168 G4cout << " G4tgbMaterialMgr::FindOrBuildG4Isotope() -"
169 << " G4Isotope already built: " << g4isot->GetName() << G4endl;
170 }
171#endif
172 }
173
174#ifdef G4VERBOSE
176 {
177 G4cout << " G4tgbMaterialMgr::FindOrBuildG4Isotope() - Isotope: " << name
178 << G4endl;
179 }
180#endif
181 return g4isot;
182}
const G4String & GetName() const
Definition G4Isotope.hh:77
G4Isotope * BuildG4Isotope()
G4tgbIsotope * FindG4tgbIsotope(const G4String &name, G4bool bMustExist=false) const
G4Isotope * FindBuiltG4Isotope(const G4String &name) const

Referenced by G4tgbElement::BuildG4ElementFromIsotopes().

◆ FindOrBuildG4Material()

G4Material * G4tgbMaterialMgr::FindOrBuildG4Material ( const G4String & name,
G4bool bMustExist = true )

Definition at line 360 of file G4tgbMaterialMgr.cc.

362{
363 G4Material* g4mate = FindBuiltG4Material(name);
364 if(g4mate == nullptr)
365 {
366 G4tgbMaterial* tgbmate = FindG4tgbMaterial(name, false);
367
368 if(tgbmate == nullptr)
369 {
370 // if FindG4tgbMaterial() returns 0, look for a G4NISTMaterial
372 }
373 else
374 {
375 g4mate = tgbmate->BuildG4Material();
376
377 if(tgbmate->GetTgrMate()->GetIonisationMeanExcitationEnergy() != -1.)
378 {
381 }
382 }
383
384 // Register it
385 if(g4mate != nullptr)
386 {
387 theG4Materials[g4mate->GetName()] = g4mate;
388#ifdef G4VERBOSE
390 {
391 G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() - Material: "
392 << name << G4endl;
393 }
394#endif
395 }
396 else
397 {
398 if(bMustExist)
399 {
400 G4String ErrMessage = "Material " + name + " not found !";
401 G4Exception("G4tgbMaterialMgr::FindOrBuildG4Material()", "InvalidSetup",
402 FatalException, ErrMessage);
403 }
404#ifdef G4VERBOSE
406 {
407 G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() - Element: "
408 << name << " not found " << G4endl;
409 }
410#endif
411 }
412 }
413 else
414 {
415#ifdef G4VERBOSE
417 {
418 G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() -"
419 << " G4Material already built: " << g4mate->GetName() << G4endl;
420 }
421#endif
422 }
423
424 return g4mate;
425}
void SetMeanExcitationEnergy(G4double value)
G4IonisParamMat * GetIonisation() const
const G4String & GetName() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4Material * FindBuiltG4Material(const G4String &name) const
G4tgbMaterial * FindG4tgbMaterial(const G4String &name, G4bool bMustExist=false) const
G4tgrMaterial * GetTgrMate() const
virtual G4Material * BuildG4Material()=0
G4double GetIonisationMeanExcitationEnergy() const

Referenced by G4tgbMaterialMixtureByVolume::BuildG4Material(), G4tgbMaterialMixtureByWeight::BuildG4Material(), G4tgbVolume::ConstructG4LogVol(), G4tgbVolume::ConstructG4PhysVol(), and G4tgbMaterialMixtureByVolume::TransformToFractionsByWeight().

◆ GetG4ElementList()

const G4msg4elem G4tgbMaterialMgr::GetG4ElementList ( ) const
inline

Definition at line 106 of file G4tgbMaterialMgr.hh.

106{ return theG4Elements; }

Referenced by G4tgbVolumeMgr::DumpSummary().

◆ GetG4IsotopeList()

const G4msg4isot G4tgbMaterialMgr::GetG4IsotopeList ( ) const
inline

Definition at line 105 of file G4tgbMaterialMgr.hh.

105{ return theG4Isotopes; }

Referenced by G4tgbVolumeMgr::DumpSummary().

◆ GetG4MaterialList()

const G4msg4mate G4tgbMaterialMgr::GetG4MaterialList ( ) const
inline

Definition at line 107 of file G4tgbMaterialMgr.hh.

107{ return theG4Materials; }

Referenced by G4tgbVolumeMgr::DumpSummary().

◆ GetInstance()


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