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

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

#include <Doxymodules_medical.h>

Inheritance diagram for RadioBio::RBEAccumulable:
RadioBio::VRadiobiologicalAccumulable G4VAccumulable

Public Types

using array_type = std::valarray< G4double >
 

Public Member Functions

 RBEAccumulable ()
 
 RBEAccumulable (const RBEAccumulable &other)=default
 
void Merge (const G4VAccumulable &rhs) override
 
void Reset () override
 
void Accumulate (G4double E, G4double energyDeposit, G4double dX, G4int Z, G4int i, G4int j, G4int k)
 
void Accumulate (Hit *hit) override
 
const array_type GetAlphaNumerator () const
 
const array_type GetBetaNumerator () const
 
const array_type GetDenominator () 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 fAlphaNumerator = {}
 
array_type fBetaNumerator = {}
 
array_type fDenominator = {}
 
size_t fVoxelsAlongX = -1
 
size_t fVoxelsAlongY = -1
 
size_t fVoxelsAlongZ = -1
 
size_t fVoxels = -1
 

Detailed Description

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

It keeps the sum of alpha and beta numerators/denominator, as well as energy deposits. The class is closely tied with the singleton RBE that is used both to calculate alphas and betas, and also to store results.

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 RBE).
std::valarray is used (instead of C arrays or std::vectors) to accumulate data for its logical simplicity.

Definition at line 142 of file Doxymodules_medical.h.

Member Typedef Documentation

◆ array_type

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

Definition at line 75 of file RBEAccumulable.hh.

Constructor & Destructor Documentation

◆ RBEAccumulable() [1/2]

RadioBio::RBEAccumulable::RBEAccumulable ( )

Definition at line 47 of file RBEAccumulable.cc.

◆ RBEAccumulable() [2/2]

RadioBio::RBEAccumulable::RBEAccumulable ( const RBEAccumulable other)
default

Member Function Documentation

◆ Merge()

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

Definition at line 51 of file RBEAccumulable.cc.

52{
53 if (GetVerboseLevel() > 1) {
54 G4cout << "RBEAccumulable::Merge()" << G4endl;
55 }
56 const RBEAccumulable& other = dynamic_cast<const RBEAccumulable&>(rhs);
57 fAlphaNumerator += other.fAlphaNumerator;
58 fDenominator += other.fDenominator;
59 fBetaNumerator += other.fBetaNumerator;
60}

◆ Reset()

void RadioBio::RBEAccumulable::Reset ( )
override

Definition at line 64 of file RBEAccumulable.cc.

65{
66 if (GetVerboseLevel() > 0) {
67 G4cout << "RBEAccumulable::Reset()" << G4endl;
68 }
69 if (fInitialized) {
70 fAlphaNumerator = 0.0;
71 fBetaNumerator = 0.0;
72 fDenominator = 0.0;
73 }
74 else {
75 Initialize();
76 }
77}

◆ Accumulate() [1/2]

void RadioBio::RBEAccumulable::Accumulate ( G4double  E,
G4double  energyDeposit,
G4double  dX,
G4int  Z,
G4int  i,
G4int  j,
G4int  k 
)

Definition at line 101 of file RBEAccumulable.cc.

103{
104 if (!fInitialized) {
105 G4Exception("RBEAccumulable::Accumulate", "NotInitialized", FatalException,
106 "Accumulable not initialized. Must be a programming error.");
107 }
108 if (GetVerboseLevel() > 2) {
109 G4cout << "RBEAccumulable::Accumulate() in " << i << ", " << j << ", " << k << G4endl;
110 }
111 if (energyDeposit <= 0) {
112 return;
113 }
114
115 // Get the global voxel number for the given indexes
117
118 // Calculate only for hadrons that traveled finite range and released finite energy.
119 if ((Z >= 1) && (dX > 0) && (E > 0)) {
120 RBE* rbe = dynamic_cast<RBE*>(Manager::GetInstance()->GetQuantity("RBE"));
121 std::tuple<G4double, G4double> alpha_beta = rbe->GetHitAlphaAndBeta(E, Z);
122 fDenominator[n] += energyDeposit;
123 fAlphaNumerator[n] += std::get<0>(alpha_beta) * energyDeposit;
124 fBetaNumerator[n] += std::sqrt(std::get<1>(alpha_beta)) * energyDeposit;
125 }
126}
VRadiobiologicalQuantity * GetQuantity(G4String)
Definition Manager.cc:113
static Manager * GetInstance()
Definition Manager.cc:63
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.

