Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PurgMagSteppingAction.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 // Code developed by:
27 // S.Larsson
28 //
29 // ***********************************
30 // * *
31 // * PurgMagSteppingAction.cc *
32 // * *
33 // ***********************************
34 //
35 // $Id$
36 //
37 
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
39 
40 #include "PurgMagSteppingAction.hh"
41 #include "PurgMagRunAction.hh"
43 
44 #include "G4SteppingManager.hh"
45 #include "G4VTouchable.hh"
46 #include "G4VPhysicalVolume.hh"
47 
48 #ifdef G4ANALYSIS_USE
50 #endif
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53 
55 :PurgMagRun(run),Detector(det)
56 { }
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59 
61 { }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
65 #ifdef G4ANALYSIS_USE
67 
68 {
69  //Collection at SSD in N-tuples. Electrons and photons separated
70  //Prestep point in World, next volume MeasureVolume, process transportation
71  PurgMagAnalysisManager* analysis = PurgMagAnalysisManager::getInstance();
72  if ((aStep->GetPreStepPoint()->GetPhysicalVolume() == Detector->GetWorld())&&
73  (aStep->GetTrack()->GetNextVolume() == Detector->GetMeasureVolume())&&
74  //(aStep->GetTrack()->GetMomentumDirection().z()>0.)&& // only particles with positive momentum
75  (aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == "Transportation"))
76  {
77  G4double gx, gy, gz, ge, gpx, gpy, gpz, ex, ey, ez, ee;
78  G4double epx, epy, epz, px, py, pz, pe, ppx, ppy, ppz;
79 
80 
81  // Electrons
83  == "e-")
84  {//Position
85  ex = (aStep->GetTrack()->GetPosition().x())/cm;
86  ey = (aStep->GetTrack()->GetPosition().y())/cm;
87  ez = (aStep->GetTrack()->GetPosition().z())/cm;
88  // Energy
89  ee = (aStep->GetTrack()->GetKineticEnergy())/MeV;
90  // Momentum
91  epx = aStep->GetTrack()->GetMomentum().x();
92  epy = aStep->GetTrack()->GetMomentum().y();
93  epz = aStep->GetTrack()->GetMomentum().z();
94 
95  // Fill N-tuple electrons
96  analysis->fill_Tuple_Electrons(ex, ey, ez, ee, epx, epy, epz);
97  }
98 
99  // Photons
100  if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
101  GetParticleName() == "gamma")
102  {
103 
104  // Position
105  gx = (aStep->GetTrack()->GetPosition().x())/cm;
106  gy = (aStep->GetTrack()->GetPosition().y())/cm;
107  gz = (aStep->GetTrack()->GetPosition().z())/cm;
108 
109  // Energy
110  ge = (aStep->GetTrack()->GetKineticEnergy())/MeV;
111 
112  // Momentum
113  gpx = aStep->GetTrack()->GetMomentum().x();
114  gpy = aStep->GetTrack()->GetMomentum().y();
115  gpz = aStep->GetTrack()->GetMomentum().z();
116 
117  // Fill N-tuple photons
118  analysis->fill_Tuple_Gamma(gx, gy, gz, ge, gpx, gpy, gpz);
119  }
120 
121 
122  // Positrons
123  if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName() == "e+")
124  {
125 
126  // Position
127  px = (aStep->GetTrack()->GetPosition().x())/cm;
128  py = (aStep->GetTrack()->GetPosition().y())/cm;
129  pz = (aStep->GetTrack()->GetPosition().z())/cm;
130 
131  // Energy
132  pe = (aStep->GetTrack()->GetKineticEnergy())/MeV;
133 
134  // Momentum
135  ppx = aStep->GetTrack()->GetMomentum().x();
136  ppy = aStep->GetTrack()->GetMomentum().y();
137  ppz = aStep->GetTrack()->GetMomentum().z();
138 
139  // Fill Ntuple positrons
140  analysis->fill_Tuple_Positrons(px, py, pz, pe, ppx, ppy, ppz);
141  }
142  }
143 #else
145 {
146 #endif
147 }
148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....