Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Em10SteppingAction.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 //
28 //
29 //
30 // $Id$
31 //
32 //
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 
38 #include "G4Electron.hh"
39 #include "G4Positron.hh"
40 #include "G4Gamma.hh"
41 #include "Em10SteppingAction.hh"
42 #include "Em10EventAction.hh"
43 #include "Em10RunAction.hh"
44 #include "G4Event.hh"
45 #include "G4VPhysicalVolume.hh"
46 #include "G4PhysicalConstants.hh"
47 #include "G4ios.hh"
48 #include <iomanip>
49 
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
54  Em10EventAction* EA,
55  Em10RunAction* RA)
56  :detector (DET),eventaction (EA),runaction (RA),
57  IDold(-1) ,evnoold(-1)
58 {}
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
61 
63 {}
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
66 
68 {
69 
70  G4double Theta,Thetaback,Ttrans,Tback,Tsec,Egamma,yend,zend,rend ;
71 
72  G4int evno = eventaction->GetEventno() ;
73 
74  const G4Track* track = aStep->GetTrack();
75  const G4StepPoint* prePoint = aStep->GetPreStepPoint();
76  G4int trackID = track->GetTrackID();
77  G4int parentID = track->GetParentID();
78 
79  const G4DynamicParticle* dynParticle = track->GetDynamicParticle();
80  const G4ParticleDefinition* particle = dynParticle->GetDefinition();
81  G4VPhysicalVolume* preVol = prePoint->GetPhysicalVolume();
83 
84  IDnow = evno+10000*trackID+100000000*parentID;
85  if(IDnow != IDold) {
86  IDold=IDnow ;
87  if(trackID > 1 && (particle == G4Electron::Electron() ||
88  particle == G4Positron::Positron() ||
89  particle == G4Gamma::Gamma())) {
90  runaction->Fillvertexz(track->GetVertexPosition().z());
91 
92  if(preVol->GetName()=="Absorber") {
93  if(particle == G4Gamma::Gamma()) {
94  eventaction->AddNeutral() ;
95  } else {
96  eventaction->AddCharged() ;
97  Tsec = track->GetKineticEnergy() ;
98  Tsec += aStep->GetTotalEnergyDeposit() ;
99  runaction->FillTsec(Tsec) ;
100  if(particle == G4Electron::Electron()) {
101  eventaction->AddE() ;
102  } else {
103  eventaction->AddP() ;
104  }
105  }
106  }
107  }
108  }
109 
110  if(preVol->GetName()=="Absorber") {
111  if(particle == G4Electron::Electron() ||
112  particle == G4Positron::Positron()) {
113  eventaction->CountStepsCharged() ;
114 
115  } else if(particle == G4Gamma::Gamma()) {
116  eventaction->CountStepsNeutral() ;
117  }
118 
119  if(prePoint->GetStepStatus() == fGeomBoundary &&
120  preVol != postVol) {
121 
122  if(trackID == 1) {
123  if(track->GetMomentumDirection().z()>0.) {
124 
125  eventaction->SetTr();
126  Theta = std::acos(track->GetMomentumDirection().z()) ;
127  runaction->FillTh(Theta) ;
128  Ttrans = track->GetKineticEnergy() ;
129  runaction->FillTt(Ttrans) ;
130  yend= aStep->GetTrack()->GetPosition().y() ;
131  zend= aStep->GetTrack()->GetPosition().x() ;
132  rend = std::sqrt(yend*yend+zend*zend) ;
133  runaction->FillR(rend);
134 
135  } else {
136  eventaction->SetRef();
137  Thetaback = std::acos(aStep->GetTrack()->GetMomentumDirection().z());
138  Thetaback -= 0.5*pi ;
139  runaction->FillThBack(Thetaback) ;
140  Tback = aStep->GetTrack()->GetKineticEnergy() ;
141  runaction->FillTb(Tback) ;
142  }
143  }
144  if(track->GetMomentumDirection().z()>0. &&
145  particle == G4Gamma::Gamma()) {
146 
147  Egamma = aStep->GetTrack()->GetKineticEnergy() ;
148  runaction->FillGammaSpectrum(Egamma) ;
149  }
150  }
151  }
152 }
153 
154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
155