Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DNAMolecularMaterial Class Reference

G4DNAMolecularMaterial builds tables of molecular densities for chosen molecular materials. The class handles homogeneous, composite and derived materials. A material of interest is labeled as molecular if built using the number of atoms rather than the mass fractions. More...

#include <G4DNAMolecularMaterial.hh>

+ Inheritance diagram for G4DNAMolecularMaterial:

Public Member Functions

void Initialize ()
 
void Clear ()
 
virtual G4bool Notify (G4ApplicationState requestedState)
 
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 material.
 
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 for chosen material.
 
const std::vector< ComponentMap > * GetMassFractionTable () const
 
const std::vector< ComponentMap > * GetDensityTable () const
 
G4MolecularConfigurationGetMolecularConfiguration (const G4Material *) const
 
void SetMolecularConfiguration (const G4Material *, G4MolecularConfiguration *)
 Associate a molecular configuration to a G4material.
 
void SetMolecularConfiguration (const G4Material *, const G4String &)
 Associate a molecular configuration to a G4material.
 
void SetMolecularConfiguration (const G4String &materialName, const G4String &molUserIF)
 
G4double GetNumMoleculePerVolumeUnitForMaterial (const G4Material *mat)
 Deprecated.
 
G4double GetNumMolPerVolForComponentInComposite (const G4Material *composite, const G4Material *component, G4double massFraction)
 Deprecated.
 
- Public Member Functions inherited from G4VStateDependent
 G4VStateDependent (G4bool bottom=false)
 
virtual ~G4VStateDependent ()
 
G4bool operator== (const G4VStateDependent &right) const
 
G4bool operator!= (const G4VStateDependent &right) const
 
virtual G4bool Notify (G4ApplicationState requestedState)=0
 

Static Public Member Functions

static G4DNAMolecularMaterialInstance ()
 

Protected Member Functions

 G4DNAMolecularMaterial ()
 
 G4DNAMolecularMaterial (const G4DNAMolecularMaterial &right)
 
G4DNAMolecularMaterialoperator= (const G4DNAMolecularMaterial &)
 
virtual ~G4DNAMolecularMaterial ()
 
void Create ()
 
void InitializeNumMolPerVol ()
 
void InitializeDensity ()
 
void RecordMolecularMaterial (G4Material *parentMaterial, G4Material *molecularMaterial, G4double fraction)
 
void SearchMolecularMaterial (G4Material *parentMaterial, G4Material *material, G4double currentFraction)
 
void AddMaterial (const G4Material *, G4double fraction)
 
void PrintNotAMolecularMaterial (const char *methodName, const G4Material *lookForMaterial) const
 

Protected Attributes

std::vector< ComponentMap > * fpCompFractionTable
 
std::vector< ComponentMap > * fpCompDensityTable
 
std::vector< ComponentMap > * fpCompNumMolPerVolTable
 
std::map< const G4Material *, std::vector< G4double > *, CompareMaterialfAskedDensityTable
 
std::map< const G4Material *, std::vector< G4double > *, CompareMaterialfAskedNumPerVolTable
 
std::map< const G4Material *, bool, CompareMaterialfWarningPrinted
 
std::map< int, G4MolecularConfiguration * > fMaterialToMolecularConf
 
G4bool fIsInitialized
 
size_t fNMaterials
 

Static Protected Attributes

static G4DNAMolecularMaterialfInstance
 

Detailed Description

G4DNAMolecularMaterial builds tables of molecular densities for chosen molecular materials. The class handles homogeneous, composite and derived materials. A material of interest is labeled as molecular if built using the number of atoms rather than the mass fractions.

  • Initialization: G4DNAMolecularMaterial is initialized when G4ApplicationState == G4State_Idle. It should be initialized on the master thread and used in read-only mode during stepping. The singleton is thread-shared.
  • For Developers: Use GetNumMolPerVolTableFor(molecule) in the concrete implementation of G4VEmModel::Initialise or G4VProcess::PreparePhysicsTable at run initialization to retrieve a read-only, thread-safe, table. The table is then built on the master thread at initialization time and shared between all threads and models.
