Geant4  10.01.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 // -------------------------------------------------------------------
27 // $Id: SteppingAction.cc,v 1.1 2012-09-21 mraine Exp $
28 // -------------------------------------------------------------------
29 
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
31 
32 #include "Analysis.hh"
33 
34 #include "SteppingAction.hh"
35 #include "RunAction.hh"
36 #include "DetectorConstruction.hh"
37 #include "PrimaryGeneratorAction.hh"
38 
39 #include "G4SystemOfUnits.hh"
40 #include "G4SteppingManager.hh"
41 #include "G4VTouchable.hh"
42 #include "G4VPhysicalVolume.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
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() == "GenericIon") flagParticle = 3;
65 
66  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="msc") flagProcess =10;
67  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4MicroElecElastic") flagProcess =11;
68  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4MicroElecInelastic") flagProcess =12;
69  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eCapture") flagProcess =13;
70 
71  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="p_G4MicroElecInelastic") flagProcess =14;
72 
73  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ion_G4MicroElecInelastic") flagProcess =15;
74 
75  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hIoni") flagProcess =16;
76  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eIoni") flagProcess =17;
77 
78  if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()!="Transportation")
79  {
80  x=step->GetPreStepPoint()->GetPosition().x()/nanometer;
81  y=step->GetPreStepPoint()->GetPosition().y()/nanometer;
82  z=step->GetPreStepPoint()->GetPosition().z()/nanometer;
83  xp=step->GetPostStepPoint()->GetPosition().x()/nanometer;
84  yp=step->GetPostStepPoint()->GetPosition().y()/nanometer;
85  zp=step->GetPostStepPoint()->GetPosition().z()/nanometer;
86 
87  // get analysis manager
88  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
89 
90  // fill ntuple
91  analysisManager->FillNtupleDColumn(0, flagParticle);
92  analysisManager->FillNtupleDColumn(1, flagProcess);
93  analysisManager->FillNtupleDColumn(2, x);
94  analysisManager->FillNtupleDColumn(3, y);
95  analysisManager->FillNtupleDColumn(4, z);
96  analysisManager->FillNtupleDColumn(5, step->GetTotalEnergyDeposit()/eV);
97  analysisManager->FillNtupleDColumn(6, std::sqrt((x-xp)*(x-xp)+(y-yp)*(y-yp)+(z-zp)*(z-zp))/nm);
98  analysisManager->FillNtupleDColumn(7, (step->GetPreStepPoint()->GetKineticEnergy() - step->GetPostStepPoint()->GetKineticEnergy())/eV );
99  analysisManager->AddNtupleRow();
100  }
101 }
const G4DynamicParticle * GetDynamicParticle() const
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
const G4ThreeVector & GetPosition() const
ExG4HbookAnalysisManager G4AnalysisManager
Definition: g4hbook_defs.hh:61
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
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const