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 | #include "G4ios.hh" |
---|
27 | |
---|
28 | #include "exrdmSteppingAction.hh" |
---|
29 | #include "exrdmAnalysisManager.hh" |
---|
30 | #include "G4Track.hh" |
---|
31 | #include "globals.hh" |
---|
32 | #include "G4SteppingManager.hh" |
---|
33 | |
---|
34 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
35 | |
---|
36 | exrdmSteppingAction::exrdmSteppingAction() |
---|
37 | { } |
---|
38 | |
---|
39 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
40 | |
---|
41 | exrdmSteppingAction::~exrdmSteppingAction() |
---|
42 | { } |
---|
43 | |
---|
44 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
45 | |
---|
46 | void exrdmSteppingAction::UserSteppingAction(const G4Step* fStep) |
---|
47 | { |
---|
48 | #ifdef G4ANALYSIS_USE |
---|
49 | G4Track* fTrack = fStep->GetTrack(); |
---|
50 | G4int StepNo = fTrack->GetCurrentStepNumber(); |
---|
51 | if(StepNo >= 10000) fTrack->SetTrackStatus(fStopAndKill); |
---|
52 | if (StepNo == 1) { |
---|
53 | if ( (fTrack->GetDefinition()->GetParticleType() == "nucleus") && |
---|
54 | !( fTrack->GetDefinition()->GetPDGStable()) && |
---|
55 | fStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Target" ) { |
---|
56 | // G4String particleName = fTrack->GetDefinition()->GetParticleName(); |
---|
57 | G4double particleName = G4double(fTrack->GetDefinition()->GetPDGEncoding()); |
---|
58 | G4double time = fStep->GetPreStepPoint()->GetGlobalTime() ; |
---|
59 | // - fStep->GetPreStepPoint()->GetLocalTime(); // do we have to take out the local time? |
---|
60 | G4double weight = fStep->GetPreStepPoint()->GetWeight() ; |
---|
61 | // get the analysis manager |
---|
62 | exrdmAnalysisManager* analysis = exrdmAnalysisManager::getInstance(); |
---|
63 | // G4cout << particleName << " " << weight << " " << time/s << G4endl; |
---|
64 | analysis->AddIsotope(particleName, weight, time); |
---|
65 | } |
---|
66 | if (fTrack->GetTrackID() != 1 ){ |
---|
67 | if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") { |
---|
68 | // emitted particles |
---|
69 | if (fTrack->GetDefinition()->GetParticleType() != "nucleus") { |
---|
70 | // G4String particleName = fTrack->GetDefinition()->GetParticleName(); |
---|
71 | G4double particleName = G4double (fTrack->GetDefinition()->GetPDGEncoding()); |
---|
72 | G4double time = fStep->GetPreStepPoint()->GetGlobalTime() ; |
---|
73 | //- fStep->GetPreStepPoint()->GetLocalTime(); |
---|
74 | G4double weight = fStep->GetPreStepPoint()->GetWeight() ; |
---|
75 | G4double energy = fStep->GetPreStepPoint()->GetKineticEnergy(); |
---|
76 | // |
---|
77 | exrdmAnalysisManager::getInstance()->AddParticle(particleName, energy, weight, time); |
---|
78 | } |
---|
79 | } |
---|
80 | } |
---|
81 | } |
---|
82 | // energy deposition: collect energy deposited by decay products only |
---|
83 | if (fTrack->GetTrackID() != 1 ) { |
---|
84 | if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") { |
---|
85 | if (fStep->GetTotalEnergyDeposit() ) { |
---|
86 | G4double time = fStep->GetPreStepPoint()->GetGlobalTime() ; |
---|
87 | // - fStep->GetPreStepPoint()->GetLocalTime(); |
---|
88 | // G4double time = fStep->GetPreStepPoint()->GetLocalTime(); // time since the track was created |
---|
89 | G4double edep = fStep->GetTotalEnergyDeposit(); |
---|
90 | G4double weight = fStep->GetPreStepPoint()->GetWeight() ; |
---|
91 | if (fStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Detector") edep = -edep; |
---|
92 | exrdmAnalysisManager::getInstance()->AddEnergy(edep,weight,time); |
---|
93 | } |
---|
94 | } |
---|
95 | } |
---|
96 | #endif |
---|
97 | } |
---|
98 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
99 | |
---|
100 | |
---|