Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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=0) const
 
G4ElementFindOrBuildG4Element (const G4String &name, G4bool bMustExist=1)
 
G4ElementFindBuiltG4Element (const G4String &name) const
 
G4tgbElementFindG4tgbElement (const G4String &name, G4bool bMustExist=0) const
 
G4MaterialFindOrBuildG4Material (const G4String &name, G4bool bMustExist=1)
 
G4MaterialFindBuiltG4Material (const G4String &name) const
 
G4tgbMaterialFindG4tgbMaterial (const G4String &name, G4bool bMustExist=0) const
 
const G4msg4isot GetG4IsotopeList () const
 
const G4msg4elem GetG4ElementList () const
 
const G4msg4mate GetG4MaterialList () const
 

Static Public Member Functions

static G4tgbMaterialMgrGetInstance ()
 

Detailed Description

Definition at line 66 of file G4tgbMaterialMgr.hh.

Constructor & Destructor Documentation

G4tgbMaterialMgr::~G4tgbMaterialMgr ( )

Definition at line 74 of file G4tgbMaterialMgr.cc.

75 {
76  G4mstgbisot::const_iterator isotcite;
77  for( isotcite = theG4tgbIsotopes.begin();
78  isotcite != theG4tgbIsotopes.end(); isotcite++)
79  {
80  delete (*isotcite).second;
81  }
82  theG4tgbIsotopes.clear();
83 
84  G4mstgbelem::const_iterator elemcite;
85  for( elemcite = theG4tgbElements.begin();
86  elemcite != theG4tgbElements.end(); elemcite++)
87  {
88  delete (*elemcite).second;
89  }
90  theG4tgbElements.clear();
91 
92  G4mstgbmate::const_iterator matcite;
93  for( matcite = theG4tgbMaterials.begin();
94  matcite != theG4tgbMaterials.end(); matcite++)
95  {
96  delete (*matcite).second;
97  }
98  theG4tgbMaterials.clear();
99 
100  delete theInstance;
101 }

Member Function Documentation

void G4tgbMaterialMgr::CopyElements ( )

Definition at line 120 of file G4tgbMaterialMgr.cc.

121 {
122  const G4mstgrelem tgrElems
124  G4mstgrelem::const_iterator cite;
125  for( cite = tgrElems.begin(); cite != tgrElems.end(); cite++ )
126  {
127  G4tgrElement* tgr = (*cite).second;
128  G4tgbElement* tgb = new G4tgbElement( tgr );
129  theG4tgbElements[tgb->GetName()] = tgb;
130  }
131 }
const G4String & GetName() const
Definition: G4tgbElement.hh:68
const G4mstgrelem & GetElementList() const
static G4tgrMaterialFactory * GetInstance()
std::map< G4String, G4tgrElement * > G4mstgrelem

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgbMaterialMgr::CopyIsotopes ( )

Definition at line 105 of file G4tgbMaterialMgr.cc.

106 {
107  const G4mstgrisot tgrIsots
109  G4mstgrisot::const_iterator cite;
110  for( cite = tgrIsots.begin(); cite != tgrIsots.end(); cite++ )
111  {
112  G4tgrIsotope* tgr = (*cite).second;
113  G4tgbIsotope* tgb = new G4tgbIsotope( tgr );
114  theG4tgbIsotopes[tgb->GetName()] = tgb;
115  }
116 }
const G4mstgrisot & GetIsotopeList() const
static G4tgrMaterialFactory * GetInstance()
const G4String & GetName() const
Definition: G4tgbIsotope.hh:67
std::map< G4String, G4tgrIsotope * > G4mstgrisot

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgbMaterialMgr::CopyMaterials ( )

Definition at line 135 of file G4tgbMaterialMgr.cc.

