38 if(mat1==0 && mat2==0)
return false;
39 if(mat1==0)
return true;
40 if(mat2==0)
return false;
45 if((baseMat1 || baseMat2) == 0)
49 else if(baseMat1 && baseMat2)
51 return baseMat1 < baseMat2;
54 else if(baseMat1 && (baseMat2 == 0))
56 return baseMat1 < mat2;
59 return mat1 < baseMat2;
78 fpCompFractionTable = 0;
79 fpCompDensityTable = 0;
80 fpCompNumMolPerVolTable = 0;
81 fIsInitialized =
false;
104 if(
this == &rhs)
return *
this;
130 std::map<const G4Material*,std::vector<double>*,
CompareMaterial>::iterator it;
155 if(matComponent.empty())
157 matComponent[molecularMaterial] = fraction;
161 ComponentMap::iterator it = matComponent.find(molecularMaterial);
163 if(it == matComponent.end())
165 matComponent[molecularMaterial] = fraction;
169 matComponent[molecularMaterial] = it->second + fraction;
184 std::map<G4Material*,G4double>::iterator it = matComponent.begin();
186 for( ; it!=matComponent.end() ; it++)
189 fraction = it->second;
213 double massFraction = -1;
214 double parentDensity = -1;
216 for(
int i = 0 ; i <
int(materialTable->size()) ; i++)
218 parentMat = materialTable->at(i);
219 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
222 parentDensity = parentMat->GetDensity();
224 for(ComponentMap::iterator it = massFractionComp.begin() ; it!=massFractionComp.end() ; it++)
227 massFraction = it->second;
228 densityComp[compMat] = massFraction*parentDensity;
237 exceptionDescription <<
"The pointer fpCompFractionTable is not initialized" <<
G4endl;
238 G4Exception(
"G4DNAMolecularMaterial::InitializeDensity",
"G4DNAMolecularMaterial001",
252 for(
int i = 0 ; i <
int(materialTable->size()) ; i++)
254 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
256 ComponentMap& numMolPerVol = (*fpCompNumMolPerVolTable)[i];
258 for(ComponentMap::iterator it = massFractionComp.begin() ; it!=massFractionComp.end() ; it++)
261 numMolPerVol[compMat] = densityComp[compMat]/ compMat->GetMassOfMolecule();
269 exceptionDescription <<
"The pointer fpCompDensityTable is not initialized" <<
G4endl;
270 G4Exception(
"G4DNAMolecularMaterial::InitializeNumMolPerVol",
"G4DNAMolecularMaterial002",
288 for(
int i = 0 ; i <
int(materialTable->size()) ; i++)
290 mat = materialTable->at(i);
309 exceptionDescription <<
"The pointer fpCompDensityTable is not initialized will the singleton of G4DNAMolecularMaterial "
310 <<
"has already been initialized."<<
G4endl;
311 G4Exception(
"G4DNAMolecularMaterial::GetDensityTableFor",
"G4DNAMolecularMaterial003",
320 exceptionDescription <<
"The geant4 application is at the wrong state. State must be: G4State_Idle."<<
G4endl;
321 G4Exception(
"G4DNAMolecularMaterial::GetDensityTableFor",
322 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
FatalException,exceptionDescription);
329 return it_askedDensityTable->second;
334 std::vector<double>* output =
new std::vector<double>(materialTable->size());
336 ComponentMap::const_iterator it;
338 G4bool materialWasNotFound =
true;
340 for(
int i = 0 ; i <
int(materialTable->size()) ; i++)
344 it = densityTable.find(lookForMaterial);
346 if(it==densityTable.end())
352 materialWasNotFound =
false;
353 (*output)[i] = it->second;
357 if(materialWasNotFound)
374 exceptionDescription <<
"The pointer fpCompNumMolPerVolTable is not initialized will the singleton of G4DNAMolecularMaterial "
375 <<
"has already been initialized."<<
G4endl;
376 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
"G4DNAMolecularMaterial005",
387 exceptionDescription <<
"The geant4 application is at the wrong state. State must be : G4State_Idle."<<
G4endl;
388 G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
389 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
FatalException,exceptionDescription);
396 return it_askedNumMolPerVolTable->second;
401 std::vector<double>* output =
new std::vector<double>(materialTable->size());
403 ComponentMap::const_iterator it;
405 G4bool materialWasNotFound =
true;
407 for(
int i = 0 ; i <
int(materialTable->size()) ; i++)
409 ComponentMap& densityTable = (*fpCompNumMolPerVolTable)[i];
411 it = densityTable.find(lookForMaterial);
413 if(it==densityTable.end())
419 materialWasNotFound =
false;
420 (*output)[i] = it->second;
424 if(materialWasNotFound)
436 std::map<const G4Material*,bool,CompareMaterial>::iterator it =
fWarningPrinted.find(lookForMaterial);
442 <<
"The material " << lookForMaterial->
GetName()
443 <<
" is not defined as a molecular material."<<
G4endl
444 <<
"Meaning: The elements should be added to the material using atom count rather than mass fraction (cf. G4Material)"
446 <<
"If you want to use DNA processes on liquid water, you should better use the NistManager to create the water material."
448 <<
"Since this message is displayed, it means that the DNA models will not be called."
449 <<
"Please note that this message will only appear once even if you are using other methods of G4DNAMolecularMaterial."