Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RemSimSteppingAction.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 // Author: Susanna Guatelli (susanna@uow.edu.au)
31 //
32 
33 #include "RemSimSteppingAction.hh"
36 #include "RemSimAnalysis.hh"
37 
38 #include "G4ios.hh"
39 #include "G4SystemOfUnits.hh"
40 #include "G4SteppingManager.hh"
41 #include "G4Step.hh"
42 #include "G4Track.hh"
43 #include "G4StepPoint.hh"
44 #include "G4ParticleDefinition.hh"
45 #include "G4VPhysicalVolume.hh"
46 #include "G4TrackStatus.hh"
47 
49  primaryAction(primary)
50 {
51  hadronic = "Off";
52  messenger = new RemSimSteppingActionMessenger(this);
53 }
54 
56 {
57  delete messenger;
58 }
59 
61 {
62  G4String oldVolumeName = aStep -> GetPreStepPoint()->
63  GetPhysicalVolume()-> GetName();
64 
65  // Store in histograms useful information concerning secondary particles
66 
67  G4VPhysicalVolume* volume = aStep -> GetPostStepPoint() -> GetPhysicalVolume();
68 
69  // Get analysis manager
70  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
71 
72  // Secondary particles reaching the astronaut
73  if(oldVolumeName != "phantom")
74  {
75  if (volume)
76  {
77  G4String volumeName = volume -> GetName();
78  if (volumeName == "phantom")
79  {
80  G4String particleName = (aStep -> GetTrack() -> GetDynamicParticle()
81  -> GetDefinition() -> GetParticleName());
82 
83  G4double particleEnergy = aStep -> GetTrack() -> GetKineticEnergy();
84 
85  if(aStep -> GetTrack() -> GetTrackID()!= 1)
86  // analysis of secondary particles reaching the astronaut
87  {
88  if (particleName == "proton") analysisManager -> FillH1(1, particleEnergy/MeV);
89 
90  else{
91  if (particleName == "neutron") analysisManager -> FillH1(2, particleEnergy/MeV);
92 
93  else{
94  if (particleName == "pi+" || particleName == "pi-" ||particleName == "pi0" )
95  analysisManager -> FillH1(3,particleEnergy/MeV);
96  else{
97  if (particleName == "alpha") analysisManager -> FillH1(4, particleEnergy/MeV);
98  }
99  }
100  }
101  }
102  }
103  }
104 }
105 
106 
107  // Analysis of the secondary particles generated in the phantom
108 
109  G4SteppingManager* steppingManager = fpSteppingManager;
110  G4Track* theTrack = aStep -> GetTrack();
111 
112  // check if it is alive
113  if(theTrack-> GetTrackStatus() == fAlive) { return; }
114 
115  // Retrieve the secondary particles
116  G4TrackVector* fSecondary = steppingManager -> GetfSecondary();
117 
118  for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++)
119  {
120  // Retrieve the info about the generation of secondary particles in the phantom and
121  // in the vehicle
122  G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName();
123  G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();
124  G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy();
125  G4String process = (*fSecondary)[lp1]-> GetCreatorProcess()-> GetProcessName();
126 
127  // If the secondaries are originated in the phantom....
128  if (volumeName == "phantom")
129  {
130 
131  if (secondaryParticleName == "proton") analysisManager -> FillH1(5, secondaryParticleKineticEnergy/MeV);
132 
133  else
134  {
135  if (secondaryParticleName == "neutron") analysisManager -> FillH1(6, secondaryParticleKineticEnergy/MeV);
136 
137  else{
138  if (secondaryParticleName == "pi+" ||
139  secondaryParticleName == "pi-"||secondaryParticleName == "pi0")
140  analysisManager -> FillH1(7, secondaryParticleKineticEnergy/MeV);
141 
142  else{
143  if (secondaryParticleName == "alpha")
144  analysisManager -> FillH1(8, secondaryParticleKineticEnergy/MeV);
145  }
146  }
147  }
148 
149  }
150 
151  }
152 
153  //analysis of hadronic physics
154  if (hadronic == "On")
155  {
156  if(aStep -> GetPostStepPoint() -> GetProcessDefinedStep() != NULL)
157  {
158  G4String process = aStep -> GetPostStepPoint() ->
159  GetProcessDefinedStep() ->GetProcessName();
160 
161  if ((process != "Transportation") &&
162  (process != "msc") &&
163  (process != "LowEnergyIoni") &&
164  (process != "LowEnergyBrem") &&
165  (process != "eIoni") &&
166  (process != "hIoni") &&
167  (process != "eBrem") &&
168  (process != "compt") &&
169  (process != "phot") &&
170  (process != "conv") &&
171  (process != "annihil") &&
172  (process != "hLowEIoni") &&
173  (process != "LowEnBrem") &&
174  (process != "LowEnCompton") &&
175  (process != "LowEnPhotoElec") &&
176  (process != "LowEnRayleigh") &&
177  (process != "LowEnConversion"))
178  G4cout << "Hadronic Process:" << process << G4endl;
179  }
180  }
181 }
183 {
184  hadronic = value;
185 }