Geant4  10.02.p03
G4DNAChemistryManager Class Reference

#include <G4DNAChemistryManager.hh>

Inheritance diagram for G4DNAChemistryManager:
Collaboration diagram for G4DNAChemistryManager:

Public Member Functions

G4bool IsChemistryActivated ()
 
void SetChemistryActivation (G4bool)
 
virtual G4bool Notify (G4ApplicationState requestedState)
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
void Initialize ()
 
void SetChemistryList (G4VUserChemistryList *)
 
void Deregister (G4VUserChemistryList *)
 
void SetGlobalTemperature (double temp_K)
 
void ForceMasterReinitialization ()
 
void TagThreadForReinitialization ()
 
void Run ()
 
void Clear ()
 
void Gun (G4ITGun *, bool physicsTableToBuild=true)
 
void ForceThreadReinitialization ()
 
void ForceRebuildingPhysicsTable ()
 
void WriteInto (const G4String &, std::ios_base::openmode mode=std::ios_base::out)
 
void AddEmptyLineInOuputFile ()
 
void CloseFile ()
 
void CreateWaterMolecule (ElectronicModification, G4int, const G4Track *)
 
void CreateSolvatedElectron (const G4Track *, G4ThreeVector *finalPosition=0)
 
void PushMolecule (G4Molecule *&molecule, double time, const G4ThreeVector &position, int parentID)
 
void PushMoleculeAtParentTimeAndPlace (G4Molecule *&molecule, const G4Track *)
 
void SetVerbose (G4int verbose)
 
void SetBuildPhysicsTable (bool flag)
 
G4bool IsCounterResetWhenRunEnds () const
 
void ResetCounterWhenRunEnds (G4bool resetCounterWhenRunEnds)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 
- Public Member Functions inherited from G4VStateDependent
 G4VStateDependent (G4bool bottom=false)
 
virtual ~G4VStateDependent ()
 
G4int operator== (const G4VStateDependent &right) const
 
G4int operator!= (const G4VStateDependent &right) const
 

Static Public Member Functions

static G4DNAChemistryManagerInstance ()
 
static G4DNAChemistryManagerGetInstanceIfExists ()
 
static void DeleteInstance ()
 
static G4bool IsActivated ()
 
static void Activated (G4bool flag=true)
 

Protected Member Functions

virtual ~G4DNAChemistryManager ()
 
G4DNAWaterExcitationStructure * GetExcitationLevel ()
 
G4DNAWaterIonisationStructure * GetIonisationLevel ()
 
void InitializeFile ()
 
void InitializeMaster ()
 
void InitializeThread ()
 
 G4DNAChemistryManager ()
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 

Private Attributes

G4UIdirectoryfpChemDNADirectory
 
G4UIcmdWithABoolfpActivateChem
 
G4UIcmdWithoutParameterfpRunChem
 
G4UIcmdWithoutParameterfpSkipReactionsFromChemList
 
G4UIcmdWithADoubleAndUnitfpScaleForNewTemperature
 
G4UIcmdWithoutParameterfpInitChem
 
bool fActiveChemistry
 
G4bool fFileInitialized
 
G4bool fWriteFile
 
G4bool fMasterInitialized
 
G4bool fForceThreadReinitialization
 
G4DNAWaterExcitationStructure * fpExcitationLevel
 
G4DNAWaterIonisationStructure * fpIonisationLevel
 
G4VUserChemistryListfpUserChemistryList
 
G4bool fBuildPhysicsTable
 
G4bool fPhysicsTableBuilt
 
G4bool fSkipReactions
 
G4bool fGeometryClosed
 
G4int fVerbose
 
G4bool fResetCounterWhenRunEnds
 

Static Private Attributes

static G4DNAChemistryManagerfgInstance
 
static G4ThreadLocal std::ofstream * fpgOutput_tl = 0
 
static G4ThreadLocal G4boolfpgThreadInitialized_tl = 0
 

Additional Inherited Members

- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

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 88 of file G4DNAChemistryManager.hh.

Constructor & Destructor Documentation

◆ ~G4DNAChemistryManager()

G4DNAChemistryManager::~G4DNAChemistryManager ( )
protectedvirtual

Definition at line 137 of file G4DNAChemistryManager.cc.

138 {
139 // G4cout << "Deleting G4DNAChemistryManager" << G4endl;
140  Clear();
141  fgInstance = 0;
142  /*
143  * DEBUG : check that the chemistry manager has well been deregistered
144  * assert(G4StateManager::GetStateManager()->
145  * DeregisterDependent(this) == true);
146  */
147 }
static G4DNAChemistryManager * fgInstance
Here is the call graph for this function:

◆ G4DNAChemistryManager()

G4DNAChemistryManager::G4DNAChemistryManager ( )
protected

Definition at line 70 of file G4DNAChemistryManager.cc.

70  :
72 {
73 //==============================================================================
74 /* M.K: 24/11/2014
75  * To work properly, the chemistry manager should be created and initialized on
76  * the master thread only. If the static flag fActiveChemistry is on but the
77  * chemistry manager singleton
78  */
79 //==============================================================================
80 
81 // if (/*fActiveChemistry &&*/ G4Threading::IsWorkerThread()
82 // && G4Threading::IsMultithreadedApplication())
83 // {
84 // G4Exception("G4DNAChemistryManager::G4DNAChemistryManager",
85 // "G4DNAChemistryManager_MASTER_CREATION", FatalException,
86 // "The chemistry manager should be created and initialized on the "
87 // "master thread only");
88 // }
89 
92  fWriteFile = false;
94  fMasterInitialized = false;
95  fpChemDNADirectory = new G4UIdirectory("/chem/");
96  fpActivateChem = new G4UIcmdWithABool("/chem/activate", this);
97  fpRunChem = new G4UIcmdWithoutParameter("/chem/run", this);
98  //fpGridSize = new G4UIcmdWithADoubleAndUnit("/chem/gridRes", this);
99  fpScaleForNewTemperature = new G4UIcmdWithADoubleAndUnit("/chem/temperature",
100  this);
102  new G4UIcmdWithoutParameter("/chem/skipReactionsFromChemList", this);
103  fpInitChem = new G4UIcmdWithoutParameter("/chem/init", this);
104  //fDefaultGridResolution = -1;
105  fBuildPhysicsTable = false;
106  fGeometryClosed = false;
107  fPhysicsTableBuilt = false;
109  fFileInitialized = false;
110  fVerbose = 0;
111  fActiveChemistry = false;
112  fSkipReactions = false;
114 }
G4UIcmdWithADoubleAndUnit * fpScaleForNewTemperature
G4DNAWaterIonisationStructure * fpIonisationLevel
G4UIcmdWithoutParameter * fpSkipReactionsFromChemList
G4VUserChemistryList * fpUserChemistryList
G4UIcmdWithoutParameter * fpRunChem
G4DNAWaterExcitationStructure * fpExcitationLevel
G4VStateDependent(G4bool bottom=false)
G4UIcmdWithoutParameter * fpInitChem
G4UIdirectory * fpChemDNADirectory
G4UIcmdWithABool * fpActivateChem
Here is the caller graph for this function:

Member Function Documentation

◆ Activated()

void G4DNAChemistryManager::Activated ( G4bool  flag = true)
static

Definition at line 500 of file G4DNAChemistryManager.cc.

501 {
502  Instance()->fActiveChemistry = flag;
503 }
static G4DNAChemistryManager * Instance()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddEmptyLineInOuputFile()

void G4DNAChemistryManager::AddEmptyLineInOuputFile ( )

Definition at line 530 of file G4DNAChemistryManager.cc.

531 {
532  if (fWriteFile)
533  {
534  *fpgOutput_tl << G4endl;
535  }
536 }
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal std::ofstream * fpgOutput_tl

◆ Clear()

void G4DNAChemistryManager::Clear ( )

Definition at line 149 of file G4DNAChemistryManager.cc.

150 {
151  if (fpIonisationLevel)
152  {
153  delete fpIonisationLevel;
154  fpIonisationLevel = 0;
155 
156  }
157  if (fpExcitationLevel)
158  {
159  delete fpExcitationLevel;
160  fpExcitationLevel = 0;
161  }
163  {
165  {
166  delete fpUserChemistryList;
167  }
168 // else
169 // {
170 // G4cout << "G4DNAChemistryManager will not delete the chemistry list "
171 // "since it inherits from G4VPhysicsConstructor and it is then "
172 // "expected to be the responsability to the G4VModularPhysics to handle"
173 // " the chemistry list." << G4endl;
174 // }
176  }
177  if (fpChemDNADirectory)
178  {
179  delete fpChemDNADirectory;
180  fpChemDNADirectory = 0;
181  }
182  if (fpActivateChem)
183  {
184  delete fpActivateChem;
185  fpActivateChem = 0;
186  }
187  if(fpRunChem)
188  {
189  delete fpRunChem;
190  fpRunChem = 0;
191  }
193  {
196  }
197  if(fpInitChem)
198  {
199  delete fpInitChem;
200  fpInitChem = 0;
201  }
202 
204  //G4MoleculeHandleManager::DeleteInstance();
207 }
G4DNAWaterIonisationStructure * fpIonisationLevel
G4UIcmdWithoutParameter * fpSkipReactionsFromChemList
G4VUserChemistryList * fpUserChemistryList
G4UIcmdWithoutParameter * fpRunChem
G4DNAWaterExcitationStructure * fpExcitationLevel
G4UIcmdWithoutParameter * fpInitChem
G4UIdirectory * fpChemDNADirectory
G4UIcmdWithABool * fpActivateChem
static void DeleteInstance()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CloseFile()

void G4DNAChemistryManager::CloseFile ( )

Close the file specified with WriteInto

Definition at line 538 of file G4DNAChemistryManager.cc.

