Import Geant4 10.6.0.beta source tree
This commit is contained in:
@@ -44,8 +44,7 @@
|
||||
// J. Comput. Phys. 274 (2014) 841-882
|
||||
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
|
||||
|
||||
#ifndef G4DNACHEMISTRYMANAGER_HH
|
||||
#define G4DNACHEMISTRYMANAGER_HH
|
||||
#pragma once
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
@@ -62,14 +61,15 @@ class G4VUserChemistryList;
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4ITGun;
|
||||
class G4VPhysChemIO;
|
||||
|
||||
enum ElectronicModification
|
||||
{
|
||||
eIonizedMolecule,
|
||||
eExcitedMolecule,
|
||||
eDissociativeAttachment
|
||||
eIonizedMolecule,
|
||||
eExcitedMolecule,
|
||||
eDissociativeAttachment
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -84,217 +84,172 @@ enum ElectronicModification
|
||||
* The user can also ask to create a file containing a information about the
|
||||
* creation of water molecules and solvated electrons.
|
||||
*/
|
||||
|
||||
class G4DNAChemistryManager: public G4UImessenger,
|
||||
public G4VStateDependent
|
||||
{
|
||||
protected:
|
||||
virtual ~G4DNAChemistryManager();
|
||||
~G4DNAChemistryManager() override;
|
||||
|
||||
public:
|
||||
//============================================================================
|
||||
// STATIC METHODS
|
||||
//============================================================================
|
||||
static G4DNAChemistryManager* Instance();
|
||||
static G4DNAChemistryManager* GetInstanceIfExists();
|
||||
//============================================================================
|
||||
// STATIC METHODS
|
||||
//============================================================================
|
||||
static G4DNAChemistryManager* Instance();
|
||||
static G4DNAChemistryManager* GetInstanceIfExists();
|
||||
|
||||
/**
|
||||
* You should rather use DeleteInstance than the destructor of this class
|
||||
*/
|
||||
static void DeleteInstance();
|
||||
G4bool IsChemistryActivated();
|
||||
void SetChemistryActivation(G4bool);
|
||||
static G4bool IsActivated();
|
||||
static void Activated(G4bool flag = true);
|
||||
static void DeleteInstance();
|
||||
static G4bool IsActivated();
|
||||
|
||||
//============================================================================
|
||||
// VIRTUAL METHODS
|
||||
//============================================================================
|
||||
virtual G4bool Notify(G4ApplicationState requestedState);
|
||||
virtual void SetNewValue(G4UIcommand*, G4String);
|
||||
virtual G4String GetCurrentValue(G4UIcommand * command);
|
||||
//============================================================================
|
||||
// VIRTUAL METHODS
|
||||
//============================================================================
|
||||
// G4VStateDependent
|
||||
G4bool Notify(G4ApplicationState requestedState) override;
|
||||
// G4UImessenger
|
||||
void SetNewValue(G4UIcommand*, G4String) override;
|
||||
G4String GetCurrentValue(G4UIcommand* pCommand) override;
|
||||
|
||||
//============================================================================
|
||||
// INITIALIZATION AND FINALIZATION METHODS
|
||||
//============================================================================
|
||||
void Initialize();
|
||||
inline void SetChemistryList(G4VUserChemistryList*);
|
||||
inline void Deregister(G4VUserChemistryList*);
|
||||
void SetGlobalTemperature(G4double temp_K);
|
||||
//============================================================================
|
||||
// INITIALIZATION AND FINALIZATION METHODS
|
||||
//============================================================================
|
||||
G4bool IsChemistryActivated();
|
||||
void SetChemistryActivation(G4bool);
|
||||
|
||||
inline void ForceMasterReinitialization();
|
||||
inline void TagThreadForReinitialization();
|
||||
/** Chemistry list is managed outside the chemistry manager (eg. constructor). */
|
||||
void SetChemistryList(G4VUserChemistryList&);
|
||||
|
||||
void Run();
|
||||
void Clear();
|
||||
void Gun(G4ITGun*, bool physicsTableToBuild = true);
|
||||
inline void ForceThreadReinitialization();
|
||||
inline void ForceRebuildingPhysicsTable();
|
||||
/** Not a constructor or when used in standalone? Prefer this method. */
|
||||
void SetChemistryList(std::unique_ptr<G4VUserChemistryList>);
|
||||
|
||||
//============================================================================
|
||||
// FILE OPERATIONS
|
||||
//============================================================================
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
void WriteInto(const G4String&, std::ios_base::openmode mode =
|
||||
std::ios_base::out);
|
||||
void AddEmptyLineInOuputFile();
|
||||
// [[deprecated]] : chemistry list should never be nullptr
|
||||
void SetChemistryList(G4VUserChemistryList*);
|
||||
|
||||
/**
|
||||
* Close the file specified with WriteInto
|
||||
*/
|
||||
void CloseFile();
|
||||
void Deregister(G4VUserChemistryList&);
|
||||
|
||||
//============================================================================
|
||||
// PUSH MOLECULES
|
||||
//============================================================================
|
||||
/**
|
||||
* 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...).
|
||||
*/
|
||||
void CreateWaterMolecule(ElectronicModification,
|
||||
G4int /*electronicLevel*/,
|
||||
const G4Track* /*theIncomingTrack*/);
|
||||
void Initialize();
|
||||
void Run();
|
||||
void Clear();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
void CreateSolvatedElectron(const G4Track* /*theIncomingTrack*/,
|
||||
G4ThreeVector* finalPosition = 0);
|
||||
/**
|
||||
* @brief Inject custom species to the simulation
|
||||
* @details 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.
|
||||
*/
|
||||
void SetGun(G4ITGun* pChemSpeciesGun);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
void SetPhysChemIO(std::unique_ptr<G4VPhysChemIO> pPhysChemIO);
|
||||
|
||||
void PushMolecule(G4Molecule*& molecule,
|
||||
G4double time,
|
||||
const G4ThreeVector& position,
|
||||
G4int parentID);
|
||||
void SetVerbose(G4int verbose);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
void PushMoleculeAtParentTimeAndPlace(G4Molecule*& molecule,
|
||||
const G4Track* /*theIncomingTrack*/);
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
void UseAsStandalone(G4bool flag);
|
||||
G4bool IsCounterResetWhenRunEnds() const;
|
||||
|
||||
void ResetCounterWhenRunEnds(G4bool resetCounterWhenRunEnds);
|
||||
|
||||
inline void SetVerbose(G4int verbose)
|
||||
{
|
||||
fVerbose = verbose;
|
||||
}
|
||||
void ForceMasterReinitialization();
|
||||
void TagThreadForReinitialization();
|
||||
void ForceThreadReinitialization();
|
||||
void ForceRebuildingPhysicsTable();
|
||||
|
||||
inline void SetBuildPhysicsTable(G4bool flag)
|
||||
{fBuildPhysicsTable = flag;}
|
||||
//============================================================================
|
||||
// FILE OPERATIONS
|
||||
//============================================================================
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
void WriteInto(const G4String&, std::ios_base::openmode mode =
|
||||
std::ios_base::out);
|
||||
void AddEmptyLineInOutputFile();
|
||||
|
||||
G4bool IsCounterResetWhenRunEnds() const
|
||||
{
|
||||
return fResetCounterWhenRunEnds;
|
||||
}
|
||||
/**
|
||||
* Close the file specified with WriteInto
|
||||
*/
|
||||
void CloseFile();
|
||||
|
||||
void ResetCounterWhenRunEnds(G4bool resetCounterWhenRunEnds)
|
||||
{
|
||||
fResetCounterWhenRunEnds = resetCounterWhenRunEnds;
|
||||
}
|
||||
//============================================================================
|
||||
// PUSH MOLECULES
|
||||
//============================================================================
|
||||
/**
|
||||
* 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...).
|
||||
*/
|
||||
void CreateWaterMolecule(ElectronicModification,
|
||||
G4int /*electronicLevel*/,
|
||||
const G4Track* /*pIncomingTrack*/);
|
||||
|
||||
/**
|
||||
* This method should be used by the physics model of the ElectronSolvatation
|
||||
* process.
|
||||
*/
|
||||
void CreateSolvatedElectron(const G4Track* /*pIncomingTrack*/,
|
||||
G4ThreeVector* pFinalPosition = nullptr);
|
||||
|
||||
void PushMolecule(std::unique_ptr<G4Molecule> pMolecule,
|
||||
G4double time,
|
||||
const G4ThreeVector& position,
|
||||
G4int parentID);
|
||||
|
||||
void SetPhysChemIO(G4VPhysChemIO* physChemIO);
|
||||
|
||||
protected:
|
||||
G4DNAWaterExcitationStructure* GetExcitationLevel();
|
||||
G4DNAWaterIonisationStructure* GetIonisationLevel();
|
||||
void InitializeFile();
|
||||
void InitializeMaster();
|
||||
void InitializeThread();
|
||||
void HandleStandaloneInitialization();
|
||||
void PushTrack(G4Track*);
|
||||
void SetGlobalTemperature(G4double temperatureKelvin);
|
||||
|
||||
G4DNAChemistryManager();
|
||||
G4DNAWaterExcitationStructure* GetExcitationLevel();
|
||||
G4DNAWaterIonisationStructure* GetIonisationLevel();
|
||||
void InitializeFile();
|
||||
void InitializeMaster();
|
||||
void InitializeThread();
|
||||
void InitializeThreadSharedData();
|
||||
|
||||
G4DNAChemistryManager();
|
||||
|
||||
private:
|
||||
G4UIdirectory* fpChemDNADirectory;
|
||||
G4UIcmdWithABool* fpActivateChem;
|
||||
G4UIcmdWithoutParameter* fpRunChem;
|
||||
G4UIcmdWithoutParameter* fpSkipReactionsFromChemList;
|
||||
//G4UIcmdWithADoubleAndUnit* fpGridSize; // not used in release
|
||||
G4UIcmdWithADoubleAndUnit* fpScaleForNewTemperature;
|
||||
G4UIcmdWithoutParameter* fpInitChem;
|
||||
|
||||
static G4DNAChemistryManager* fgInstance;
|
||||
G4bool fActiveChemistry;
|
||||
|
||||
struct ThreadLocalData{
|
||||
ThreadLocalData();
|
||||
~ThreadLocalData();
|
||||
G4VPhysChemIO* fpPhysChemIO;
|
||||
G4bool fThreadInitialized_tl;
|
||||
};
|
||||
|
||||
static G4ThreadLocal ThreadLocalData* fpThreadData;
|
||||
|
||||
G4bool fMasterInitialized;
|
||||
G4bool fForceThreadReinitialization;
|
||||
std::unique_ptr<G4UIdirectory> fpChemDNADirectory;
|
||||
std::unique_ptr<G4UIcmdWithABool> fpActivateChem;
|
||||
std::unique_ptr<G4UIcmdWithAnInteger> fpRunChem;
|
||||
std::unique_ptr<G4UIcmdWithoutParameter> fpSkipReactionsFromChemList;
|
||||
std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpScaleForNewTemperature;
|
||||
std::unique_ptr<G4UIcmdWithoutParameter> fpInitChem;
|
||||
|
||||
G4DNAWaterExcitationStructure* fpExcitationLevel;
|
||||
G4DNAWaterIonisationStructure* fpIonisationLevel;
|
||||
static G4DNAChemistryManager* fgInstance;
|
||||
G4bool fActiveChemistry;
|
||||
|
||||
G4VUserChemistryList* fpUserChemistryList;
|
||||
G4bool fBuildPhysicsTable;
|
||||
G4bool fPhysicsTableBuilt;
|
||||
G4bool fSkipReactions;
|
||||
struct ThreadLocalData{
|
||||
ThreadLocalData();
|
||||
~ThreadLocalData();
|
||||
std::unique_ptr<G4VPhysChemIO> fpPhysChemIO;
|
||||
G4bool fThreadInitialized = false;
|
||||
};
|
||||
|
||||
G4bool fGeometryClosed;
|
||||
static G4ThreadLocal ThreadLocalData* fpThreadData;
|
||||
|
||||
G4int fVerbose;
|
||||
G4bool fResetCounterWhenRunEnds;
|
||||
G4bool fMasterInitialized;
|
||||
G4bool fForceThreadReinitialization;
|
||||
|
||||
std::unique_ptr<G4DNAWaterExcitationStructure> fpExcitationLevel;
|
||||
std::unique_ptr<G4DNAWaterIonisationStructure> fpIonisationLevel;
|
||||
|
||||
std::unique_ptr<G4VUserChemistryList> fpUserChemistryList;
|
||||
G4bool fOwnChemistryList;
|
||||
G4bool fUseInStandalone;
|
||||
G4bool fPhysicsTableBuilt;
|
||||
G4bool fSkipReactions;
|
||||
|
||||
G4bool fGeometryClosed;
|
||||
|
||||
G4int fVerbose;
|
||||
G4bool fResetCounterWhenRunEnds;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline void G4DNAChemistryManager::ForceRebuildingPhysicsTable()
|
||||
{
|
||||
fPhysicsTableBuilt = false;
|
||||
}
|
||||
|
||||
inline void G4DNAChemistryManager::SetChemistryList(G4VUserChemistryList* chemistryList)
|
||||
{
|
||||
fpUserChemistryList = chemistryList;
|
||||
Activated();
|
||||
}
|
||||
|
||||
inline void G4DNAChemistryManager::Deregister(G4VUserChemistryList* chemistryList)
|
||||
{
|
||||
if (fpUserChemistryList == chemistryList) fpUserChemistryList = 0;
|
||||
}
|
||||
|
||||
inline void G4DNAChemistryManager::ForceMasterReinitialization()
|
||||
{
|
||||
fMasterInitialized = false;
|
||||
InitializeMaster();
|
||||
}
|
||||
|
||||
inline void G4DNAChemistryManager::ForceThreadReinitialization()
|
||||
{
|
||||
fForceThreadReinitialization = true;
|
||||
}
|
||||
|
||||
inline void G4DNAChemistryManager::TagThreadForReinitialization()
|
||||
{
|
||||
fpThreadData->fThreadInitialized_tl = false;
|
||||
}
|
||||
|
||||
#endif // G4DNACHEMISTRYMANAGER_HH
|
||||
|
||||
Reference in New Issue
Block a user