Geant4  10.00.p01
exrdmSteppingAction.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 // $Id: exrdmSteppingAction.cc 68030 2013-03-13 13:51:27Z gcosmo $
27 //
30 //
31 #include "G4ios.hh"
32 
33 #include "exrdmSteppingAction.hh"
34 #include "exrdmAnalysisManager.hh"
35 #include "G4Track.hh"
36 #include "globals.hh"
37 #include "G4SteppingManager.hh"
38 #include "G4ParticleDefinition.hh"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41 
44 { }
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47 
49 { }
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
54 {
55  G4Track* fTrack = fStep->GetTrack();
56  G4int StepNo = fTrack->GetCurrentStepNumber();
57  if(StepNo >= 10000) fTrack->SetTrackStatus(fStopAndKill);
58 
59 #ifdef G4ANALYSIS_USE
60 #define COLLECT
61 #endif
62 #ifdef G4ANALYSIS_USE_ROOT
63 #ifndef COLLECT
64 #define COLLECT
65 #endif
66 #endif
67 
68 #ifdef COLLECT
69  G4double time = fStep->GetPreStepPoint()->GetGlobalTime();
70  G4double weight = fStep->GetPreStepPoint()->GetWeight();
71  G4double edep = fStep->GetTotalEnergyDeposit();
73  if (StepNo == 1) { //beginning of step
76  G4ParticleDefinition* thePartDef = fTrack->GetDefinition();
77  G4String partType= fTrack->GetDefinition()->GetParticleType();
78  if (( partType == "nucleus") && !(thePartDef->GetPDGStable()) &&
79  fStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Target" ) {
80  analysis->AddIsotope(pid, weight, time);
81  }
82  if (fTrack->GetTrackID() != 1 ){
83  //Radioactive decay products
84  if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") {
85  //all products
86  G4int Z=thePartDef->GetAtomicNumber();
87  G4int A=thePartDef->GetAtomicMass();
88  analysis->AddDecayProduct(pid, Z, A, energy, time, weight);
89  // emitted particles except nuclei
90  if ( partType!= "nucleus") {
91  analysis->AddParticle(pid, energy, weight, time);
92  }
93  }
94  }
95  }
96  // energy deposition
97  if (fTrack->GetTrackID() != 1 && edep) {
98  if (fStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Detector")
99  edep = -edep;
100  analysis->AddEnergy(edep,weight,time);
101  }
102 #endif
103 }
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
105 
106 
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
G4double GetWeight() const
void AddEnergy(G4double, G4double, G4double)
virtual void UserSteppingAction(const G4Step *)
G4bool GetPDGStable() const
Definition of the exrdmSteppingAction class.
int G4int
Definition: G4Types.hh:78
G4int GetAtomicNumber() const
G4StepPoint * GetPreStepPoint() const
const G4VProcess * GetCreatorProcess() const
G4int GetCurrentStepNumber() const
Definition of the exrdmAnalysisManager class.
G4VPhysicalVolume * GetPhysicalVolume() const
const G4String & GetName() const
void AddDecayProduct(G4double pid, G4int Z, G4int A, G4double energy, G4double time, G4double weight)
const G4String & GetParticleType() const
Definition: G4Step.hh:76
G4int GetTrackID() const
void AddParticle(G4double, G4double, G4double, G4double)
static const G4double A[nN]
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4int GetAtomicMass() const
G4double GetTotalEnergyDeposit() const
G4double energy(const ThreeVector &p, const G4double m)
static exrdmAnalysisManager * GetInstance()
G4double GetGlobalTime() const
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const
void AddIsotope(G4double, G4double, G4double)