Geant4-11
Data Structures | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes
G4DNAChemistryManager Class Reference

#include <G4DNAChemistryManager.hh>

Inheritance diagram for G4DNAChemistryManager:
G4UImessenger G4VStateDependent

Data Structures

struct  ThreadLocalData
 

Public Member Functions

void AddEmptyLineInOutputFile ()
 
void Clear ()
 
void CloseFile ()
 
G4bool CommandsShouldBeInMaster () const
 
void CreateSolvatedElectron (const G4Track *, G4ThreeVector *pFinalPosition=nullptr)
 
void CreateWaterMolecule (ElectronicModification, G4int, const G4Track *)
 
void Deregister (G4VUserChemistryList &)
 
void ForceMasterReinitialization ()
 
void ForceRebuildingPhysicsTable ()
 
void ForceThreadReinitialization ()
 
G4String GetCurrentValue (G4UIcommand *pCommand) override
 
void Initialize ()
 
G4bool IsChemistryActivated ()
 
G4bool IsCounterResetWhenRunEnds () const
 
G4bool Notify (G4ApplicationState requestedState) override
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4VStateDependent &right) const
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator== (const G4VStateDependent &right) const
 
void PushMolecule (std::unique_ptr< G4Molecule > pMolecule, G4double time, const G4ThreeVector &position, G4int parentID)
 
void ResetCounterWhenRunEnds (G4bool resetCounterWhenRunEnds)
 
void Run ()
 
void SetChemistryActivation (G4bool)
 
void SetChemistryList (G4VUserChemistryList &)
 
void SetChemistryList (G4VUserChemistryList *)
 
void SetChemistryList (std::unique_ptr< G4VUserChemistryList >)
 
void SetGun (G4ITGun *pChemSpeciesGun)
 Inject custom species to the simulation. More...
 
void SetNewValue (G4UIcommand *, G4String) override
 
void SetPhysChemIO (std::unique_ptr< G4VPhysChemIO > pPhysChemIO)
 
void SetVerbose (G4int verbose)
 
void TagThreadForReinitialization ()
 
void UseAsStandalone (G4bool flag)
 
void WriteInto (const G4String &, std::ios_base::openmode mode=std::ios_base::out)
 

Static Public Member Functions

static void DeleteInstance ()
 
static G4DNAChemistryManagerGetInstanceIfExists ()
 
static G4DNAChemistryManagerInstance ()
 
static G4bool IsActivated ()
 

Protected Member Functions

void AddUIcommand (G4UIcommand *newCommand)
 
G4String BtoS (G4bool b)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
G4String DtoS (G4double a)
 
 G4DNAChemistryManager ()
 
G4DNAWaterExcitationStructureGetExcitationLevel ()
 
G4DNAWaterIonisationStructureGetIonisationLevel ()
 
void HandleStandaloneInitialization ()
 
void InitializeFile ()
 
void InitializeMaster ()
 
void InitializeThread ()
 
void InitializeThreadSharedData ()
 
G4String ItoS (G4int i)
 
void PushTrack (G4Track *)
 
void SetGlobalTemperature (G4double temperatureKelvin)
 
G4bool StoB (G4String s)
 
G4double StoD (G4String s)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 
 ~G4DNAChemistryManager () override
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Private Attributes

G4bool fActiveChemistry
 
G4bool fForceThreadReinitialization
 
G4bool fGeometryClosed
 
G4bool fMasterInitialized
 
G4bool fOwnChemistryList
 
std::unique_ptr< G4UIcmdWithABoolfpActivateChem
 
std::unique_ptr< G4UIdirectoryfpChemDNADirectory
 
std::unique_ptr< G4DNAWaterExcitationStructurefpExcitationLevel
 
G4bool fPhysicsTableBuilt
 
std::unique_ptr< G4UIcmdWithoutParameterfpInitChem
 
std::unique_ptr< G4DNAWaterIonisationStructurefpIonisationLevel
 
std::unique_ptr< G4UIcmdWithAnIntegerfpRunChem
 
std::unique_ptr< G4UIcmdWithADoubleAndUnitfpScaleForNewTemperature
 
std::unique_ptr< G4UIcmdWithoutParameterfpSkipReactionsFromChemList
 
std::unique_ptr< G4VUserChemistryListfpUserChemistryList
 
G4bool fResetCounterWhenRunEnds
 
G4bool fSkipReactions
 
G4bool fUseInStandalone
 
G4int fVerbose
 

Static Private Attributes

static G4DNAChemistryManagerfgInstance = nullptr
 
static G4ThreadLocal ThreadLocalDatafpThreadData = nullptr
 

Detailed Description

WARNING: THIS CLASS IS A PROTOTYPE G4DNAChemistryManager is called from the physics models. It creates the water molecules and the solvated electrons and and send them to G4ITStepManager to be treated in the chemistry stage. For this, the fActiveChemistry flag needs to be on. It is also possible to give already molecule's pointers already built. G4DNAChemistryManager will then be in charge of creating the track and loading it to the IT system. The user can also ask to create a file containing a information about the creation of water molecules and solvated electrons.

Definition at line 87 of file G4DNAChemistryManager.hh.

Constructor & Destructor Documentation

◆ ~G4DNAChemistryManager()

G4DNAChemistryManager::~G4DNAChemistryManager ( )
overrideprotected

Definition at line 164 of file G4DNAChemistryManager.cc.

165{
166 Clear();
167 fgInstance = nullptr;
168}
static G4DNAChemistryManager * fgInstance

References Clear(), and fgInstance.

◆ G4DNAChemistryManager()

