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

#include <G4MaterialPropertiesTable.hh>

+ Inheritance diagram for G4MaterialPropertiesTable:

Public Member Functions

 G4MaterialPropertiesTable ()
 
virtual ~G4MaterialPropertiesTable ()
 
void AddConstProperty (const G4String &key, G4double propertyValue, G4bool createNewKey=false)
 
void AddConstProperty (const char *key, G4double propertyValue, G4bool createNewKey=false)
 
G4MaterialPropertyVectorAddProperty (const G4String &key, const std::vector< G4double > &photonEnergies, const std::vector< G4double > &propertyValues, G4bool createNewKey=false, G4bool spline=false)
 
G4MaterialPropertyVectorAddProperty (const char *key, G4double *photonEnergies, G4double *propertyValues, G4int numEntries, G4bool createNewKey=false, G4bool spline=false)
 
void AddProperty (const G4String &key, G4MaterialPropertyVector *opv, G4bool createNewKey=false)
 
void AddProperty (const char *key, G4MaterialPropertyVector *opv, G4bool createNewKey=false)
 
void AddProperty (const G4String &key, const G4String &mat)
 
void RemoveConstProperty (const G4String &key)
 
void RemoveConstProperty (const char *key)
 
void RemoveProperty (const G4String &key)
 
void RemoveProperty (const char *key)
 
G4double GetConstProperty (const G4String &key) const
 
G4double GetConstProperty (const char *key) const
 
G4double GetConstProperty (const G4int index) const
 
G4bool ConstPropertyExists (const G4String &key) const
 
G4bool ConstPropertyExists (const char *key) const
 
G4bool ConstPropertyExists (const G4int index) const
 
G4MaterialPropertyVectorGetProperty (const char *key) const
 
G4MaterialPropertyVectorGetProperty (const G4String &key) const
 
G4MaterialPropertyVectorGetProperty (const G4int index) const
 
void AddEntry (const G4String &key, G4double aPhotonEnergy, G4double aPropertyValue)
 
void AddEntry (const char *key, G4double aPhotonEnergy, G4double aPropertyValue)
 
G4int GetConstPropertyIndex (const G4String &key) const
 
G4int GetPropertyIndex (const G4String &key) const
 
void DumpTable () const
 
const std::vector< G4String > & GetMaterialPropertyNames () const
 
const std::vector< G4String > & GetMaterialConstPropertyNames () const
 
const std::vector< G4MaterialPropertyVector * > & GetProperties () const
 
const std::vector< std::pair< G4double, G4bool > > & GetConstProperties () const
 

Detailed Description

Definition at line 61 of file G4MaterialPropertiesTable.hh.

Constructor & Destructor Documentation

◆ G4MaterialPropertiesTable()

G4MaterialPropertiesTable::G4MaterialPropertiesTable ( )

Definition at line 65 of file G4MaterialPropertiesTable.cc.