539 {
540  if (fpgOutput_tl == 0) return;
541 
542  if (fpgOutput_tl->is_open())
543  {
544  if (fVerbose)
545  {
546  G4cout << "G4DNAChemistryManager: Close File" << G4endl;
547  }
548  fpgOutput_tl->close();
549  }
550 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal std::ofstream * fpgOutput_tl
Here is the caller graph for this function:

◆ CreateSolvatedElectron()

void G4DNAChemistryManager::CreateSolvatedElectron ( const G4Track *  theIncomingTrack,
G4ThreeVector finalPosition = 0 
)

On the same idea as the previous method but for solvated electron. This method should be used by the physics model of the ElectronSolvatation process.

Definition at line 638 of file G4DNAChemistryManager.cc.

641 {
642  if (fWriteFile)
643  {
645 
646  *fpgOutput_tl << setw(11) << theIncomingTrack->GetTrackID() << setw(10)
647  << "e_aq" << setw(14) << -1 << std::setprecision(2)
648  << std::fixed << setw(13)
649  << theIncomingTrack->GetKineticEnergy() / eV
650  << std::setprecision(6) << std::scientific << setw(22)
651  << (theIncomingTrack->GetPosition().x()) / nanometer
652  << setw(22)
653  << (theIncomingTrack->GetPosition().y()) / nanometer
654  << setw(22)
655  << (theIncomingTrack->GetPosition().z()) / nanometer;
656 
657  if (finalPosition != 0)
658  {
659  *fpgOutput_tl << setw(14) << (finalPosition->x()) / nanometer << setw(14)
660  << (finalPosition->y()) / nanometer << setw(14)
661  << (finalPosition->z()) / nanometer;
662  }
663 
664  *fpgOutput_tl << G4endl;
665  }
666 
667  if(fActiveChemistry)
668  {
670  G4Track * e_aqTrack(0);
671  if(finalPosition)
672  {
673  e_aqTrack = e_aq->BuildTrack(picosecond,*finalPosition);
674  }
675  else
676  {
677  e_aqTrack = e_aq->BuildTrack(picosecond,theIncomingTrack->GetPosition());
678  }
679  e_aqTrack -> SetTrackStatus(fAlive);
680  e_aqTrack -> SetParentID(theIncomingTrack->GetTrackID());
681  G4VITTrackHolder::Instance()->Push(e_aqTrack);
682  }
683 }
static G4VITTrackHolder * Instance()
static G4Electron_aq * Definition()
static const double nanometer
Definition: G4SIunits.hh:100
virtual void Push(G4Track *)
double x() const
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:380
static const double eV
Definition: G4SIunits.hh:212
double y() const
double z() const
#define G4endl
Definition: G4ios.hh:61
static const double picosecond
Definition: G4SIunits.hh:160
static G4ThreadLocal std::ofstream * fpgOutput_tl
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateWaterMolecule()

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

Method used by DNA physics model to create a water molecule. The ElectronicModification is a flag telling wheter 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, for instance an electron.

Definition at line 572 of file G4DNAChemistryManager.cc.

575 {
576  if (fWriteFile)
577  {
579 
580  G4double energy = -1.;
581 
582  switch (modification)
583  {
585  energy = 0;
586  break;
587  case eExcitedMolecule:
588  energy = GetExcitationLevel()->ExcitationEnergy(electronicLevel);
589  break;
590  case eIonizedMolecule:
591  energy = GetIonisationLevel()->IonisationEnergy(electronicLevel);
592  break;
593  }
594 
595  *fpgOutput_tl << setw(11) << left << theIncomingTrack->GetTrackID()
596  << setw(10) << "H2O" << left << modification << internal
597  << ":" << right << electronicLevel << left << setw(11) << ""
598  << std::setprecision(2) << std::fixed << setw(13)
599  << energy / eV << std::setprecision(6) << std::scientific
600  << setw(22)
601  << (theIncomingTrack->GetPosition().x()) / nanometer
602  << setw(22)
603  << (theIncomingTrack->GetPosition().y()) / nanometer
604  << setw(22)
605  << (theIncomingTrack->GetPosition().z()) / nanometer
606  << G4endl;
607  }
608 
609  if(fActiveChemistry)
610  {
611  G4Molecule * H2O = new G4Molecule (G4H2O::Definition());
612 
613  switch (modification)
614  {
616  H2O -> AddElectron(5,1);
617  break;
618  case eExcitedMolecule :
619  H2O -> ExciteMolecule(electronicLevel);
620  break;
621  case eIonizedMolecule :
622  H2O -> IonizeMolecule(electronicLevel);
623  break;
624  }
625 
626  G4Track * H2OTrack = H2O->BuildTrack(1*picosecond,
627  theIncomingTrack->GetPosition());
628 
629  H2OTrack -> SetParentID(theIncomingTrack->GetTrackID());
630  H2OTrack -> SetTrackStatus(fStopButAlive);
631  H2OTrack -> SetKineticEnergy(0.);
632  G4VITTrackHolder::Instance()->Push(H2OTrack);
633  }
634 // else
635 // abort();
636 }
static G4VITTrackHolder * Instance()
static G4H2O * Definition()
Definition: G4H2O.cc:46
static const double nanometer
Definition: G4SIunits.hh:100
virtual void Push(G4Track *)
G4DNAWaterExcitationStructure * GetExcitationLevel()
double energy
Definition: plottest35.C:25
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:380
static const double eV
Definition: G4SIunits.hh:212
#define G4endl
Definition: G4ios.hh:61
static const double picosecond
Definition: G4SIunits.hh:160
double G4double
Definition: G4Types.hh:76
G4DNAWaterIonisationStructure * GetIonisationLevel()
static G4ThreadLocal std::ofstream * fpgOutput_tl
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeleteInstance()

void G4DNAChemistryManager::DeleteInstance ( )
static

You should rather use DeleteInstance than the destructor of this class

Definition at line 209 of file G4DNAChemistryManager.cc.

210 {
211  //G4cout << "G4DNAChemistryManager::DeleteInstance" << G4endl;
212 
214 
215  if(fgInstance)
216  {
217  G4DNAChemistryManager* deleteMe = fgInstance;
218  fgInstance = 0;
219  lock.unlock();
220  delete deleteMe;
221  }
222  else
223  {
224  G4cout << "G4DNAChemistryManager already deleted" << G4endl;
225  }
226  lock.unlock();
227 }
G4Mutex chemManExistence
static G4DNAChemistryManager * fgInstance
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ Deregister()

void G4DNAChemistryManager::Deregister ( G4VUserChemistryList chemistryList)
inline

Definition at line 269 of file G4DNAChemistryManager.hh.

270 {
271  if (fpUserChemistryList == chemistryList) fpUserChemistryList = 0;
272 }
G4VUserChemistryList * fpUserChemistryList
Here is the caller graph for this function:

◆ ForceMasterReinitialization()

void G4DNAChemistryManager::ForceMasterReinitialization ( )
inline

Definition at line 274 of file G4DNAChemistryManager.hh.

275 {
276  fMasterInitialized = false;
278 }
Here is the call graph for this function:

◆ ForceRebuildingPhysicsTable()

void G4DNAChemistryManager::ForceRebuildingPhysicsTable ( )
inline

Definition at line 258 of file G4DNAChemistryManager.hh.

259 {
260  fPhysicsTableBuilt = false;
261 }

◆ ForceThreadReinitialization()

void G4DNAChemistryManager::ForceThreadReinitialization ( )
inline

Definition at line 280 of file G4DNAChemistryManager.hh.

281 {
282  // TODO
284 }

◆ GetCurrentValue()

G4String G4DNAChemistryManager::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 283 of file G4DNAChemistryManager.cc.

284 {
285  if (command == fpActivateChem)
286  {
288  }
289 
290  return "";
291 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
G4UIcmdWithABool * fpActivateChem
Here is the call graph for this function:

◆ GetExcitationLevel()

G4DNAWaterExcitationStructure * G4DNAChemistryManager::GetExcitationLevel ( )
protected

Definition at line 553 of file G4DNAChemistryManager.cc.

554 {
555  if (!fpExcitationLevel)
556  {
557  fpExcitationLevel = new G4DNAWaterExcitationStructure;
558  }
559  return fpExcitationLevel;
560 }
G4DNAWaterExcitationStructure * fpExcitationLevel
Here is the caller graph for this function:

◆ GetInstanceIfExists()

G4DNAChemistryManager * G4DNAChemistryManager::GetInstanceIfExists ( )
static

Definition at line 132 of file G4DNAChemistryManager.cc.

133 {
134  return fgInstance;
135 }
static G4DNAChemistryManager * fgInstance
Here is the caller graph for this function:

◆ GetIonisationLevel()

G4DNAWaterIonisationStructure * G4DNAChemistryManager::GetIonisationLevel ( )
protected

Definition at line 563 of file G4DNAChemistryManager.cc.

564 {
565  if (!fpIonisationLevel)
566  {
567  fpIonisationLevel = new G4DNAWaterIonisationStructure;
568  }
569  return fpIonisationLevel;
570 }
G4DNAWaterIonisationStructure * fpIonisationLevel
Here is the caller graph for this function:

◆ Gun()

void G4DNAChemistryManager::Gun ( G4ITGun gun,
bool  physicsTableToBuild = true 
)

Definition at line 325 of file G4DNAChemistryManager.cc.

326 {
327  fBuildPhysicsTable = physicsTableToBuild;
329 }
static G4Scheduler * Instance()
Definition: G4Scheduler.cc:102
void SetGun(G4ITGun *)
Definition: G4Scheduler.hh:423
Here is the call graph for this function:

◆ Initialize()

void G4DNAChemistryManager::Initialize ( )

Definition at line 331 of file G4DNAChemistryManager.cc.

332 {
333  //===========================================================================
334  // MT MODE
335  //===========================================================================
337  {
338  //==========================================================================
339  // ON WORKER THREAD
340  //==========================================================================
342  {
343  InitializeThread(); // Will create and initialize G4ITScheduler
344  return;
345  }
346  //==========================================================================
347  // ON MASTER THREAD
348  //==========================================================================
349  else
350  {
352  return;
353  }
354  }
355  //===========================================================================
356  // IS NOT IN MT MODE
357  //===========================================================================
358  else
359  {
361  // In this case: InitializeThread is called when Run() is called
362  return;
363  }
364 
365 }
G4bool IsMultithreadedApplication()
Definition: G4Threading.cc:142
G4bool IsWorkerThread()
Definition: G4Threading.cc:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeFile()

void G4DNAChemistryManager::InitializeFile ( )
protected

Definition at line 466 of file G4DNAChemistryManager.cc.

467 {
468  if (fpgOutput_tl == 0 || fWriteFile == false || fFileInitialized)
469  {
470  return;
471  }
472 
473  if(fVerbose)
474  {
475  G4cout << "G4DNAChemistryManager::InitializeFile() is called"
476  << G4endl;
477  }
478 
479  *fpgOutput_tl << std::setprecision(6) << std::scientific;
480  *fpgOutput_tl << setw(11) << left << "#Parent ID" << setw(10) << "Molecule"
481  << setw(14) << "Elec Modif" << setw(13) << "Energy (eV)"
482  << setw(22) << "X pos of parent [nm]" << setw(22)
483  << "Y pos of parent [nm]" << setw(22) << "Z pos of parent [nm]"
484  << setw(14) << "X pos [nm]" << setw(14) << "Y pos [nm]"
485  << setw(14) << "Z pos [nm]" << G4endl<< setw(21) << "#"
486  << setw(13) << "1)io/ex=0/1"
487  << G4endl
488  << setw(21) << "#"
489  << setw(13) << "2)level=0...5"
490  << G4endl;
491 
492  fFileInitialized = true;
493 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal std::ofstream * fpgOutput_tl
Here is the caller graph for this function:

◆ InitializeMaster()

void G4DNAChemistryManager::InitializeMaster ( )
protected

Definition at line 367 of file G4DNAChemistryManager.cc.

368 {
369  if (fMasterInitialized == false)
370  {
371  if(fVerbose)
372  {
373  G4cout << "G4DNAChemistryManager::InitializeMaster() is called" << G4endl;
374  }
375 
377  // creates a concrete object of the scheduler
378  // and track container
379 
381  {
383  if(fSkipReactions == false)
384  {
387  }
388  else
389  {
391  }
392  fMasterInitialized = true;
393  }
394  else
395  {
396  if (fActiveChemistry)
397  {
398  G4ExceptionDescription description;
399  description << "No user chemistry list has been provided.";
400  G4Exception("G4DNAChemistryManager::InitializeMaster", "NO_CHEM_LIST",
401  FatalException, description);
402  }
403  }
404  }
405 }
virtual void ConstructReactionTable(G4DNAMolecularReactionTable *reactionTable)=0
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
static G4Scheduler * Instance()
Definition: G4Scheduler.cc:102
static G4DNAMolecularReactionTable * GetReactionTable()
G4GLOB_DLL std::ostream G4cout
G4VUserChemistryList * fpUserChemistryList
virtual void ConstructDissociationChannels()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeThread()

void G4DNAChemistryManager::InitializeThread ( )
protected

Definition at line 407 of file G4DNAChemistryManager.cc.

408 {
410  {
412  {
413  if(fVerbose)
414  {
415  G4cout << "G4DNAChemistryManager::InitializeThread() is called"
416  << G4endl;
417  }
418 
419  if (fBuildPhysicsTable && fPhysicsTableBuilt == false)
420  {
421  if(fVerbose)
422  {
423  G4cout << "G4DNAChemistryManager: Build the physics tables for "
424  "molecules."
425  << G4endl;
426  }
427 
429  if (fGeometryClosed == false)
430  {
431  if(fVerbose)
432  {
433  G4cout << "G4DNAChemistryManager: Close geometry"
434  << G4endl;
435  }
436 
438  // G4cout << "Start closing geometry." << G4endl;
439  geomManager->OpenGeometry();
440  geomManager->CloseGeometry(true, true);
441  fGeometryClosed = true;
442  }
443 
444  fPhysicsTableBuilt = true;
445  }
449 
450  fpgThreadInitialized_tl = new G4bool(true);
451  }
452  else
453  {
454  G4ExceptionDescription description;
455  description << "No user chemistry list has been provided.";
456  G4Exception("G4DNAChemistryManager::InitializeThread", "NO_CHEM_LIST",
457  FatalException, description);
458  }
459 
461  }
462 
463  InitializeFile();
464 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
static G4Scheduler * Instance()
Definition: G4Scheduler.cc:102
static G4DNAMolecularReactionTable * GetReactionTable()
G4GLOB_DLL std::ostream G4cout
G4VUserChemistryList * fpUserChemistryList
bool G4bool
Definition: G4Types.hh:79
static G4GeometryManager * GetInstance()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static void InitializeInstance()
#define G4endl
Definition: G4ios.hh:61
void OpenGeometry(G4VPhysicalVolume *vol=0)
virtual void ConstructTimeStepModel(G4DNAMolecularReactionTable *reactionTable)=0
void Initialize()
Definition: G4Scheduler.cc:282
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
static G4ThreadLocal G4bool * fpgThreadInitialized_tl
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

G4DNAChemistryManager * G4DNAChemistryManager::Instance ( void  )
static

Definition at line 117 of file G4DNAChemistryManager.cc.

118 {
119  if (fgInstance == 0)
120  {
122  if (fgInstance == 0) // MT : double check at initialisation
123  {
125  }
126  lock.unlock();
127  }
128  return fgInstance;
129 }
G4Mutex chemManExistence
static G4DNAChemistryManager * fgInstance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsActivated()

G4bool G4DNAChemistryManager::IsActivated ( )
static

Definition at line 495 of file G4DNAChemistryManager.cc.

496 {
497  return Instance()->fActiveChemistry;
498 }
static G4DNAChemistryManager * Instance()
Here is the call graph for this function:

◆ IsChemistryActivated()

G4bool G4DNAChemistryManager::IsChemistryActivated ( )

Definition at line 505 of file G4DNAChemistryManager.cc.

506 {
507  return fActiveChemistry;
508 }

◆ IsCounterResetWhenRunEnds()

G4bool G4DNAChemistryManager::IsCounterResetWhenRunEnds ( ) const
inline

Definition at line 206 of file G4DNAChemistryManager.hh.

207  {
209  }

◆ Notify()

G4bool G4DNAChemistryManager::Notify ( G4ApplicationState  requestedState)
virtual

Implements G4VStateDependent.

Definition at line 229 of file G4DNAChemistryManager.cc.

230 {
231  if (requestedState == G4State_Quit)
232  {
233  if(fVerbose)
234  G4cout << "G4DNAChemistryManager::Notify ---> received G4State_Quit"
235  << G4endl;
236  //DeleteInstance();
237  Clear();
238  }
239 
240  else if(requestedState == G4State_GeomClosed)
241  {
242  fGeometryClosed = true;
243  }
244 
245  else if (requestedState == G4State_Idle)
246  {
248  }
249 
250  return true;
251 }
G4GLOB_DLL std::ostream G4cout
static G4MoleculeTable * Instance()
#define G4endl
Definition: G4ios.hh:61
void PrepareMolecularConfiguration()
Here is the call graph for this function:

◆ PushMolecule()

void G4DNAChemistryManager::PushMolecule ( G4Molecule *&  molecule,
double  time,
const G4ThreeVector position,
int  parentID 
)

WARNING : In case chemistry is not activated, PushMolecule will take care of deleting the transfered molecule. Before calling this method, it is also possible to check if the chemistry is activated through IsChemistryActived(). This method will create the track corresponding to the transfered molecule and will be in charge of loading the new track to the system.

Definition at line 685 of file G4DNAChemistryManager.cc.

689 {
690  if (fWriteFile)
691  {
693 
694  *fpgOutput_tl << setw(11) << parentID << setw(10) << molecule->GetName()
695  << setw(14) << -1 << std::setprecision(2) << std::fixed
696  << setw(13) << -1 << std::setprecision(6) << std::scientific
697  << setw(22) << (position.x()) / nanometer << setw(22)
698  << (position.y()) / nanometer << setw(22)
699  << (position.z()) / nanometer;
700  *fpgOutput_tl << G4endl;
701  }
702 
703  if(fActiveChemistry)
704  {
705  G4Track* track = molecule->BuildTrack(time,position);
706  track -> SetTrackStatus(fAlive);
707  track -> SetParentID(parentID);
709  }
710  else
711  {
712  delete molecule;
713  molecule = 0;
714  }
715 }
static G4VITTrackHolder * Instance()
static const double nanometer
Definition: G4SIunits.hh:100
virtual void Push(G4Track *)
const G4String & GetName() const
Definition: G4Molecule.cc:345
double x() const
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:380
double y() const
double z() const
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal std::ofstream * fpgOutput_tl
Here is the call graph for this function:

◆ PushMoleculeAtParentTimeAndPlace()

void G4DNAChemistryManager::PushMoleculeAtParentTimeAndPlace ( G4Molecule *&  molecule,
const G4Track *  theIncomingTrack 
)

WARNING : In case chemistry is not activated, PushMoleculeAtParentTimeAndPlace will take care of deleting the transfered molecule. Before calling this method, it is also possible to check if the chemistry is activated through IsChemistryActived(). This method will create the track corresponding to the transfered molecule and will be in charge of loading the new track to the system.

Definition at line 717 of file G4DNAChemistryManager.cc.

719 {
720  if (fWriteFile)
721  {
723 
724  *fpgOutput_tl << setw(11) << theIncomingTrack->GetTrackID() << setw(10)
725  << molecule->GetName() << setw(14) << -1
726  << std::setprecision(2) << std::fixed << setw(13)
727  << theIncomingTrack->GetKineticEnergy() / eV
728  << std::setprecision(6) << std::scientific << setw(22)
729  << (theIncomingTrack->GetPosition().x()) / nanometer
730  << setw(22)
731  << (theIncomingTrack->GetPosition().y()) / nanometer
732  << setw(22)
733  << (theIncomingTrack->GetPosition().z()) / nanometer;
734  *fpgOutput_tl << G4endl;
735  }
736 
737  if(fActiveChemistry)
738  {
739  G4Track* track = molecule->BuildTrack(theIncomingTrack->GetGlobalTime(),
740  theIncomingTrack->GetPosition());
741  track -> SetTrackStatus(fAlive);
742  track -> SetParentID(theIncomingTrack->GetTrackID());
744  }
745  else
746  {
747  delete molecule;
748  molecule = 0;
749  }
750 }
static G4VITTrackHolder * Instance()
static const double nanometer
Definition: G4SIunits.hh:100
virtual void Push(G4Track *)
const G4String & GetName() const
Definition: G4Molecule.cc:345
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:380
static const double eV
Definition: G4SIunits.hh:212
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal std::ofstream * fpgOutput_tl
Here is the call graph for this function:

◆ ResetCounterWhenRunEnds()

void G4DNAChemistryManager::ResetCounterWhenRunEnds ( G4bool  resetCounterWhenRunEnds)
inline

Definition at line 211 of file G4DNAChemistryManager.hh.

212  {
213  fResetCounterWhenRunEnds = resetCounterWhenRunEnds;
214  }
Here is the call graph for this function:

◆ Run()

void G4DNAChemistryManager::Run ( )

Definition at line 293 of file G4DNAChemistryManager.cc.

294 {
295  if (fActiveChemistry)
296  {
298 
299  if (fMasterInitialized == false)
300  {
301  G4ExceptionDescription description;
302  description << "Global components were not initialized.";
303  G4Exception("G4DNAChemistryManager::Run", "MASTER_INIT", FatalException,
304  description);
305  }
306 
307  if (fpgThreadInitialized_tl == 0)
308  {
309  G4ExceptionDescription description;
310  description << "Thread local components were not initialized.";
311  G4Exception("G4DNAChemistryManager::Run", "THREAD_INIT", FatalException,
312  description);
313  }
314 
318  {
320  }
321  CloseFile();
322  }
323 }
void Process()
Definition: G4Scheduler.cc:377
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void Finalize(G4MoleculeDefinition *)
static G4Scheduler * Instance()
Definition: G4Scheduler.cc:102
static G4MoleculeCounter * Instance()
static G4MoleculeTable * Instance()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual void ResetCounter()
static G4ThreadLocal G4bool * fpgThreadInitialized_tl
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBuildPhysicsTable()

void G4DNAChemistryManager::SetBuildPhysicsTable ( bool  flag)
inline

Definition at line 203 of file G4DNAChemistryManager.hh.

◆ SetChemistryActivation()

void G4DNAChemistryManager::SetChemistryActivation ( G4bool  flag)

Definition at line 510 of file G4DNAChemistryManager.cc.

511 {
512  fActiveChemistry = flag;
513 }

◆ SetChemistryList()

void G4DNAChemistryManager::SetChemistryList ( G4VUserChemistryList chemistryList)
inline

Definition at line 263 of file G4DNAChemistryManager.hh.

264 {
265  fpUserChemistryList = chemistryList;
266  Activated();
267 }
G4VUserChemistryList * fpUserChemistryList
static void Activated(G4bool flag=true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetGlobalTemperature()

void G4DNAChemistryManager::SetGlobalTemperature ( double  temp_K)

Definition at line 752 of file G4DNAChemistryManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetNewValue()

void G4DNAChemistryManager::SetNewValue ( G4UIcommand command,
G4String  value 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 253 of file G4DNAChemistryManager.cc.

254 {
255  if (command == fpActivateChem)
256  {
258  }
259  else if (command == fpRunChem)
260  {
261  Run();
262  }
263  /*
264  else if(command == fpGridSize)
265  {
266  fDefaultGridResolution = fpGridSize->ConvertToDimensionedDouble(value);
267  }*/
268  else if (command == fpSkipReactionsFromChemList)
269  {
270  fSkipReactions = true;
271  }
272  else if(command == fpScaleForNewTemperature)
273  {
275  }
276  else if(command == fpInitChem)
277  {
278  Initialize();
280  }
281 }
G4UIcmdWithADoubleAndUnit * fpScaleForNewTemperature
G4UIcmdWithoutParameter * fpSkipReactionsFromChemList
static G4bool GetNewBoolValue(const char *paramString)
static G4double ConvertToDimensionedDouble(const char *st)
Definition: G4UIcommand.cc:451
void SetGlobalTemperature(double temp_K)
G4UIcmdWithoutParameter * fpRunChem
static void Activated(G4bool flag=true)
G4UIcmdWithoutParameter * fpInitChem
G4UIcmdWithABool * fpActivateChem
Here is the call graph for this function:

◆ SetVerbose()

void G4DNAChemistryManager::SetVerbose ( G4int  verbose)
inline

Definition at line 198 of file G4DNAChemistryManager.hh.

199  {
200  fVerbose = verbose;
201  }

◆ TagThreadForReinitialization()

void G4DNAChemistryManager::TagThreadForReinitialization ( )
inline

Definition at line 286 of file G4DNAChemistryManager.hh.

287 {
289 }
static G4ThreadLocal G4bool * fpgThreadInitialized_tl

◆ WriteInto()

void G4DNAChemistryManager::WriteInto ( const G4String ,
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 515 of file G4DNAChemistryManager.cc.

517 {
518  if (fVerbose)
519  {
520  G4cout << "G4DNAChemistryManager: Write chemical stage into "
521  << output.data() << G4endl;
522  }
523 
524  fpgOutput_tl = new std::ofstream();
525  fpgOutput_tl->open(output.data(), mode);
526  fWriteFile = true;
527  fFileInitialized = false;
528 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal std::ofstream * fpgOutput_tl
Here is the call graph for this function:

Member Data Documentation

◆ fActiveChemistry

bool G4DNAChemistryManager::fActiveChemistry
private

Definition at line 236 of file G4DNAChemistryManager.hh.

◆ fBuildPhysicsTable

G4bool G4DNAChemistryManager::fBuildPhysicsTable
private

Definition at line 248 of file G4DNAChemistryManager.hh.

◆ fFileInitialized

G4bool G4DNAChemistryManager::fFileInitialized
private

Definition at line 237 of file G4DNAChemistryManager.hh.

◆ fForceThreadReinitialization

G4bool G4DNAChemistryManager::fForceThreadReinitialization
private

Definition at line 242 of file G4DNAChemistryManager.hh.

◆ fGeometryClosed

G4bool G4DNAChemistryManager::fGeometryClosed
private

Definition at line 252 of file G4DNAChemistryManager.hh.

◆ fgInstance

G4DNAChemistryManager * G4DNAChemistryManager::fgInstance
staticprivate

Definition at line 234 of file G4DNAChemistryManager.hh.

◆ fMasterInitialized

G4bool G4DNAChemistryManager::fMasterInitialized
private

Definition at line 241 of file G4DNAChemistryManager.hh.

◆ fpActivateChem

G4UIcmdWithABool* G4DNAChemistryManager::fpActivateChem
private

Definition at line 227 of file G4DNAChemistryManager.hh.

◆ fpChemDNADirectory

G4UIdirectory* G4DNAChemistryManager::fpChemDNADirectory
private

Definition at line 226 of file G4DNAChemistryManager.hh.

◆ fpExcitationLevel

G4DNAWaterExcitationStructure* G4DNAChemistryManager::fpExcitationLevel
private

Definition at line 244 of file G4DNAChemistryManager.hh.

◆ fpgOutput_tl

G4ThreadLocal std::ofstream * G4DNAChemistryManager::fpgOutput_tl = 0
staticprivate

Definition at line 239 of file G4DNAChemistryManager.hh.

◆ fpgThreadInitialized_tl

G4ThreadLocal G4bool * G4DNAChemistryManager::fpgThreadInitialized_tl = 0
staticprivate

Definition at line 240 of file G4DNAChemistryManager.hh.

◆ fPhysicsTableBuilt

G4bool G4DNAChemistryManager::fPhysicsTableBuilt
private

Definition at line 249 of file G4DNAChemistryManager.hh.

◆ fpInitChem

G4UIcmdWithoutParameter* G4DNAChemistryManager::fpInitChem
private

Definition at line 232 of file G4DNAChemistryManager.hh.

◆ fpIonisationLevel

G4DNAWaterIonisationStructure* G4DNAChemistryManager::fpIonisationLevel
private

Definition at line 245 of file G4DNAChemistryManager.hh.

◆ fpRunChem

G4UIcmdWithoutParameter* G4DNAChemistryManager::fpRunChem
private

Definition at line 228 of file G4DNAChemistryManager.hh.

◆ fpScaleForNewTemperature

G4UIcmdWithADoubleAndUnit* G4DNAChemistryManager::fpScaleForNewTemperature
private

Definition at line 231 of file G4DNAChemistryManager.hh.

◆ fpSkipReactionsFromChemList

G4UIcmdWithoutParameter* G4DNAChemistryManager::fpSkipReactionsFromChemList
private

Definition at line 229 of file G4DNAChemistryManager.hh.

◆ fpUserChemistryList

G4VUserChemistryList* G4DNAChemistryManager::fpUserChemistryList
private

Definition at line 247 of file G4DNAChemistryManager.hh.

◆ fResetCounterWhenRunEnds

G4bool G4DNAChemistryManager::fResetCounterWhenRunEnds
private

Definition at line 255 of file G4DNAChemistryManager.hh.

◆ fSkipReactions

G4bool G4DNAChemistryManager::fSkipReactions
private

Definition at line 250 of file G4DNAChemistryManager.hh.

◆ fVerbose

G4int G4DNAChemistryManager::fVerbose
private

Definition at line 254 of file G4DNAChemistryManager.hh.

◆ fWriteFile

G4bool G4DNAChemistryManager::fWriteFile
private

Definition at line 238 of file G4DNAChemistryManager.hh.


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