Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
RadioBio::Dose Class Reference

#include <Doxymodules_medical.h>

Inheritance diagram for RadioBio::Dose:
RadioBio::VRadiobiologicalQuantity

Public Member Functions

 Dose ()
 
 ~Dose () override
 
void AddFromAccumulable (G4VAccumulable *) override
 
void Initialize () override
 
void Compute () override
 
void Reset () override
 
void Store () override
 
void PrintParameters () override
 
array_type GetDose () const
 
- Public Member Functions inherited from RadioBio::VRadiobiologicalQuantity
 VRadiobiologicalQuantity ()
 
virtual ~VRadiobiologicalQuantity ()
 
G4bool IsCalculationEnabled () const
 
G4bool HasBeenCalculated () const
 
void SetCalculationEnabled (G4bool enabled)
 
void SetVerboseLevel (G4int level)
 
G4int GetVerboseLevel () const
 
void SetPath (G4String fN)
 
void PrintVirtualParameters ()
 

Private Member Functions

void SetEnergyDeposit (const array_type Dep)
 
void AddEnergyDeposit (const array_type Dep)
 

Private Attributes

array_type fEnDep = {}
 
array_type fDose = {}
 

Friends

class RBE
 

Additional Inherited Members

- Public Types inherited from RadioBio::VRadiobiologicalQuantity
using array_type = std::valarray< G4double >
 
- Protected Attributes inherited from RadioBio::VRadiobiologicalQuantity
G4UImessengerfMessenger = nullptr
 
G4int fVerboseLevel = 1
 
G4bool fInitialized = false
 
G4bool fSaved = false
 
G4bool fCalculated = false
 
G4String fPath
 
G4bool fCalculationEnabled = false
 

Detailed Description

Definition at line 129 of file Doxymodules_medical.h.

Constructor & Destructor Documentation

◆ Dose()

RadioBio::Dose::Dose ( )

Definition at line 48 of file Dose.cc.

49{
50 // Default output filename
51 fPath = "RadioBio_Dose.out";
52
53 // Create the messenger
54 fMessenger = new DoseMessenger(this);
55
56 // Initialize the class
57 Initialize();
58}
void Initialize() override
Definition Dose.cc:69

◆ ~Dose()

RadioBio::Dose::~Dose ( )
override

Definition at line 62 of file Dose.cc.

63{
64 delete fMessenger;
65}

Member Function Documentation

◆ AddFromAccumulable()

void RadioBio::Dose::AddFromAccumulable ( G4VAccumulable GenAcc)
overridevirtual

Implements RadioBio::VRadiobiologicalQuantity.

Definition at line 156 of file Dose.cc.

157{
158 DoseAccumulable* acc = (DoseAccumulable*)GenAcc;
159 AddEnergyDeposit(acc->GetEnDeposit());
160 fCalculated = false;
161}
void AddEnergyDeposit(const array_type Dep)
Definition Dose.hh:81

◆ Initialize()

void RadioBio::Dose::Initialize ( )
overridevirtual

Implements RadioBio::VRadiobiologicalQuantity.

Definition at line 69 of file Dose.cc.

70{
71 if (fVerboseLevel > 0) G4cout << "Dose::Initialize() called" << G4endl;
72
74
75 fEnDep.resize(VoxelNumber);
76 fDose.resize(VoxelNumber);
77 fInitialized = true;
78}
array_type fEnDep
Definition Dose.hh:73
array_type fDose
Definition Dose.hh:74
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.

◆ Compute()

void RadioBio::Dose::Compute ( )
overridevirtual

Implements RadioBio::VRadiobiologicalQuantity.

Definition at line 82 of file Dose.cc.

83{
84 // Skip Dose computation if calculation not enabled.
86 if (fVerboseLevel > 0) {
87 G4cout << "Dose::Compute() called but skipped as calculation not enabled" << G4endl;
88 }
89 return;
90 }
91
92 if (fCalculated) return;
93
94 if (fVerboseLevel > 0) G4cout << "Dose::Compute() called" << G4endl;
95
97
98 if (voxSensDet == nullptr)
99 G4Exception("Dose::Compute", "VoxNotInit", FatalException,
100 "Calculating dose without voxelized geometry pointer!");
101
102 G4double voxelMass = voxSensDet->GetVoxelMass();
103
104 for (G4int v = 0; v < voxSensDet->GetTotalVoxelNumber(); v++) {
105 if (fVerboseLevel > 1) G4cout << "Calculating Dose for voxel number " << v << G4endl;
106
107 // compute total Dose
108 fDose[v] = fEnDep[v] / voxelMass;
109 }
110
111 fCalculated = true;
112}

◆ Reset()

void RadioBio::Dose::Reset ( )
overridevirtual

Implements RadioBio::VRadiobiologicalQuantity.

Definition at line 165 of file Dose.cc.

166{
167 if (fVerboseLevel > 1) {
168 G4cout << "Dose::Reset(): ";
169 }
170 fEnDep = 0.0;
171 fDose = 0.0;
172 fCalculated = false;
173}

◆ Store()

void RadioBio::Dose::Store ( )
overridevirtual

Implements RadioBio::VRadiobiologicalQuantity.

Definition at line 116 of file Dose.cc.

117{
118 // Skip Dose store if calculation not enabled.
119 if (!fCalculationEnabled) {
120 if (fVerboseLevel > 0) {
121 G4cout << "Dose::Store() called but skipped as calculation not enabled" << G4endl;
122 }
123 return;
124 }
125
126 if (fSaved == true)
127 G4Exception("Dose::Store", "DoseOverwrite", JustWarning,
128 "Overwriting Dose file. For multiple runs, change filename.");
129
130 Compute();
131
132 std::ofstream ofs(fPath);
133
134 if (ofs.is_open()) {
135 ofs << "x_index" << std::setw(width) << "y_index" << std::setw(width) << "z_index"
136 << std::setw(width) << "Dose (Gy)" << G4endl;
137
138 auto voxSensDet = VoxelizedSensitiveDetector::GetInstance();
139
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;
146 }
147 }
148 if (fVerboseLevel > 0) {
149 G4cout << "Dose: Dose written to " << fPath << G4endl;
150 }
151 fSaved = true;
152}
#define width
Definition Dose.cc:44
void Compute() override
Definition Dose.cc:82

◆ PrintParameters()

void RadioBio::Dose::PrintParameters ( )
overridevirtual

Reimplemented from RadioBio::VRadiobiologicalQuantity.

Definition at line 177 of file Dose.cc.

178{
179 G4cout << "*******************************************" << G4endl
180 << "****** Parameters of the class Dose *******" << G4endl
181 << "*******************************************" << G4endl;
183}

◆ GetDose()

array_type RadioBio::Dose::GetDose ( ) const
inline

Definition at line 66 of file Dose.hh.

67 {
68 return fDose;
69 }

◆ SetEnergyDeposit()

void RadioBio::Dose::SetEnergyDeposit ( const array_type  Dep)
inlineprivate

Definition at line 77 of file Dose.hh.

78 {
79 fEnDep = Dep;
80 }

◆ AddEnergyDeposit()

void RadioBio::Dose::AddEnergyDeposit ( const array_type  Dep)
inlineprivate

Definition at line 81 of file Dose.hh.

82 {
83 fEnDep += Dep;
84 }

Friends And Related Symbol Documentation

◆ RBE

friend class RBE
friend

Definition at line 51 of file Dose.hh.

Member Data Documentation

◆ fEnDep

array_type RadioBio::Dose::fEnDep = {}
private

Definition at line 73 of file Dose.hh.

73{};

◆ fDose

array_type RadioBio::Dose::fDose = {}
private

Definition at line 74 of file Dose.hh.

74{};

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

Applications | User Support | Publications | Collaboration