136 {
137  const G4mstgrmate tgrMates
139  G4mstgrmate::const_iterator cite;
140  for( cite = tgrMates.begin(); cite != tgrMates.end(); cite++ )
141  {
142  G4tgrMaterial* tgr = (*cite).second;
143  G4tgbMaterial* tgb = 0;
144  if( tgr->GetType() == "MaterialSimple" ) {
145  tgb = new G4tgbMaterialSimple( tgr );
146  } else if( tgr->GetType() == "MaterialMixtureByWeight" ) {
147  tgb = new G4tgbMaterialMixtureByWeight( tgr );
148  } else if( tgr->GetType() == "MaterialMixtureByNoAtoms" ) {
149  tgb = new G4tgbMaterialMixtureByNoAtoms( tgr );
150  } else if( tgr->GetType() == "MaterialMixtureByVolume" ) {
151  tgb = new G4tgbMaterialMixtureByVolume( tgr );
152  } else {
153  return;
154  }
155  theG4tgbMaterials[tgb->GetName()] = tgb;
156  }
157 }
const G4mstgrmate & GetMaterialList() const
std::map< G4String, G4tgrMaterial * > G4mstgrmate
const G4String & GetType() const
static G4tgrMaterialFactory * GetInstance()
const G4String & GetName() const

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 325 of file G4tgbMaterialMgr.cc.