66{
67 // elements of these 2 vectors must be in same order as
68 // the corresponding enums in G4MaterialPropertiesIndex.hh
69 fMatPropNames.emplace_back("RINDEX");
70 fMatPropNames.emplace_back("REFLECTIVITY");
71 fMatPropNames.emplace_back("REALRINDEX");
72 fMatPropNames.emplace_back("IMAGINARYRINDEX");
73 fMatPropNames.emplace_back("EFFICIENCY");
74 fMatPropNames.emplace_back("TRANSMITTANCE");
75 fMatPropNames.emplace_back("SPECULARLOBECONSTANT");
76 fMatPropNames.emplace_back("SPECULARSPIKECONSTANT");
77 fMatPropNames.emplace_back("BACKSCATTERCONSTANT");
78 fMatPropNames.emplace_back("GROUPVEL");
79 fMatPropNames.emplace_back("MIEHG");
80 fMatPropNames.emplace_back("RAYLEIGH");
81 fMatPropNames.emplace_back("WLSCOMPONENT");
82 fMatPropNames.emplace_back("WLSABSLENGTH");
83 fMatPropNames.emplace_back("WLSCOMPONENT2");
84 fMatPropNames.emplace_back("WLSABSLENGTH2");
85 fMatPropNames.emplace_back("ABSLENGTH");
86 fMatPropNames.emplace_back("PROTONSCINTILLATIONYIELD");
87 fMatPropNames.emplace_back("DEUTERONSCINTILLATIONYIELD");
88 fMatPropNames.emplace_back("TRITONSCINTILLATIONYIELD");
89 fMatPropNames.emplace_back("ALPHASCINTILLATIONYIELD");
90 fMatPropNames.emplace_back("IONSCINTILLATIONYIELD");
91 fMatPropNames.emplace_back("ELECTRONSCINTILLATIONYIELD");
92 fMatPropNames.emplace_back("SCINTILLATIONCOMPONENT1");
93 fMatPropNames.emplace_back("SCINTILLATIONCOMPONENT2");
94 fMatPropNames.emplace_back("SCINTILLATIONCOMPONENT3");
95 fMatPropNames.emplace_back("COATEDRINDEX");
96
97 assert(fMatPropNames.size() == kNumberOfPropertyIndex);
98
99 fMP.assign(kNumberOfPropertyIndex, nullptr);
100
101 fMatConstPropNames.emplace_back("SURFACEROUGHNESS");
102 fMatConstPropNames.emplace_back("ISOTHERMAL_COMPRESSIBILITY");
103 fMatConstPropNames.emplace_back("RS_SCALE_FACTOR");
104 fMatConstPropNames.emplace_back("WLSMEANNUMBERPHOTONS");
105 fMatConstPropNames.emplace_back("WLSTIMECONSTANT");
106 fMatConstPropNames.emplace_back("WLSMEANNUMBERPHOTONS2");
107 fMatConstPropNames.emplace_back("WLSTIMECONSTANT2");
108 fMatConstPropNames.emplace_back("MIEHG_FORWARD");
109 fMatConstPropNames.emplace_back("MIEHG_BACKWARD");
110 fMatConstPropNames.emplace_back("MIEHG_FORWARD_RATIO");
111 fMatConstPropNames.emplace_back("SCINTILLATIONYIELD");
112 fMatConstPropNames.emplace_back("RESOLUTIONSCALE");
113 fMatConstPropNames.emplace_back("FERMIPOT");
114 fMatConstPropNames.emplace_back("DIFFUSION");
115 fMatConstPropNames.emplace_back("SPINFLIP");
116 fMatConstPropNames.emplace_back("LOSS");
117 fMatConstPropNames.emplace_back("LOSSCS");
118 fMatConstPropNames.emplace_back("ABSCS");
119 fMatConstPropNames.emplace_back("SCATCS");
120 fMatConstPropNames.emplace_back("MR_NBTHETA");
121 fMatConstPropNames.emplace_back("MR_NBE");
122 fMatConstPropNames.emplace_back("MR_RRMS");
123 fMatConstPropNames.emplace_back("MR_CORRLEN");
124 fMatConstPropNames.emplace_back("MR_THETAMIN");
125 fMatConstPropNames.emplace_back("MR_THETAMAX");
126 fMatConstPropNames.emplace_back("MR_EMIN");
127 fMatConstPropNames.emplace_back("MR_EMAX");
128 fMatConstPropNames.emplace_back("MR_ANGNOTHETA");
129 fMatConstPropNames.emplace_back("MR_ANGNOPHI");
130 fMatConstPropNames.emplace_back("MR_ANGCUT");
131 fMatConstPropNames.emplace_back("SCINTILLATIONTIMECONSTANT1");
132 fMatConstPropNames.emplace_back("SCINTILLATIONTIMECONSTANT2");
133 fMatConstPropNames.emplace_back("SCINTILLATIONTIMECONSTANT3");
134 fMatConstPropNames.emplace_back("SCINTILLATIONRISETIME1");
135 fMatConstPropNames.emplace_back("SCINTILLATIONRISETIME2");
136 fMatConstPropNames.emplace_back("SCINTILLATIONRISETIME3");
137 fMatConstPropNames.emplace_back("SCINTILLATIONYIELD1");
138 fMatConstPropNames.emplace_back("SCINTILLATIONYIELD2");
139 fMatConstPropNames.emplace_back("SCINTILLATIONYIELD3");
140 fMatConstPropNames.emplace_back("PROTONSCINTILLATIONYIELD1");
141 fMatConstPropNames.emplace_back("PROTONSCINTILLATIONYIELD2");
142 fMatConstPropNames.emplace_back("PROTONSCINTILLATIONYIELD3");
143 fMatConstPropNames.emplace_back("DEUTERONSCINTILLATIONYIELD1");
144 fMatConstPropNames.emplace_back("DEUTERONSCINTILLATIONYIELD2");
145 fMatConstPropNames.emplace_back("DEUTERONSCINTILLATIONYIELD3");
146 fMatConstPropNames.emplace_back("TRITONSCINTILLATIONYIELD1");
147 fMatConstPropNames.emplace_back("TRITONSCINTILLATIONYIELD2");
148 fMatConstPropNames.emplace_back("TRITONSCINTILLATIONYIELD3");
149 fMatConstPropNames.emplace_back("ALPHASCINTILLATIONYIELD1");
150 fMatConstPropNames.emplace_back("ALPHASCINTILLATIONYIELD2");
151 fMatConstPropNames.emplace_back("ALPHASCINTILLATIONYIELD3");
152 fMatConstPropNames.emplace_back("IONSCINTILLATIONYIELD1");
153 fMatConstPropNames.emplace_back("IONSCINTILLATIONYIELD2");
154 fMatConstPropNames.emplace_back("IONSCINTILLATIONYIELD3");
155 fMatConstPropNames.emplace_back("ELECTRONSCINTILLATIONYIELD1");
156 fMatConstPropNames.emplace_back("ELECTRONSCINTILLATIONYIELD2");
157 fMatConstPropNames.emplace_back("ELECTRONSCINTILLATIONYIELD3");
158 fMatConstPropNames.emplace_back("COATEDTHICKNESS");
159 fMatConstPropNames.emplace_back("COATEDFRUSTRATEDTRANSMISSION");
160
161 assert(fMatConstPropNames.size() == kNumberOfConstPropertyIndex);
162
163 fMCP.assign(kNumberOfConstPropertyIndex, { 0., false });
164}
@ kNumberOfPropertyIndex
@ kNumberOfConstPropertyIndex