Note
A G4material is labeled as molecular if built using the number of atoms

Definition at line 95 of file G4DNAMolecularMaterial.hh.

Constructor & Destructor Documentation

◆ G4DNAMolecularMaterial() [1/2]

G4DNAMolecularMaterial::G4DNAMolecularMaterial ( )
protected

Definition at line 139 of file G4DNAMolecularMaterial.cc.

Referenced by Instance().

◆ G4DNAMolecularMaterial() [2/2]

G4DNAMolecularMaterial::G4DNAMolecularMaterial ( const G4DNAMolecularMaterial right)
protected

Definition at line 158 of file G4DNAMolecularMaterial.cc.

159 :
161{
162 Create();
163}

◆ ~G4DNAMolecularMaterial()

G4DNAMolecularMaterial::~G4DNAMolecularMaterial ( )
protectedvirtual

Definition at line 177 of file G4DNAMolecularMaterial.cc.

178{
179 Clear();
180}

Member Function Documentation

◆ AddMaterial()

void G4DNAMolecularMaterial::AddMaterial ( const G4Material ,
G4double  fraction 
)
protected

◆ Clear()

void G4DNAMolecularMaterial::Clear ( )

Definition at line 99 of file G4DNAMolecularMaterial.cc.

100{
101 G4AutoLock l2(&aMutex);
102 if (fpCompFractionTable != nullptr){
103 fpCompFractionTable->clear();
104 delete fpCompFractionTable;
105 fpCompFractionTable = nullptr;
106 }
107 if (fpCompDensityTable != nullptr){
108 fpCompDensityTable->clear();
109 delete fpCompDensityTable;
110 fpCompDensityTable = nullptr;
111 }
112 if (fpCompNumMolPerVolTable != nullptr){
115 fpCompNumMolPerVolTable = nullptr;
116 }
117
118 std::map<const G4Material*, std::vector<G4double>*, CompareMaterial>::iterator it;
119
120 for (it = fAskedDensityTable.begin(); it != fAskedDensityTable.end(); ++it){
121 if (it->second != nullptr){
122 delete it->second;
123 it->second = nullptr;
124 }
125 }
126
127 for (it = fAskedNumPerVolTable.begin(); it != fAskedNumPerVolTable.end(); ++it){
128 if (it->second != nullptr){
129 delete it->second;
130 it->second = nullptr;
131 }
132 }
133 l2.unlock();
134}
std::map< const G4Material *, std::vector< G4double > *, CompareMaterial > fAskedDensityTable
std::vector< ComponentMap > * fpCompFractionTable
std::vector< ComponentMap > * fpCompNumMolPerVolTable
std::map< const G4Material *, std::vector< G4double > *, CompareMaterial > fAskedNumPerVolTable
std::vector< ComponentMap > * fpCompDensityTable
Materials can be described as a derivation of existing "parent" materials in order to alter few of th...

Referenced by ~G4DNAMolecularMaterial().

◆ Create()

void G4DNAMolecularMaterial::Create ( )
protected

Definition at line 88 of file G4DNAMolecularMaterial.cc.

Referenced by G4DNAMolecularMaterial(), and operator=().

◆ GetDensityTable()

const std::vector< ComponentMap > * G4DNAMolecularMaterial::GetDensityTable ( ) const
inline

Definition at line 144 of file G4DNAMolecularMaterial.hh.

144 {
145 return fpCompDensityTable;
146 }

◆ GetDensityTableFor()

const std::vector< G4double > * G4DNAMolecularMaterial::GetDensityTableFor ( const G4Material searchedMaterial) const

Retrieve a table of volumetric mass densities (mass per unit volume) in the G4 unit system for chosen material.