326 {
327  G4Element* g4elem = 0;
328 
329  G4msg4elem::const_iterator cite = theG4Elements.find( name );
330  if( cite != theG4Elements.end() )
331  {
332  g4elem = (*cite).second;
333 #ifdef G4VERBOSE
335  {
336  G4cout << " G4tgbMaterialMgr::FindBuiltG4Element() - Element: "
337  << name << " = " << g4elem << G4endl;
338  }
339 #endif
340  }
341 
342  return g4elem;
343 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 196 of file G4tgbMaterialMgr.cc.

197 {
198  G4Isotope* g4isot = 0;
199 
200  G4msg4isot::const_iterator cite = theG4Isotopes.find( name );
201  if( cite != theG4Isotopes.end() )
202  {
203  g4isot = (*cite).second;
204 #ifdef G4VERBOSE
206  {
207  G4cout << " G4tgbMaterialMgr::FindBuiltG4Isotope() - Isotope: "
208  << name << " = " << g4isot << G4endl;
209  }
210 #endif
211 
212  }
213 
214  return g4isot;
215 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 446 of file G4tgbMaterialMgr.cc.

447 {
448  G4Material* g4mate = 0;
449  //---------- look for an existing G4Material
450  G4msg4mate::const_iterator cite = theG4Materials.find( name );
451  if( cite != theG4Materials.end() )
452  {
453  g4mate = (*cite).second;
454 #ifdef G4VERBOSE
456  {
457  G4cout << " G4tgbMaterialMgr::FindBuiltG4Material() - Material: "
458  << name << " = " << g4mate << G4endl;
459  }
460 #endif
461  }
462 
463  return g4mate;
464 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 347 of file G4tgbMaterialMgr.cc.

349 {
350  G4tgbElement* elem = 0;
351 
352  G4mstgbelem::const_iterator cite = theG4tgbElements.find( name );
353  if( cite != theG4tgbElements.end() )
354  {
355 #ifdef G4VERBOSE
357  {
358  G4cout << " G4tgbMaterialMgr::FindG4tgbElement() -"
359  << " G4tgbElement found: " << ( (*cite).second )->GetName()
360  << G4endl;
361  }
362 #endif
363  elem = (*cite).second;
364  }
365  if( (elem == 0) && bMustExist )
366  {
367  G4String ErrMessage = "Element " + name + " not found !";
368  G4Exception("G4tgbMaterialMgr::FindG4tgbElement()",
369  "InvalidSetup", FatalException, ErrMessage);
370  }
371 
372  return elem;
373 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 219 of file G4tgbMaterialMgr.cc.

221 {
222  G4tgbIsotope* isot = 0;
223 
224  G4mstgbisot::const_iterator cite = theG4tgbIsotopes.find( name );
225  if( cite != theG4tgbIsotopes.end() )
226  {
227 #ifdef G4VERBOSE
229  {
230  G4cout << " G4tgbMaterialMgr::FindG4tgbIsotope() -"
231  << " G4tgbIsotope found: " << ( (*cite).second )->GetName()
232  << G4endl;
233  }
234 #endif
235  isot = (*cite).second;
236  }
237  if( (isot == 0) && bMustExist )
238  {
239  G4String ErrMessage = "Isotope " + name + " not found !";
240  G4Exception("G4tgbMaterialMgr::FindG4tgbIsotope()",
241  "InvalidSetup", FatalException, ErrMessage);
242  }
243 
244  return isot;
245 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 468 of file G4tgbMaterialMgr.cc.

470 {
471  G4tgbMaterial* mate = 0;
472  G4mstgbmate::const_iterator cite = theG4tgbMaterials.find( name );
473  if( cite != theG4tgbMaterials.end() )
474  {
475  mate = (*cite).second;
476 #ifdef G4VERBOSE
478  {
479  G4cout << " G4tgbMaterialMgr::FindG4tgbMaterial() -"
480  << " G4tgbMaterial found: " << ( (*cite).second )->GetName()
481  << " type " << ( (*cite).second )->GetName() << G4endl;
482  }
483 #endif
484  }
485 
486  if( (mate == 0) && bMustExist )
487  {
488  G4String ErrMessage = "Material " + name + " not found !";
489  G4Exception("G4tgbMaterialMgr::FindG4tgbMaterial()",
490  "InvalidSetup", FatalException, ErrMessage);
491  }
492 
493  return mate;
494 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 249 of file G4tgbMaterialMgr.cc.

251 {
252  G4Element* g4elem = FindBuiltG4Element( name );
253  if( g4elem == 0 )
254  {
255  G4tgbElement* tgbelem = FindG4tgbElement( name, false );
256  if( tgbelem == 0)
257  {
258  // If FindG4tgbElement returns 0, look for a G4NISTElement
259  G4cout << " G4NistManager::Instance()->FindOrBuildElement( " << G4endl;
261  }
262  else
263  {
264  if( tgbelem->GetType() == "ElementSimple" )
265  {
266  g4elem = tgbelem->BuildG4ElementSimple();
267  }
268  else if( tgbelem->GetType() == "ElementFromIsotopes" )
269  {
270  g4elem = tgbelem->BuildG4ElementFromIsotopes();
271  }
272  else
273  {
274  G4String ErrMessage = "Element type " + tgbelem->GetType()
275  + " does not exist !";
276  G4Exception("G4tgbMaterialMgr::GetG4Element()",
277  "InvalidSetup", FatalException, ErrMessage);
278  }
279  }
280  // Register it
281  if( (g4elem != 0) )
282  {
283  theG4Elements[g4elem->GetName()] = g4elem;
284 #ifdef G4VERBOSE
286  {
287  G4cout << " G4tgbMaterialMgr::FindOrBuildG4Element() - Element: "
288  << name << G4endl;
289  }
290 #endif
291  }
292  else
293  {
294  if( bMustExist )
295  {
296  G4String ErrMessage = "Element " + name + " not found !";
297  G4Exception("G4tgbMaterialMgr::FindOrBuildG4Element()",
298  "InvalidSetup", FatalException, ErrMessage);
299  }
300 #ifdef G4VERBOSE
302  {
303  G4cout << " G4tgbMaterialMgr::FindOrBuildG4Element() - Element: "
304  << name << " not found " << G4endl;
305  }
306 #endif
307  }
308  }
309  else
310  {
311 #ifdef G4VERBOSE
313  {
314  G4cout << " G4tgbMaterialMgr::GetG4Element() -"
315  << " G4Element already built: " << g4elem->GetName() << G4endl;
316  }
317 #endif
318  }
319 
320  return g4elem;
321 }
G4tgbElement * FindG4tgbElement(const G4String &name, G4bool bMustExist=0) const
G4Element * BuildG4ElementSimple()
Definition: G4tgbElement.cc:52
static G4NistManager * Instance()
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
const G4String & GetType() const
Definition: G4tgbElement.hh:72
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4Element * FindBuiltG4Element(const G4String &name) const
#define G4endl
Definition: G4ios.hh:61
G4Element * BuildG4ElementFromIsotopes()
Definition: G4tgbElement.cc:83
const G4String & GetName() const
Definition: G4Element.hh:127
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)

Here is the call graph for this function:

Here is the caller graph for this function:

G4Isotope * G4tgbMaterialMgr::FindOrBuildG4Isotope ( const G4String name)

Definition at line 161 of file G4tgbMaterialMgr.cc.

162 {
163  G4Isotope* g4isot = FindBuiltG4Isotope( name );
164  if( g4isot == 0 )
165  {
166  G4tgbIsotope* tgbisot = FindG4tgbIsotope( name );
167  // FindG4tgbIsotope never returns 0, otherwise if not found, crashes
168  g4isot = tgbisot->BuildG4Isotope();
169  // Register it
170  G4String isotname = g4isot->GetName();
171  theG4Isotopes[isotname] = g4isot;
172  }
173  else
174  {
175 #ifdef G4VERBOSE
177  {
178  G4cout << " G4tgbMaterialMgr::FindOrBuildG4Isotope() -"
179  << " G4Isotope already built: " << g4isot->GetName() << G4endl;
180  }
181 #endif
182  }
183 
184 #ifdef G4VERBOSE
186  {
187  G4cout << " G4tgbMaterialMgr::FindOrBuildG4Isotope() - Isotope: "
188  << name << G4endl;
189  }
190 #endif
191  return g4isot;
192 }
const G4String & GetName() const
Definition: G4Isotope.hh:88
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
G4tgbIsotope * FindG4tgbIsotope(const G4String &name, G4bool bMustExist=0) const
#define G4endl
Definition: G4ios.hh:61
G4Isotope * BuildG4Isotope()
Definition: G4tgbIsotope.cc:58
G4Isotope * FindBuiltG4Isotope(const G4String &name) const

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 377 of file G4tgbMaterialMgr.cc.

379 {
380  G4Material* g4mate = FindBuiltG4Material( name );
381  if( g4mate == 0)
382  {
383  G4tgbMaterial* tgbmate = FindG4tgbMaterial( name, false );
384 
385  if( tgbmate == 0)
386  {
387  // if FindG4tgbMaterial() returns 0, look for a G4NISTMaterial
389  }
390  else
391  {
392  g4mate = tgbmate->BuildG4Material();
393 
394  if( tgbmate->GetTgrMate()->GetIonisationMeanExcitationEnergy() != -1. )
395  {
396  g4mate->GetIonisation()->SetMeanExcitationEnergy(tgbmate->
397  GetTgrMate()->GetIonisationMeanExcitationEnergy());
398  }
399  }
400 
401  // Register it
402  if( g4mate != 0 )
403  {
404  theG4Materials[g4mate->GetName()] = g4mate;
405 #ifdef G4VERBOSE
407  {
408  G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() - Material: "
409  << name << G4endl;
410  }
411 #endif
412  }
413  else
414  {
415  if( bMustExist )
416  {
417  G4String ErrMessage = "Material " + name + " not found !";
418  G4Exception("G4tgbMaterialMgr::FindOrBuildG4Material()",
419  "InvalidSetup", FatalException, ErrMessage);
420  }
421 #ifdef G4VERBOSE
423  {
424  G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() - Element: "
425  << name << " not found " << G4endl;
426  }
427 #endif
428  }
429  }
430  else
431  {
432 #ifdef G4VERBOSE
434  {
435  G4cout << " G4tgbMaterialMgr::FindOrBuildG4Material() -"
436  << " G4Material already built: " << g4mate->GetName() << G4endl;
437  }
438 #endif
439  }
440 
441  return g4mate;
442 }
G4tgbMaterial * FindG4tgbMaterial(const G4String &name, G4bool bMustExist=0) const
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:226
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
void SetMeanExcitationEnergy(G4double value)
const G4String & GetName() const
Definition: G4Material.hh:178
G4tgrMaterial * GetTgrMate() const
static G4NistManager * Instance()
G4GLOB_DLL std::ostream G4cout
virtual G4Material * BuildG4Material()=0
static G4int GetVerboseLevel()
G4double GetIonisationMeanExcitationEnergy() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4Material * FindBuiltG4Material(const G4String &name) const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

const G4msg4elem G4tgbMaterialMgr::GetG4ElementList ( ) const
inline

Definition at line 112 of file G4tgbMaterialMgr.hh.

112 { return theG4Elements; }

Here is the caller graph for this function:

const G4msg4isot G4tgbMaterialMgr::GetG4IsotopeList ( ) const
inline

Definition at line 111 of file G4tgbMaterialMgr.hh.

111 { return theG4Isotopes; }

Here is the caller graph for this function:

const G4msg4mate G4tgbMaterialMgr::GetG4MaterialList ( ) const
inline

Definition at line 113 of file G4tgbMaterialMgr.hh.

113 { return theG4Materials; }

Here is the caller graph for this function:

G4tgbMaterialMgr * G4tgbMaterialMgr::GetInstance ( )
static

Definition at line 60 of file G4tgbMaterialMgr.cc.

61 {
62  if( !theInstance )
63  {
64  theInstance = new G4tgbMaterialMgr;
65  theInstance->CopyIsotopes();
66  theInstance->CopyElements();
67  theInstance->CopyMaterials();
68  }
69  return theInstance;
70 }

Here is the call graph for this function:

Here is the caller graph for this function:


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