Geant4  10.01
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 // The Geant4-DNA web site is available at http://geant4-dna.org
31 //
32 // If you use this example, please cite the following publication:
33 // Rad. Prot. Dos. 133 (2009) 2-11
34 
35 #include "G4SystemOfUnits.hh"
36 #include "G4SteppingManager.hh"
37 
38 #include "SteppingAction.hh"
39 #include "RunAction.hh"
40 #include "DetectorConstruction.hh"
41 #include "Analysis.hh"
42 
43 #include "G4Alpha.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46 
48 :fRun(run),fDetector(det)
49 { }
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
54 { }
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
57 
59 
60 {
61  // Analysis manager
62 
63  G4AnalysisManager* man = G4AnalysisManager::Instance();
64 
65  // Read phantom - Singleton
66 
68 
69  //
70 
71  // Material : 1 is cytoplasm, 2 is nucleus
72 
73  G4int matVoxelPRE = -1;
74  G4int matVoxelPOST = -1;
75  G4int tmp=-1;
76 
78 
79  if (tmp>0)
80  {
81  matVoxelPRE = fMyCellParameterisation->GetTissueType(tmp);
82  }
83 
85 
86  if (tmp>0)
87  {
88  matVoxelPOST = fMyCellParameterisation->GetTissueType(tmp);
89  }
90 
91 // COUNT GAS DETECTOR HITS
92 
96 
97  ||
101 
102  ||
103 
107 
108  )
109  {
110  fRun->AddNbOfHitsGas();
111  }
112 
113 // STOPPING POWER AND BEAM SPOT SIZE AT CELL ENTRANCE
114 
118 
119  ||
121  && (matVoxelPOST == 1)
123  )
124  {
125 
126  if( (aStep->GetPreStepPoint()->GetKineticEnergy() - aStep->GetPostStepPoint()->GetKineticEnergy() ) >0)
127  {
128  //Fill ntupleid=1
129  man->FillNtupleDColumn(1,0,aStep->GetPreStepPoint()->GetKineticEnergy()/keV);
130  man->FillNtupleDColumn(1,1,
131  (aStep->GetPreStepPoint()->GetKineticEnergy() -
132  aStep->GetPostStepPoint()->GetKineticEnergy())/
133  keV/(aStep->GetStepLength()/micrometer));
134  man->AddNtupleRow(1);
135  }
136 
137  // Average dE over step suggested by Michel Maire
138 
139  G4StepPoint* p1 = aStep->GetPreStepPoint();
140  G4ThreeVector coord1 = p1->GetPosition();
141  const G4AffineTransform transformation1 = p1->GetTouchable()->GetHistory()->GetTopTransform();
142  G4ThreeVector localPosition1 = transformation1.TransformPoint(coord1);
143 
144  G4StepPoint* p2 = aStep->GetPostStepPoint();
145  G4ThreeVector coord2 = p2->GetPosition();
146  const G4AffineTransform transformation2 = p2->GetTouchable()->GetHistory()->GetTopTransform();
147  G4ThreeVector localPosition2 = transformation2.TransformPoint(coord2);
148 
149  G4ThreeVector localPosition = localPosition1 + G4UniformRand()*(localPosition2-localPosition1);
150 
151  // end
152 
153  //Fill ntupleid=2
154  man->FillNtupleDColumn(2,0,localPosition.x()/micrometer);
155  man->FillNtupleDColumn(2,1,localPosition.y()/micrometer);
156  man->AddNtupleRow(2);
157  }
158 
159 // ALPHA RANGE
160 
161 if (
162 
164 
165  &&
166 
167  (aStep->GetTrack()->GetKineticEnergy()<1e-6)
168 
169  &&
170 
171  ( (matVoxelPOST==1)
173  || (matVoxelPOST==2) )
174 
175  )
176 
177  {
178  //Fill ntupleid=3
179  man->FillNtupleDColumn(3,0,
180  aStep->GetPostStepPoint()->GetPosition().x()/micrometer);
181  man->FillNtupleDColumn(3,1,
182  aStep->GetPostStepPoint()->GetPosition().y()/micrometer);
183  man->FillNtupleDColumn(3,2,
184  aStep->GetPostStepPoint()->GetPosition().z()/micrometer);
185  man->AddNtupleRow(3);
186  }
187 
188 // TOTAL DOSE DEPOSIT AND DOSE DEPOSIT WITHIN A PHANTOM VOXEL
189 // FOR ALL PARTICLES
190 
191 if (matVoxelPRE == 2)
192 
193  {
194  G4double dose = (aStep->GetTotalEnergyDeposit()/joule)/(fRun->GetMassNucleus()/kg);
195  fRun->AddDoseN(dose);
196 
197  G4ThreeVector v;
199  aStep->GetTotalEnergyDeposit()/eV);
200  }
201 
202 
203 if (matVoxelPRE == 1)
204 
205  {
207  fRun->AddDoseC(dose);
208 
209  G4ThreeVector v;
211  aStep->GetTotalEnergyDeposit()/eV);
212  }
213 }
void AddDoseN(G4double dose)
Definition: RunAction.hh:60
CLHEP::Hep3Vector G4ThreeVector
G4double GetStepLength() const
const G4DynamicParticle * GetDynamicParticle() const
G4LogicalVolume * GetLogicalCollDetYoke()
virtual const G4NavigationHistory * GetHistory() const
Definition: G4VTouchable.cc:86
static const double joule
Definition: G4SIunits.hh:183
G4ParticleDefinition * GetDefinition() const
const G4VTouchable * GetTouchable() const
void UserSteppingAction(const G4Step *)
int G4int
Definition: G4Types.hh:78
G4StepPoint * GetPreStepPoint() const
G4double GetKineticEnergy() const
#define G4UniformRand()
Definition: Randomize.hh:95
G4LogicalVolume * GetLogicalIsobutane()
const G4ThreeVector & GetPosition() const
static const double kg
Definition: G4SIunits.hh:161
ExG4HbookAnalysisManager G4AnalysisManager
Definition: g4hbook_defs.hh:61
Definition: G4Step.hh:76
void AddNbOfHitsGas()
Definition: RunAction.hh:72
DetectorConstruction * fDetector
G4double GetTotalEnergyDeposit() const
static const double micrometer
Definition: G4SIunits.hh:90
static const double eV
Definition: G4SIunits.hh:194
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
G4LogicalVolume * GetLogicalVolume() const
CellParameterisation * fMyCellParameterisation
G4double GetMassNucleus()
Definition: RunAction.hh:75
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
void AddDoseC(G4double dose)
Definition: RunAction.hh:64
G4StepPoint * GetPostStepPoint() const
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:58
G4LogicalVolume * GetLogicalKgm()
Detector construction class to demonstrate various ways of placement.
const G4AffineTransform & GetTopTransform() const
static const double keV
Definition: G4SIunits.hh:195
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
G4LogicalVolume * GetLogicalCollDetGap4()
void AddDoseBox(G4int i, G4double x)
Definition: RunAction.hh:80
G4LogicalVolume * GetLogicalPolyprop()
G4Track * GetTrack() const
G4double GetMassCytoplasm()
Definition: RunAction.hh:78
static CellParameterisation * Instance()
RunAction * fRun
static G4Alpha * AlphaDefinition()
Definition: G4Alpha.cc:84
const G4TouchableHandle & GetTouchableHandle() const