G4DNAChemistryManager::G4DNAChemistryManager ( )
protected

Definition at line 101 of file G4DNAChemistryManager.cc.

102 : G4UImessenger()
104 , fpChemDNADirectory(new G4UIdirectory("/chem/"))
105 , fpActivateChem(new G4UIcmdWithABool("/chem/activate", this))
106 , fpRunChem(new G4UIcmdWithAnInteger("/chem/run", this))
107 , fpSkipReactionsFromChemList(new G4UIcmdWithoutParameter("/chem/skipReactionsFromChemList", this))
108 , fpScaleForNewTemperature(new G4UIcmdWithADoubleAndUnit("/chem/temperature", this))
109 , fpInitChem(new G4UIcmdWithoutParameter("/chem/init", this))
110 , fActiveChemistry(false)
111 , fMasterInitialized(false)
113 , fpExcitationLevel(nullptr)
114 , fpIonisationLevel(nullptr)
115 , fpUserChemistryList(nullptr)
116 , fOwnChemistryList(false)
117 , fUseInStandalone(false)
118 , fPhysicsTableBuilt(false)
119 , fSkipReactions(false)
120 , fGeometryClosed(false)
121 , fVerbose(0)
123{
124 fpRunChem->SetParameterName("Number of runs to execute for the chemistry module"
125 "(this works when used in standalone", true, true);
126 fpRunChem->SetDefaultValue(1);
127 fpScaleForNewTemperature->SetUnitCategory("Temperature");
128}
std::unique_ptr< G4UIcmdWithABool > fpActivateChem
std::unique_ptr< G4DNAWaterIonisationStructure > fpIonisationLevel
std::unique_ptr< G4UIcmdWithoutParameter > fpInitChem
std::unique_ptr< G4UIcmdWithADoubleAndUnit > fpScaleForNewTemperature
std::unique_ptr< G4UIdirectory > fpChemDNADirectory
std::unique_ptr< G4VUserChemistryList > fpUserChemistryList
std::unique_ptr< G4DNAWaterExcitationStructure > fpExcitationLevel
std::unique_ptr< G4UIcmdWithoutParameter > fpSkipReactionsFromChemList
std::unique_ptr< G4UIcmdWithAnInteger > fpRunChem
G4VStateDependent(G4bool bottom=false)

References fpRunChem, and fpScaleForNewTemperature.

Referenced by Instance().

Member Function Documentation

◆ AddEmptyLineInOutputFile()

void G4DNAChemistryManager::AddEmptyLineInOutputFile ( )

Definition at line 564 of file G4DNAChemistryManager.cc.

565{
567 {
568 fpThreadData->fpPhysChemIO->AddEmptyLineInOutputFile();
569 }
570}
static G4ThreadLocal ThreadLocalData * fpThreadData
std::unique_ptr< G4VPhysChemIO > fpPhysChemIO

References G4DNAChemistryManager::ThreadLocalData::fpPhysChemIO, and fpThreadData.

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protectedinherited

Definition at line 149 of file G4UImessenger.cc.

150{
151 G4cerr << "Warning : Old style definition of G4UIcommand <"
152 << newCommand->GetCommandPath() << ">." << G4endl;
153}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136

References G4cerr, G4endl, and G4UIcommand::GetCommandPath().

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protectedinherited

Definition at line 98 of file G4UImessenger.cc.

99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}

◆ Clear()

void G4DNAChemistryManager::Clear ( )

◆ CloseFile()

void G4DNAChemistryManager::CloseFile ( )

Close the file specified with WriteInto

Definition at line 574 of file G4DNAChemistryManager.cc.

575{
577 {
578 fpThreadData->fpPhysChemIO->CloseFile();
579 }
580}

References G4DNAChemistryManager::ThreadLocalData::fpPhysChemIO, and fpThreadData.

Referenced by Run().

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inlineinherited

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

References G4UImessenger::commandsShouldBeInMaster.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protectedinherited

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 path = "/" + path;
118 }
119
120 T* command = new T(path.c_str(), this);
121 command->SetGuidance(dsc.c_str());
122
123 return command;
124}
G4String baseDirName

References G4UImessenger::baseDirName.

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protectedinherited

Definition at line 156 of file G4UImessenger.cc.

158{
160
161 G4String fullpath = path;
162 if(fullpath.back() != '/')
163 fullpath.append("/");
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIdirectory * baseDir

References G4UImessenger::baseDir, G4UImessenger::baseDirName, G4UIcommandTree::FindCommandTree(), G4UIcommandTree::GetPathName(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), and G4UIcommand::SetGuidance().

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger::G4UImessenger().

◆ CreateSolvatedElectron()

void G4DNAChemistryManager::CreateSolvatedElectron ( const G4Track pIncomingTrack,
G4ThreeVector pFinalPosition = nullptr 
)

This method should be used by the physics model of the ElectronSolvatation process.

Definition at line 662 of file G4DNAChemistryManager.cc.

664{
666 {
667 fpThreadData->fpPhysChemIO->CreateSolvatedElectron(pIncomingTrack,
668 pFinalPosition);
669 }
670
672 {
673 PushMolecule(std::unique_ptr<G4Molecule>(new G4Molecule(G4Electron_aq::Definition())),
675 pFinalPosition ? *pFinalPosition : pIncomingTrack->GetPosition(),
676 pIncomingTrack->GetTrackID());
677 }
678}
static constexpr double picosecond
Definition: G4SIunits.hh:141
void PushMolecule(std::unique_ptr< G4Molecule > pMolecule, G4double time, const G4ThreeVector &position, G4int parentID)
static G4Electron_aq * Definition()
G4int GetTrackID() const
const G4ThreeVector & GetPosition() const

References G4Electron_aq::Definition(), fActiveChemistry, G4DNAChemistryManager::ThreadLocalData::fpPhysChemIO, fpThreadData, G4Track::GetPosition(), G4Track::GetTrackID(), picosecond, and PushMolecule().

Referenced by G4TDNAOneStepThermalizationModel< MODEL >::SampleSecondaries(), and G4DNATransformElectronModel::SampleSecondaries().

◆ CreateWaterMolecule()

void G4DNAChemistryManager::CreateWaterMolecule ( ElectronicModification  modification,
G4int  electronicLevel,
const G4Track pIncomingTrack 
)

Method used by DNA physics model to create a water molecule. The ElectronicModification is a flag telling whether the molecule is ionized or excited, the electronic level is calculated by the model and the IncomingTrack is the track responsible for the creation of this molecule (electron, proton...).

Definition at line 606 of file G4DNAChemistryManager.cc.

609{
611 {
612 G4double energy = -1.;
613
614 switch (modification)
615 {
617 energy = 0.;
618 break;
619 case eExcitedMolecule:
620 energy = GetExcitationLevel()->ExcitationEnergy(electronicLevel);
621 break;
622 case eIonizedMolecule:
623 energy = GetIonisationLevel()->IonisationEnergy(electronicLevel);
624 break;
625 }
626
627 fpThreadData->fpPhysChemIO->CreateWaterMolecule(modification,
628 4 - electronicLevel,
629 energy,
630 pIncomingTrack);
631 }
632
634 {
635 G4Molecule* pH2OMolecule = new G4Molecule(G4H2O::Definition());
636
637 switch (modification)
638 {
640 pH2OMolecule->AddElectron(5, 1);
641 break;
642 case eExcitedMolecule:
643 pH2OMolecule->ExciteMolecule(4 - electronicLevel);
644 break;
645 case eIonizedMolecule:
646 pH2OMolecule->IonizeMolecule(4 - electronicLevel);
647 break;
648 }
649
650 G4Track* pH2OTrack = pH2OMolecule->BuildTrack(picosecond,
651 pIncomingTrack->GetPosition());
652
653 pH2OTrack->SetParentID(pIncomingTrack->GetTrackID());
654 pH2OTrack->SetTrackStatus(fStopButAlive);
655 pH2OTrack->SetKineticEnergy(0.);
656 PushTrack(pH2OTrack);
657 }
658}
@ eIonizedMolecule
@ eDissociativeAttachment
@ eExcitedMolecule
@ fStopButAlive
double G4double
Definition: G4Types.hh:83
G4DNAWaterIonisationStructure * GetIonisationLevel()
G4DNAWaterExcitationStructure * GetExcitationLevel()
static G4H2O * Definition()
Definition: G4H2O.cc:42
void IonizeMolecule(G4int)
Definition: G4Molecule.cc:308
void AddElectron(G4int orbit, G4int n=1)
Definition: G4Molecule.cc:315
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:373
void ExciteMolecule(G4int)
Definition: G4Molecule.cc:301
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void SetKineticEnergy(const G4double aValue)
void SetParentID(const G4int aValue)
G4double energy(const ThreeVector &p, const G4double m)

References G4Molecule::AddElectron(), G4Molecule::BuildTrack(), G4H2O::Definition(), eDissociativeAttachment, eExcitedMolecule, eIonizedMolecule, G4INCL::KinematicsUtils::energy(), G4DNAWaterExcitationStructure::ExcitationEnergy(), G4Molecule::ExciteMolecule(), fActiveChemistry, G4DNAChemistryManager::ThreadLocalData::fpPhysChemIO, fpThreadData, fStopButAlive, GetExcitationLevel(), GetIonisationLevel(), G4Track::GetPosition(), G4Track::GetTrackID(), G4DNAWaterIonisationStructure::IonisationEnergy(), G4Molecule::IonizeMolecule(), picosecond, PushTrack(), G4Track::SetKineticEnergy(), G4Track::SetParentID(), and G4Track::SetTrackStatus().

Referenced by G4DNABornExcitationModel1::SampleSecondaries(), G4DNABornExcitationModel2::SampleSecondaries(), G4DNABornIonisationModel1::SampleSecondaries(), G4DNABornIonisationModel2::SampleSecondaries(), G4DNACPA100ExcitationModel::SampleSecondaries(), G4DNACPA100IonisationModel::SampleSecondaries(), G4DNADingfelderChargeDecreaseModel::SampleSecondaries(), G4DNAEmfietzoglouExcitationModel::SampleSecondaries(), G4DNAEmfietzoglouIonisationModel::SampleSecondaries(), G4DNAMillerGreenExcitationModel::SampleSecondaries(), G4DNARuddIonisationExtendedModel::SampleSecondaries(), G4DNARuddIonisationModel::SampleSecondaries(), and G4DNAPTBExcitationModel::SampleSecondaries().

◆ DeleteInstance()

void G4DNAChemistryManager::DeleteInstance ( )
static

Definition at line 202 of file G4DNAChemistryManager.cc.

203{
205
206 if (fgInstance != nullptr)
207 {
209 fgInstance = nullptr;
210 lock.unlock();
211 delete pDeleteMe;
212 }
213 else
214 {
215 G4cerr << "G4DNAChemistryManager already deleted" << G4endl;
216 }
217 lock.unlock();
218}
G4Mutex chemManExistence

References chemManExistence, fgInstance, G4cerr, G4endl, and G4TemplateAutoLock< _Mutex_t >::unlock().

◆ Deregister()

void G4DNAChemistryManager::Deregister ( G4VUserChemistryList chemistryList)

Definition at line 730 of file G4DNAChemistryManager.cc.

731{
732 if (fpUserChemistryList.get() == &chemistryList)
733 {
734 if (!fpUserChemistryList->IsPhysicsConstructor() || fOwnChemistryList)
735 {
736 fpUserChemistryList.reset();
737 }
738
739 fpUserChemistryList.release();
740 }
741}

References fOwnChemistryList, and fpUserChemistryList.

Referenced by Clear(), and G4VUserChemistryList::~G4VUserChemistryList().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protectedinherited

Definition at line 90 of file G4UImessenger.cc.

91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}

Referenced by G4ScoreQuantityMessenger::FilterCommands(), and G4UIcontrolMessenger::SetNewValue().

◆ ForceMasterReinitialization()

void G4DNAChemistryManager::ForceMasterReinitialization ( )

Definition at line 780 of file G4DNAChemistryManager.cc.

781{
782 fMasterInitialized = false;
784}

References fMasterInitialized, and InitializeMaster().

◆ ForceRebuildingPhysicsTable()

void G4DNAChemistryManager::ForceRebuildingPhysicsTable ( )

Definition at line 773 of file G4DNAChemistryManager.cc.

774{
775 fPhysicsTableBuilt = false;
776}

References fPhysicsTableBuilt.

◆ ForceThreadReinitialization()

void G4DNAChemistryManager::ForceThreadReinitialization ( )

Definition at line 788 of file G4DNAChemistryManager.cc.

789{
791}

References fForceThreadReinitialization.

◆ GetCurrentValue()

G4String G4DNAChemistryManager::GetCurrentValue ( G4UIcommand pCommand)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 278 of file G4DNAChemistryManager.cc.

279{
280 if (pCommand == fpActivateChem.get())
281 {
283 }
284 else if (pCommand == fpScaleForNewTemperature.get())
285 {
287 }
288 else if (pCommand == fpSkipReactionsFromChemList.get())
289 {
291 }
292
293 return "";
294}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445

References G4UIcommand::ConvertToString(), fActiveChemistry, fpActivateChem, fpScaleForNewTemperature, fpSkipReactionsFromChemList, fSkipReactions, and G4MolecularConfiguration::GetGlobalTemperature().

◆ GetExcitationLevel()

G4DNAWaterExcitationStructure * G4DNAChemistryManager::GetExcitationLevel ( )
protected

Definition at line 584 of file G4DNAChemistryManager.cc.

References fpExcitationLevel.

Referenced by CreateWaterMolecule().

◆ GetInstanceIfExists()

G4DNAChemistryManager * G4DNAChemistryManager::GetInstanceIfExists ( )
static

Definition at line 157 of file G4DNAChemistryManager.cc.

158{
159 return fgInstance;
160}

References fgInstance.

Referenced by G4VUserChemistryList::~G4VUserChemistryList().

◆ GetIonisationLevel()

G4DNAWaterIonisationStructure * G4DNAChemistryManager::GetIonisationLevel ( )
protected

Definition at line 595 of file G4DNAChemistryManager.cc.

References fpIonisationLevel.

Referenced by CreateWaterMolecule().

◆ HandleStandaloneInitialization()

void G4DNAChemistryManager::HandleStandaloneInitialization ( )
protected

Definition at line 438 of file G4DNAChemistryManager.cc.

439{
441 {
442 return;
443 }
444
445 if (fVerbose)
446 {
447 G4cout << "G4DNAChemistryManager: Build the physics tables for "
448 "molecule definition only."
449 << G4endl;
450 }
451
452 fpUserChemistryList->BuildPhysicsTable();
453
454 if (!fGeometryClosed)
455 {
456 if (fVerbose)
457 {
458 G4cout << "G4DNAChemistryManager: Close geometry" << G4endl;
459 }
460
462 pGeomManager->OpenGeometry();
463 pGeomManager->CloseGeometry(true, true);
464 fGeometryClosed = true;
465 }
466
467 fPhysicsTableBuilt = true;
468}
G4GLOB_DLL std::ostream G4cout
static G4GeometryManager * GetInstance()
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=nullptr)
void OpenGeometry(G4VPhysicalVolume *vol=nullptr)

References G4GeometryManager::CloseGeometry(), fGeometryClosed, fPhysicsTableBuilt, fpUserChemistryList, fUseInStandalone, fVerbose, G4cout, G4endl, G4GeometryManager::GetInstance(), and G4GeometryManager::OpenGeometry().

Referenced by InitializeThread().

◆ Initialize()

void G4DNAChemistryManager::Initialize ( )

Definition at line 360 of file G4DNAChemistryManager.cc.

361{
362 //===========================================================================
363 // MT MODE
364 //===========================================================================
366 {
367 //==========================================================================
368 // ON WORKER THREAD
369 //==========================================================================
371 {
372 InitializeThread(); // Will create and initialize G4Scheduler
373 return;
374 }
375 //==========================================================================
376 // ON MASTER THREAD
377 //==========================================================================
378 else
379 {
382 return;
383 }
384 }
385 //===========================================================================
386 // IS NOT IN MT MODE
387 //===========================================================================
388 else
389 {
392 // In this case: InitializeThread is called when Run() is called
393 return;
394 }
395}
G4bool IsWorkerThread()
Definition: G4Threading.cc:123
G4bool IsMultithreadedApplication()
Definition: G4Threading.cc:130

References InitializeMaster(), InitializeThread(), InitializeThreadSharedData(), G4Threading::IsMultithreadedApplication(), and G4Threading::IsWorkerThread().

Referenced by G4EmDNAChemistry::ConstructProcess(), G4EmDNAChemistry_option1::ConstructProcess(), G4EmDNAChemistry_option3::ConstructProcess(), G4EmDNAChemistry_option2::ConstructProcess(), and SetNewValue().

◆ InitializeFile()

void G4DNAChemistryManager::InitializeFile ( )
protected

Definition at line 507 of file G4DNAChemistryManager.cc.

508{
509 if (fVerbose)
510 {
511 G4cout << "G4DNAChemistryManager::InitializeFile() is called"
512 << G4endl;
513 }
514
516 {
517 fpThreadData->fpPhysChemIO->InitializeFile();
518 }
519}

References G4DNAChemistryManager::ThreadLocalData::fpPhysChemIO, fpThreadData, fVerbose, G4cout, and G4endl.

Referenced by InitializeThread().

◆ InitializeMaster()

void G4DNAChemistryManager::InitializeMaster ( )
protected

Definition at line 399 of file G4DNAChemistryManager.cc.

400{
402 {
403 return;
404 }
405
406 if (fVerbose)
407 {
408 G4cout << "G4DNAChemistryManager::InitializeMaster() is called" << G4endl;
409 }
410
411
412 if (fpUserChemistryList == nullptr)
413 {
414 G4ExceptionDescription description;
415 description << "No user chemistry list has been provided.";
416 G4Exception("G4DNAChemistryManager::InitializeMaster", "NO_CHEM_LIST",
417 FatalException, description);
418 }
419
421 // creates a concrete object of the scheduler
422
423
424 fpUserChemistryList->ConstructDissociationChannels();
425 if (!fSkipReactions)
426 {
428 }
429 else
430 {
432 }
433 fMasterInitialized = true;
434}
@ 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
static G4DNAMolecularReactionTable * GetReactionTable()
static G4Scheduler * Instance()
Definition: G4Scheduler.cc:101

References FatalException, fMasterInitialized, fpUserChemistryList, fSkipReactions, fVerbose, G4cout, G4endl, G4Exception(), G4DNAMolecularReactionTable::GetReactionTable(), and G4Scheduler::Instance().

Referenced by ForceMasterReinitialization(), and Initialize().

◆ InitializeThread()

void G4DNAChemistryManager::InitializeThread ( )
protected

Definition at line 472 of file G4DNAChemistryManager.cc.

473{
475 {
476 return;
477 }
478
479 if (fpUserChemistryList == nullptr)
480 {
481 G4ExceptionDescription description;
482 description << "No user chemistry list has been provided.";
483 G4Exception("G4DNAChemistryManager::InitializeThread", "NO_CHEM_LIST",
484 FatalException, description);
485 }
486
487 if (fVerbose)
488 {
489 G4cout << "G4DNAChemistryManager::InitializeThread() is called"
490 << G4endl;
491 }
492
494
497
499
501
503}
void Initialize()
Definition: G4Scheduler.cc:284
static void InitializeInstance()

References FatalException, fForceThreadReinitialization, fpThreadData, fpUserChemistryList, G4DNAChemistryManager::ThreadLocalData::fThreadInitialized, fVerbose, G4cout, G4endl, G4Exception(), G4DNAMolecularReactionTable::GetReactionTable(), HandleStandaloneInitialization(), G4Scheduler::Initialize(), InitializeFile(), G4VMoleculeCounter::InitializeInstance(), and G4Scheduler::Instance().

Referenced by Initialize(), Run(), and SetNewValue().

◆ InitializeThreadSharedData()

void G4DNAChemistryManager::InitializeThreadSharedData ( )
protected

Definition at line 298 of file G4DNAChemistryManager.cc.

299{
301 {
302 return;
303 }
304
307}
void Finalize(G4MoleculeDefinition *)
void PrepareMolecularConfiguration()
static G4MoleculeTable * Instance()
G4bool IsMasterThread()
Definition: G4Threading.cc:124

References G4MoleculeTable::Finalize(), G4MoleculeTable::Instance(), G4Threading::IsMasterThread(), and G4MoleculeTable::PrepareMolecularConfiguration().

Referenced by Initialize(), and Notify().

◆ Instance()

G4DNAChemistryManager * G4DNAChemistryManager::Instance ( )
static

Definition at line 132 of file G4DNAChemistryManager.cc.

133{
134 if (fgInstance == nullptr)
135 {
137 if (fgInstance == nullptr) // MT : double check at initialisation
138 {
140 }
141 lock.unlock();
142 }
143
144 // make sure thread local data is initialized for all threads
145 if (fpThreadData == nullptr)
146 {
147 fpThreadData = new ThreadLocalData();
148 }
149
150 assert(fpThreadData != nullptr);
151
152 return fgInstance;
153}

References chemManExistence, fgInstance, fpThreadData, G4DNAChemistryManager(), and G4TemplateAutoLock< _Mutex_t >::unlock().

Referenced by G4EmDNAChemistry::ConstructProcess(), G4EmDNAChemistry_option1::ConstructProcess(), G4EmDNAChemistry_option3::ConstructProcess(), G4EmDNAChemistry_option2::ConstructProcess(), G4EmDNAChemistry::G4EmDNAChemistry(), G4EmDNAChemistry_option1::G4EmDNAChemistry_option1(), G4EmDNAChemistry_option2::G4EmDNAChemistry_option2(), G4EmDNAChemistry_option3::G4EmDNAChemistry_option3(), G4DNABornExcitationModel1::SampleSecondaries(), G4DNABornExcitationModel2::SampleSecondaries(), G4DNABornIonisationModel1::SampleSecondaries(), G4DNABornIonisationModel2::SampleSecondaries(), G4DNACPA100ExcitationModel::SampleSecondaries(), G4DNACPA100IonisationModel::SampleSecondaries(), G4DNADingfelderChargeDecreaseModel::SampleSecondaries(), G4DNAEmfietzoglouExcitationModel::SampleSecondaries(), G4DNAEmfietzoglouIonisationModel::SampleSecondaries(), G4DNAMeltonAttachmentModel::SampleSecondaries(), G4DNAMillerGreenExcitationModel::SampleSecondaries(), G4TDNAOneStepThermalizationModel< MODEL >::SampleSecondaries(), G4DNARuddIonisationExtendedModel::SampleSecondaries(), G4DNARuddIonisationModel::SampleSecondaries(), G4DNATransformElectronModel::SampleSecondaries(), and G4DNAPTBExcitationModel::SampleSecondaries().

◆ IsActivated()

G4bool G4DNAChemistryManager::IsActivated ( )
static

◆ IsChemistryActivated()

G4bool G4DNAChemistryManager::IsChemistryActivated ( )

Definition at line 530 of file G4DNAChemistryManager.cc.

531{
532 return fActiveChemistry;
533}

References fActiveChemistry.

Referenced by IsActivated().

◆ IsCounterResetWhenRunEnds()

G4bool G4DNAChemistryManager::IsCounterResetWhenRunEnds ( ) const

Definition at line 759 of file G4DNAChemistryManager.cc.

760{
762}

References fResetCounterWhenRunEnds.

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protectedinherited

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ Notify()

G4bool G4DNAChemistryManager::Notify ( G4ApplicationState  requestedState)
overridevirtual

Implements G4VStateDependent.

Definition at line 222 of file G4DNAChemistryManager.cc.

223{
224 if (requestedState == G4State_Quit)
225 {
226 if (fVerbose)
227 {
228 G4cout << "G4DNAChemistryManager::Notify ---> received G4State_Quit"
229 << G4endl;
230 }
231 Clear();
232 }
233 else if (requestedState == G4State_GeomClosed)
234 {
235 fGeometryClosed = true;
236 }
237 else if (requestedState == G4State_Idle)
238 {
240 }
241
242 return true;
243}
@ G4State_Idle
@ G4State_Quit
@ G4State_GeomClosed

References Clear(), fGeometryClosed, fVerbose, G4cout, G4endl, G4State_GeomClosed, G4State_Idle, G4State_Quit, and InitializeThreadSharedData().

◆ operator!=() [1/2]

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const
inherited

Definition at line 76 of file G4UImessenger.cc.

77{
78 return this != &messenger;
79}

◆ operator!=() [2/2]

G4bool G4VStateDependent::operator!= ( const G4VStateDependent right) const
inherited

Definition at line 66 of file G4VStateDependent.cc.

67{
68 return (this != &right);
69}

◆ operator==() [1/2]

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const
inherited

Definition at line 70 of file G4UImessenger.cc.

71{
72 return this == &messenger;
73}

◆ operator==() [2/2]

G4bool G4VStateDependent::operator== ( const G4VStateDependent right) const
inherited

Definition at line 61 of file G4VStateDependent.cc.

62{
63 return (this == &right);
64}

◆ PushMolecule()

void G4DNAChemistryManager::PushMolecule ( std::unique_ptr< G4Molecule pMolecule,
G4double  time,
const G4ThreeVector position,
G4int  parentID 
)

Definition at line 682 of file G4DNAChemistryManager.cc.

686{
687 assert(fActiveChemistry
688 && "To inject chemical species, the chemistry must be activated. "
689 "Check chemistry activation before injecting species.");
690 G4Track* pTrack = pMolecule->BuildTrack(time, position);
691 pTrack->SetTrackStatus(fAlive);
692 pTrack->SetParentID(parentID);
693 pMolecule.release();
694 PushTrack(pTrack);
695}
@ fAlive

References fActiveChemistry, fAlive, PushTrack(), G4Track::SetParentID(), and G4Track::SetTrackStatus().

Referenced by CreateSolvatedElectron().

◆ PushTrack()

void G4DNAChemistryManager::PushTrack ( G4Track pTrack)
protected

Definition at line 745 of file G4DNAChemistryManager.cc.

746{
748}
virtual void Push(G4Track *)
static G4ITTrackHolder * Instance()

References G4ITTrackHolder::Instance(), and G4ITTrackHolder::Push().

Referenced by CreateWaterMolecule(), and PushMolecule().

◆ ResetCounterWhenRunEnds()

void G4DNAChemistryManager::ResetCounterWhenRunEnds ( G4bool  resetCounterWhenRunEnds)

Definition at line 766 of file G4DNAChemistryManager.cc.

767{
768 fResetCounterWhenRunEnds = resetCounterWhenRunEnds;
769}

References fResetCounterWhenRunEnds.

◆ Run()

void G4DNAChemistryManager::Run ( )

Definition at line 310 of file G4DNAChemistryManager.cc.

311{
312 if (!fActiveChemistry)
313 {
314 return;
315 }
316
318
320 {
321 G4ExceptionDescription description;
322 description << "Global components were not initialized.";
323 G4Exception("G4DNAChemistryManager::Run", "MASTER_INIT", FatalException,
324 description);
325 }
326
328 {
329 G4ExceptionDescription description;
330 description << "Thread local components were not initialized.";
331 G4Exception("G4DNAChemistryManager::Run", "THREAD_INIT", FatalException,
332 description);
333 }
334
338 {
340 }
341 CloseFile();
342}
void Process()
Definition: G4Scheduler.cc:379
static G4VMoleculeCounter * Instance()
virtual void ResetCounter()=0