◆ ~G4MaterialPropertiesTable()

G4MaterialPropertiesTable::~G4MaterialPropertiesTable ( )
virtual

Definition at line 166 of file G4MaterialPropertiesTable.cc.

167{
168 for(auto prop : fMP)
169 {
170 delete(prop);
171 }
172}

Member Function Documentation

◆ AddConstProperty() [1/2]

void G4MaterialPropertiesTable::AddConstProperty ( const char *  key,
G4double  propertyValue,
G4bool  createNewKey = false 
)

Definition at line 487 of file G4MaterialPropertiesTable.cc.

490{
491 // Provides a way of adding a constant property to the Material Properties
492 // Table given a key
493 AddConstProperty(G4String(key), propertyValue, createNewKey);
494}
void AddConstProperty(const G4String &key, G4double propertyValue, G4bool createNewKey=false)

◆ AddConstProperty() [2/2]

void G4MaterialPropertiesTable::AddConstProperty ( const G4String key,
G4double  propertyValue,
G4bool  createNewKey = false 
)

Definition at line 458 of file G4MaterialPropertiesTable.cc.

461{
462 // Provides a way of adding a constant property to the Material Properties
463 // Table given a key
464 if(std::find(fMatConstPropNames.cbegin(), fMatConstPropNames.cend(), key) ==
465 fMatConstPropNames.cend())
466 {
467 if(createNewKey)
468 {
469 fMatConstPropNames.push_back(key);
470 fMCP.emplace_back(0., true);
471 }
472 else
473 {
475 ed << "Attempting to create a new material constant property key " << key
476 << " without setting"
477 << " createNewKey parameter of AddProperty to true.";
478 G4Exception("G4MaterialPropertiesTable::AddProperty()", "mat207",
479 FatalException, ed);
480 }
481 }
482 G4int index = GetConstPropertyIndex(key);
483
484 fMCP[index] = std::pair<G4double, G4bool>{ propertyValue, true };
485}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
int G4int
Definition: G4Types.hh:85
G4int GetConstPropertyIndex(const G4String &key) const

Referenced by AddConstProperty(), G4GDMLReadMaterials::PropertyRead(), G4GDMLReadSolids::PropertyRead(), and G4UCNMaterialPropertiesTable::SetMicroRoughnessParameters().

◆ AddEntry() [1/2]

void G4MaterialPropertiesTable::AddEntry ( const char *  key,
G4double  aPhotonEnergy,
G4double  aPropertyValue 
)

Definition at line 565 of file G4MaterialPropertiesTable.cc.

568{
569 AddEntry(G4String(key), aPhotonEnergy, aPropertyValue);
570}
void AddEntry(const G4String &key, G4double aPhotonEnergy, G4double aPropertyValue)

◆ AddEntry() [2/2]

void G4MaterialPropertiesTable::AddEntry ( const G4String key,
G4double  aPhotonEnergy,
G4double  aPropertyValue 
)

Definition at line 522 of file G4MaterialPropertiesTable.cc.

525{
526 // Allows to add an entry pair directly to the Material Property Vector
527 // given a key.
528 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) ==
529 fMatPropNames.cend())
530 {
531 G4Exception("G4MaterialPropertiesTable::AddEntry()", "mat214",
532 FatalException, "Material Property Vector not found.");
533 }
534 G4int index = GetPropertyIndex(key);
535
536 G4MaterialPropertyVector* targetVector = fMP[index];
537 if(targetVector != nullptr)
538 {
539 // do not allow duplicate energies
540 for (std::size_t i = 0; i < targetVector->GetVectorLength(); ++i)
541 {
542 if(aPhotonEnergy == targetVector->Energy(i))
543 {
545 ed << "Energy values in material property vector must be unique. "
546 << "Key: " << key;
547 G4Exception("G4MaterialPropertiesTable::AddEntry()", "mat217",
548 FatalException, ed);
549 }
550 }
551
552 targetVector->InsertValues(aPhotonEnergy, aPropertyValue);
553 }
554 else
555 {
556 G4Exception("G4MaterialPropertiesTable::AddEntry()", "mat208",
557 FatalException, "Material Property Vector not found.");
558 }
559 if(key == "RINDEX")
560 {
561 CalculateGROUPVEL();
562 }
563}
G4int GetPropertyIndex(const G4String &key) const
void InsertValues(const G4double energy, const G4double value)
G4double Energy(const std::size_t index) const
std::size_t GetVectorLength() const

Referenced by AddEntry().

◆ AddProperty() [1/5]

G4MaterialPropertyVector * G4MaterialPropertiesTable::AddProperty ( const char *  key,
G4double photonEnergies,
G4double propertyValues,
G4int  numEntries,
G4bool  createNewKey = false,
G4bool  spline = false 
)

Definition at line 375 of file G4MaterialPropertiesTable.cc.

378{
379
380 // Provides a way of adding a property to the Material Properties
381 // Table given a pair of arrays and a key
382 G4String k(key);
383
384 std::vector<G4double> energies(photonEnergies, photonEnergies + numEntries);
385 std::vector<G4double> values(propertyValues, propertyValues + numEntries);
386 return AddProperty(k, energies, values, createNewKey, spline);
387}
G4MaterialPropertyVector * AddProperty(const G4String &key, const std::vector< G4double > &photonEnergies, const std::vector< G4double > &propertyValues, G4bool createNewKey=false, G4bool spline=false)

◆ AddProperty() [2/5]

void G4MaterialPropertiesTable::AddProperty ( const char *  key,
G4MaterialPropertyVector opv,
G4bool  createNewKey = false 
)

Definition at line 442 of file G4MaterialPropertiesTable.cc.

445{
446 AddProperty(G4String(key), mpv, createNewKey);
447}

◆ AddProperty() [3/5]

void G4MaterialPropertiesTable::AddProperty ( const G4String key,
const G4String mat 
)

Definition at line 449 of file G4MaterialPropertiesTable.cc.

451{
452 // load a material property vector defined in Geant4 source
455 AddProperty(key, v);
456}
G4MaterialPropertyVector * GetProperty(const G4String &key, const G4String &mat)

◆ AddProperty() [4/5]

G4MaterialPropertyVector * G4MaterialPropertiesTable::AddProperty ( const G4String key,
const std::vector< G4double > &  photonEnergies,
const std::vector< G4double > &  propertyValues,
G4bool  createNewKey = false,
G4bool  spline = false 
)

Definition at line 309 of file G4MaterialPropertiesTable.cc.

313{
314 if(photonEnergies.size() != propertyValues.size())
315 {
317 ed << "AddProperty error!";
318 G4Exception("G4MaterialPropertiesTable::AddProperty()", "mat204",
319 FatalException, ed);
320 }
321
322 // G4PhysicsVector assumes energies are in increasing order
323 for (std::size_t i = 0; i < photonEnergies.size() - 1; ++i)
324 {
325 if(photonEnergies.at(i+1) < photonEnergies.at(i))
326 {
328 ed << "Energies in material property table must be in increasing "
329 << "order. Key: " << key << " Energy: " << photonEnergies.at(i+1);
330 G4Exception("G4MaterialPropertiesTable::AddProperty()", "mat215",
331 FatalException, ed);
332 }
333 }
334
335 // if the key doesn't exist, add it if requested
336 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) ==
337 fMatPropNames.cend())
338 {
339 if(createNewKey)
340 {
341 fMatPropNames.push_back(key);
342 fMP.push_back(nullptr);
343 }
344 else
345 {
347 ed << "Attempting to create a new material property key " << key
348 << " without setting\n"
349 << "createNewKey parameter of AddProperty to true.";
350 G4Exception("G4MaterialPropertiesTable::AddProperty()", "mat205",
351 FatalException, ed);
352 }
353 }
354
355 auto* mpv =
356 new G4MaterialPropertyVector(photonEnergies, propertyValues, spline);
357 mpv->SetVerboseLevel(1);
358 if(spline)
359 {
360 mpv->FillSecondDerivatives();
361 }
362 G4int index = GetPropertyIndex(key);
363 fMP[index] = mpv;
364
365 // if key is RINDEX, we calculate GROUPVEL -
366 // contribution from Tao Lin (IHEP, the JUNO experiment)
367 if(key == "RINDEX")
368 {
369 CalculateGROUPVEL();
370 }
371
372 return mpv;
373}
G4PhysicsFreeVector G4MaterialPropertyVector

Referenced by AddProperty(), G4GDMLReadMaterials::PropertyRead(), and G4GDMLReadSolids::PropertyRead().

◆ AddProperty() [5/5]

void G4MaterialPropertiesTable::AddProperty ( const G4String key,
G4MaterialPropertyVector opv,
G4bool  createNewKey = false 
)

Definition at line 389 of file G4MaterialPropertiesTable.cc.

392{
393 // Provides a way of adding a property to the Material Properties
394 // Table given an G4MaterialPropertyVector Reference and a key
395
396 // G4PhysicsVector assumes energies are in increasing order
397 // An MPV with size==0 or 1 is also ok
398 if (mpv->GetVectorLength() > 1) {
399 for (std::size_t i = 0; i < mpv->GetVectorLength() - 1; ++i)
400 {
401 if(mpv->Energy(i+1) < mpv->Energy(i))
402 {
404 ed << "Energies in material property vector must be in increasing "
405 << "order. Key: " << key << " Energy: " << mpv->Energy(i+1);
406 G4Exception("G4MaterialPropertiesTable::AddProperty()", "mat216",
407 FatalException, ed);
408 }
409 }
410 }
411
412 // if the key doesn't exist, add it
413 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) ==
414 fMatPropNames.cend())
415 {
416 if(createNewKey)
417 {
418 fMatPropNames.push_back(key);
419 fMP.push_back(nullptr);
420 }
421 else
422 {
424 ed << "Attempting to create a new material property key " << key
425 << " without setting\n"
426 << "createNewKey parameter of AddProperty to true.";
427 G4Exception("G4MaterialPropertiesTable::AddProperty()", "mat206",
428 FatalException, ed);
429 }
430 }
431 G4int index = GetPropertyIndex(key);
432 fMP[index] = mpv;
433
434 // if key is RINDEX, we calculate GROUPVEL -
435 // contribution from Tao Lin (IHEP, the JUNO experiment)
436 if(key == "RINDEX")
437 {
438 CalculateGROUPVEL();
439 }
440}

◆ ConstPropertyExists() [1/3]

G4bool G4MaterialPropertiesTable::ConstPropertyExists ( const char *  key) const

Definition at line 260 of file G4MaterialPropertiesTable.cc.

261{
262 std::size_t index = std::distance(
263 fMatConstPropNames.cbegin(),
264 std::find(fMatConstPropNames.cbegin(), fMatConstPropNames.cend(), key));
265 if(index < fMatConstPropNames.size())
266 { // index is type std::size_t so >= 0
267 return ConstPropertyExists((G4int)index);
268 }
269 return false;
270}
G4bool ConstPropertyExists(const G4String &key) const

◆ ConstPropertyExists() [2/3]

G4bool G4MaterialPropertiesTable::ConstPropertyExists ( const G4int  index) const

Definition at line 240 of file G4MaterialPropertiesTable.cc.

241{
242 // Returns true if a const property corresponding to 'index' exists
243
244 return index >= 0 && index < (G4int) fMCP.size() && fMCP[index].second;
245}

◆ ConstPropertyExists() [3/3]

G4bool G4MaterialPropertiesTable::ConstPropertyExists ( const G4String key) const

Definition at line 247 of file G4MaterialPropertiesTable.cc.

248{
249 // Returns true if a const property 'key' exists
250 std::size_t index = std::distance(
251 fMatConstPropNames.cbegin(),
252 std::find(fMatConstPropNames.cbegin(), fMatConstPropNames.cend(), key));
253 if(index < fMatConstPropNames.size())
254 { // index is type std::size_t so >= 0
255 return ConstPropertyExists((G4int)index);
256 }
257 return false;
258}

Referenced by ConstPropertyExists(), G4Scintillation::GetScintillationYieldByParticleType(), G4UCNMaterialPropertiesTable::InitMicroRoughnessTables(), G4Scintillation::PostStepDoIt(), G4OpBoundaryProcess::PostStepDoIt(), G4OpWLS::PostStepDoIt(), G4OpWLS2::PostStepDoIt(), and G4UCNMaterialPropertiesTable::SetMicroRoughnessParameters().

◆ DumpTable()

void G4MaterialPropertiesTable::DumpTable ( ) const

Definition at line 572 of file G4MaterialPropertiesTable.cc.

573{
574 // material properties
575 G4int j = 0;
576 for(const auto& prop : fMP)
577 {
578 if(prop != nullptr)
579 {
580 G4cout << j << ": " << fMatPropNames[j] << G4endl;
581 prop->DumpValues();
582 }
583 ++j;
584 }
585 // material constant properties
586 j = 0;
587 for(const auto& cprop : fMCP)
588 {
589 if(cprop.second)
590 {
591 G4cout << j << ": " << fMatConstPropNames[j] << " " << cprop.first
592 << G4endl;
593 }
594 ++j;
595 }
596}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

◆ GetConstProperties()

const std::vector< std::pair< G4double, G4bool > > & G4MaterialPropertiesTable::GetConstProperties ( ) const
inline

Definition at line 159 of file G4MaterialPropertiesTable.hh.

161 {
162 return fMCP;
163 }

Referenced by G4GDMLWriteMaterials::PropertyWrite(), and G4GDMLWriteSolids::PropertyWrite().

◆ GetConstProperty() [1/3]

G4double G4MaterialPropertiesTable::GetConstProperty ( const char *  key) const

Definition at line 235 of file G4MaterialPropertiesTable.cc.

236{
238}
G4double GetConstProperty(const G4String &key) const

◆ GetConstProperty() [2/3]

G4double G4MaterialPropertiesTable::GetConstProperty ( const G4int  index) const

Definition at line 211 of file G4MaterialPropertiesTable.cc.

212{
213 // Returns the constant material property corresponding to an index
214 // fatal exception if property not found
215
216 if(index < (G4int) fMCP.size() && fMCP[index].second)
217 {
218 return fMCP[index].first;
219 }
221 ed << "Constant Material Property Index " << index << " not found.";
222 G4Exception("G4MaterialPropertiesTable::GetConstProperty()", "mat202",
223 FatalException, ed);
224 return 0.;
225}

◆ GetConstProperty() [3/3]

◆ GetConstPropertyIndex()

G4int G4MaterialPropertiesTable::GetConstPropertyIndex ( const G4String key) const

Definition at line 174 of file G4MaterialPropertiesTable.cc.

176{
177 // Returns the constant material property index corresponding to a key
178
179 std::size_t index = std::distance(
180 fMatConstPropNames.cbegin(),
181 std::find(fMatConstPropNames.cbegin(), fMatConstPropNames.cend(), key));
182 if(index < fMatConstPropNames.size())
183 {
184 return (G4int)index;
185 }
186
188 ed << "Constant Material Property Index for key " << key << " not found.";
189 G4Exception("G4MaterialPropertiesTable::GetConstPropertyIndex()", "mat200",
190 FatalException, ed);
191 return 0;
192}

Referenced by AddConstProperty(), GetConstProperty(), and RemoveConstProperty().

