Geant4  10.00.p01
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: PurgMagSteppingAction.cc 72967 2013-08-14 14:57:48Z gcosmo $
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 
49 #include "G4SystemOfUnits.hh"
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
54 :Detector(det)
55 { }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58 
60 { }
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63 
65 
66 {
67  //Collection at SSD in N-tuples. Electrons and photons separated
68  //Prestep point in World, next volume MeasureVolume, process transportation
70  if ((aStep->GetPreStepPoint()->GetPhysicalVolume() == Detector->GetWorld())&&
71  (aStep->GetTrack()->GetNextVolume() == Detector->GetMeasureVolume())&&
72  //(aStep->GetTrack()->GetMomentumDirection().z()>0.)&& // only particles with positive momentum
73  (aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == "Transportation"))
74  {
75  G4double gx, gy, gz, ge, gpx, gpy, gpz, ex, ey, ez, ee;
76  G4double epx, epy, epz, px, py, pz, pe, ppx, ppy, ppz;
77 
78 
79  // Electrons
81  == "e-")
82  {//Position
83  ex = (aStep->GetTrack()->GetPosition().x())/cm;
84  ey = (aStep->GetTrack()->GetPosition().y())/cm;
85  ez = (aStep->GetTrack()->GetPosition().z())/cm;
86  // Energy
87  ee = (aStep->GetTrack()->GetKineticEnergy())/MeV;
88  // Momentum
89  epx = aStep->GetTrack()->GetMomentum().x();
90  epy = aStep->GetTrack()->GetMomentum().y();
91  epz = aStep->GetTrack()->GetMomentum().z();
92 
93  // Fill N-tuple electrons
94  analysis->fill_Tuple_Electrons(ex, ey, ez, ee, epx, epy, epz);
95  }
96 
97  // Photons
98  if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
99  GetParticleName() == "gamma")
100  {
101 
102  // Position
103  gx = (aStep->GetTrack()->GetPosition().x())/cm;
104  gy = (aStep->GetTrack()->GetPosition().y())/cm;
105  gz = (aStep->GetTrack()->GetPosition().z())/cm;
106 
107  // Energy
108  ge = (aStep->GetTrack()->GetKineticEnergy())/MeV;
109 
110  // Momentum
111  gpx = aStep->GetTrack()->GetMomentum().x();
112  gpy = aStep->GetTrack()->GetMomentum().y();
113  gpz = aStep->GetTrack()->GetMomentum().z();
114 
115  // Fill N-tuple photons
116  analysis->fill_Tuple_Gamma(gx, gy, gz, ge, gpx, gpy, gpz);
117  }
118 
119 
120  // Positrons
121  if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName() == "e+")
122  {
123 
124  // Position
125  px = (aStep->GetTrack()->GetPosition().x())/cm;
126  py = (aStep->GetTrack()->GetPosition().y())/cm;
127  pz = (aStep->GetTrack()->GetPosition().z())/cm;
128 
129  // Energy
130  pe = (aStep->GetTrack()->GetKineticEnergy())/MeV;
131 
132  // Momentum
133  ppx = aStep->GetTrack()->GetMomentum().x();
134  ppy = aStep->GetTrack()->GetMomentum().y();
135  ppz = aStep->GetTrack()->GetMomentum().z();
136 
137  // Fill Ntuple positrons
138  analysis->fill_Tuple_Positrons(px, py, pz, pe, ppx, ppy, ppz);
139  }
140  }
141 }
142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
static const double cm
Definition: G4SIunits.hh:106
static const double MeV
Definition: G4SIunits.hh:193
const G4DynamicParticle * GetDynamicParticle() const
PurgMagSteppingAction(PurgMagDetectorConstruction *)
const G4ThreeVector & GetPosition() const
void fill_Tuple_Gamma(G4double, G4double, G4double, G4double, G4double, G4double, G4double)
G4ParticleDefinition * GetDefinition() const
const G4String & GetParticleName() const
G4VPhysicalVolume * GetNextVolume() const
G4StepPoint * GetPreStepPoint() const
PurgMagDetectorConstruction * Detector
G4double GetKineticEnergy() const
G4VPhysicalVolume * GetPhysicalVolume() const
Definition: G4Step.hh:76
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4ThreeVector GetMomentum() const
void fill_Tuple_Positrons(G4double, G4double, G4double, G4double, G4double, G4double, G4double)
const G4VProcess * GetProcessDefinedStep() const
G4StepPoint * GetPostStepPoint() const
void UserSteppingAction(const G4Step *)
void fill_Tuple_Electrons(G4double, G4double, G4double, G4double, G4double, G4double, G4double)
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const
const G4VPhysicalVolume * GetWorld()
const G4VPhysicalVolume * GetMeasureVolume()
static PurgMagAnalysisManager * getInstance()