References CloseFile(), fActiveChemistry, FatalException, G4MoleculeTable::Finalize(), fMasterInitialized, fpThreadData, fResetCounterWhenRunEnds, G4DNAChemistryManager::ThreadLocalData::fThreadInitialized, G4Exception(), InitializeThread(), G4Scheduler::Instance(), G4MoleculeTable::Instance(), G4VMoleculeCounter::Instance(), G4Scheduler::Process(), and G4VMoleculeCounter::ResetCounter().

Referenced by SetNewValue().

◆ SetChemistryActivation()

void G4DNAChemistryManager::SetChemistryActivation ( G4bool  flag)

Definition at line 537 of file G4DNAChemistryManager.cc.

538{
539 fActiveChemistry = flag;
540}

References fActiveChemistry.

Referenced by SetChemistryList(), and SetNewValue().

◆ SetChemistryList() [1/3]

void G4DNAChemistryManager::SetChemistryList ( G4VUserChemistryList chemistryList)

◆ SetChemistryList() [2/3]

void G4DNAChemistryManager::SetChemistryList ( G4VUserChemistryList pChemistryList)

Definition at line 707 of file G4DNAChemistryManager.cc.

708{
709 fpUserChemistryList.reset(pChemistryList);
710 fOwnChemistryList = false;
712}

References fOwnChemistryList, fpUserChemistryList, and SetChemistryActivation().

◆ SetChemistryList() [3/3]

void G4DNAChemistryManager::SetChemistryList ( std::unique_ptr< G4VUserChemistryList pChemistryList)

Not a constructor or when used in standalone? Prefer this method.

Definition at line 721 of file G4DNAChemistryManager.cc.

722{
723 fpUserChemistryList = std::move(pChemistryList);
724 fOwnChemistryList = true;
726}

References fOwnChemistryList, fpUserChemistryList, and SetChemistryActivation().

◆ SetGlobalTemperature()

void G4DNAChemistryManager::SetGlobalTemperature ( G4double  temperatureKelvin)
protected

◆ SetGun()

void G4DNAChemistryManager::SetGun ( G4ITGun pChemSpeciesGun)

Inject custom species to the simulation.

This method should be called per thread, possibly from ActionInitialisation::Build. One can decide to set the same gun for all threads. It is the user responsibility to handle the pointer deletion.

Definition at line 353 of file G4DNAChemistryManager.cc.

354{
355 G4Scheduler::Instance()->SetGun(pChemGun);
356}
void SetGun(G4ITGun *)
Definition: G4Scheduler.hh:431

References G4Scheduler::Instance(), and G4Scheduler::SetGun().

◆ SetNewValue()

void G4DNAChemistryManager::SetNewValue ( G4UIcommand pCommand,
G4String  value 
)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 247 of file G4DNAChemistryManager.cc.

248{
249 if (pCommand == fpActivateChem.get())
250 {
252 }
253 else if (pCommand == fpRunChem.get())
254 {
255 int nbExec = value.empty() ? 1 : G4UIcommand::ConvertToInt(value);
256 for (int i = 0 ; i < nbExec ; ++i)
257 {
258 Run();
259 }
260 }
261 else if (pCommand == fpSkipReactionsFromChemList.get())
262 {
263 fSkipReactions = true;
264 }
265 else if (pCommand == fpScaleForNewTemperature.get())
266 {
267 SetGlobalTemperature(fpScaleForNewTemperature->ConvertToDimensionedDouble(value));
268 }
269 else if (pCommand == fpInitChem.get())
270 {
271 Initialize();
273 }
274}
void SetGlobalTemperature(G4double temperatureKelvin)
static G4bool GetNewBoolValue(const char *paramString)
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:557

References G4UIcommand::ConvertToInt(), fpActivateChem, fpInitChem, fpRunChem, fpScaleForNewTemperature, fpSkipReactionsFromChemList, fSkipReactions, G4UIcmdWithABool::GetNewBoolValue(), Initialize(), InitializeThread(), Run(), SetChemistryActivation(), and SetGlobalTemperature().

◆ SetPhysChemIO()

void G4DNAChemistryManager::SetPhysChemIO ( std::unique_ptr< G4VPhysChemIO pPhysChemIO)

Definition at line 88 of file G4DNAChemistryManager.cc.

89{
90 fpThreadData->fpPhysChemIO = std::move(pPhysChemIO);
91}

References G4DNAChemistryManager::ThreadLocalData::fpPhysChemIO, and fpThreadData.

◆ SetVerbose()

void G4DNAChemistryManager::SetVerbose ( G4int  verbose)

Definition at line 752 of file G4DNAChemistryManager.cc.

753{
754 fVerbose = verbose;
755}

References fVerbose.

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protectedinherited

Definition at line 137 of file G4UImessenger.cc.

138{
140 G4bool vl = false;
141 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
142 {
143 vl = true;
144 }
145 return vl;
146}
bool G4bool
Definition: G4Types.hh:86
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

References G4StrUtil::to_upper_copy().

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

G4double G4UImessenger::StoD ( G4String  s)
protectedinherited

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protectedinherited

◆ StoL()

G4long G4UImessenger::StoL ( G4String  s)
protectedinherited

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

◆ TagThreadForReinitialization()

void G4DNAChemistryManager::TagThreadForReinitialization ( )

◆ UseAsStandalone()

void G4DNAChemistryManager::UseAsStandalone ( G4bool  flag)