Parameters
[in]searchedMaterialThe material which you'd like to retrieve the volumic mass
Precondition
The searchedMaterial used in parameter must be built as a molecular material, using the number of atoms rather than the density fractions.
Returns
Pointer to a table of molecular densities for the searchedMaterial indexed on the (parent) material index.

Definition at line 348 of file G4DNAMolecularMaterial.cc.

350{
351 if (!fpCompDensityTable){
352 if (fIsInitialized){
353 G4ExceptionDescription exceptionDescription;
354 exceptionDescription
355 << "The pointer fpCompDensityTable is not initialized will the "
356 "singleton of G4DNAMolecularMaterial "
357 << "has already been initialized." << G4endl;
358 G4Exception("G4DNAMolecularMaterial::GetDensityTableFor",
359 "G4DNAMolecularMaterial003", FatalException,
360 exceptionDescription);
361 }
362
363 if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_Init){
364 const_cast<G4DNAMolecularMaterial*>(this)->Initialize();
365 }
366 else{
367 G4ExceptionDescription exceptionDescription;
368 exceptionDescription
369 << "The geant4 application is at the wrong state. State must be: "
370 "G4State_Init."
371 << G4endl;
372 G4Exception("G4DNAMolecularMaterial::GetDensityTableFor",
373 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
374 FatalException, exceptionDescription);
375 }
376 }
377
378 auto it_askedDensityTable = fAskedDensityTable.find(lookForMaterial);
379
380 if (it_askedDensityTable != fAskedDensityTable.cend()){
381 return it_askedDensityTable->second;
382 }
383
384 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
385
386 std::vector<G4double>* output = new std::vector<G4double>(materialTable->size());
387
388 ComponentMap::const_iterator it;
389
390 G4bool materialWasNotFound = true;
391
392 for (std::size_t i = 0; i < fNMaterials; ++i){
393 ComponentMap& densityTable = (*fpCompDensityTable)[i];
394
395 it = densityTable.find(lookForMaterial);
396
397 if (it == densityTable.cend()){
398 (*output)[i] = 0.0;
399 }
400 else{
401 materialWasNotFound = false;
402 (*output)[i] = it->second;
403 }
404 }
405
406 if (materialWasNotFound){
407 PrintNotAMolecularMaterial("G4DNAMolecularMaterial::GetDensityTableFor",
408 lookForMaterial);
409 }
410
411 fAskedDensityTable.insert(make_pair(lookForMaterial, output));
412
413 return output;
414}
@ G4State_Init
std::map< const G4Material *, G4double, CompareMaterial > ComponentMap
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
std::vector< G4Material * > G4MaterialTable
bool G4bool
Definition: G4Types.hh:86
#define G4endl
Definition: G4ios.hh:57
G4DNAMolecularMaterial builds tables of molecular densities for chosen molecular materials....
void PrintNotAMolecularMaterial(const char *methodName, const G4Material *lookForMaterial) const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:637
static G4StateManager * GetStateManager()

◆ GetMassFractionTable()

const std::vector< ComponentMap > * G4DNAMolecularMaterial::GetMassFractionTable ( ) const
inline

Definition at line 141 of file G4DNAMolecularMaterial.hh.

141 {
142 return fpCompFractionTable;
143 }

◆ GetMolecularConfiguration()

G4MolecularConfiguration * G4DNAMolecularMaterial::GetMolecularConfiguration ( const G4Material material) const

Definition at line 522 of file G4DNAMolecularMaterial.cc.

524{
525 int material_id = material->GetIndex();
526 auto it = fMaterialToMolecularConf.find(material_id);
527 if(it == fMaterialToMolecularConf.cend()) return nullptr;
528 return it->second;
529}
std::map< int, G4MolecularConfiguration * > fMaterialToMolecularConf
size_t GetIndex() const
Definition: G4Material.hh:258

◆ GetNumMoleculePerVolumeUnitForMaterial()

G4double G4DNAMolecularMaterial::GetNumMoleculePerVolumeUnitForMaterial ( const G4Material mat)

