Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PhysChemIO::FormattedText Class Reference

#include <G4PhysChemIO.hh>

+ Inheritance diagram for G4PhysChemIO::FormattedText:

Public Member Functions

 FormattedText ()
 
virtual ~FormattedText ()
 
virtual void InitializeMaster ()
 
virtual void InitializeThread ()
 
virtual void InitializeFile ()
 
virtual void NewRun ()
 
virtual void NewEvent ()
 
virtual void CreateWaterMolecule (G4int electronicModif, G4int, G4double energy, const G4Track *)
 
virtual void CreateSolvatedElectron (const G4Track *, G4ThreeVector *finalPosition=0)
 
virtual void WriteInto (const G4String &, std::ios_base::openmode mode=std::ios_base::out)
 
virtual void AddEmptyLineInOutputFile ()
 
virtual void CloseFile ()
 
- Public Member Functions inherited from G4VPhysChemIO
 G4VPhysChemIO ()
 
virtual ~G4VPhysChemIO ()
 
virtual void InitializeMaster ()
 
virtual void InitializeThread ()
 
virtual void InitializeFile ()=0
 
virtual void NewRun ()=0
 
virtual void NewEvent ()=0
 
virtual void CreateWaterMolecule (G4int electronicModif, G4int, G4double energy, const G4Track *)=0
 
virtual void CreateSolvatedElectron (const G4Track *, G4ThreeVector *finalPosition=0)=0
 
virtual void WriteInto (const G4String &, std::ios_base::openmode mode=std::ios_base::out)=0
 
virtual void AddEmptyLineInOutputFile ()
 
virtual void CloseFile ()=0
 

Protected Attributes

G4int fRunID
 
G4int fEventID
 
G4bool fFileInitialized
 
std::ofstream fOfstream
 

Detailed Description

Definition at line 40 of file G4PhysChemIO.hh.

Constructor & Destructor Documentation

◆ FormattedText()

G4PhysChemIO::FormattedText::FormattedText ( )

Definition at line 44 of file G4PhysChemIO.cc.

◆ ~FormattedText()

G4PhysChemIO::FormattedText::~FormattedText ( )
virtual

Definition at line 52 of file G4PhysChemIO.cc.

52 {
53 CloseFile();
54}

Member Function Documentation

◆ AddEmptyLineInOutputFile()

void G4PhysChemIO::FormattedText::AddEmptyLineInOutputFile ( )
virtual

Reimplemented from G4VPhysChemIO.

Definition at line 89 of file G4PhysChemIO.cc.

90{
92}
#define G4endl
Definition: G4ios.hh:57

◆ CloseFile()

void G4PhysChemIO::FormattedText::CloseFile ( )
virtual

Close the file specified with WriteInto

Implements G4VPhysChemIO.

Definition at line 96 of file G4PhysChemIO.cc.

97{
98 if (fFileInitialized == false) return;
99
100 if (fOfstream.is_open())
101 {
102 fOfstream.close();
103 }
104}

Referenced by ~FormattedText().

◆ CreateSolvatedElectron()

void G4PhysChemIO::FormattedText::CreateSolvatedElectron ( const G4Track theIncomingTrack,
G4ThreeVector finalPosition = 0 
)
virtual

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

Implements G4VPhysChemIO.

Definition at line 131 of file G4PhysChemIO.cc.

133{
135
136 fOfstream << setw(11) << theIncomingTrack->GetTrackID() << setw(10)
137 << "e_aq" << setw(14) << -1 << std::setprecision(2)
138 << std::fixed << setw(13)
139 << theIncomingTrack->GetKineticEnergy() / eV
140 << std::setprecision(6) << std::scientific << setw(22)
141 << (theIncomingTrack->GetPosition().x()) / nanometer
142 << setw(22)
143 << (theIncomingTrack->GetPosition().y()) / nanometer
144 << setw(22)
145 << (theIncomingTrack->GetPosition().z()) / nanometer;
146
147 if (finalPosition != 0)
148 {
149 fOfstream << setw(14) << (finalPosition->x()) / nanometer << setw(14)
150 << (finalPosition->y()) / nanometer << setw(14)
151 << (finalPosition->z()) / nanometer;
152 }
153
154 fOfstream << G4endl;
155}
double z() const
double x() const
double y() const
virtual void InitializeFile()
Definition: G4PhysChemIO.cc:58
G4int GetTrackID() const
const G4ThreeVector & GetPosition() const
G4double GetKineticEnergy() const

◆ CreateWaterMolecule()

void G4PhysChemIO::FormattedText::CreateWaterMolecule ( G4int  electronicModif,
G4int  electronicLevel,
G4double  energy,
const G4Track theIncomingTrack 
)
virtual

When DNA physics model create a water molecule, you'll get a notification through this method. 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...)

Implements G4VPhysChemIO.

Definition at line 108 of file G4PhysChemIO.cc.

112{
114
115 fOfstream << setw(11) << left << theIncomingTrack->GetTrackID()
116 << setw(10) << "H2O" << left << modification << internal
117 << ":" << right << electronicLevel << left << setw(11) << ""
118 << std::setprecision(2) << std::fixed << setw(13)
119 << energy / eV << std::setprecision(6) << std::scientific
120 << setw(22)
121 << (theIncomingTrack->GetPosition().x()) / nanometer
122 << setw(22)
123 << (theIncomingTrack->GetPosition().y()) / nanometer
124 << setw(22)
125 << (theIncomingTrack->GetPosition().z()) / nanometer
126 << G4endl;
127}
G4double energy(const ThreeVector &p, const G4double m)

◆ InitializeFile()

void G4PhysChemIO::FormattedText::InitializeFile ( )
virtual

Implements G4VPhysChemIO.

Definition at line 58 of file G4PhysChemIO.cc.

59{
60 if(fFileInitialized) return;
61
62 fOfstream << std::setprecision(6) << std::scientific;
63 fOfstream << setw(11) << left << "#Parent ID" << setw(10) << "Molecule"
64 << setw(14) << "Elec Modif" << setw(13) << "Energy (eV)"
65 << setw(22) << "X pos of parent [nm]" << setw(22)
66 << "Y pos of parent [nm]" << setw(22) << "Z pos of parent [nm]"
67 << setw(14) << "X pos [nm]" << setw(14) << "Y pos [nm]"
68 << setw(14) << "Z pos [nm]" << G4endl<< setw(21) << "#"
69 << setw(13) << "1)io/ex=0/1"
70 << G4endl
71 << setw(21) << "#"
72 << setw(13) << "2)level=0...5"
73 << G4endl;
74
75 fFileInitialized = true;
76}

Referenced by CreateSolvatedElectron(), and CreateWaterMolecule().

◆ InitializeMaster()

virtual void G4PhysChemIO::FormattedText::InitializeMaster ( )
inlinevirtual

Reimplemented from G4VPhysChemIO.

Definition at line 46 of file G4PhysChemIO.hh.

46{}

◆ InitializeThread()

virtual void G4PhysChemIO::FormattedText::InitializeThread ( )
inlinevirtual

Reimplemented from G4VPhysChemIO.

Definition at line 47 of file G4PhysChemIO.hh.

47{}

◆ NewEvent()

virtual void G4PhysChemIO::FormattedText::NewEvent ( )
inlinevirtual

Implements G4VPhysChemIO.

Definition at line 51 of file G4PhysChemIO.hh.

51{}

◆ NewRun()

virtual void G4PhysChemIO::FormattedText::NewRun ( )
inlinevirtual

Implements G4VPhysChemIO.

Definition at line 50 of file G4PhysChemIO.hh.

50{}

◆ WriteInto()

void G4PhysChemIO::FormattedText::WriteInto ( const G4String ,
std::ios_base::openmode  mode = std::ios_base::out 
)
virtual

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

Implements G4VPhysChemIO.

Definition at line 80 of file G4PhysChemIO.cc.

82{
83 fOfstream.open(output.data(), mode);
84 fFileInitialized = false;
85}

Member Data Documentation

◆ fEventID

G4int G4PhysChemIO::FormattedText::fEventID
protected

Definition at line 94 of file G4PhysChemIO.hh.

Referenced by FormattedText().

◆ fFileInitialized

G4bool G4PhysChemIO::FormattedText::fFileInitialized
protected

◆ fOfstream

std::ofstream G4PhysChemIO::FormattedText::fOfstream
protected

◆ fRunID

G4int G4PhysChemIO::FormattedText::fRunID
protected

Definition at line 93 of file G4PhysChemIO.hh.

Referenced by FormattedText().


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