Geant4  10.02.p01
SteppingAction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // shall cite the following Geant4-DNA collaboration publication:
29 // Med. Phys. 37 (2010) 4692-4708
30 // Delage et al. PDB4DNA: implementation of DNA geometry from the Protein Data
31 // Bank (PDB) description for Geant4-DNA Monte-Carlo
32 // simulations (submitted to Comput. Phys. Commun.)
33 // The Geant4-DNA web site is available at http://geant4-dna.org
34 //
35 // $Id$
36 //
39 
40 #include "SteppingAction.hh"
41 
42 #include "DetectorConstruction.hh"
43 #include "G4EventManager.hh"
44 #include "EventAction.hh"
45 #include "G4LogicalVolumeStore.hh"
46 #include "G4RunManager.hh"
47 #include "G4SteppingManager.hh"
48 #include "G4SystemOfUnits.hh"
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 :G4UserSteppingAction(),RunInitObserver(),fpEventAction(0),fpDetector(0)
54 {
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 {
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 {
68  GetUserEventAction();
70  GetUserDetectorConstruction();
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
75 void SteppingAction::UserSteppingAction(const G4Step* theStep)
76 {
78  "Transportation")
79  {
80  // Get position and edep of current step
81  //
82  G4double x = theStep->GetPreStepPoint()->GetPosition().x()/nanometer;
83  G4double y = theStep->GetPreStepPoint()->GetPosition().y()/nanometer;
84  G4double z = theStep->GetPreStepPoint()->GetPosition().z()/nanometer;
85  G4double edepStep = theStep->GetTotalEnergyDeposit()/eV;
86 
87  G4LogicalVolume* targetVolume =
89  G4LogicalVolume* theVolume =
91 
92  if ((edepStep > 0.) && (theVolume==targetVolume))
93  {
94  // Add edep to this event
95  //
96  fpEventAction->AddEdepEvent(edepStep);
97  if (fpDetector->GetBarycenterList()==NULL)
98  {
99  G4cout << "Barycenter list is null!!!" << G4endl;
100  }
101  else
102  {
103  CheckAndProcessDNAHit(x,y,z,edepStep);
104  }
105  }
106  }
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
110 
112  G4double edepStep)
113 {
114  int numStrand=0;
115  int numNucl=0;
116  int intResidue=-1; // 0 for Phospat, 1 for Sugar, 2 for Base
117  unsigned short int hit = (fpDetector->GetPDBlib()).ComputeMatchEdepDNA(
120  x*10., y*10., z*10.,// x10 => angstrom<->nm
121  numStrand, numNucl, intResidue);
122 
123  if (hit==1)
124  {
125  if ((intResidue==0)||(intResidue==1)) //Edep in Phosphate or Sugar
126  {
127  fpEventAction->AddEdepToNucleotide(numStrand,numNucl,edepStep);
128  return true;
129  }
130  else
131  {
132  return false;
133  }
134  }
135  else
136  {
137  return false;
138  }
139 }
G4double z
Definition: TRTMaterials.hh:39
static const double nanometer
Definition: G4SIunits.hh:100
Event action class.
Definition: EventAction.hh:45
void UserSteppingAction(const G4Step *)
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
Barycenter * GetBarycenterList()
G4StepPoint * GetPreStepPoint() const
G4GLOB_DLL std::ostream G4cout
EventAction * fpEventAction
G4VPhysicalVolume * GetPhysicalVolume() const
G4bool CheckAndProcessDNAHit(G4double x, G4double y, G4double z, G4double edep)
const G4ThreeVector & GetPosition() const
bool G4bool
Definition: G4Types.hh:79
static G4LogicalVolumeStore * GetInstance()
Definition: G4Step.hh:76
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4double GetTotalEnergyDeposit() const
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
static const double eV
Definition: G4SIunits.hh:212
const G4VProcess * GetProcessDefinedStep() const
G4LogicalVolume * GetLogicalVolume() const
void AddEdepEvent(G4double edep)
Definition: EventAction.hh:62
G4StepPoint * GetPostStepPoint() const
const G4double x[NPOINTSGL]
static G4EventManager * GetEventManager()
Detector construction class to demonstrate various ways of placement.
#define G4endl
Definition: G4ios.hh:61
DetectorConstruction * fpDetector
double G4double
Definition: G4Types.hh:76
virtual void Initialize()
void AddEdepToNucleotide(G4int numStrand, G4int numNucl, G4double edep)
Definition: EventAction.hh:71