Geant4-11
Public Member Functions | Protected Attributes
G4PhysChemIO::FormattedText Class Reference

#include <G4PhysChemIO.hh>

Inheritance diagram for G4PhysChemIO::FormattedText:
G4VPhysChemIO

Public Member Functions

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

Protected Attributes

G4int fEventID
 
G4bool fFileInitialized
 
std::ofstream fOfstream
 
G4int fRunID
 

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.

References fEventID, fFileInitialized, and fRunID.

◆ ~FormattedText()

G4PhysChemIO::FormattedText::~FormattedText ( )
virtual

Definition at line 52 of file G4PhysChemIO.cc.

52 {
53 CloseFile();
54}

References CloseFile().

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

References fFileInitialized, fOfstream, and G4endl.

◆ 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}

References fFileInitialized, and fOfstream.

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}
static constexpr double eV
Definition: G4SIunits.hh:201
static constexpr double nanometer
Definition: G4SIunits.hh:81
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

References eV, fFileInitialized, fOfstream, G4endl, G4Track::GetKineticEnergy(), G4Track::GetPosition(), G4Track::GetTrackID(), InitializeFile(), nanometer, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

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

References G4INCL::KinematicsUtils::energy(), eV, fFileInitialized, fOfstream, G4endl, G4Track::GetPosition(), G4Track::GetTrackID(), InitializeFile(), nanometer, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ 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}

References fFileInitialized, fOfstream, and G4endl.

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}

References fFileInitialized, and fOfstream.

Field 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: