Geant4  10.00.p03
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 // and the DNA geometry given in the Geom_DNA example
29 // shall cite the following Geant4-DNA collaboration publications:
30 // [1] NIM B 298 (2013) 47-54
31 // [2] Med. Phys. 37 (2010) 4692-4708
32 // The Geant4-DNA web site is available at http://geant4-dna.org
33 //
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 
36 #include "SteppingAction.hh"
37 #include "RunAction.hh"
38 #include "DetectorConstruction.hh"
39 #include "PrimaryGeneratorAction.hh"
40 #include "HistoManager.hh"
41 
42 #include "G4SystemOfUnits.hh"
43 #include "G4SteppingManager.hh"
44 #include "G4VTouchable.hh"
45 #include "G4VPhysicalVolume.hh"
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48 
50 :Run(run),Detector(det),Primary(pri),Histo(his)
51 {}
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54 
56 {}
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59 
61 {
62  G4double flagParticle=0.;
63  G4double flagProcess=0.;
64  G4double flagVolume=0.;
65  G4double x,y,z,xp,yp,zp;
66  G4double dE;
67 
68  dE=step->GetTotalEnergyDeposit()/eV;
69 
70  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "e-") flagParticle = 10;
71  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "proton") flagParticle = 20;
72  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "hydrogen") flagParticle = 30;
73  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha") flagParticle = 40;
74  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha+") flagParticle = 50;
75  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "helium") flagParticle = 60;
76 
77 
78  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAElastic") flagProcess =11;
79  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAExcitation") flagProcess =12;
80  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAIonisation") flagProcess =13;
81  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAAttachment") flagProcess =14;
82  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAVibExcitation") flagProcess =15;
83  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eCapture") flagProcess =16;
84 // if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="msc") flagProcess =17;
85 
86  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="proton_G4DNAExcitation") flagProcess =21;
87  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="proton_G4DNAIonisation") flagProcess =22;
88  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="proton_G4DNAChargeDecrease") flagProcess =23;
89 
90  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hydrogen_G4DNAExcitation") flagProcess =31;
91  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hydrogen_G4DNAIonisation") flagProcess =32;
92  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hydrogen_G4DNAChargeIncrease") flagProcess =33;
93 
94  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha_G4DNAExcitation") flagProcess =41;
95  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha_G4DNAIonisation") flagProcess =42;
96  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha_G4DNAChargeDecrease") flagProcess =43;
97 
98  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha+_G4DNAExcitation") flagProcess =51;
99  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha+_G4DNAIonisation") flagProcess =52;
100  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha+_G4DNAChargeDecrease") flagProcess =53;
101  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha+_G4DNAChargeIncrease") flagProcess =54;
102 
103  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="helium_G4DNAExcitation") flagProcess =61;
104  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="helium_G4DNAIonisation") flagProcess =62;
105  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="helium_G4DNAChargeIncrease") flagProcess =63;
106 
107 // if (step->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hIoni") flagProcess =24;
108 // if (step->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eIoni") flagProcess =18;
109 
110  if (step->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="physi sugar 2") flagVolume=1;
111 
112  if (step->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="physi sugar 4") flagVolume=2;
113 
114  if (flagVolume !=0 && dE!=0 )
115  {
116 
117  x=step->GetPreStepPoint()->GetPosition().x()/nanometer;
118  y=step->GetPreStepPoint()->GetPosition().y()/nanometer;
119  z=step->GetPreStepPoint()->GetPosition().z()/nanometer;
120  xp=step->GetPostStepPoint()->GetPosition().x()/nanometer;
121  yp=step->GetPostStepPoint()->GetPosition().y()/nanometer;
122  zp=step->GetPostStepPoint()->GetPosition().z()/nanometer;
123 
124  Histo->FillNtupleDColumn(0, flagParticle);
125  Histo->FillNtupleDColumn(1, flagProcess);
126  Histo->FillNtupleDColumn(2, flagVolume);
127  Histo->FillNtupleDColumn(3, xp);
128  Histo->FillNtupleDColumn(4, yp);
129  Histo->FillNtupleDColumn(5, zp);
130  Histo->FillNtupleDColumn(6, dE );
131  Histo->FillNtupleDColumn(7, std::sqrt((x-xp)*(x-xp)+(y-yp)*(y-yp)+(z-zp)*(z-zp)));
132 
133  Histo->AddNtupleRow();
134  }
135 
136 
137 }
const G4DynamicParticle * GetDynamicParticle() const
Definition: Histo.hh:56
G4double z
Definition: TRTMaterials.hh:39
static const double nanometer
Definition: G4SIunits.hh:91
G4ParticleDefinition * GetDefinition() const
void UserSteppingAction(const G4Step *)
const G4String & GetParticleName() const
G4StepPoint * GetPreStepPoint() const
static const G4double dE
G4VPhysicalVolume * GetPhysicalVolume() const
const G4String & GetName() const
const G4ThreeVector & GetPosition() const
Definition: G4Step.hh:76
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4double GetTotalEnergyDeposit() const
static const double eV
Definition: G4SIunits.hh:194
const G4VProcess * GetProcessDefinedStep() const
G4StepPoint * GetPostStepPoint() const
Detector construction class to demonstrate various ways of placement.
double G4double
Definition: G4Types.hh:76
Definition: Run.hh:46
G4Track * GetTrack() const