If the chemistry module is used in standalone (ie. without running the physics stage beforehand), the physics table still needs to be built. It is therefore necessary to flag the chemistry module as being run in standalone.

Definition at line 346 of file G4DNAChemistryManager.cc.

347{
348 fUseInStandalone = flag;
349}

References fUseInStandalone.

◆ WriteInto()

void G4DNAChemistryManager::WriteInto ( const G4String output,
std::ios_base::openmode  mode = std::ios_base::out 
)

Tells the chemMan to write into a file the position and electronic state of the water molecule and the position thermalized or not of the solvated electron

Definition at line 544 of file G4DNAChemistryManager.cc.

546{
547 if (fVerbose)
548 {
549 G4cout << "G4DNAChemistryManager: Write chemical stage into "
550 << output.data() << G4endl;
551 }
552
554 {
556 }
557
558 fpThreadData->fpPhysChemIO->WriteInto(output, mode);
559
560}

References G4DNAChemistryManager::ThreadLocalData::fpPhysChemIO, fpThreadData, fVerbose, G4cout, and G4endl.

Field Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ fActiveChemistry

G4bool G4DNAChemistryManager::fActiveChemistry
private

◆ fForceThreadReinitialization

G4bool G4DNAChemistryManager::fForceThreadReinitialization
private

Definition at line 240 of file G4DNAChemistryManager.hh.

Referenced by ForceThreadReinitialization(), and InitializeThread().

◆ fGeometryClosed

G4bool G4DNAChemistryManager::fGeometryClosed
private

Definition at line 251 of file G4DNAChemistryManager.hh.

Referenced by HandleStandaloneInitialization(), and Notify().

◆ fgInstance

G4DNAChemistryManager * G4DNAChemistryManager::fgInstance = nullptr
staticprivate

◆ fMasterInitialized

G4bool G4DNAChemistryManager::fMasterInitialized
private

Definition at line 239 of file G4DNAChemistryManager.hh.

Referenced by ForceMasterReinitialization(), InitializeMaster(), and Run().

◆ fOwnChemistryList

G4bool G4DNAChemistryManager::fOwnChemistryList
private

Definition at line 246 of file G4DNAChemistryManager.hh.

Referenced by Deregister(), and SetChemistryList().

◆ fpActivateChem

std::unique_ptr<G4UIcmdWithABool> G4DNAChemistryManager::fpActivateChem
private

Definition at line 221 of file G4DNAChemistryManager.hh.

Referenced by Clear(), GetCurrentValue(), and SetNewValue().

◆ fpChemDNADirectory

std::unique_ptr<G4UIdirectory> G4DNAChemistryManager::fpChemDNADirectory
private

Definition at line 220 of file G4DNAChemistryManager.hh.

Referenced by Clear().

◆ fpExcitationLevel

std::unique_ptr<G4DNAWaterExcitationStructure> G4DNAChemistryManager::fpExcitationLevel
private

Definition at line 242 of file G4DNAChemistryManager.hh.

Referenced by Clear(), and GetExcitationLevel().

◆ fPhysicsTableBuilt

G4bool G4DNAChemistryManager::fPhysicsTableBuilt
private

◆ fpInitChem

std::unique_ptr<G4UIcmdWithoutParameter> G4DNAChemistryManager::fpInitChem
private

Definition at line 225 of file G4DNAChemistryManager.hh.

Referenced by Clear(), and SetNewValue().

◆ fpIonisationLevel

std::unique_ptr<G4DNAWaterIonisationStructure> G4DNAChemistryManager::fpIonisationLevel
private

Definition at line 243 of file G4DNAChemistryManager.hh.

Referenced by Clear(), and GetIonisationLevel().

◆ fpRunChem

std::unique_ptr<G4UIcmdWithAnInteger> G4DNAChemistryManager::fpRunChem
private

Definition at line 222 of file G4DNAChemistryManager.hh.

Referenced by Clear(), G4DNAChemistryManager(), and SetNewValue().

◆ fpScaleForNewTemperature

std::unique_ptr<G4UIcmdWithADoubleAndUnit> G4DNAChemistryManager::fpScaleForNewTemperature
private

Definition at line 224 of file G4DNAChemistryManager.hh.

Referenced by G4DNAChemistryManager(), GetCurrentValue(), and SetNewValue().

◆ fpSkipReactionsFromChemList

std::unique_ptr<G4UIcmdWithoutParameter> G4DNAChemistryManager::fpSkipReactionsFromChemList
private

Definition at line 223 of file G4DNAChemistryManager.hh.

Referenced by Clear(), GetCurrentValue(), and SetNewValue().

◆ fpThreadData

G4ThreadLocal G4DNAChemistryManager::ThreadLocalData * G4DNAChemistryManager::fpThreadData = nullptr
staticprivate

◆ fpUserChemistryList

std::unique_ptr<G4VUserChemistryList> G4DNAChemistryManager::fpUserChemistryList
private

◆ fResetCounterWhenRunEnds

G4bool G4DNAChemistryManager::fResetCounterWhenRunEnds
private

◆ fSkipReactions

G4bool G4DNAChemistryManager::fSkipReactions
private

Definition at line 249 of file G4DNAChemistryManager.hh.

Referenced by GetCurrentValue(), InitializeMaster(), and SetNewValue().

◆ fUseInStandalone

G4bool G4DNAChemistryManager::fUseInStandalone
private

Definition at line 247 of file G4DNAChemistryManager.hh.

Referenced by HandleStandaloneInitialization(), and UseAsStandalone().

◆ fVerbose

G4int G4DNAChemistryManager::fVerbose
private

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