Deprecated.

Deprecated:
Will return a G4 fatal exception. Use instead GetNumMolPerVolTableFor(molecule) at run initialization to retrieve a read-only, thread-safe, table.
Note
A G4material is labeled as molecular if built using the number of atoms.

Definition at line 575 of file G4DNAMolecularMaterial.cc.

577{
578 G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite",
579 "DEPRECATED",
580 FatalException,"Use standard method: GetNumMolPerVolTableFor"
581 " at the run initialization to retrieve a read-only table used"
582 " during stepping. The method is thread-safe.");
583 return 0.;
584}

◆ GetNumMolPerVolForComponentInComposite()

G4double G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite ( const G4Material composite,
const G4Material component,
G4double  massFraction 
)

Deprecated.

Deprecated:
Will return a G4 fatal exception. Use instead GetNumMolPerVolTableFor(molecule) at run initialization to retrieve a read-only, thread-safe, table.
Note
A G4material is labeled as molecular if built using the number of atoms.

Definition at line 589 of file G4DNAMolecularMaterial.cc.

593{
594 G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite",
595 "DEPRECATED",
596 FatalException,"Use standard method: GetNumMolPerVolTableFor"
597 " at the run initialization to retrieve a read-only table used"
598 " during stepping. The method is thread-safe.");
599 return 0.;
600}

◆ GetNumMolPerVolTableFor()

const std::vector< G4double > * G4DNAMolecularMaterial::GetNumMolPerVolTableFor ( const G4Material searchedMaterial) const

Retrieve a table of molecular densities (number of molecules per unit volume) in the G4 unit system for chosen material.

Parameters
[in]searchedMaterialThe material which you'd like to retrieve the molecular density
Precondition
The searchedMaterial used in parameter must be built as a molecular material, using the number of atoms rather than the density fractions.
Returns
Pointer to a table of molecular densities for the searchedMaterial indexed on the (parent) material index.

Definition at line 418 of file G4DNAMolecularMaterial.cc.

420{
421 if(lookForMaterial==nullptr) return nullptr;
422
424 if (fIsInitialized){
425 G4ExceptionDescription exceptionDescription;
426 exceptionDescription
427 << "The pointer fpCompNumMolPerVolTable is not initialized whereas "
428 "the singleton of G4DNAMolecularMaterial "
429 << "has already been initialized." << G4endl;
430 G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
431 "G4DNAMolecularMaterial005", FatalException,
432 exceptionDescription);
433 }
434
435 if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_Init){
436 const_cast<G4DNAMolecularMaterial*>(this)->Initialize();
437 }
438 else{
439 G4ExceptionDescription exceptionDescription;
440 exceptionDescription
441 << "The geant4 application is at the wrong state. State must be : "
442 "G4State_Init."
443 << G4endl;
444 G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
445 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
446 FatalException, exceptionDescription);
447 }
448 }
449
450 auto it_askedNumMolPerVolTable = fAskedNumPerVolTable.find(lookForMaterial);
451 if (it_askedNumMolPerVolTable != fAskedNumPerVolTable.cend()){
452 return it_askedNumMolPerVolTable->second;
453 }
454
455 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
456
457 std::vector<G4double>* output = new std::vector<G4double>(materialTable->size());
458
459 ComponentMap::const_iterator it;
460
461 G4bool materialWasNotFound = true;
462
463 for (std::size_t i = 0; i < fNMaterials; ++i){
464 ComponentMap& densityTable = (*fpCompNumMolPerVolTable)[i];
465
466 it = densityTable.find(lookForMaterial);
467
468 if (it == densityTable.cend()){
469 (*output)[i] = 0.0;
470 }
471 else{
472 materialWasNotFound = false;
473 (*output)[i] = it->second;
474 }
475 }
476
477 if (materialWasNotFound){
479 "G4DNAMolecularMaterial::GetNumMolPerVolTableFor", lookForMaterial);
480 }
481
482 fAskedNumPerVolTable.insert(make_pair(lookForMaterial, output));
483
484 return output;
485}

Referenced by G4DNASecondOrderReaction::BuildPhysicsTable(), G4DNACPA100ElasticModel::Initialise(), G4DNADingfelderChargeDecreaseModel::Initialise(), G4DNADingfelderChargeIncreaseModel::Initialise(), G4DNAMillerGreenExcitationModel::Initialise(), G4DNARuddIonisationExtendedModel::Initialise(), G4DNARuddIonisationModel::Initialise(), G4DNABornExcitationModel1::Initialise(), G4DNABornExcitationModel2::Initialise(), G4DNACPA100ExcitationModel::Initialise(), G4DNACPA100IonisationModel::Initialise(), G4DNAEmfietzoglouExcitationModel::Initialise(), and G4DNADummyModel::Initialise().

◆ Initialize()

void G4DNAMolecularMaterial::Initialize ( )

Definition at line 184 of file G4DNAMolecularMaterial.cc.

185{
186 if (fIsInitialized){
187 return;
188 }
189
190 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
191
192 fNMaterials = materialTable->size();
193 // This is to prevent segment fault if materials are created later on
194 // Actually this creation should not be done
195
196 G4AutoLock l1(&aMutex);
197 if (fpCompFractionTable == nullptr){
198 fpCompFractionTable = new vector<ComponentMap>(materialTable->size());
199 }
200
201 G4Material* mat(nullptr);
202
203 for (std::size_t i = 0; i < fNMaterials; ++i){
204 mat = materialTable->at(i);
205 SearchMolecularMaterial(mat, mat, 1);
206 }
207
210 l1.unlock();
211
212 fIsInitialized = true;
213}
void SearchMolecularMaterial(G4Material *parentMaterial, G4Material *material, G4double currentFraction)

Referenced by GetDensityTableFor(), GetNumMolPerVolTableFor(), G4DNAChampionElasticModel::Initialise(), G4DNAELSEPAElasticModel::Initialise(), G4DNAIonElasticModel::Initialise(), and Notify().

◆ InitializeDensity()

void G4DNAMolecularMaterial::InitializeDensity ( )
protected

Definition at line 217 of file G4DNAMolecularMaterial.cc.

218{
220 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
221 fpCompDensityTable = new vector<ComponentMap>(
223
224 G4Material* parentMat;
225 const G4Material* compMat(nullptr);
226 G4double massFraction = -1;
227 G4double parentDensity = -1;
228
229 for (std::size_t i = 0; i < fNMaterials; ++i){
230 parentMat = materialTable->at(i);
231 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
232 ComponentMap& densityComp = (*fpCompDensityTable)[i];
233
234 parentDensity = parentMat->GetDensity();
235
236 for (auto it = massFractionComp.cbegin();
237 it != massFractionComp.cend(); ++it){
238 compMat = it->first;
239 massFraction = it->second;
240 densityComp[compMat] = massFraction * parentDensity;
241 compMat = nullptr;
242 massFraction = -1;
243 }
244 }
245 }
246 else{
247 G4ExceptionDescription exceptionDescription;
248 exceptionDescription << "The pointer fpCompFractionTable is not initialized"
249 << G4endl;
250 G4Exception("G4DNAMolecularMaterial::InitializeDensity",
251 "G4DNAMolecularMaterial001", FatalException,
252 exceptionDescription);
253 }
254}
double G4double
Definition: G4Types.hh:83
G4double GetDensity() const
Definition: G4Material.hh:178

Referenced by Initialize().

◆ InitializeNumMolPerVol()

void G4DNAMolecularMaterial::InitializeNumMolPerVol ( )
protected

Definition at line 258 of file G4DNAMolecularMaterial.cc.

259{
261 fpCompNumMolPerVolTable = new vector<ComponentMap>(fNMaterials);
262
263 const G4Material* compMat(nullptr);
264
265 for (std::size_t i = 0; i < fNMaterials; ++i){
266 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
267 ComponentMap& densityComp = (*fpCompDensityTable)[i];
268 ComponentMap& numMolPerVol = (*fpCompNumMolPerVolTable)[i];
269
270 for (auto it = massFractionComp.cbegin();
271 it != massFractionComp.cend(); ++it){
272 compMat = it->first;
273 numMolPerVol[compMat] = densityComp[compMat]
274 / compMat->GetMassOfMolecule();
275 compMat = nullptr;
276 }
277 }
278 }
279 else{
280 G4ExceptionDescription exceptionDescription;
281 exceptionDescription << "The pointer fpCompDensityTable is not initialized"
282 << G4endl;
283 G4Exception("G4DNAMolecularMaterial::InitializeNumMolPerVol",
284 "G4DNAMolecularMaterial002", FatalException,
285 exceptionDescription);
286 }
287}

Referenced by Initialize().

◆ Instance()

G4DNAMolecularMaterial * G4DNAMolecularMaterial::Instance ( )
static

Definition at line 80 of file G4DNAMolecularMaterial.cc.

81{
83 return fInstance;
84}
static G4DNAMolecularMaterial * fInstance

Referenced by G4DNABrownianTransportation::BuildPhysicsTable(), G4DNASecondOrderReaction::BuildPhysicsTable(), G4DNAChampionElasticModel::Initialise(), G4DNACPA100ElasticModel::Initialise(), G4DNADingfelderChargeDecreaseModel::Initialise(), G4DNADingfelderChargeIncreaseModel::Initialise(), G4DNAELSEPAElasticModel::Initialise(), G4DNAMeltonAttachmentModel::Initialise(), G4DNAMillerGreenExcitationModel::Initialise(), G4TDNAOneStepThermalizationModel< MODEL >::Initialise(), G4DNARuddIonisationExtendedModel::Initialise(), G4DNARuddIonisationModel::Initialise(), G4DNASancheExcitationModel::Initialise(), G4DNAScreenedRutherfordElasticModel::Initialise(), G4DNATransformElectronModel::Initialise(), G4DNAUeharaScreenedRutherfordElasticModel::Initialise(), G4DNABornExcitationModel1::Initialise(), G4DNABornExcitationModel2::Initialise(), G4DNABornIonisationModel1::Initialise(), G4DNABornIonisationModel2::Initialise(), G4DNACPA100ExcitationModel::Initialise(), G4DNACPA100IonisationModel::Initialise(), G4DNAEmfietzoglouExcitationModel::Initialise(), G4DNAEmfietzoglouIonisationModel::Initialise(), G4DNADummyModel::Initialise(), and G4DNAIonElasticModel::Initialise().

◆ Notify()

G4bool G4DNAMolecularMaterial::Notify ( G4ApplicationState  requestedState)
virtual

Implements G4VStateDependent.

Definition at line 147 of file G4DNAMolecularMaterial.cc.

148{
149 if (requestedState == G4State_Idle && G4StateManager::GetStateManager()
150 ->GetPreviousState() == G4State_PreInit){
151 Initialize();
152 }
153 return true;
154}
@ G4State_Idle
@ G4State_PreInit

◆ operator=()

G4DNAMolecularMaterial & G4DNAMolecularMaterial::operator= ( const G4DNAMolecularMaterial rhs)
protected

Definition at line 168 of file G4DNAMolecularMaterial.cc.

169{
170 if (this == &rhs) return *this;
171 Create();
172 return *this;
173}

◆ PrintNotAMolecularMaterial()

void G4DNAMolecularMaterial::PrintNotAMolecularMaterial ( const char *  methodName,
const G4Material lookForMaterial 
) const
protected

Definition at line 489 of file G4DNAMolecularMaterial.cc.

