Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DNAChemistryManager Class Reference

#include <G4DNAChemistryManager.hh>

Public Member Functions

void WriteInto (const G4String &, std::ios_base::openmode mode=std::ios_base::out)
 
void CloseFile ()
 
G4bool IsChemistryActived ()
 
void SetChemistryActivation (G4bool)
 
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 *)
 

Static Public Member Functions

static G4DNAChemistryManagerInstance ()
 
static void DeleteInstance ()
 

Protected Member Functions

G4DNAWaterExcitationStructureGetExcitationLevel ()
 
G4DNAWaterIonisationStructureGetIonisationLevel ()
 

Friends

class std::auto_ptr< G4DNAChemistryManager >
 

Detailed Description

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

Member Function Documentation

◆ CloseFile()

void G4DNAChemistryManager::CloseFile ( )

Close the file specified with WriteInto

Definition at line 117 of file G4DNAChemistryManager.cc.

118{
119 if (fOutput.is_open())
120 {
121 fOutput.close();
122 }
123 fWriteFile = false;
124}

◆ 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 209 of file G4DNAChemistryManager.cc.

212{
213 if(fWriteFile)
214 {
215 fOutput << setw(11)<< theIncomingTrack->GetTrackID()
216 << setw(10)<< "e_aq"
217 << setw(14)<< -1
218 << std::setprecision(2) << std::fixed
219 << setw(13)<< theIncomingTrack->GetKineticEnergy()/eV
220 << std::setprecision(6) << std::scientific
221 << setw(22)<< (theIncomingTrack->GetPosition().x())/nanometer
222 << setw(22)<< (theIncomingTrack->GetPosition().y())/nanometer
223 << setw(22)<< (theIncomingTrack->GetPosition().z())/nanometer ;
224
225 if(finalPosition != 0)
226 {
227 fOutput<< setw(14)<< (finalPosition->x())/nanometer
228 << setw(14)<< (finalPosition->y())/nanometer
229 << setw(14)<< (finalPosition->z())/nanometer ;
230 }
231
232 fOutput << G4endl;
233 }
234
235 if(fActiveChemistry)
236 {
238 G4Track * e_aqTrack(0);
239 if(finalPosition)
240 {
241 e_aqTrack = e_aq->BuildTrack(picosecond,*finalPosition);
242 }
243 else
244 {
245 e_aqTrack = e_aq->BuildTrack(picosecond,theIncomingTrack->GetPosition());
246 }
247 e_aqTrack -> SetTrackStatus(fAlive);
248 e_aqTrack -> SetParentID(theIncomingTrack->GetTrackID());
250 G4ITManager<G4Molecule>::Instance()->Push(e_aqTrack);
251 }
252}
@ fAlive
#define G4endl
Definition: G4ios.hh:52
double z() const
double x() const
double y() const
static G4Electron_aq * Definition()
static G4ITManager< T > * Instance()
virtual void PushTrack(G4Track *)
static G4ITTrackHolder * Instance()
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:279
G4int GetTrackID() const
const G4ThreeVector & GetPosition() const
G4double GetKineticEnergy() const

Referenced by G4DNASancheSolvatationModel::SampleSecondaries(), and G4DNATransformElectronModel::SampleSecondaries().

◆ 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 144 of file G4DNAChemistryManager.cc.

147{
148 if(fWriteFile)
149 {
150 G4double energy = -1.;
151
152 switch (modification)
153 {
155 energy = -1;
156 break;
157 case eExcitedMolecule :
158 energy = GetExcitationLevel()->ExcitationEnergy(electronicLevel);
159 break;
160 case eIonizedMolecule :
161 energy = GetIonisationLevel()->IonisationEnergy(electronicLevel);
162 break;
163 }
164
165 fOutput << setw(11) << left << theIncomingTrack->GetTrackID()
166 << setw(10) << "H2O"
167 << left << modification
168 << internal <<":"
169 << right <<electronicLevel
170 << left
171 << setw(11) << ""
172 << std::setprecision(2) << std::fixed
173 << setw(13) << energy/eV
174 << std::setprecision(6) << std::scientific
175 << setw(22) << (theIncomingTrack->GetPosition().x())/nanometer
176 << setw(22) << (theIncomingTrack->GetPosition().y())/nanometer
177 << setw(22) << (theIncomingTrack->GetPosition().z())/nanometer
178 << G4endl;
179 }
180
181 if(fActiveChemistry)
182 {
184
185 switch (modification)
186 {
188 H2O -> AddElectron(5,1);
189 break;
190 case eExcitedMolecule :
191 H2O -> ExciteMolecule(electronicLevel);
192 break;
193 case eIonizedMolecule :
194 H2O -> IonizeMolecule(electronicLevel);
195 break;
196 }
197
198 G4Track * H2OTrack = H2O->BuildTrack(1*picosecond,
199 theIncomingTrack->GetPosition());
200
201 H2OTrack -> SetParentID(theIncomingTrack->GetTrackID());
202 H2OTrack -> SetTrackStatus(fStopButAlive);
203 H2OTrack -> SetKineticEnergy(0.);
204
206 }
207}
@ eIonizedMolecule
@ eDissociativeAttachment
@ eExcitedMolecule
@ fStopButAlive
double G4double
Definition: G4Types.hh:64
G4DNAWaterIonisationStructure * GetIonisationLevel()
G4DNAWaterExcitationStructure * GetExcitationLevel()
static G4H2O * Definition()
Definition: G4H2O.cc:46

