32#include "G4SystemOfUnits.hh"
34#include "DetectorConstruction.hh"
51 fPath =
"RadioBio_Dose.out";
71 if (
fVerboseLevel > 0) G4cout <<
"Dose::Initialize() called" << G4endl;
75 fEnDep.resize(VoxelNumber);
76 fDose.resize(VoxelNumber);
87 G4cout <<
"Dose::Compute() called but skipped as calculation not enabled" << G4endl;
94 if (
fVerboseLevel > 0) G4cout <<
"Dose::Compute() called" << G4endl;
98 if (voxSensDet ==
nullptr)
99 G4Exception(
"Dose::Compute",
"VoxNotInit", FatalException,
100 "Calculating dose without voxelized geometry pointer!");
102 G4double voxelMass = voxSensDet->GetVoxelMass();
104 for (G4int v = 0; v < voxSensDet->GetTotalVoxelNumber(); v++) {
105 if (
fVerboseLevel > 1) G4cout <<
"Calculating Dose for voxel number " << v << G4endl;
121 G4cout <<
"Dose::Store() called but skipped as calculation not enabled" << G4endl;
127 G4Exception(
"Dose::Store",
"DoseOverwrite", JustWarning,
128 "Overwriting Dose file. For multiple runs, change filename.");
132 std::ofstream ofs(
fPath);
135 ofs <<
"x_index" << std::setw(
width) <<
"y_index" << std::setw(
width) <<
"z_index"
136 << std::setw(
width) <<
"Dose (Gy)" << G4endl;
140 for (G4int i = 0; i < voxSensDet->GetVoxelNumberAlongX(); i++)
141 for (G4int j = 0; j < voxSensDet->GetVoxelNumberAlongY(); j++)
142 for (G4int k = 0; k < voxSensDet->GetVoxelNumberAlongZ(); k++) {
143 G4int v = voxSensDet->GetThisVoxelNumber(i, j, k);
144 ofs << i << std::setw(
width) << j << std::setw(
width) << k << std::setw(
width)
145 <<
fDose[v] / gray << G4endl;
149 G4cout <<
"Dose: Dose written to " <<
fPath << G4endl;
168 G4cout <<
"Dose::Reset(): ";
179 G4cout <<
"*******************************************" << G4endl
180 <<
"****** Parameters of the class Dose *******" << G4endl
181 <<
"*******************************************" << G4endl;
Definition of the RadioBio::DoseAccumulable class.
Definition of the RadioBio::DoseMessenger class.
Definition of the RadioBio::Dose class.
Definition of the RadioBio::VoxelizedSensitiveDetector class.
Accumulable of Dose-related data (that must be thread-local).
const array_type GetEnDeposit() const
void Initialize() override
void AddFromAccumulable(G4VAccumulable *) override
void AddEnergyDeposit(const array_type Dep)
void PrintParameters() override
void PrintVirtualParameters()
G4bool fCalculationEnabled
G4UImessenger * fMessenger
static VoxelizedSensitiveDetector * GetInstance()
Static method to retrieve a pointer to the only object existing in the simulation.
G4int GetTotalVoxelNumber() const
Method to get the total voxel number.