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

Accumulable of Dose-related data (that must be thread-local). More...

#include <Doxymodules_medical.h>

Inheritance diagram for RadioBio::DoseAccumulable:
RadioBio::VRadiobiologicalAccumulable G4VAccumulable

Public Types

using array_type = std::valarray< G4double >
 

Public Member Functions

 DoseAccumulable ()
 
 DoseAccumulable (const DoseAccumulable &other)=default
 
void Merge (const G4VAccumulable &rhs) override
 
void Reset () override
 
void Accumulate (Hit *hit) override
 
const array_type GetEnDeposit () const
 
G4int GetVerboseLevel () const
 
- Public Member Functions inherited from RadioBio::VRadiobiologicalAccumulable
 VRadiobiologicalAccumulable (G4String name)
 
virtual ~VRadiobiologicalAccumulable ()
 

Private Member Functions

void Initialize ()
 

Private Attributes

G4bool fInitialized = false
 
array_type fEnDep
 

Detailed Description

Accumulable of Dose-related data (that must be thread-local).

It keeps the energy deposit data divided in voxels for dose calculation

This is implemented as a customized G4VAccumulable with non-scalar data.

Note
There are two levels of merging (accumulation): 1) From more threads in one run (G4VAccumulable merging is applied) 2) (Optional) inter-run merging of data (implemented in Dose).
std::valarray is used (instead of C arrays or std::vectors) to accumulate data for its logical simplicity.

Definition at line 130 of file Doxymodules_medical.h.

Member Typedef Documentation

◆ array_type

using RadioBio::DoseAccumulable::array_type = std::valarray<G4double>

Definition at line 72 of file DoseAccumulable.hh.

Constructor & Destructor Documentation

◆ DoseAccumulable() [1/2]

RadioBio::DoseAccumulable::DoseAccumulable ( )

Definition at line 48 of file DoseAccumulable.cc.

◆ DoseAccumulable() [2/2]

RadioBio::DoseAccumulable::DoseAccumulable ( const DoseAccumulable other)
default

Member Function Documentation

◆ Merge()

void RadioBio::DoseAccumulable::Merge ( const G4VAccumulable rhs)
override

Definition at line 52 of file DoseAccumulable.cc.

53{
54 if (GetVerboseLevel() > 1) {
55 G4cout << "DoseAccumulable::Merge()" << G4endl;
56 }
57 const DoseAccumulable& other = dynamic_cast<const DoseAccumulable&>(rhs);
58
59 // Merges the counter
60 fEnDep += other.GetEnDeposit();
61}

◆ Reset()

void RadioBio::DoseAccumulable::Reset ( )
override

Definition at line 65 of file DoseAccumulable.cc.

66{
67 if (GetVerboseLevel() > 0) {
68 G4cout << "DoseAccumulable::Reset()" << G4endl;
69 }
70 if (fInitialized) {
71 fEnDep = 0.0;
72 }
73 else {
74 Initialize();
75 }
76}

◆ Accumulate()

void RadioBio::DoseAccumulable::Accumulate ( Hit hit)
overridevirtual

Implements RadioBio::VRadiobiologicalAccumulable.

Definition at line 81 of file DoseAccumulable.cc.

82{
83 // Calculation done only if energy is deposited
84 if (hit->GetDeltaE() <= 0.) return;
85
86 if (GetVerboseLevel() > 1) {
87 G4cout << "DoseAccumulable::Accumulate()" << G4endl;
88 }
89
90 // Get voxel number
91 G4int xIndex = hit->GetXindex();
92 G4int yIndex = hit->GetYindex();
93 G4int zIndex = hit->GetZindex();
94
95 G4int voxel =
97
98 // Get deposited energy
99 G4double DE = hit->GetDeltaE();
100
101 // Update total dose
102 fEnDep[voxel] += DE;
103}
static VoxelizedSensitiveDetector * GetInstance()
Static method to retrieve a pointer to the only object existing in the simulation.
G4int GetThisVoxelNumber(G4int x, G4int j, G4int k) const
Method to get the absolute voxel index given its indexes in the three dimensions.

◆ GetEnDeposit()

const array_type RadioBio::DoseAccumulable::GetEnDeposit ( ) const
inline

Definition at line 75 of file DoseAccumulable.hh.

75{ return fEnDep; }

◆ GetVerboseLevel()

G4int RadioBio::DoseAccumulable::GetVerboseLevel ( ) const

Definition at line 107 of file DoseAccumulable.cc.

108{
109 // Returns same verbosity of Dose class
111}
VRadiobiologicalQuantity * GetQuantity(G4String)
Definition Manager.cc:113
static Manager * GetInstance()
Definition Manager.cc:63

◆ Initialize()

void RadioBio::DoseAccumulable::Initialize ( )
private

Definition at line 115 of file DoseAccumulable.cc.

116{
117 if (GetVerboseLevel() > 0) {
118 G4cout << "DoseAccumulable::Initialize(): " << G4endl;
119 }
120
121 fEnDep = array_type(0.0, VoxelizedSensitiveDetector::GetInstance()->GetTotalVoxelNumber());
122
123 fInitialized = true;
124}
std::valarray< G4double > array_type

Member Data Documentation

◆ fInitialized

G4bool RadioBio::DoseAccumulable::fInitialized = false
private

Definition at line 83 of file DoseAccumulable.hh.

◆ fEnDep

array_type RadioBio::DoseAccumulable::fEnDep
private

Definition at line 85 of file DoseAccumulable.hh.


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

Applications | User Support | Publications | Collaboration