|
|
|||
File indexing completed on 2026-04-01 07:51:14
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /// \file DoseAccumulable.cc 0027 /// \brief Implementation of the RadioBio::DoseAccumulable class 0028 0029 #include "DoseAccumulable.hh" 0030 0031 #include "G4EmCalculator.hh" 0032 #include "G4LogicalVolume.hh" 0033 #include "G4ParticleDefinition.hh" 0034 0035 #include "Hit.hh" 0036 #include "Manager.hh" 0037 #include "VoxelizedSensitiveDetector.hh" 0038 #include <G4SystemOfUnits.hh> 0039 0040 #include <tuple> 0041 0042 namespace RadioBio 0043 { 0044 0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0046 0047 DoseAccumulable::DoseAccumulable() : VRadiobiologicalAccumulable("Dose") {} 0048 0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0050 0051 void DoseAccumulable::Merge(const G4VAccumulable& rhs) 0052 { 0053 if (GetVerboseLevel() > 1) { 0054 G4cout << "DoseAccumulable::Merge()" << G4endl; 0055 } 0056 const DoseAccumulable& other = dynamic_cast<const DoseAccumulable&>(rhs); 0057 0058 // Merges the counter 0059 fEnDep += other.GetEnDeposit(); 0060 } 0061 0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0063 0064 void DoseAccumulable::Reset() 0065 { 0066 if (GetVerboseLevel() > 0) { 0067 G4cout << "DoseAccumulable::Reset()" << G4endl; 0068 } 0069 if (fInitialized) { 0070 fEnDep = 0.0; 0071 } 0072 else { 0073 Initialize(); 0074 } 0075 } 0076 0077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0078 0079 // To accumulate given the hit 0080 void DoseAccumulable::Accumulate(Hit* hit) 0081 { 0082 // Calculation done only if energy is deposited 0083 if (hit->GetDeltaE() <= 0.) return; 0084 0085 if (GetVerboseLevel() > 1) { 0086 G4cout << "DoseAccumulable::Accumulate()" << G4endl; 0087 } 0088 0089 // Get voxel number 0090 G4int xIndex = hit->GetXindex(); 0091 G4int yIndex = hit->GetYindex(); 0092 G4int zIndex = hit->GetZindex(); 0093 0094 G4int voxel = 0095 VoxelizedSensitiveDetector::GetInstance()->GetThisVoxelNumber(xIndex, yIndex, zIndex); 0096 0097 // Get deposited energy 0098 G4double DE = hit->GetDeltaE(); 0099 0100 // Update total dose 0101 fEnDep[voxel] += DE; 0102 } 0103 0104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0105 0106 G4int DoseAccumulable::GetVerboseLevel() const 0107 { 0108 // Returns same verbosity of Dose class 0109 return Manager::GetInstance()->GetQuantity("Dose")->GetVerboseLevel(); 0110 } 0111 0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0113 0114 void DoseAccumulable::Initialize() 0115 { 0116 if (GetVerboseLevel() > 0) { 0117 G4cout << "DoseAccumulable::Initialize(): " << G4endl; 0118 } 0119 0120 fEnDep = array_type(0.0, VoxelizedSensitiveDetector::GetInstance()->GetTotalVoxelNumber()); 0121 0122 fInitialized = true; 0123 } 0124 0125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0126 0127 } // namespace RadioBio
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|