49 if (mat1 == 0 && mat2 == 0)
return false;
50 if (mat1 == 0)
return true;
51 if (mat2 == 0)
return false;
56 if ((baseMat1 || baseMat2) == 0){
60 else if (baseMat1 && baseMat2){
62 return baseMat1 < baseMat2;
65 else if (baseMat1 && (baseMat2 == 0)){
67 return baseMat1 < mat2;
70 return mat1 < baseMat2;
95 fpCompFractionTable = 0;
96 fpCompDensityTable = 0;
97 fpCompNumMolPerVolTable = 0;
98 fIsInitialized =
false;
107 if (fpCompFractionTable){
108 fpCompFractionTable->clear();
109 delete fpCompFractionTable;
110 fpCompFractionTable = 0;
112 if (fpCompDensityTable){
113 fpCompDensityTable->clear();
114 delete fpCompDensityTable;
115 fpCompDensityTable = 0;
117 if (fpCompNumMolPerVolTable){
118 fpCompNumMolPerVolTable->clear();
119 delete fpCompNumMolPerVolTable;
120 fpCompNumMolPerVolTable = 0;
125 for (it = fAskedDensityTable.begin(); it != fAskedDensityTable.end(); it++){
132 for (it = fAskedNumPerVolTable.begin(); it != fAskedNumPerVolTable.end();
181 if (
this == &rhs)
return *
this;
218 mat = materialTable->at(i);
241 double massFraction = -1;
242 double parentDensity = -1;
245 parentMat = materialTable->at(i);
246 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
249 parentDensity = parentMat->GetDensity();
251 for (ComponentMap::iterator
it = massFractionComp.begin();
252 it != massFractionComp.end();
it++){
254 massFraction =
it->second;
255 densityComp[compMat] = massFraction * parentDensity;
263 exceptionDescription <<
"The pointer fpCompFractionTable is not initialized"
265 G4Exception(
"G4DNAMolecularMaterial::InitializeDensity",
267 exceptionDescription);
281 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
283 ComponentMap& numMolPerVol = (*fpCompNumMolPerVolTable)[i];
285 for (ComponentMap::iterator
it = massFractionComp.begin();
286 it != massFractionComp.end();
it++){
288 numMolPerVol[compMat] = densityComp[compMat]
289 / compMat->GetMassOfMolecule();
296 exceptionDescription <<
"The pointer fpCompDensityTable is not initialized"
298 G4Exception(
"G4DNAMolecularMaterial::InitializeNumMolPerVol",
300 exceptionDescription);
312 (*fpCompFractionTable)[parentMaterial->
GetIndex()];
314 if (matComponent.empty()){
315 matComponent[molecularMaterial] = fraction;
319 ComponentMap::iterator
it = matComponent.find(molecularMaterial);
321 if (it == matComponent.end()){
322 matComponent[molecularMaterial] = fraction;
325 matComponent[molecularMaterial] = it->second + fraction;
334 double currentFraction)
343 std::map<G4Material*, G4double> matComponent = material->
GetMatComponents();
344 std::map<G4Material*, G4double>::iterator
it = matComponent.begin();
346 for (; it != matComponent.end(); it++){
348 fraction = it->second;
351 currentFraction * fraction);
355 currentFraction * fraction);
362 const std::vector<double>*
370 <<
"The pointer fpCompDensityTable is not initialized will the "
371 "singleton of G4DNAMolecularMaterial "
372 <<
"has already been initialized." <<
G4endl;
373 G4Exception(
"G4DNAMolecularMaterial::GetDensityTableFor",
375 exceptionDescription);
384 <<
"The geant4 application is at the wrong state. State must be: "
387 G4Exception(
"G4DNAMolecularMaterial::GetDensityTableFor",
388 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
394 const_iterator it_askedDensityTable =
398 return it_askedDensityTable->second;
403 std::vector<double>* output =
new std::vector<double>(materialTable->size());
405 ComponentMap::const_iterator
it;
407 G4bool materialWasNotFound =
true;
412 it = densityTable.find(lookForMaterial);
414 if (it == densityTable.end()){
418 materialWasNotFound =
false;
419 (*output)[i] = it->second;
423 if (materialWasNotFound){
438 if(lookForMaterial==0)
return nullptr;
444 <<
"The pointer fpCompNumMolPerVolTable is not initialized whereas "
445 "the singleton of G4DNAMolecularMaterial "
446 <<
"has already been initialized." <<
G4endl;
447 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
449 exceptionDescription);
458 <<
"The geant4 application is at the wrong state. State must be : "
461 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
462 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
468 const_iterator it_askedNumMolPerVolTable =
471 return it_askedNumMolPerVolTable->second;
476 std::vector<double>* output =
new std::vector<double>(materialTable->size());
478 ComponentMap::const_iterator
it;
480 G4bool materialWasNotFound =
true;
483 ComponentMap& densityTable = (*fpCompNumMolPerVolTable)[i];
485 it = densityTable.find(lookForMaterial);
487 if (it == densityTable.end()){
491 materialWasNotFound =
false;
492 (*output)[i] = it->second;
496 if (materialWasNotFound){
498 "G4DNAMolecularMaterial::GetNumMolPerVolTableFor", lookForMaterial);
512 std::map<const G4Material*, bool, CompareMaterial>::iterator
it =
517 exceptionDescription <<
"The material " << lookForMaterial->
GetName()
518 <<
" is not defined as a molecular material."
520 <<
"Meaning: The elements should be added to the "
521 "material using atom count rather than mass fraction "
524 <<
"If you want to use DNA processes on liquid water, you should better use "
525 "the NistManager to create the water material."
527 <<
"Since this message is displayed, it means that the DNA models will not "
529 <<
"Please note that this message will only appear once even if you are "
530 "using other methods of G4DNAMolecularMaterial."
534 exceptionDescription);
545 int material_id = material->
GetIndex();
558 assert(material != 0);
559 int material_id = material->
GetIndex();
569 assert(material != 0);
570 int material_id = material->
GetIndex();
584 G4cout<<
"Material " << materialName
585 <<
" was not found and therefore won't be linked to "
598 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite",
601 " at the run initialization to retrieve a read-only table used"
602 " during stepping. The method is thread-safe.");
614 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite",
617 " at the run initialization to retrieve a read-only table used"
618 " during stepping. The method is thread-safe.");