Referenced by G4DNABornExcitationModel::SampleSecondaries(), G4DNABornIonisationModel::SampleSecondaries(), G4DNAEmfietzoglouExcitationModel::SampleSecondaries(), G4DNAMeltonAttachmentModel::SampleSecondaries(), G4DNAMillerGreenExcitationModel::SampleSecondaries(), G4DNARuddIonisationExtendedModel::SampleSecondaries(), and G4DNARuddIonisationModel::SampleSecondaries().

◆ DeleteInstance()

void G4DNAChemistryManager::DeleteInstance ( )
static

You should rather use DeleteInstance than the destructor of this class

Definition at line 85 of file G4DNAChemistryManager.cc.

86{
87 if(fInstance.get())
88 fInstance.reset();
89}

Referenced by G4EmDNAPhysicsChemistry::~G4EmDNAPhysicsChemistry().

◆ GetExcitationLevel()

G4DNAWaterExcitationStructure * G4DNAChemistryManager::GetExcitationLevel ( )
protected

Definition at line 126 of file G4DNAChemistryManager.cc.

127{
128 if(!fExcitationLevel)
129 {
130 fExcitationLevel = new G4DNAWaterExcitationStructure;
131 }
132 return fExcitationLevel;
133}

Referenced by CreateWaterMolecule().

◆ GetIonisationLevel()

G4DNAWaterIonisationStructure * G4DNAChemistryManager::GetIonisationLevel ( )
protected

Definition at line 135 of file G4DNAChemistryManager.cc.

136{
137 if(!fIonisationLevel)
138 {
139 fIonisationLevel = new G4DNAWaterIonisationStructure;
140 }
141 return fIonisationLevel;
142}

Referenced by CreateWaterMolecule().

◆ Instance()

◆ IsChemistryActived()

G4bool G4DNAChemistryManager::IsChemistryActived ( )
inline

Definition at line 154 of file G4DNAChemistryManager.hh.

155{
156 return fActiveChemistry;
157}

◆ 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 255 of file G4DNAChemistryManager.cc.

257{
258 if(fWriteFile)
259 {
260 fOutput << setw(11)<< parentID
261 << setw(10)<< molecule->GetName()
262 << setw(14)<< -1
263 << std::setprecision(2) << std::fixed
264 << setw(13)<< -1
265 << std::setprecision(6) << std::scientific
266 << setw(22)<< (position.x())/nanometer
267 << setw(22)<< (position.y())/nanometer
268 << setw(22)<< (position.z())/nanometer;
269 fOutput << G4endl;
270 }
271
272 if(fActiveChemistry)
273 {
274 G4Track* track = molecule->BuildTrack(time,position);
275 track -> SetTrackStatus(fAlive);
276 track -> SetParentID(parentID);
279 }
280 else
281 {
282 delete molecule;
283 molecule = 0;
284 }
285}
const G4String & GetName() const
Definition: G4Molecule.cc:259

◆ 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 287 of file G4DNAChemistryManager.cc.

289{
290 if(fWriteFile)
291 {
292 fOutput << setw(11)<< theIncomingTrack->GetTrackID()
293 << setw(10)<< molecule->GetName()
294 << setw(14)<< -1
295 << std::setprecision(2) << std::fixed
296 << setw(13)<< theIncomingTrack->GetKineticEnergy()/eV
297 << std::setprecision(6) << std::scientific
298 << setw(22)<< (theIncomingTrack->GetPosition().x())/nanometer
299 << setw(22)<< (theIncomingTrack->GetPosition().y())/nanometer
300 << setw(22)<< (theIncomingTrack->GetPosition().z())/nanometer ;
301 fOutput << G4endl;
302 }
303
304 if(fActiveChemistry)
305 {
306 G4Track* track = molecule->BuildTrack(theIncomingTrack->GetGlobalTime(),theIncomingTrack->GetPosition());
307 track -> SetTrackStatus(fAlive);
308 track -> SetParentID(theIncomingTrack->GetTrackID());
311 }
312 else
313 {
314 delete molecule;
315 molecule = 0;
316 }
317}
G4double GetGlobalTime() const

◆ SetChemistryActivation()

void G4DNAChemistryManager::SetChemistryActivation ( G4bool  flag)
inline

Definition at line 159 of file G4DNAChemistryManager.hh.

160{
161 fActiveChemistry = flag;
162}

Referenced by G4EmDNAPhysicsChemistry::ConstructProcess().

◆ 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 91 of file G4DNAChemistryManager.cc.

93{
94 fOutput.open(output.data(), mode);
95 fOutput << std::setprecision(6) << std::scientific;
96
97 fOutput << setw(11) << left << "#Parent ID"
98 << setw(10) << "Molecule"
99 << setw(14) << "Elec Modif"
100 << setw(13) << "Energy (eV)"
101 << setw(22) << "X pos of parent [nm]"
102 << setw(22) << "Y pos of parent [nm]"
103 << setw(22) << "Z pos of parent [nm]"
104 << setw(14) << "X pos [nm]"
105 << setw(14) << "Y pos [nm]"
106 << setw(14) << "Z pos [nm]"
107 << G4endl
108 << setw(21) << "#"
109 << setw(13) << "1)io/ex=0/1"
110 << G4endl
111 << setw(21) << "#"
112 << setw(13) << "2)level=0...5"
113 << G4endl;
114 fWriteFile = true;
115}

Friends And Related Function Documentation

◆ std::auto_ptr< G4DNAChemistryManager >

friend class std::auto_ptr< G4DNAChemistryManager >
friend

Definition at line 159 of file G4DNAChemistryManager.hh.

Referenced by Instance().


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