Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:04

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