◆ GetMaterialConstPropertyNames()

const std::vector< G4String > & G4MaterialPropertiesTable::GetMaterialConstPropertyNames ( ) const
inline

Definition at line 151 of file G4MaterialPropertiesTable.hh.

152 {
153 return fMatConstPropNames;
154 }

Referenced by G4GDMLWriteMaterials::PropertyWrite(), and G4GDMLWriteSolids::PropertyWrite().

◆ GetMaterialPropertyNames()

const std::vector< G4String > & G4MaterialPropertiesTable::GetMaterialPropertyNames ( ) const
inline

Definition at line 147 of file G4MaterialPropertiesTable.hh.

148 {
149 return fMatPropNames;
150 }

Referenced by G4GDMLWriteMaterials::PropertyWrite(), and G4GDMLWriteSolids::PropertyWrite().

◆ GetProperties()

const std::vector< G4MaterialPropertyVector * > & G4MaterialPropertiesTable::GetProperties ( ) const
inline

Definition at line 155 of file G4MaterialPropertiesTable.hh.

156 {
157 return fMP;
158 }

Referenced by G4GDMLWriteMaterials::PropertyWrite(), and G4GDMLWriteSolids::PropertyWrite().

◆ GetProperty() [1/3]

◆ GetProperty() [2/3]

G4MaterialPropertyVector * G4MaterialPropertiesTable::GetProperty ( const G4int  index) const

Definition at line 297 of file G4MaterialPropertiesTable.cc.

299{
300 // Returns a Material Property Vector corresponding to an index
301 // returns nullptr if the property has not been defined by user
302 if(index >= 0 && index < (G4int) fMP.size())
303 {
304 return fMP[index];
305 }
306 return nullptr;
307}

◆ GetProperty() [3/3]

G4MaterialPropertyVector * G4MaterialPropertiesTable::GetProperty ( const G4String key) const

Definition at line 272 of file G4MaterialPropertiesTable.cc.

274{
275 // Returns a Material Property Vector corresponding to a key
276 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) !=
277 fMatPropNames.cend())
278 {
279 const G4int index = GetPropertyIndex(G4String(key));
280 return GetProperty(index);
281 }
282 return nullptr;
283}

◆ GetPropertyIndex()

G4int G4MaterialPropertiesTable::GetPropertyIndex ( const G4String key) const

Definition at line 194 of file G4MaterialPropertiesTable.cc.

195{
196 // Returns the material property index corresponding to a key
197 std::size_t index =
198 std::distance(fMatPropNames.cbegin(),
199 std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key));
200 if(index < fMatPropNames.size())
201 {
202 return (G4int)index;
203 }
205 ed << "Material Property Index for key " << key << " not found.";
206 G4Exception("G4MaterialPropertiesTable::GetPropertyIndex()", "mat201",
207 FatalException, ed);
208 return 0;
209}

Referenced by AddEntry(), AddProperty(), GetProperty(), and RemoveProperty().

◆ RemoveConstProperty() [1/2]

void G4MaterialPropertiesTable::RemoveConstProperty ( const char *  key)

Definition at line 505 of file G4MaterialPropertiesTable.cc.

506{
508}
void RemoveConstProperty(const G4String &key)

◆ RemoveConstProperty() [2/2]

void G4MaterialPropertiesTable::RemoveConstProperty ( const G4String key)

Definition at line 496 of file G4MaterialPropertiesTable.cc.

497{
498 G4int index = GetConstPropertyIndex(key);
499 if(index < (G4int) fMCP.size())
500 {
501 fMCP[index] = std::pair<G4double, G4bool>{ 0., false };
502 }
503}

Referenced by RemoveConstProperty(), and G4UCNMaterialPropertiesTable::SetMicroRoughnessParameters().

◆ RemoveProperty() [1/2]

void G4MaterialPropertiesTable::RemoveProperty ( const char *  key)

Definition at line 517 of file G4MaterialPropertiesTable.cc.

518{
520}
void RemoveProperty(const G4String &key)

◆ RemoveProperty() [2/2]

void G4MaterialPropertiesTable::RemoveProperty ( const G4String key)

Definition at line 510 of file G4MaterialPropertiesTable.cc.

511{
512 G4int index = GetPropertyIndex(key);
513 delete fMP[index];
514 fMP[index] = nullptr;
515}

Referenced by RemoveProperty().


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