45   if (mat1 == 0 && mat2 == 0) 
return false; 
    46   if (mat1 == 0) 
return true; 
    47   if (mat2 == 0) 
return false; 
    52   if ((baseMat1 || baseMat2) == 0) 
    56   else if (baseMat1 && baseMat2) 
    58     return baseMat1 < baseMat2;
    61   else if (baseMat1 && (baseMat2 == 0)) 
    63     return baseMat1 < mat2;
    66   return mat1 < baseMat2;
    86   fpCompFractionTable = 0;
    87   fpCompDensityTable = 0;
    88   fpCompNumMolPerVolTable = 0;
    89   fIsInitialized = 
false;
    96   if (fpCompFractionTable)
    98     fpCompFractionTable->clear();
    99     delete fpCompFractionTable;
   100     fpCompFractionTable = 0;
   102   if (fpCompDensityTable)
   104     fpCompDensityTable->clear();
   105     delete fpCompDensityTable;
   106     fpCompDensityTable = 0;
   108   if (fpCompNumMolPerVolTable)
   110     fpCompNumMolPerVolTable->clear();
   111     delete fpCompNumMolPerVolTable;
   112     fpCompNumMolPerVolTable = 0;
   115   map<const G4Material*, std::vector<double>*, 
CompareMaterial>::iterator it;
   117   for (it = fAskedDensityTable.begin(); it != fAskedDensityTable.end(); it++)
   126   for (it = fAskedNumPerVolTable.begin(); it != fAskedNumPerVolTable.end();
   171   if (
this == &rhs) 
return *
this;
   207     mat = materialTable->at(i);
   229     double massFraction = -1;
   230     double parentDensity = -1;
   234       parentMat = materialTable->at(i);
   235       ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
   238       parentDensity = parentMat->GetDensity();
   240       for (ComponentMap::iterator it = massFractionComp.begin();
   241           it != massFractionComp.end(); it++)
   244         massFraction = it->second;
   245         densityComp[compMat] = massFraction * parentDensity;
   254     exceptionDescription << 
"The pointer fpCompFractionTable is not initialized"   256     G4Exception(
"G4DNAMolecularMaterial::InitializeDensity",
   258                 exceptionDescription);
   272       ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
   274       ComponentMap& numMolPerVol = (*fpCompNumMolPerVolTable)[i];
   276       for (ComponentMap::iterator it = massFractionComp.begin();
   277           it != massFractionComp.end(); it++)
   280         numMolPerVol[compMat] = densityComp[compMat]
   281             / compMat->GetMassOfMolecule();
   289     exceptionDescription << 
"The pointer fpCompDensityTable is not initialized"   291     G4Exception(
"G4DNAMolecularMaterial::InitializeNumMolPerVol",
   293                 exceptionDescription);
   302       (*fpCompFractionTable)[parentMaterial->
GetIndex()];
   304   if (matComponent.empty())
   306     matComponent[molecularMaterial] = fraction;
   310   ComponentMap::iterator it = matComponent.find(molecularMaterial);
   312   if (it == matComponent.end())
   314     matComponent[molecularMaterial] = fraction;
   318     matComponent[molecularMaterial] = it->second + fraction;
   324                                                      double currentFraction)
   334   std::map<G4Material*, G4double> matComponent = material->
GetMatComponents();
   335   std::map<G4Material*, G4double>::iterator it = matComponent.begin();
   337   for (; it != matComponent.end(); it++)
   340     fraction = it->second;
   344                               currentFraction * fraction);
   349                               currentFraction * fraction);
   357 const std::vector<double>*
   367           << 
"The pointer fpCompDensityTable is not initialized will the "   368           "singleton of G4DNAMolecularMaterial "   369           << 
"has already been initialized." << 
G4endl;
   370       G4Exception(
"G4DNAMolecularMaterial::GetDensityTableFor",
   372                   exceptionDescription);
   383           << 
"The geant4 application is at the wrong state. State must be: "   386       G4Exception(
"G4DNAMolecularMaterial::GetDensityTableFor",
   387                   "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
   393     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;
   413     it = densityTable.find(lookForMaterial);
   415     if (it == densityTable.end())
   421       materialWasNotFound = 
false;
   422       (*output)[i] = it->second;
   426   if (materialWasNotFound)
   446           << 
"The pointer fpCompNumMolPerVolTable is not initialized whereas "   447           "the singleton of G4DNAMolecularMaterial "   448           << 
"has already been initialized." << 
G4endl;
   449       G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
   451                   exceptionDescription);
   462           << 
"The geant4 application is at the wrong state. State must be : "   465       G4Exception(
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
   466                   "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
   472       const_iterator it_askedNumMolPerVolTable =
   476     return it_askedNumMolPerVolTable->second;
   481   std::vector<double>* output = 
new std::vector<double>(materialTable->size());
   483   ComponentMap::const_iterator it;
   485   G4bool materialWasNotFound = 
true;
   489     ComponentMap& densityTable = (*fpCompNumMolPerVolTable)[i];
   491     it = densityTable.find(lookForMaterial);
   493     if (it == densityTable.end())
   499       materialWasNotFound = 
false;
   500       (*output)[i] = it->second;
   504   if (materialWasNotFound)
   507         "G4DNAMolecularMaterial::GetNumMolPerVolTableFor", lookForMaterial);
   519   std::map<const G4Material*, bool, CompareMaterial>::iterator it =
   525     exceptionDescription << 
"The material " << lookForMaterial->
GetName()
   526                          << 
" is not defined as a molecular material."   528                          << 
"Meaning: The elements should be added to the "   529                          "material using atom count rather than mass fraction "   532     << 
"If you want to use DNA processes on liquid water, you should better use "   533     "the NistManager to create the water material."   535     << 
"Since this message is displayed, it means that the DNA models will not "   537     << 
"Please note that this message will only appear once even if you are "   538     "using other methods of G4DNAMolecularMaterial."   542                 exceptionDescription);
 std::map< const G4Material *, double, CompareMaterial > ComponentMap
void SearchMolecularMaterial(G4Material *parentMaterial, G4Material *material, double currentFraction)
std::ostringstream G4ExceptionDescription
virtual G4bool Notify(G4ApplicationState requestedState)
std::map< const G4Material *, std::vector< double > *, CompareMaterial > fAskedNumPerVolTable
void RecordMolecularMaterial(G4Material *parentMaterial, G4Material *molecularMaterial, G4double fraction)
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
const std::vector< double > * GetNumMolPerVolTableFor(const G4Material *) const
void InitializeNumMolPerVol()
#define G4MUTEX_INITIALIZER
std::vector< ComponentMap > * fpCompNumMolPerVolTable
std::map< const G4Material *, std::vector< double > *, CompareMaterial > fAskedDensityTable
static G4DNAMolecularMaterial * fInstance
static G4StateManager * GetStateManager()
G4double GetMassOfMolecule() const
G4DNAMolecularMaterial & operator=(const G4DNAMolecularMaterial &)
const std::vector< double > * GetDensityTableFor(const G4Material *) const
std::map< const G4Material *, bool, CompareMaterial > fWarningPrinted
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const std::map< G4Material *, G4double > & GetMatComponents() const
static G4DNAMolecularMaterial * Instance()
std::vector< ComponentMap > * fpCompFractionTable
virtual ~G4DNAMolecularMaterial()
std::vector< ComponentMap > * fpCompDensityTable
void PrintNotAMolecularMaterial(const char *methodName, const G4Material *lookForMaterial) const
const G4String & GetName() const
static void DeleteInstance()
const G4Material * GetBaseMaterial() const
bool operator()(const G4Material *mat1, const G4Material *mat2) const