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");
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");
179 std::size_t index = std::distance(
180 fMatConstPropNames.cbegin(),
181 std::find(fMatConstPropNames.cbegin(), fMatConstPropNames.cend(), key));
182 if(index < fMatConstPropNames.size())
188 ed <<
"Constant Material Property Index for key " << key <<
" not found.";
189 G4Exception(
"G4MaterialPropertiesTable::GetConstPropertyIndex()",
"mat200",
198 std::distance(fMatPropNames.cbegin(),
199 std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key));
200 if(index < fMatPropNames.size())
205 ed <<
"Material Property Index for key " << key <<
" not found.";
206 G4Exception(
"G4MaterialPropertiesTable::GetPropertyIndex()",
"mat201",
216 if(index < (
G4int) fMCP.size() && fMCP[index].second)
218 return fMCP[index].first;
221 ed <<
"Constant Material Property Index " << index <<
" not found.";
222 G4Exception(
"G4MaterialPropertiesTable::GetConstProperty()",
"mat202",
244 return index >= 0 && index < (
G4int) fMCP.size() && fMCP[index].second;
250 std::size_t index = std::distance(
251 fMatConstPropNames.cbegin(),
252 std::find(fMatConstPropNames.cbegin(), fMatConstPropNames.cend(), key));
253 if(index < fMatConstPropNames.size())
262 std::size_t index = std::distance(
263 fMatConstPropNames.cbegin(),
264 std::find(fMatConstPropNames.cbegin(), fMatConstPropNames.cend(), key));
265 if(index < fMatConstPropNames.size())
276 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) !=
277 fMatPropNames.cend())
286 const char* key)
const
288 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) !=
289 fMatPropNames.cend())
298 const G4int index)
const
302 if(index >= 0 && index < (
G4int) fMP.size())
310 const G4String& key,
const std::vector<G4double>& photonEnergies,
311 const std::vector<G4double>& propertyValues,
G4bool createNewKey,
314 if(photonEnergies.size() != propertyValues.size())
317 ed <<
"AddProperty error!";
318 G4Exception(
"G4MaterialPropertiesTable::AddProperty()",
"mat204",
323 for (std::size_t i = 0; i < photonEnergies.size() - 1; ++i)
325 if(photonEnergies.at(i+1) < photonEnergies.at(i))
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",
336 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) ==
337 fMatPropNames.cend())
341 fMatPropNames.push_back(key);
342 fMP.push_back(
nullptr);
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",
357 mpv->SetVerboseLevel(1);
360 mpv->FillSecondDerivatives();
384 std::vector<G4double> energies(photonEnergies, photonEnergies + numEntries);
385 std::vector<G4double> values(propertyValues, propertyValues + numEntries);
386 return AddProperty(k, energies, values, createNewKey, spline);
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",
413 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) ==
414 fMatPropNames.cend())
418 fMatPropNames.push_back(key);
419 fMP.push_back(
nullptr);
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",
464 if(std::find(fMatConstPropNames.cbegin(), fMatConstPropNames.cend(), key) ==
465 fMatConstPropNames.cend())
469 fMatConstPropNames.push_back(key);
470 fMCP.emplace_back(0.,
true);
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",
484 fMCP[index] = std::pair<G4double, G4bool>{ propertyValue,
true };
499 if(index < (
G4int) fMCP.size())
501 fMCP[index] = std::pair<G4double, G4bool>{ 0.,
false };
514 fMP[index] =
nullptr;
528 if(std::find(fMatPropNames.cbegin(), fMatPropNames.cend(), key) ==
529 fMatPropNames.cend())
531 G4Exception(
"G4MaterialPropertiesTable::AddEntry()",
"mat214",
537 if(targetVector !=
nullptr)
542 if(aPhotonEnergy == targetVector->
Energy(i))
545 ed <<
"Energy values in material property vector must be unique. "
547 G4Exception(
"G4MaterialPropertiesTable::AddEntry()",
"mat217",
552 targetVector->
InsertValues(aPhotonEnergy, aPropertyValue);
556 G4Exception(
"G4MaterialPropertiesTable::AddEntry()",
"mat208",
576 for(
const auto& prop : fMP)
587 for(
const auto& cprop : fMCP)
591 G4cout << j <<
": " << fMatConstPropNames[j] <<
" " << cprop.first
600#ifdef G4MULTITHREADED
612 if(rindex ==
nullptr)
625 groupvel->SetVerboseLevel(1);
634 G4Exception(
"G4MaterialPropertiesTable::CalculateGROUPVEL()",
"mat211",
648 G4Exception(
"G4MaterialPropertiesTable::CalculateGROUPVEL()",
"mat212",
655 vg = c_light / (n0 + (n1 - n0) /
G4Log(E1 / E0));
658 if((vg < 0) || (vg > c_light / n0))
663 groupvel->InsertValues(E0, vg);
668 vg = c_light / (0.5 * (n0 + n1) + (n1 - n0) /
G4Log(E1 / E0));
671 if((vg < 0) || (vg > c_light / (0.5 * (n0 + n1))))
673 vg = c_light / (0.5 * (n0 + n1));
675 groupvel->InsertValues(0.5 * (E0 + E1), vg);
685 G4Exception(
"G4MaterialPropertiesTable::CalculateGROUPVEL()",
"mat213",
691 vg = c_light / (n1 + (n1 - n0) /
G4Log(E1 / E0));
694 if((vg < 0) || (vg > c_light / n1))
698 groupvel->InsertValues(E1, vg);
702 groupvel->InsertValues(E0, c_light / n0);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Log(G4double x)
@ kNumberOfConstPropertyIndex
G4PhysicsFreeVector G4MaterialPropertyVector
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
G4int GetConstPropertyIndex(const G4String &key) const
void AddConstProperty(const G4String &key, G4double propertyValue, G4bool createNewKey=false)
G4bool ConstPropertyExists(const G4String &key) const
void RemoveProperty(const G4String &key)
G4int GetPropertyIndex(const G4String &key) const
virtual ~G4MaterialPropertiesTable()
G4double GetConstProperty(const G4String &key) const
void AddEntry(const G4String &key, G4double aPhotonEnergy, G4double aPropertyValue)
G4MaterialPropertyVector * AddProperty(const G4String &key, const std::vector< G4double > &photonEnergies, const std::vector< G4double > &propertyValues, G4bool createNewKey=false, G4bool spline=false)
G4MaterialPropertyVector * GetProperty(const char *key) const
G4MaterialPropertiesTable()
void RemoveConstProperty(const G4String &key)
void InsertValues(const G4double energy, const G4double value)
G4double Energy(const std::size_t index) const
std::size_t GetVectorLength() const
G4MaterialPropertyVector * GetProperty(const G4String &key, const G4String &mat)