Geant4 11.2.2
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 ()
 
 ~FormattedText () override
 
void InitializeMaster () override
 
void InitializeThread () override
 
void InitializeFile () override
 
void NewRun () override
 
void NewEvent () override
 
void CreateWaterMolecule (G4int electronicModif, G4int, G4double energy, const G4Track *) override
 
void CreateSolvatedElectron (const G4Track *, G4ThreeVector *finalPosition=nullptr) override
 
void WriteInto (const G4String &, std::ios_base::openmode mode=std::ios_base::out) override
 
void AddEmptyLineInOutputFile () override
 
void CloseFile () override
 
- Public Member Functions inherited from G4VPhysChemIO
 G4VPhysChemIO ()
 
virtual ~G4VPhysChemIO ()
 

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 ( )
override

Definition at line 52 of file G4PhysChemIO.cc.

52 {
53 CloseFile();
54}

Member Function Documentation

◆ AddEmptyLineInOutputFile()

void G4PhysChemIO::FormattedText::AddEmptyLineInOutputFile ( )
overridevirtual

Reimplemented from G4VPhysChemIO.

Definition at line 89 of file G4PhysChemIO.cc.

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

◆ CloseFile()

void G4PhysChemIO::FormattedText::CloseFile ( )
overridevirtual

Close the file specified with WriteInto

Implements G4VPhysChemIO.

Definition at line 96 of file G4PhysChemIO.cc.

97{
98 if (!fFileInitialized) 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 = nullptr )
overridevirtual

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 != nullptr)
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
void InitializeFile() override
G4int GetTrackID() const
const G4ThreeVector & GetPosition() const
G4double GetKineticEnergy() const

◆ CreateWaterMolecule()

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

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 ( )
overridevirtual

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()

void G4PhysChemIO::FormattedText::InitializeMaster ( )
inlineoverridevirtual

Reimplemented from G4VPhysChemIO.

Definition at line 46 of file G4PhysChemIO.hh.

46{}

◆ InitializeThread()

void G4PhysChemIO::FormattedText::InitializeThread ( )
inlineoverridevirtual

Reimplemented from G4VPhysChemIO.

Definition at line 47 of file G4PhysChemIO.hh.

47{}

◆ NewEvent()

void G4PhysChemIO::FormattedText::NewEvent ( )
inlineoverridevirtual

Implements G4VPhysChemIO.

Definition at line 51 of file G4PhysChemIO.hh.

51{}

◆ NewRun()

void G4PhysChemIO::FormattedText::NewRun ( )
inlineoverridevirtual

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 )
overridevirtual

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: