Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // -------------------------------------------------------------------
27 // $Id$
28 // -------------------------------------------------------------------
29 
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
31 
32 #include "SteppingAction.hh"
33 #include "RunAction.hh"
34 #include "DetectorConstruction.hh"
35 #include "PrimaryGeneratorAction.hh"
36 #include "HistoManager.hh"
37 
38 #include "G4SystemOfUnits.hh"
39 #include "G4SteppingManager.hh"
40 #include "G4VTouchable.hh"
41 #include "G4VPhysicalVolume.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 
46 :Run(run),Detector(det),Primary(pri),Histo(his)
47 {}
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
52 {}
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55 
57 {
58  G4double flagParticle=0.;
59  G4double flagProcess=0.;
60  G4double x,y,z,xp,yp,zp;
61 
62  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "e-") flagParticle = 1;
63  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "proton") flagParticle = 2;
64  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "hydrogen") flagParticle = 3;
65  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha") flagParticle = 4;
66  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha+") flagParticle = 5;
67  if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "helium") flagParticle = 6;
68 
69  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="msc") flagProcess =10;
70  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAElastic") flagProcess =11;
71  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAExcitation") flagProcess =12;
72  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAIonisation") flagProcess =13;
73  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAAttachment") flagProcess =14;
74  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4DNAVibExcitation") flagProcess =15;
75  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eCapture") flagProcess =16;
76 
77  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="proton_G4DNAExcitation") flagProcess =17;
78  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="proton_G4DNAIonisation") flagProcess =18;
79  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="proton_G4DNAChargeDecrease") flagProcess =19;
80 
81  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hydrogen_G4DNAExcitation") flagProcess =20;
82  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hydrogen_G4DNAIonisation") flagProcess =21;
83  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hydrogen_G4DNAChargeIncrease") flagProcess =22;
84 
85  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha_G4DNAExcitation") flagProcess =23;
86  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha_G4DNAIonisation") flagProcess =24;
87  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha_G4DNAChargeDecrease") flagProcess =25;
88 
89  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha+_G4DNAExcitation") flagProcess =26;
90  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha+_G4DNAIonisation") flagProcess =27;
91  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha+_G4DNAChargeDecrease") flagProcess =28;
92  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="alpha+_G4DNAChargeIncrease") flagProcess =29;
93 
94  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="helium_G4DNAExcitation") flagProcess =30;
95  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="helium_G4DNAIonisation") flagProcess =31;
96  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="helium_G4DNAChargeIncrease") flagProcess =32;
97 
98  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hIoni") flagProcess =33;
99  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eIoni") flagProcess =34;
100 
101  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()!="Transportation")
102  {
103  x=step->GetPreStepPoint()->GetPosition().x()/nanometer;
104  y=step->GetPreStepPoint()->GetPosition().y()/nanometer;
105  z=step->GetPreStepPoint()->GetPosition().z()/nanometer;
106  xp=step->GetPostStepPoint()->GetPosition().x()/nanometer;
107  yp=step->GetPostStepPoint()->GetPosition().y()/nanometer;
108  zp=step->GetPostStepPoint()->GetPosition().z()/nanometer;
109 
110  Histo->FillNtupleDColumn(0, flagParticle);
111  Histo->FillNtupleDColumn(1, flagProcess);
112  Histo->FillNtupleDColumn(2, x);
113  Histo->FillNtupleDColumn(3, y);
114  Histo->FillNtupleDColumn(4, z);
115  Histo->FillNtupleDColumn(5, step->GetTotalEnergyDeposit()/eV);
116  Histo->FillNtupleDColumn(6, std::sqrt((x-xp)*(x-xp)+(y-yp)*(y-yp)+(z-zp)*(z-zp)));
117 
118  Histo->AddNtupleRow();
119  }
120 }