492{
493 auto it = fWarningPrinted.find(lookForMaterial);
494
495 if (it == fWarningPrinted.cend()){
496 G4ExceptionDescription exceptionDescription;
497 exceptionDescription << "The material " << lookForMaterial->GetName()
498 << " is not defined as a molecular material."
499 << G4endl
500 << "Meaning: The elements should be added to the "
501 "material using atom count rather than mass fraction "
502 "(cf. G4Material)"
503 << G4endl
504 << "If you want to use DNA processes on liquid water, you should better use "
505 "the NistManager to create the water material."
506 << G4endl
507 << "Since this message is displayed, it means that the DNA models will not "
508 "be called."
509 << "Please note that this message will only appear once even if you are "
510 "using other methods of G4DNAMolecularMaterial."
511 << G4endl;
512
513 G4Exception(methodName, "MATERIAL_NOT_DEFINE_USING_ATOM_COUNT", JustWarning,
514 exceptionDescription);
515 fWarningPrinted[lookForMaterial] = true;
516 }
517}
@ JustWarning
std::map< const G4Material *, bool, CompareMaterial > fWarningPrinted
const G4String & GetName() const
Definition: G4Material.hh:175

Referenced by GetDensityTableFor(), and GetNumMolPerVolTableFor().

◆ RecordMolecularMaterial()

void G4DNAMolecularMaterial::RecordMolecularMaterial ( G4Material parentMaterial,
G4Material molecularMaterial,
G4double  fraction 
)
protected

Definition at line 292 of file G4DNAMolecularMaterial.cc.

295{
296 ComponentMap& matComponent =
297 (*fpCompFractionTable)[parentMaterial->GetIndex()];
298
299 if (matComponent.empty()){
300 matComponent[molecularMaterial] = fraction;
301 return;
302 }
303
304 auto it = matComponent.find(molecularMaterial);
305
306 if (it == matComponent.cend()){
307 matComponent[molecularMaterial] = fraction;
308 }
309 else{
310 matComponent[molecularMaterial] = it->second + fraction;
311 // handle "base material"
312 }
313}

Referenced by SearchMolecularMaterial().

◆ SearchMolecularMaterial()

void G4DNAMolecularMaterial::SearchMolecularMaterial ( G4Material parentMaterial,
G4Material material,
G4double  currentFraction 
)
protected

Definition at line 317 of file G4DNAMolecularMaterial.cc.

320{
321 if (material->GetMassOfMolecule() != 0.0){ // is a molecular material
322 RecordMolecularMaterial(parentMaterial, material, currentFraction);
323 return;
324 }
325
326 G4Material* compMat(nullptr);
327 G4double fraction = -1.;
328 std::map<G4Material*, G4double> matComponent = material->GetMatComponents();
329 auto it = matComponent.cbegin();
330
331 for (; it != matComponent.cend(); ++it){
332 compMat = it->first;
333 fraction = it->second;
334 if (compMat->GetMassOfMolecule() == 0.0){ // is not a molecular material
335 SearchMolecularMaterial(parentMaterial, compMat,
336 currentFraction * fraction);
337 }
338 else{ // is a molecular material
339 RecordMolecularMaterial(parentMaterial, compMat,
340 currentFraction * fraction);
341 }
342 }
343}
void RecordMolecularMaterial(G4Material *parentMaterial, G4Material *molecularMaterial, G4double fraction)
const std::map< G4Material *, G4double > & GetMatComponents() const
Definition: G4Material.hh:235
G4double GetMassOfMolecule() const
Definition: G4Material.hh:239

Referenced by Initialize(), and SearchMolecularMaterial().

◆ SetMolecularConfiguration() [1/3]

void G4DNAMolecularMaterial::SetMolecularConfiguration ( const G4Material material,
const G4String molConf 
)

Associate a molecular configuration to a G4material.

 

Parameters
[in]materialPointer to a G4 material. The material does not need to be defined as a molecular material.
[in]molConfUser ID of the molecular configuration corresponding to the G4 material.

 