◆ Accumulate() [2/2]

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

Implements RadioBio::VRadiobiologicalAccumulable.

Definition at line 82 of file RBEAccumulable.cc.

83{
84 G4double kineticEnergy = hit->GetEkinMean();
85 G4int A = hit->GetPartType()->GetAtomicMass();
86 G4double energyDeposit = hit->GetDeltaE();
87 G4double DX = hit->GetTrackLength();
88 G4int Z = hit->GetPartType()->GetAtomicNumber();
89 G4int i = hit->GetXindex();
90 G4int j = hit->GetYindex();
91 G4int k = hit->GetZindex();
92
93 // If A is zero, return immediately to avoid division by zero
94 if (!A) return;
95
96 Accumulate(kineticEnergy / A, energyDeposit, DX, Z, i, j, k);
97}
void Accumulate(G4double E, G4double energyDeposit, G4double dX, G4int Z, G4int i, G4int j, G4int k)

◆ GetAlphaNumerator()

const array_type RadioBio::RBEAccumulable::GetAlphaNumerator ( ) const
inline

Definition at line 78 of file RBEAccumulable.hh.

79 {
80 return fAlphaNumerator;
81 }

◆ GetBetaNumerator()

const array_type RadioBio::RBEAccumulable::GetBetaNumerator ( ) const
inline

Definition at line 82 of file RBEAccumulable.hh.

83 {
84 return fBetaNumerator;
85 }

◆ GetDenominator()

const array_type RadioBio::RBEAccumulable::GetDenominator ( ) const
inline

Definition at line 86 of file RBEAccumulable.hh.

87 {
88 return fDenominator;
89 }

◆ GetVerboseLevel()

G4int RadioBio::RBEAccumulable::GetVerboseLevel ( ) const

Definition at line 130 of file RBEAccumulable.cc.

131{
132 // Return same verbosity of RBE class
134}

◆ Initialize()

void RadioBio::RBEAccumulable::Initialize ( )
private

Definition at line 138 of file RBEAccumulable.cc.

139{
140 if (GetVerboseLevel() > 0) {
141 G4cout << "RBEAccumulable::Initialize(): " << G4endl;
142 }
143
144 auto voxSensDet = VoxelizedSensitiveDetector::GetInstance();
145
146 fVoxelsAlongX = voxSensDet->GetVoxelNumberAlongX();
147 fVoxelsAlongY = voxSensDet->GetVoxelNumberAlongY();
148 fVoxelsAlongZ = voxSensDet->GetVoxelNumberAlongZ();
150
151 if (GetVerboseLevel() > 1) {
152 G4cout << fVoxels << " voxels." << G4endl;
153 }
154
158 fInitialized = true;
159}
std::valarray< G4double > array_type

Member Data Documentation

◆ fInitialized

G4bool RadioBio::RBEAccumulable::fInitialized = false
private

Definition at line 97 of file RBEAccumulable.hh.

◆ fAlphaNumerator

array_type RadioBio::RBEAccumulable::fAlphaNumerator = {}
private

Definition at line 99 of file RBEAccumulable.hh.

99{};

◆ fBetaNumerator

array_type RadioBio::RBEAccumulable::fBetaNumerator = {}
private

Definition at line 100 of file RBEAccumulable.hh.

100{};

◆ fDenominator

array_type RadioBio::RBEAccumulable::fDenominator = {}
private

Definition at line 101 of file RBEAccumulable.hh.

101{};

◆ fVoxelsAlongX

size_t RadioBio::RBEAccumulable::fVoxelsAlongX = -1
private

Definition at line 105 of file RBEAccumulable.hh.

◆ fVoxelsAlongY

size_t RadioBio::RBEAccumulable::fVoxelsAlongY = -1
private

Definition at line 106 of file RBEAccumulable.hh.

◆ fVoxelsAlongZ

size_t RadioBio::RBEAccumulable::fVoxelsAlongZ = -1
private

Definition at line 107 of file RBEAccumulable.hh.

◆ fVoxels

size_t RadioBio::RBEAccumulable::fVoxels = -1
private

Definition at line 109 of file RBEAccumulable.hh.


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

Applications | User Support | Publications | Collaboration