Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 08:29:07

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 SteppingAction.cc
0027 /// \brief Implementation of the SteppingAction class
0028 
0029 // This example is provided by the Geant4-DNA collaboration
0030 // Any report or published results obtained using the Geant4-DNA software
0031 // shall cite the following Geant4-DNA collaboration publication:
0032 // Med. Phys. 37 (2010) 4692-4708
0033 // and papers
0034 // M. Batmunkh et al. J Radiat Res Appl Sci 8 (2015) 498-507
0035 // O. Belov et al. Physica Medica 32 (2016) 1510-1520
0036 // The Geant4-DNA web site is available at http://geant4-dna.org
0037 //
0038 // -------------------------------------------------------------------
0039 // November 2016
0040 // -------------------------------------------------------------------
0041 //
0042 
0043 #include "SteppingAction.hh"
0044 
0045 #include "PrimaryGeneratorAction.hh"
0046 #include "Run.hh"
0047 #include "RunAction.hh"
0048 
0049 #include "G4AnalysisManager.hh"
0050 #include "G4LogicalVolume.hh"
0051 #include "G4LogicalVolumeStore.hh"
0052 #include "G4PhysicalVolumeStore.hh"
0053 #include "G4RunManager.hh"
0054 #include "G4SteppingManager.hh"
0055 #include "G4SystemOfUnits.hh"
0056 #include "G4VPhysicalVolume.hh"
0057 #include "G4VTouchable.hh"
0058 #include "G4ios.hh"
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0061 
0062 SteppingAction::SteppingAction(RunAction* run) : G4UserSteppingAction(), fRunAction(run) {}
0063 
0064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0065 
0066 void SteppingAction::UserSteppingAction(const G4Step* step)
0067 {
0068   if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() != "Transportation") {
0069     G4double edepStep = step->GetTotalEnergyDeposit();
0070     G4VPhysicalVolume* volumeStep = step->GetPreStepPoint()->GetPhysicalVolume();
0071     G4TouchableHandle touchStep = step->GetPreStepPoint()->GetTouchableHandle();
0072     G4VPhysicalVolume* volumeMedium = G4PhysicalVolumeStore::GetInstance()->GetVolume("Medium");
0073     G4VPhysicalVolume* volumeSlice =
0074       G4PhysicalVolumeStore::GetInstance()->GetVolume("BoundingSlice");
0075 
0076     // count processes
0077     //
0078     const G4StepPoint* endPoint = step->GetPostStepPoint();
0079     const G4VProcess* process = endPoint->GetProcessDefinedStep();
0080     Run* run = static_cast<Run*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
0081     run->CountProcesses(process);
0082 
0083     // Edep in all volume
0084     if (edepStep > 0.) {
0085       fRunAction->AddEdepALL(edepStep);
0086 
0087       // Edep in a target volume (Bounding slice)
0088       if (volumeStep == volumeSlice) {
0089         fRunAction->AddEdepSlice(edepStep);
0090       }
0091 
0092       // Edep in Soma
0093       if (volumeStep->GetName() == "Soma") {
0094         fRunAction->AddEdepSoma(edepStep);
0095         run->AddSomaCompart(touchStep->GetCopyNumber(), edepStep);
0096       }
0097 
0098       // Edep in Dendrites
0099       if (volumeStep->GetName() == "Dendrites") {
0100         fRunAction->AddEdepDend(edepStep);
0101         run->AddDendCompart(touchStep->GetCopyNumber(), edepStep);
0102       }
0103 
0104       // Edep in Axon
0105       if (volumeStep->GetName() == "Axon") {
0106         fRunAction->AddEdepAxon(edepStep);
0107         run->AddAxonCompart(touchStep->GetCopyNumber(), edepStep);
0108       }
0109 
0110       // Edep in whole Neuron
0111       if (volumeStep != volumeMedium && volumeStep != volumeSlice) {
0112         fRunAction->AddEdepNeuron(edepStep);
0113       }
0114 
0115       // Edep outside bounding scice
0116       if (volumeStep == volumeMedium) {
0117         fRunAction->AddEdepMedium(edepStep);
0118       }
0119     }  // end edep>0
0120   }
0121 }