Parameters
[in]materialName of the G4 material. The material does not need to be defined as a molecular material.
[in]molConfUser ID of the molecular configuration corresponding to the G4 material.

Definition at line 546 of file G4DNAMolecularMaterial.cc.

548{
549 assert(material != nullptr);
550 int material_id = material->GetIndex();
551 fMaterialToMolecularConf[material_id] =
553}
G4MolecularConfiguration * GetConfiguration(const G4String &, bool mustExist=true)
static G4MoleculeTable * Instance()

◆ SetMolecularConfiguration() [2/3]

void G4DNAMolecularMaterial::SetMolecularConfiguration ( const G4Material material,
G4MolecularConfiguration molConf 
)

Associate a molecular configuration to a G4material.

 

Parameters
[in]materialPointer to a G4 material. The material does not need to be defined as a molecular material.
[in]molConfThe molecular configuration corresponding to the G4 material.

Definition at line 534 of file G4DNAMolecularMaterial.cc.

537{
538 assert(material != nullptr);
539 int material_id = material->GetIndex();
540 fMaterialToMolecularConf[material_id] = molConf;
541}

Referenced by SetMolecularConfiguration().

◆ SetMolecularConfiguration() [3/3]

void G4DNAMolecularMaterial::SetMolecularConfiguration ( const G4String materialName,
const G4String molUserIF 
)

Definition at line 558 of file G4DNAMolecularMaterial.cc.

560{
561 G4Material* material = G4Material::GetMaterial(materialName);
562
563 if(material == nullptr){
564 G4cout<< "Material " << materialName
565 << " was not found and therefore won't be linked to "
566 << molUserID << G4endl;
567 return;
568 }
569 SetMolecularConfiguration(material, molUserID);
570}
G4GLOB_DLL std::ostream G4cout
void SetMolecularConfiguration(const G4Material *, G4MolecularConfiguration *)
Associate a molecular configuration to a G4material.
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:651

Member Data Documentation

◆ fAskedDensityTable

std::map<const G4Material*, std::vector<G4double>*, CompareMaterial> G4DNAMolecularMaterial::fAskedDensityTable
mutableprotected

Definition at line 248 of file G4DNAMolecularMaterial.hh.

Referenced by Clear(), and GetDensityTableFor().

◆ fAskedNumPerVolTable

std::map<const G4Material*, std::vector<G4double>*, CompareMaterial> G4DNAMolecularMaterial::fAskedNumPerVolTable
mutableprotected

Definition at line 250 of file G4DNAMolecularMaterial.hh.

Referenced by Clear(), and GetNumMolPerVolTableFor().

◆ fInstance

G4DNAMolecularMaterial * G4DNAMolecularMaterial::fInstance
staticprotected

Definition at line 222 of file G4DNAMolecularMaterial.hh.

Referenced by Instance().

◆ fIsInitialized

G4bool G4DNAMolecularMaterial::fIsInitialized
protected

◆ fMaterialToMolecularConf

std::map<int , G4MolecularConfiguration*> G4DNAMolecularMaterial::fMaterialToMolecularConf
protected

◆ fNMaterials

size_t G4DNAMolecularMaterial::fNMaterials
protected

◆ fpCompDensityTable

std::vector<ComponentMap>* G4DNAMolecularMaterial::fpCompDensityTable
protected

◆ fpCompFractionTable

std::vector<ComponentMap>* G4DNAMolecularMaterial::fpCompFractionTable
protected

◆ fpCompNumMolPerVolTable

std::vector<ComponentMap>* G4DNAMolecularMaterial::fpCompNumMolPerVolTable
protected

◆ fWarningPrinted

std::map<const G4Material*, bool, CompareMaterial> G4DNAMolecularMaterial::fWarningPrinted
mutableprotected

Definition at line 251 of file G4DNAMolecularMaterial.hh.

Referenced by PrintNotAMolecularMaterial().


The documentation for this class was generated from the following files: