Geant4 11.2.2
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

 G4DNAMolecularMaterial (const G4DNAMolecularMaterial &right)=delete
 
G4DNAMolecularMaterialoperator= (const G4DNAMolecularMaterial &)=delete
 
void Initialize ()
 
void Clear ()
 
G4bool Notify (G4ApplicationState requestedState) override
 
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
 

Static Public Member Functions

static G4DNAMolecularMaterialInstance ()
 

Protected Member Functions

 G4DNAMolecularMaterial ()
 
 ~G4DNAMolecularMaterial () override
 
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 *, G4bool, CompareMaterialfWarningPrinted
 
std::map< G4int, G4MolecularConfiguration * > fMaterialToMolecularConf
 
G4bool fIsInitialized
 
std::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 ( const G4DNAMolecularMaterial & right)
delete

◆ G4DNAMolecularMaterial() [2/2]

G4DNAMolecularMaterial::G4DNAMolecularMaterial ( )
protected

Definition at line 139 of file G4DNAMolecularMaterial.cc.

140{
141 Create();
142}

Referenced by Instance().

◆ ~G4DNAMolecularMaterial()

G4DNAMolecularMaterial::~G4DNAMolecularMaterial ( )
overrideprotected

Definition at line 157 of file G4DNAMolecularMaterial.cc.

158{
159 Clear();
160}

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.

89{
90 fpCompFractionTable = nullptr;
91 fpCompDensityTable = nullptr;
93 fIsInitialized = false;
94 fNMaterials = 0;
95}

Referenced by G4DNAMolecularMaterial().

◆ GetDensityTable()

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

Definition at line 147 of file G4DNAMolecularMaterial.hh.

147 {
148 return fpCompDensityTable;
149 }

◆ 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 326 of file G4DNAMolecularMaterial.cc.

328{
329 if (fpCompDensityTable == nullptr){
330 if (fIsInitialized){
331 G4ExceptionDescription exceptionDescription;
332 exceptionDescription
333 << "The pointer fpCompDensityTable is not initialized will the "
334 "singleton of G4DNAMolecularMaterial "
335 << "has already been initialized." << G4endl;
336 G4Exception("G4DNAMolecularMaterial::GetDensityTableFor",
337 "G4DNAMolecularMaterial003", FatalException,
338 exceptionDescription);
339 }
340
341 if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_Init){
342 const_cast<G4DNAMolecularMaterial*>(this)->Initialize();
343 }
344 else{
345 G4ExceptionDescription exceptionDescription;
346 exceptionDescription
347 << "The geant4 application is at the wrong state. State must be: "
348 "G4State_Init."
349 << G4endl;
350 G4Exception("G4DNAMolecularMaterial::GetDensityTableFor",
351 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
352 FatalException, exceptionDescription);
353 }
354 }
355
356 auto it_askedDensityTable = fAskedDensityTable.find(lookForMaterial);
357
358 if (it_askedDensityTable != fAskedDensityTable.cend()){
359 return it_askedDensityTable->second;
360 }
361
362 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
363
364 auto output = new std::vector<G4double>(materialTable->size());
365
366 ComponentMap::const_iterator it;
367
368 G4bool materialWasNotFound = true;
369
370 for (std::size_t i = 0; i < fNMaterials; ++i){
371 ComponentMap& densityTable = (*fpCompDensityTable)[i];
372
373 it = densityTable.find(lookForMaterial);
374
375 if (it == densityTable.cend()){
376 (*output)[i] = 0.0;
377 }
378 else{
379 materialWasNotFound = false;
380 (*output)[i] = it->second;
381 }
382 }
383
384 if (materialWasNotFound){
385 PrintNotAMolecularMaterial("G4DNAMolecularMaterial::GetDensityTableFor",
386 lookForMaterial);
387 }
388
389 fAskedDensityTable.insert(make_pair(lookForMaterial, output));
390
391 return output;
392}
@ G4State_Init
std::map< const G4Material *, G4double, CompareMaterial > ComponentMap
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4Material * > G4MaterialTable
bool G4bool
Definition G4Types.hh:86
#define G4endl
Definition G4ios.hh:67
G4DNAMolecularMaterial builds tables of molecular densities for chosen molecular materials....
void PrintNotAMolecularMaterial(const char *methodName, const G4Material *lookForMaterial) const
static G4MaterialTable * GetMaterialTable()
static G4StateManager * GetStateManager()

◆ GetMassFractionTable()

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

Definition at line 144 of file G4DNAMolecularMaterial.hh.

144 {
145 return fpCompFractionTable;
146 }

◆ GetMolecularConfiguration()

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

Definition at line 500 of file G4DNAMolecularMaterial.cc.

502{
503 auto material_id = (G4int)material->GetIndex();
504 auto it = fMaterialToMolecularConf.find(material_id);
505 if(it == fMaterialToMolecularConf.cend()) return nullptr;
506 return it->second;
507}
int G4int
Definition G4Types.hh:85
std::map< G4int, G4MolecularConfiguration * > fMaterialToMolecularConf
std::size_t GetIndex() const

◆ 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 553 of file G4DNAMolecularMaterial.cc.

555{
556 G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite",
557 "DEPRECATED",
558 FatalException,"Use standard method: GetNumMolPerVolTableFor"
559 " at the run initialization to retrieve a read-only table used"
560 " during stepping. The method is thread-safe.");
561 return 0.;
562}

◆ 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 567 of file G4DNAMolecularMaterial.cc.

571{
572 G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolForComponentInComposite",
573 "DEPRECATED",
574 FatalException,"Use standard method: GetNumMolPerVolTableFor"
575 " at the run initialization to retrieve a read-only table used"
576 " during stepping. The method is thread-safe.");
577 return 0.;
578}

◆ 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 396 of file G4DNAMolecularMaterial.cc.

398{
399 if(lookForMaterial==nullptr) return nullptr;
400
401 if (fpCompNumMolPerVolTable == nullptr){
402 if (fIsInitialized){
403 G4ExceptionDescription exceptionDescription;
404 exceptionDescription
405 << "The pointer fpCompNumMolPerVolTable is not initialized whereas "
406 "the singleton of G4DNAMolecularMaterial "
407 << "has already been initialized." << G4endl;
408 G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
409 "G4DNAMolecularMaterial005", FatalException,
410 exceptionDescription);
411 }
412
413 if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_Init){
414 const_cast<G4DNAMolecularMaterial*>(this)->Initialize();
415 }
416 else{
417 G4ExceptionDescription exceptionDescription;
418 exceptionDescription
419 << "The geant4 application is at the wrong state. State must be : "
420 "G4State_Init."
421 << G4endl;
422 G4Exception("G4DNAMolecularMaterial::GetNumMolPerVolTableFor",
423 "G4DNAMolecularMaterial_WRONG_STATE_APPLICATION",
424 FatalException, exceptionDescription);
425 }
426 }
427
428 auto it_askedNumMolPerVolTable = fAskedNumPerVolTable.find(lookForMaterial);
429 if (it_askedNumMolPerVolTable != fAskedNumPerVolTable.cend()){
430 return it_askedNumMolPerVolTable->second;
431 }
432
433 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
434
435 auto output = new std::vector<G4double>(materialTable->size());
436
437 ComponentMap::const_iterator it;
438
439 G4bool materialWasNotFound = true;
440
441 for (std::size_t i = 0; i < fNMaterials; ++i){
442 ComponentMap& densityTable = (*fpCompNumMolPerVolTable)[i];
443
444 it = densityTable.find(lookForMaterial);
445
446 if (it == densityTable.cend()){
447 (*output)[i] = 0.0;
448 }
449 else{
450 materialWasNotFound = false;
451 (*output)[i] = it->second;
452 }
453 }
454
455 if (materialWasNotFound){
457 "G4DNAMolecularMaterial::GetNumMolPerVolTableFor", lookForMaterial);
458 }
459
460 fAskedNumPerVolTable.insert(make_pair(lookForMaterial, output));
461
462 return output;
463}

Referenced by G4DNASecondOrderReaction::BuildPhysicsTable(), G4DNACPA100ElasticModel::CrossSectionPerVolume(), G4DNACPA100ExcitationModel::CrossSectionPerVolume(), G4DNACPA100IonisationModel::CrossSectionPerVolume(), G4DNAPTBElasticModel::CrossSectionPerVolume(), G4DNAPTBExcitationModel::CrossSectionPerVolume(), G4DNAPTBIonisationModel::CrossSectionPerVolume(), G4DNABornExcitationModel1::Initialise(), G4DNABornExcitationModel2::Initialise(), G4DNADingfelderChargeDecreaseModel::Initialise(), G4DNADingfelderChargeIncreaseModel::Initialise(), G4DNAEmfietzoglouExcitationModel::Initialise(), G4DNAMillerGreenExcitationModel::Initialise(), G4DNARelativisticIonisationModel::Initialise(), G4DNARPWBAExcitationModel::Initialise(), G4DNARPWBAIonisationModel::Initialise(), G4DNARuddIonisationExtendedModel::Initialise(), and G4DNARuddIonisationModel::Initialise().

◆ Initialize()

void G4DNAMolecularMaterial::Initialize ( )

Definition at line 164 of file G4DNAMolecularMaterial.cc.

165{
166 if (fIsInitialized){
167 return;
168 }
169
170 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
171
172 fNMaterials = materialTable->size();
173 // This is to prevent segment fault if materials are created later on
174 // Actually this creation should not be done
175
176 G4AutoLock l1(&aMutex);
177 if (fpCompFractionTable == nullptr){
178 fpCompFractionTable = new vector<ComponentMap>(materialTable->size());
179 }
180
181 G4Material* mat(nullptr);
182
183 for (std::size_t i = 0; i < fNMaterials; ++i){
184 mat = materialTable->at(i);
185 SearchMolecularMaterial(mat, mat, 1);
186 }
187
190 l1.unlock();
191
192 fIsInitialized = true;
193}
void SearchMolecularMaterial(G4Material *parentMaterial, G4Material *material, G4double currentFraction)

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

◆ InitializeDensity()

void G4DNAMolecularMaterial::InitializeDensity ( )
protected

Definition at line 197 of file G4DNAMolecularMaterial.cc.

198{
199 if (fpCompFractionTable != nullptr){
200 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
201 fpCompDensityTable = new vector<ComponentMap>(
203
204 G4Material* parentMat;
205 const G4Material* compMat(nullptr);
206 G4double massFraction = -1;
207 G4double parentDensity = -1;
208
209 for (std::size_t i = 0; i < fNMaterials; ++i){
210 parentMat = materialTable->at(i);
211 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
212 ComponentMap& densityComp = (*fpCompDensityTable)[i];
213
214 parentDensity = parentMat->GetDensity();
215
216 for (const auto& it : massFractionComp){
217 compMat = it.first;
218 massFraction = it.second;
219 densityComp[compMat] = massFraction * parentDensity;
220 compMat = nullptr;
221 massFraction = -1;
222 }
223 }
224 }
225 else{
226 G4ExceptionDescription exceptionDescription;
227 exceptionDescription << "The pointer fpCompFractionTable is not initialized"
228 << G4endl;
229 G4Exception("G4DNAMolecularMaterial::InitializeDensity",
230 "G4DNAMolecularMaterial001", FatalException,
231 exceptionDescription);
232 }
233}
double G4double
Definition G4Types.hh:83
G4double GetDensity() const

Referenced by Initialize().

◆ InitializeNumMolPerVol()

void G4DNAMolecularMaterial::InitializeNumMolPerVol ( )
protected

Definition at line 237 of file G4DNAMolecularMaterial.cc.

238{
239 if (fpCompDensityTable != nullptr){
240 fpCompNumMolPerVolTable = new vector<ComponentMap>(fNMaterials);
241
242 const G4Material* compMat(nullptr);
243
244 for (std::size_t i = 0; i < fNMaterials; ++i){
245 ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
246 ComponentMap& densityComp = (*fpCompDensityTable)[i];
247 ComponentMap& numMolPerVol = (*fpCompNumMolPerVolTable)[i];
248
249 for (auto& it : massFractionComp){
250 compMat = it.first;
251 numMolPerVol[compMat] = densityComp[compMat]
252 / compMat->GetMassOfMolecule();
253 compMat = nullptr;
254 }
255 }
256 }
257 else{
258 G4ExceptionDescription exceptionDescription;
259 exceptionDescription << "The pointer fpCompDensityTable is not initialized"
260 << G4endl;
261 G4Exception("G4DNAMolecularMaterial::InitializeNumMolPerVol",
262 "G4DNAMolecularMaterial002", FatalException,
263 exceptionDescription);
264 }
265}

Referenced by Initialize().

◆ Instance()

G4DNAMolecularMaterial * G4DNAMolecularMaterial::Instance ( )
static

Definition at line 80 of file G4DNAMolecularMaterial.cc.

81{
82 if (fInstance == nullptr) fInstance = new G4DNAMolecularMaterial();
83 return fInstance;
84}
static G4DNAMolecularMaterial * fInstance

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

◆ Notify()

G4bool G4DNAMolecularMaterial::Notify ( G4ApplicationState requestedState)
overridevirtual

Implements G4VStateDependent.

Definition at line 146 of file G4DNAMolecularMaterial.cc.

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

◆ operator=()

G4DNAMolecularMaterial & G4DNAMolecularMaterial::operator= ( const G4DNAMolecularMaterial & )
delete

◆ PrintNotAMolecularMaterial()

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

Definition at line 467 of file G4DNAMolecularMaterial.cc.

470{
471 auto it = fWarningPrinted.find(lookForMaterial);
472
473 if (it == fWarningPrinted.cend()){
474 G4ExceptionDescription exceptionDescription;
475 exceptionDescription << "The material " << lookForMaterial->GetName()
476 << " is not defined as a molecular material."
477 << G4endl
478 << "Meaning: The elements should be added to the "
479 "material using atom count rather than mass fraction "
480 "(cf. G4Material)"
481 << G4endl
482 << "If you want to use DNA processes on liquid water, you should better use "
483 "the NistManager to create the water material."
484 << G4endl
485 << "Since this message is displayed, it means that the DNA models will not "
486 "be called."
487 << "Please note that this message will only appear once even if you are "
488 "using other methods of G4DNAMolecularMaterial."
489 << G4endl;
490
491 G4Exception(methodName, "MATERIAL_NOT_DEFINE_USING_ATOM_COUNT", JustWarning,
492 exceptionDescription);
493 fWarningPrinted[lookForMaterial] = true;
494 }
495}
@ JustWarning
std::map< const G4Material *, G4bool, CompareMaterial > fWarningPrinted
const G4String & GetName() const

Referenced by GetDensityTableFor(), and GetNumMolPerVolTableFor().

◆ RecordMolecularMaterial()

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

Definition at line 270 of file G4DNAMolecularMaterial.cc.

273{
274 ComponentMap& matComponent =
275 (*fpCompFractionTable)[parentMaterial->GetIndex()];
276
277 if (matComponent.empty()){
278 matComponent[molecularMaterial] = fraction;
279 return;
280 }
281
282 auto it = matComponent.find(molecularMaterial);
283
284 if (it == matComponent.cend()){
285 matComponent[molecularMaterial] = fraction;
286 }
287 else{
288 matComponent[molecularMaterial] = it->second + fraction;
289 // handle "base material"
290 }
291}

Referenced by SearchMolecularMaterial().

◆ SearchMolecularMaterial()

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

Definition at line 295 of file G4DNAMolecularMaterial.cc.

298{
299 if (material->GetMassOfMolecule() != 0.0){ // is a molecular material
300 RecordMolecularMaterial(parentMaterial, material, currentFraction);
301 return;
302 }
303
304 G4Material* compMat(nullptr);
305 G4double fraction = -1.;
306 std::map<G4Material*, G4double> matComponent = material->GetMatComponents();
307 auto it = matComponent.cbegin();
308
309 for (; it != matComponent.cend(); ++it){
310 compMat = it->first;
311 fraction = it->second;
312 if (compMat->GetMassOfMolecule() == 0.0){ // is not a molecular material
313 SearchMolecularMaterial(parentMaterial, compMat,
314 currentFraction * fraction);
315 }
316 else{ // is a molecular material
317 RecordMolecularMaterial(parentMaterial, compMat,
318 currentFraction * fraction);
319 }
320 }
321}
void RecordMolecularMaterial(G4Material *parentMaterial, G4Material *molecularMaterial, G4double fraction)
const std::map< G4Material *, G4double > & GetMatComponents() const
G4double GetMassOfMolecule() const

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 524 of file G4DNAMolecularMaterial.cc.

526{
527 assert(material != nullptr);
528 auto material_id = (G4int)material->GetIndex();
529 fMaterialToMolecularConf[material_id] =
531}
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 512 of file G4DNAMolecularMaterial.cc.

515{
516 assert(material != nullptr);
517 auto material_id = (G4int)material->GetIndex();
518 fMaterialToMolecularConf[material_id] = molConf;
519}

Referenced by SetMolecularConfiguration().

◆ SetMolecularConfiguration() [3/3]

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

Definition at line 536 of file G4DNAMolecularMaterial.cc.

538{
539 G4Material* material = G4Material::GetMaterial(materialName);
540
541 if(material == nullptr){
542 G4cout<< "Material " << materialName
543 << " was not found and therefore won't be linked to "
544 << molUserID << G4endl;
545 return;
546 }
547 SetMolecularConfiguration(material, molUserID);
548}
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)

Member Data Documentation

◆ fAskedDensityTable

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

Definition at line 249 of file G4DNAMolecularMaterial.hh.

Referenced by Clear(), and GetDensityTableFor().

◆ fAskedNumPerVolTable

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

Definition at line 251 of file G4DNAMolecularMaterial.hh.

Referenced by Clear(), and GetNumMolPerVolTableFor().

◆ fInstance

G4DNAMolecularMaterial * G4DNAMolecularMaterial::fInstance
staticprotected

Definition at line 225 of file G4DNAMolecularMaterial.hh.

Referenced by Instance().

◆ fIsInitialized

G4bool G4DNAMolecularMaterial::fIsInitialized
protected

◆ fMaterialToMolecularConf

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

◆ fNMaterials

std::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*, G4bool, CompareMaterial> G4DNAMolecularMaterial::fWarningPrinted
mutableprotected

Definition at line 252 of file G4DNAMolecularMaterial.hh.

Referenced by PrintNotAMolecularMaterial().


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