![]() |
|
|||
File indexing completed on 2025-10-13 08:28:03
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 // This example is provided by the Geant4-DNA collaboration 0027 // Any report or published results obtained using the Geant4-DNA software 0028 // shall cite the following Geant4-DNA collaboration publications: 0029 // Med. Phys. 51 (2024) 5873-5889 0030 // Med. Phys. 45 (2018) e722-e739 0031 // Phys. Med. 31 (2015) 861-874 0032 // Med. Phys. 37 (2010) 4692-4708 0033 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178 0034 // 0035 // The Geant4-DNA web site is available at http://geant4-dna.org 0036 // 0037 /// \file SteppingAction.cc 0038 /// \brief Implementation of the SteppingAction class 0039 0040 #include "PrimaryGeneratorAction.hh" 0041 #include "SteppingAction.hh" 0042 #include "Run.hh" 0043 0044 #include "G4Electron.hh" 0045 #include "G4Proton.hh" 0046 #include "G4Alpha.hh" 0047 #include "G4Tubs.hh" 0048 #include "G4DNAGenericIonsManager.hh" 0049 #include "G4SystemOfUnits.hh" 0050 #include "G4RunManager.hh" 0051 0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0053 0054 SteppingAction::SteppingAction() 0055 {} 0056 0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0058 0059 SteppingAction::~SteppingAction() 0060 {} 0061 0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0063 0064 void SteppingAction::UserSteppingAction(const G4Step* step) 0065 { 0066 G4ParticleDefinition* partDef = 0067 step->GetTrack()->GetDynamicParticle()->GetDefinition(); 0068 0069 // Boolean to force kinetic energy value 0070 if (energyFix) 0071 { 0072 G4DNAGenericIonsManager* instance = G4DNAGenericIonsManager::Instance(); 0073 0074 if ( partDef == G4Proton::ProtonDefinition() 0075 || 0076 partDef == G4Alpha::AlphaDefinition() 0077 || 0078 partDef == instance->GetIon("hydrogen") 0079 || 0080 partDef == instance->GetIon("alpha+") 0081 || 0082 partDef == instance->GetIon("helium") 0083 || 0084 partDef->GetPDGCharge()>4 ) 0085 { 0086 const PrimaryGeneratorAction* primaryGenerator = 0087 static_cast<const PrimaryGeneratorAction*> 0088 (G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction()); 0089 0090 G4double primaryEnergy = primaryGenerator->GetPrimaryKineticEnergy(); 0091 0092 // *** WARNING *** 0093 // this is a non physical trick to fix the kinetic energy 0094 // of the ion at post step 0095 step->GetPostStepPoint()->SetKineticEnergy(primaryEnergy); 0096 0097 //G4cout << "-------------- NEW STEP ------------" 0098 // << step->GetPreStepPoint()->GetKineticEnergy()/eV << G4endl; 0099 //G4cout << "-----Kinetic energy at PreStepPoint=" 0100 // << step->GetPreStepPoint()->GetKineticEnergy()/eV << G4endl; 0101 //G4cout << "-----Kinetic energy at PostStepPoint=" 0102 // << step->GetPostStepPoint()->GetKineticEnergy()/eV << G4endl; 0103 } 0104 } 0105 0106 if (!step->GetPostStepPoint()) return; 0107 0108 if (!step->GetPostStepPoint()->GetProcessDefinedStep()) return; 0109 0110 // Absorbed dose deposited by electrons only 0111 0112 if (partDef == G4Electron::ElectronDefinition()) { 0113 0114 G4VPhysicalVolume* volume = 0115 step->GetPreStepPoint()->GetTouchableHandle()->GetVolume(); 0116 if (!volume) return; 0117 0118 G4LogicalVolume* logicVol = volume->GetLogicalVolume(); 0119 G4double dose = step->GetTotalEnergyDeposit()/logicVol->GetMass(); 0120 0121 Run* run 0122 = static_cast<Run*> 0123 (G4RunManager::GetRunManager()->GetNonConstCurrentRun()); 0124 0125 if (dose>0) run->AddCylDoseDeposit(volume->GetCopyNo(), dose); 0126 0127 /* 0128 // Mass computation check 0129 0130 G4VSolid* solidVol = logicVol->GetSolid(); 0131 G4Tubs* cylinder = dynamic_cast<G4Tubs*>(solidVol); 0132 if (cylinder) 0133 { 0134 G4double rInner = cylinder->GetInnerRadius(); 0135 G4double rOuter = cylinder->GetOuterRadius(); 0136 G4cout << "**** MASS CHECK ****" << G4endl; 0137 G4cout << "Copy number=" << volume->GetCopyNo() << G4endl; 0138 G4cout << "rInner/nm=" << rInner/nm << G4endl; 0139 G4cout << "rOuter/nm=" << rOuter/nm << G4endl; 0140 G4cout << "length/nm=" << 2*cylinder->GetZHalfLength()/nm << G4endl; 0141 G4cout << "mass/kg=" << logicVol->GetMass()/kg << G4endl; 0142 } 0143 */ 0144 } // electron 0145 0146 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |