54 if (mat1 ==
nullptr && mat2 ==
nullptr)
return false;
55 if (mat1 ==
nullptr)
return true;
56 if (mat2 ==
nullptr)
return false;
61 if (((baseMat1 !=
nullptr) || (baseMat2 !=
nullptr)) ==
false){
65 else if ((baseMat1 !=
nullptr) && (baseMat2 !=
nullptr)){
67 return baseMat1 < baseMat2;
70 else if ((baseMat1 !=
nullptr) && (baseMat2 ==
nullptr)){
72 return baseMat1 < mat2;
75 return mat1 < baseMat2;
118 std::map<const G4Material*, std::vector<G4double>*,
CompareMaterial>::iterator it;
121 if (it->second !=
nullptr){
123 it->second =
nullptr;
128 if (it->second !=
nullptr){
130 it->second =
nullptr;
170 if (
this == &rhs)
return *
this;
204 mat = materialTable->at(i);
230 parentMat = materialTable->at(i);
231 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
236 for (
auto it = massFractionComp.cbegin();
237 it != massFractionComp.cend(); ++it){
239 massFraction = it->second;
240 densityComp[compMat] = massFraction * parentDensity;
248 exceptionDescription <<
"The pointer fpCompFractionTable is not initialized"
250 G4Exception(
"G4DNAMolecularMaterial::InitializeDensity",
252 exceptionDescription);
266 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
268 ComponentMap& numMolPerVol = (*fpCompNumMolPerVolTable)[i];
270 for (
auto it = massFractionComp.cbegin();
271 it != massFractionComp.cend(); ++it){
273 numMolPerVol[compMat] = densityComp[compMat]
281 exceptionDescription <<
"The pointer fpCompDensityTable is not initialized"
283 G4Exception(
"G4DNAMolecularMaterial::InitializeNumMolPerVol",
285 exceptionDescription);
297 (*fpCompFractionTable)[parentMaterial->
GetIndex()];
299 if (matComponent.empty()){
300 matComponent[molecularMaterial] = fraction;
304 auto it = matComponent.find(molecularMaterial);
306 if (it == matComponent.cend()){
307 matComponent[molecularMaterial] = fraction;
310 matComponent[molecularMaterial] = it->second + fraction;
328 std::map<G4Material*, G4double> matComponent = material->
GetMatComponents();
329 auto it = matComponent.cbegin();
331 for (; it != matComponent.cend(); ++it){
333 fraction = it->second;
336 currentFraction * fraction);
340 currentFraction * fraction);
347const std::vector<G4double>*
355 <<
"The pointer fpCompDensityTable is not initialized will the "
356 "singleton of G4DNAMolecularMaterial "
357 <<
"has already been initialized." <<
G4endl;
358 G4Exception(
"G4DNAMolecularMaterial::GetDensityTableFor",
360 exceptionDescription);
369 <<
"The geant4 application is at the wrong state. State must be: "
372 G4Exception(
"G4DNAMolecularMaterial::GetDensityTableFor",
373 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
381 return it_askedDensityTable->second;
386 std::vector<G4double>* output =
new std::vector<G4double>(materialTable->size());
388 ComponentMap::const_iterator it;
390 G4bool materialWasNotFound =
true;
395 it = densityTable.find(lookForMaterial);
397 if (it == densityTable.cend()){
401 materialWasNotFound =
false;
402 (*output)[i] = it->second;
406 if (materialWasNotFound){
421 if(lookForMaterial==
nullptr)
return nullptr;
427 <<
"The pointer fpCompNumMolPerVolTable is not initialized whereas "
428 "the singleton of G4DNAMolecularMaterial "
429 <<
"has already been initialized." <<
G4endl;
430 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
432 exceptionDescription);
441 <<
"The geant4 application is at the wrong state. State must be : "
444 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
445 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
452 return it_askedNumMolPerVolTable->second;
457 std::vector<G4double>* output =
new std::vector<G4double>(materialTable->size());
459 ComponentMap::const_iterator it;
461 G4bool materialWasNotFound =
true;
464 ComponentMap& densityTable = (*fpCompNumMolPerVolTable)[i];
466 it = densityTable.find(lookForMaterial);
468 if (it == densityTable.cend()){
472 materialWasNotFound =
false;
473 (*output)[i] = it->second;
477 if (materialWasNotFound){
479 "G4DNAMolecularMaterial::GetNumMolPerVolTableFor", lookForMaterial);
497 exceptionDescription <<
"The material " << lookForMaterial->
GetName()
498 <<
" is not defined as a molecular material."
500 <<
"Meaning: The elements should be added to the "
501 "material using atom count rather than mass fraction "
504 <<
"If you want to use DNA processes on liquid water, you should better use "
505 "the NistManager to create the water material."
507 <<
"Since this message is displayed, it means that the DNA models will not "
509 <<
"Please note that this message will only appear once even if you are "
510 "using other methods of G4DNAMolecularMaterial."
514 exceptionDescription);
538 assert(material !=
nullptr);
549 assert(material !=
nullptr);
563 if(material ==
nullptr){
564 G4cout<<
"Material " << materialName
565 <<
" was not found and therefore won't be linked to "
578 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite",
581 " at the run initialization to retrieve a read-only table used"
582 " during stepping. The method is thread-safe.");
594 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite",
597 " at the run initialization to retrieve a read-only table used"
598 " during stepping. The method is thread-safe.");
std::map< const G4Material *, G4double, CompareMaterial > ComponentMap
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4Material * > G4MaterialTable
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
G4DNAMolecularMaterial builds tables of molecular densities for chosen molecular materials....
void SetMolecularConfiguration(const G4Material *, G4MolecularConfiguration *)
Associate a molecular configuration to a G4material.
std::map< const G4Material *, std::vector< G4double > *, CompareMaterial > fAskedDensityTable
void RecordMolecularMaterial(G4Material *parentMaterial, G4Material *molecularMaterial, G4double fraction)
G4MolecularConfiguration * GetMolecularConfiguration(const G4Material *) const
std::map< const G4Material *, G4bool, CompareMaterial > fWarningPrinted
void PrintNotAMolecularMaterial(const char *methodName, const G4Material *lookForMaterial) const
void InitializeNumMolPerVol()
std::map< G4int, G4MolecularConfiguration * > fMaterialToMolecularConf
const std::vector< G4double > * GetNumMolPerVolTableFor(const G4Material *) const
Retrieve a table of molecular densities (number of molecules per unit volume) in the G4 unit system f...
virtual G4bool Notify(G4ApplicationState requestedState)
G4double GetNumMoleculePerVolumeUnitForMaterial(const G4Material *mat)
Deprecated.
std::vector< ComponentMap > * fpCompFractionTable
std::vector< ComponentMap > * fpCompNumMolPerVolTable
static G4DNAMolecularMaterial * Instance()
virtual ~G4DNAMolecularMaterial()
G4double GetNumMolPerVolForComponentInComposite(const G4Material *composite, const G4Material *component, G4double massFraction)
Deprecated.
const std::vector< G4double > * GetDensityTableFor(const G4Material *) const
Retrieve a table of volumetric mass densities (mass per unit volume) in the G4 unit system for chosen...
static G4DNAMolecularMaterial * fInstance
void SearchMolecularMaterial(G4Material *parentMaterial, G4Material *material, G4double currentFraction)
std::map< const G4Material *, std::vector< G4double > *, CompareMaterial > fAskedNumPerVolTable
G4DNAMolecularMaterial & operator=(const G4DNAMolecularMaterial &)
std::vector< ComponentMap > * fpCompDensityTable
G4double GetDensity() const
const std::map< G4Material *, G4double > & GetMatComponents() const
const G4Material * GetBaseMaterial() const
G4double GetMassOfMolecule() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
G4MolecularConfiguration * GetConfiguration(const G4String &, bool mustExist=true)
static G4MoleculeTable * Instance()
static G4StateManager * GetStateManager()
Materials can be described as a derivation of existing "parent" materials in order to alter few of th...
bool operator()(const G4Material *mat1, const G4Material *mat2) const