Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4DNAChemistryManager.cc 97429 2016-06-03 07:16:13Z gcosmo $
|
||||
// $Id: G4DNAChemistryManager.cc 100802 2016-11-02 14:55:27Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara@cenbg.in2p3.fr)
|
||||
//
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "G4DNAWaterIonisationStructure.hh"
|
||||
#include "G4Electron_aq.hh"
|
||||
#include "G4MolecularConfiguration.hh"
|
||||
#include "G4MoleculeCounter.hh"
|
||||
#include "G4VMoleculeCounter.hh"
|
||||
#include "G4VUserChemistryList.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
@@ -203,7 +203,7 @@ void G4DNAChemistryManager::Clear()
|
||||
G4DNAMolecularReactionTable::DeleteInstance();
|
||||
//G4MoleculeHandleManager::DeleteInstance();
|
||||
G4MolecularConfiguration::DeleteManager();
|
||||
G4MoleculeCounter::DeleteInstance();
|
||||
G4VMoleculeCounter::DeleteInstance();
|
||||
}
|
||||
|
||||
void G4DNAChemistryManager::DeleteInstance()
|
||||
@@ -316,7 +316,7 @@ void G4DNAChemistryManager::Run()
|
||||
G4Scheduler::Instance()->Process();
|
||||
if(fResetCounterWhenRunEnds)
|
||||
{
|
||||
G4MoleculeCounter::Instance()->ResetCounter();
|
||||
G4VMoleculeCounter::Instance()->ResetCounter();
|
||||
}
|
||||
CloseFile();
|
||||
}
|
||||
@@ -457,7 +457,7 @@ void G4DNAChemistryManager::InitializeThread()
|
||||
FatalException, description);
|
||||
}
|
||||
|
||||
G4MoleculeCounter::InitializeInstance();
|
||||
G4VMoleculeCounter::InitializeInstance();
|
||||
}
|
||||
|
||||
InitializeFile();
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4DNADamage.cc 85152 2014-10-24 16:07:37Z matkara $
|
||||
//
|
||||
#include "G4DNADamage.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
G4ThreadLocal G4DNADamage* G4DNADamage::fpInstance(0);
|
||||
|
||||
G4DNAIndirectHit::G4DNAIndirectHit(const G4String& baseName,
|
||||
const G4Molecule* molecule,
|
||||
const G4ThreeVector& position,
|
||||
G4double time) :
|
||||
G4VDNAHit(), fpMolecule(molecule)
|
||||
{
|
||||
fBaseName = baseName;
|
||||
fPosition = position;
|
||||
fTime = time;
|
||||
}
|
||||
|
||||
G4DNAIndirectHit::~G4DNAIndirectHit()
|
||||
{
|
||||
if (fpMolecule) delete fpMolecule;
|
||||
fpMolecule = 0;
|
||||
}
|
||||
|
||||
void G4DNAIndirectHit::Print()
|
||||
{
|
||||
G4cout << "Reaction : " << fpMolecule->GetName() << " + " << fBaseName
|
||||
<< " at position : " << G4BestUnit(fPosition, "Length")
|
||||
<< " and time : " << G4BestUnit(fTime, "Time") << G4endl;
|
||||
}
|
||||
|
||||
G4DNADamage* G4DNADamage::Instance()
|
||||
{
|
||||
if (!fpInstance) new G4DNADamage();
|
||||
|
||||
return fpInstance;
|
||||
}
|
||||
|
||||
G4DNADamage::G4DNADamage()
|
||||
{
|
||||
fJustCountDamage = false;
|
||||
fNIndirectDamage = 0;
|
||||
fpInstance = this;
|
||||
}
|
||||
|
||||
G4DNADamage::~G4DNADamage()
|
||||
{
|
||||
for (int i = 0; i < (int) fIndirectHits.size(); i++)
|
||||
{
|
||||
if (fIndirectHits[i]) delete fIndirectHits[i];
|
||||
}
|
||||
fIndirectHits.clear();
|
||||
}
|
||||
|
||||
void G4DNADamage::DeleteInstance()
|
||||
{
|
||||
if (fpInstance) delete fpInstance;
|
||||
fpInstance = 0;
|
||||
}
|
||||
|
||||
void G4DNADamage::Reset()
|
||||
{
|
||||
fNIndirectDamage = 0;
|
||||
for (int i = 0; i < (int) fIndirectHits.size(); i++)
|
||||
{
|
||||
if (fIndirectHits[i]) delete fIndirectHits[i];
|
||||
}
|
||||
fIndirectHits.clear();
|
||||
}
|
||||
|
||||
void G4DNADamage::AddIndirectDamage(const G4String& baseName,
|
||||
const G4Molecule* molecule,
|
||||
const G4ThreeVector& position,
|
||||
G4double time)
|
||||
{
|
||||
if (fJustCountDamage)
|
||||
{
|
||||
fNIndirectDamage++;
|
||||
return;
|
||||
}
|
||||
|
||||
G4DNAIndirectHit* indirectHit = 0;
|
||||
std::map<G4Molecule, const G4Molecule*>::iterator it =
|
||||
fMolMap.find(*molecule);
|
||||
|
||||
if (it == fMolMap.end())
|
||||
{
|
||||
G4Molecule* mol(0);
|
||||
fMolMap[*molecule] = (mol = new G4Molecule(*molecule));
|
||||
indirectHit = new G4DNAIndirectHit(baseName, mol, position, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
indirectHit = new G4DNAIndirectHit(baseName, it->second, position, time);
|
||||
}
|
||||
fIndirectHits.push_back(indirectHit);
|
||||
}
|
||||
@@ -23,7 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4DNAMolecularMaterial.cc 94289 2015-11-11 08:33:40Z gcosmo $
|
||||
// $Id: G4DNAMolecularMaterial.cc 101354 2016-11-15 08:27:51Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros
|
||||
//
|
||||
#include "G4DNAMolecularMaterial.hh"
|
||||
#include "G4Material.hh"
|
||||
@@ -32,13 +34,15 @@
|
||||
#include "G4Threading.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4MoleculeTable.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
G4DNAMolecularMaterial* G4DNAMolecularMaterial::fInstance(0);
|
||||
//G4ThreadLocal G4DNAMolecularMaterial* G4DNAMolecularMaterial::fInstance(0);
|
||||
G4Mutex aMutex = G4MUTEX_INITIALIZER;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
bool CompareMaterial::operator()(const G4Material* mat1,
|
||||
const G4Material* mat2) const
|
||||
{
|
||||
@@ -49,38 +53,43 @@ bool CompareMaterial::operator()(const G4Material* mat1,
|
||||
const G4Material* baseMat1 = mat1->GetBaseMaterial();
|
||||
const G4Material* baseMat2 = mat2->GetBaseMaterial();
|
||||
|
||||
if ((baseMat1 || baseMat2) == 0) // None of the materials derives from a base material
|
||||
{
|
||||
if ((baseMat1 || baseMat2) == 0){
|
||||
// None of the materials derives from a base material
|
||||
return mat1 < mat2;
|
||||
}
|
||||
else if (baseMat1 && baseMat2) // Both materials derive from a base material
|
||||
{
|
||||
else if (baseMat1 && baseMat2){
|
||||
// Both materials derive from a base material
|
||||
return baseMat1 < baseMat2;
|
||||
}
|
||||
|
||||
else if (baseMat1 && (baseMat2 == 0)) // Only the material 1 derives from a base material
|
||||
{
|
||||
else if (baseMat1 && (baseMat2 == 0)){
|
||||
// Only the material 1 derives from a base material
|
||||
return baseMat1 < mat2;
|
||||
}
|
||||
// only case baseMat1==0 && baseMat2 remains
|
||||
return mat1 < baseMat2;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4DNAMolecularMaterial* G4DNAMolecularMaterial::Instance()
|
||||
{
|
||||
if (!fInstance) new G4DNAMolecularMaterial();
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAMolecularMaterial::DeleteInstance()
|
||||
{
|
||||
if (fInstance)
|
||||
{
|
||||
if (fInstance){
|
||||
delete fInstance;
|
||||
fInstance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAMolecularMaterial::Create()
|
||||
{
|
||||
fpCompFractionTable = 0;
|
||||
@@ -91,22 +100,21 @@ void G4DNAMolecularMaterial::Create()
|
||||
fInstance = this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAMolecularMaterial::Clear()
|
||||
{
|
||||
if (fpCompFractionTable)
|
||||
{
|
||||
if (fpCompFractionTable){
|
||||
fpCompFractionTable->clear();
|
||||
delete fpCompFractionTable;
|
||||
fpCompFractionTable = 0;
|
||||
}
|
||||
if (fpCompDensityTable)
|
||||
{
|
||||
if (fpCompDensityTable){
|
||||
fpCompDensityTable->clear();
|
||||
delete fpCompDensityTable;
|
||||
fpCompDensityTable = 0;
|
||||
}
|
||||
if (fpCompNumMolPerVolTable)
|
||||
{
|
||||
if (fpCompNumMolPerVolTable){
|
||||
fpCompNumMolPerVolTable->clear();
|
||||
delete fpCompNumMolPerVolTable;
|
||||
fpCompNumMolPerVolTable = 0;
|
||||
@@ -114,26 +122,24 @@ void G4DNAMolecularMaterial::Clear()
|
||||
|
||||
map<const G4Material*, std::vector<double>*, CompareMaterial>::iterator it;
|
||||
|
||||
for (it = fAskedDensityTable.begin(); it != fAskedDensityTable.end(); it++)
|
||||
{
|
||||
if (it->second)
|
||||
{
|
||||
for (it = fAskedDensityTable.begin(); it != fAskedDensityTable.end(); it++){
|
||||
if (it->second){
|
||||
delete it->second;
|
||||
it->second = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (it = fAskedNumPerVolTable.begin(); it != fAskedNumPerVolTable.end();
|
||||
it++)
|
||||
{
|
||||
if (it->second)
|
||||
{
|
||||
it++){
|
||||
if (it->second){
|
||||
delete it->second;
|
||||
it->second = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4DNAMolecularMaterial::G4DNAMolecularMaterial() :
|
||||
G4VStateDependent()
|
||||
{
|
||||
@@ -141,15 +147,15 @@ G4DNAMolecularMaterial::G4DNAMolecularMaterial() :
|
||||
fInstance = this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4bool G4DNAMolecularMaterial::Notify(G4ApplicationState requestedState)
|
||||
{
|
||||
if (requestedState == G4State_Idle && G4StateManager::GetStateManager()
|
||||
->GetPreviousState() == G4State_PreInit)
|
||||
{
|
||||
->GetPreviousState() == G4State_PreInit){
|
||||
Initialize();
|
||||
}
|
||||
else if (requestedState == G4State_Quit)
|
||||
{
|
||||
else if (requestedState == G4State_Quit){
|
||||
// G4cout << "G4DNAMolecularMaterial::Notify ---> received G4State_Quit"
|
||||
// << G4endl;
|
||||
Clear();
|
||||
@@ -158,6 +164,8 @@ G4bool G4DNAMolecularMaterial::Notify(G4ApplicationState requestedState)
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4DNAMolecularMaterial::G4DNAMolecularMaterial(
|
||||
const G4DNAMolecularMaterial& /*rhs*/) :
|
||||
G4VStateDependent()
|
||||
@@ -165,6 +173,8 @@ G4DNAMolecularMaterial::G4DNAMolecularMaterial(
|
||||
Create();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4DNAMolecularMaterial&
|
||||
G4DNAMolecularMaterial::operator=(const G4DNAMolecularMaterial& rhs)
|
||||
{
|
||||
@@ -173,6 +183,8 @@ G4DNAMolecularMaterial::operator=(const G4DNAMolecularMaterial& rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4DNAMolecularMaterial::~G4DNAMolecularMaterial()
|
||||
{
|
||||
// G4cout << "Deleting G4DNAMolecularMaterial" << G4endl;
|
||||
@@ -181,11 +193,12 @@ G4DNAMolecularMaterial::~G4DNAMolecularMaterial()
|
||||
//assert(G4StateManager::GetStateManager()->DeregisterDependent(this) == true);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAMolecularMaterial::Initialize()
|
||||
{
|
||||
G4AutoLock l(&aMutex);
|
||||
if (fIsInitialized)
|
||||
{
|
||||
if (fIsInitialized){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -195,15 +208,13 @@ void G4DNAMolecularMaterial::Initialize()
|
||||
// This is to prevent segment fault if materials are created later on
|
||||
// Actually this creation should not be done
|
||||
|
||||
if (fpCompFractionTable == 0)
|
||||
{
|
||||
if (fpCompFractionTable == 0){
|
||||
fpCompFractionTable = new vector<ComponentMap>(materialTable->size());
|
||||
}
|
||||
|
||||
G4Material* mat(0);
|
||||
|
||||
for (size_t i = 0; i < fNMaterials; i++)
|
||||
{
|
||||
for (size_t i = 0; i < fNMaterials; i++){
|
||||
mat = materialTable->at(i);
|
||||
SearchMolecularMaterial(mat, mat, 1);
|
||||
|
||||
@@ -216,10 +227,11 @@ void G4DNAMolecularMaterial::Initialize()
|
||||
fIsInitialized = true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAMolecularMaterial::InitializeDensity()
|
||||
{
|
||||
if (fpCompFractionTable)
|
||||
{
|
||||
if (fpCompFractionTable){
|
||||
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
|
||||
fpCompDensityTable = new vector<ComponentMap>(
|
||||
G4Material::GetMaterialTable()->size());
|
||||
@@ -229,8 +241,7 @@ void G4DNAMolecularMaterial::InitializeDensity()
|
||||
double massFraction = -1;
|
||||
double parentDensity = -1;
|
||||
|
||||
for (size_t i = 0; i < fNMaterials; i++)
|
||||
{
|
||||
for (size_t i = 0; i < fNMaterials; i++){
|
||||
parentMat = materialTable->at(i);
|
||||
ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
|
||||
ComponentMap& densityComp = (*fpCompDensityTable)[i];
|
||||
@@ -238,8 +249,7 @@ void G4DNAMolecularMaterial::InitializeDensity()
|
||||
parentDensity = parentMat->GetDensity();
|
||||
|
||||
for (ComponentMap::iterator it = massFractionComp.begin();
|
||||
it != massFractionComp.end(); it++)
|
||||
{
|
||||
it != massFractionComp.end(); it++){
|
||||
compMat = it->first;
|
||||
massFraction = it->second;
|
||||
densityComp[compMat] = massFraction * parentDensity;
|
||||
@@ -248,8 +258,7 @@ void G4DNAMolecularMaterial::InitializeDensity()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription << "The pointer fpCompFractionTable is not initialized"
|
||||
<< G4endl;
|
||||
@@ -259,23 +268,22 @@ void G4DNAMolecularMaterial::InitializeDensity()
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAMolecularMaterial::InitializeNumMolPerVol()
|
||||
{
|
||||
if (fpCompDensityTable)
|
||||
{
|
||||
if (fpCompDensityTable){
|
||||
fpCompNumMolPerVolTable = new vector<ComponentMap>(fNMaterials);
|
||||
|
||||
const G4Material* compMat(0);
|
||||
|
||||
for (size_t i = 0; i < fNMaterials; i++)
|
||||
{
|
||||
for (size_t i = 0; i < fNMaterials; i++){
|
||||
ComponentMap& massFractionComp = (*fpCompFractionTable)[i];
|
||||
ComponentMap& densityComp = (*fpCompDensityTable)[i];
|
||||
ComponentMap& numMolPerVol = (*fpCompNumMolPerVolTable)[i];
|
||||
|
||||
for (ComponentMap::iterator it = massFractionComp.begin();
|
||||
it != massFractionComp.end(); it++)
|
||||
{
|
||||
it != massFractionComp.end(); it++){
|
||||
compMat = it->first;
|
||||
numMolPerVol[compMat] = densityComp[compMat]
|
||||
/ compMat->GetMassOfMolecule();
|
||||
@@ -283,8 +291,7 @@ void G4DNAMolecularMaterial::InitializeNumMolPerVol()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription << "The pointer fpCompDensityTable is not initialized"
|
||||
<< G4endl;
|
||||
@@ -294,37 +301,38 @@ void G4DNAMolecularMaterial::InitializeNumMolPerVol()
|
||||
}
|
||||
}
|
||||
|
||||
void G4DNAMolecularMaterial::RecordMolecularMaterial(G4Material* parentMaterial,
|
||||
G4Material* molecularMaterial,
|
||||
G4double fraction)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4DNAMolecularMaterial::RecordMolecularMaterial(G4Material* parentMaterial,
|
||||
G4Material* molecularMaterial,
|
||||
G4double fraction)
|
||||
{
|
||||
ComponentMap& matComponent =
|
||||
(*fpCompFractionTable)[parentMaterial->GetIndex()];
|
||||
|
||||
if (matComponent.empty())
|
||||
{
|
||||
if (matComponent.empty()){
|
||||
matComponent[molecularMaterial] = fraction;
|
||||
return;
|
||||
}
|
||||
|
||||
ComponentMap::iterator it = matComponent.find(molecularMaterial);
|
||||
|
||||
if (it == matComponent.end())
|
||||
{
|
||||
if (it == matComponent.end()){
|
||||
matComponent[molecularMaterial] = fraction;
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
matComponent[molecularMaterial] = it->second + fraction;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAMolecularMaterial::SearchMolecularMaterial(G4Material* parentMaterial,
|
||||
G4Material* material,
|
||||
double currentFraction)
|
||||
{
|
||||
if (material->GetMassOfMolecule() != 0.0)
|
||||
{
|
||||
if (material->GetMassOfMolecule() != 0.0){
|
||||
RecordMolecularMaterial(parentMaterial, material, currentFraction);
|
||||
return;
|
||||
}
|
||||
@@ -334,17 +342,14 @@ void G4DNAMolecularMaterial::SearchMolecularMaterial(G4Material* parentMaterial,
|
||||
std::map<G4Material*, G4double> matComponent = material->GetMatComponents();
|
||||
std::map<G4Material*, G4double>::iterator it = matComponent.begin();
|
||||
|
||||
for (; it != matComponent.end(); it++)
|
||||
{
|
||||
for (; it != matComponent.end(); it++){
|
||||
compMat = it->first;
|
||||
fraction = it->second;
|
||||
if (compMat->GetMassOfMolecule() == 0.0)
|
||||
{
|
||||
if (compMat->GetMassOfMolecule() == 0.0){
|
||||
SearchMolecularMaterial(parentMaterial, compMat,
|
||||
currentFraction * fraction);
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
RecordMolecularMaterial(parentMaterial, compMat,
|
||||
currentFraction * fraction);
|
||||
}
|
||||
@@ -354,14 +359,14 @@ void G4DNAMolecularMaterial::SearchMolecularMaterial(G4Material* parentMaterial,
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const std::vector<double>*
|
||||
G4DNAMolecularMaterial::
|
||||
GetDensityTableFor(const G4Material* lookForMaterial) const
|
||||
{
|
||||
if (!fpCompDensityTable)
|
||||
{
|
||||
if (fIsInitialized)
|
||||
{
|
||||
if (!fpCompDensityTable){
|
||||
if (fIsInitialized){
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "The pointer fpCompDensityTable is not initialized will the "
|
||||
@@ -372,12 +377,10 @@ GetDensityTableFor(const G4Material* lookForMaterial) const
|
||||
exceptionDescription);
|
||||
}
|
||||
|
||||
if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_Idle)
|
||||
{
|
||||
if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_Idle){
|
||||
const_cast<G4DNAMolecularMaterial*>(this)->Initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "The geant4 application is at the wrong state. State must be: "
|
||||
@@ -393,8 +396,7 @@ GetDensityTableFor(const G4Material* lookForMaterial) const
|
||||
const_iterator it_askedDensityTable =
|
||||
fAskedDensityTable.find(lookForMaterial);
|
||||
|
||||
if (it_askedDensityTable != fAskedDensityTable.end())
|
||||
{
|
||||
if (it_askedDensityTable != fAskedDensityTable.end()){
|
||||
return it_askedDensityTable->second;
|
||||
}
|
||||
|
||||
@@ -406,25 +408,21 @@ GetDensityTableFor(const G4Material* lookForMaterial) const
|
||||
|
||||
G4bool materialWasNotFound = true;
|
||||
|
||||
for (size_t i = 0; i < fNMaterials; i++)
|
||||
{
|
||||
for (size_t i = 0; i < fNMaterials; i++){
|
||||
ComponentMap& densityTable = (*fpCompDensityTable)[i];
|
||||
|
||||
it = densityTable.find(lookForMaterial);
|
||||
|
||||
if (it == densityTable.end())
|
||||
{
|
||||
if (it == densityTable.end()){
|
||||
(*output)[i] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
materialWasNotFound = false;
|
||||
(*output)[i] = it->second;
|
||||
}
|
||||
}
|
||||
|
||||
if (materialWasNotFound)
|
||||
{
|
||||
if (materialWasNotFound){
|
||||
PrintNotAMolecularMaterial("G4DNAMolecularMaterial::GetDensityTableFor",
|
||||
lookForMaterial);
|
||||
}
|
||||
@@ -434,13 +432,15 @@ GetDensityTableFor(const G4Material* lookForMaterial) const
|
||||
return output;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const std::vector<double>* G4DNAMolecularMaterial::GetNumMolPerVolTableFor(
|
||||
const G4Material* lookForMaterial) const
|
||||
{
|
||||
if (!fpCompNumMolPerVolTable)
|
||||
{
|
||||
if (fIsInitialized)
|
||||
{
|
||||
if(lookForMaterial==0) return nullptr;
|
||||
|
||||
if (!fpCompNumMolPerVolTable){
|
||||
if (fIsInitialized){
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "The pointer fpCompNumMolPerVolTable is not initialized whereas "
|
||||
@@ -451,12 +451,10 @@ const std::vector<double>* G4DNAMolecularMaterial::GetNumMolPerVolTableFor(
|
||||
exceptionDescription);
|
||||
}
|
||||
|
||||
if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_Idle)
|
||||
{
|
||||
if (G4StateManager::GetStateManager()->GetCurrentState() == G4State_Idle){
|
||||
const_cast<G4DNAMolecularMaterial*>(this)->Initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "The geant4 application is at the wrong state. State must be : "
|
||||
@@ -471,8 +469,7 @@ const std::vector<double>* G4DNAMolecularMaterial::GetNumMolPerVolTableFor(
|
||||
std::map<const G4Material*, std::vector<double>*, CompareMaterial>::
|
||||
const_iterator it_askedNumMolPerVolTable =
|
||||
fAskedNumPerVolTable.find(lookForMaterial);
|
||||
if (it_askedNumMolPerVolTable != fAskedNumPerVolTable.end())
|
||||
{
|
||||
if (it_askedNumMolPerVolTable != fAskedNumPerVolTable.end()){
|
||||
return it_askedNumMolPerVolTable->second;
|
||||
}
|
||||
|
||||
@@ -484,25 +481,21 @@ const std::vector<double>* G4DNAMolecularMaterial::GetNumMolPerVolTableFor(
|
||||
|
||||
G4bool materialWasNotFound = true;
|
||||
|
||||
for (size_t i = 0; i < fNMaterials; i++)
|
||||
{
|
||||
for (size_t i = 0; i < fNMaterials; i++){
|
||||
ComponentMap& densityTable = (*fpCompNumMolPerVolTable)[i];
|
||||
|
||||
it = densityTable.find(lookForMaterial);
|
||||
|
||||
if (it == densityTable.end())
|
||||
{
|
||||
if (it == densityTable.end()){
|
||||
(*output)[i] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
materialWasNotFound = false;
|
||||
(*output)[i] = it->second;
|
||||
}
|
||||
}
|
||||
|
||||
if (materialWasNotFound)
|
||||
{
|
||||
if (materialWasNotFound){
|
||||
PrintNotAMolecularMaterial(
|
||||
"G4DNAMolecularMaterial::GetNumMolPerVolTableFor", lookForMaterial);
|
||||
}
|
||||
@@ -512,6 +505,8 @@ const std::vector<double>* G4DNAMolecularMaterial::GetNumMolPerVolTableFor(
|
||||
return output;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4DNAMolecularMaterial::
|
||||
PrintNotAMolecularMaterial(const char* methodName,
|
||||
const G4Material* lookForMaterial) const
|
||||
@@ -519,8 +514,7 @@ PrintNotAMolecularMaterial(const char* methodName,
|
||||
std::map<const G4Material*, bool, CompareMaterial>::iterator it =
|
||||
fWarningPrinted.find(lookForMaterial);
|
||||
|
||||
if (it == fWarningPrinted.end())
|
||||
{
|
||||
if (it == fWarningPrinted.end()){
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription << "The material " << lookForMaterial->GetName()
|
||||
<< " is not defined as a molecular material."
|
||||
@@ -543,3 +537,56 @@ PrintNotAMolecularMaterial(const char* methodName,
|
||||
fWarningPrinted[lookForMaterial] = true;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4MolecularConfiguration*
|
||||
G4DNAMolecularMaterial::
|
||||
GetMolecularConfiguration(const G4Material* material) const
|
||||
{
|
||||
int material_id = material->GetIndex();
|
||||
auto it = fMaterialToMolecularConf.find(material_id);
|
||||
if(it == fMaterialToMolecularConf.end()) return 0;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4DNAMolecularMaterial::
|
||||
SetMolecularConfiguration(const G4Material* material,
|
||||
G4MolecularConfiguration* molConf)
|
||||
{
|
||||
assert(material != 0);
|
||||
int material_id = material->GetIndex();
|
||||
fMaterialToMolecularConf[material_id] = molConf;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4DNAMolecularMaterial::SetMolecularConfiguration(const G4Material* material,
|
||||
const G4String& molUserID)
|
||||
{
|
||||
assert(material != 0);
|
||||
int material_id = material->GetIndex();
|
||||
fMaterialToMolecularConf[material_id] =
|
||||
G4MoleculeTable::Instance()->GetConfiguration(molUserID, true);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4DNAMolecularMaterial::SetMolecularConfiguration(const G4String& materialName,
|
||||
const G4String& molUserID)
|
||||
{
|
||||
G4Material* material = G4Material::GetMaterial(materialName);
|
||||
|
||||
if(material == 0){
|
||||
G4cout<< "Material " << materialName
|
||||
<< " was not found and therefore won't be linked to "
|
||||
<< molUserID << G4endl;
|
||||
return;
|
||||
}
|
||||
SetMolecularConfiguration(material, molUserID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user