[807] | 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 | G4Track* fTrack = fStep->GetTrack(); |
---|
| 49 | G4int StepNo = fTrack->GetCurrentStepNumber(); |
---|
| 50 | if(StepNo >= 10000) fTrack->SetTrackStatus(fStopAndKill); |
---|
[1230] | 51 | |
---|
| 52 | #ifdef G4ANALYSIS_USE |
---|
| 53 | #define COLLECT |
---|
| 54 | #endif |
---|
| 55 | #ifdef G4ANALYSIS_USE_ROOT |
---|
| 56 | #ifndef COLLECT |
---|
| 57 | #define COLLECT |
---|
| 58 | #endif |
---|
| 59 | #endif |
---|
| 60 | |
---|
| 61 | #ifdef COLLECT |
---|
[807] | 62 | if (StepNo == 1) { |
---|
| 63 | if ( (fTrack->GetDefinition()->GetParticleType() == "nucleus") && |
---|
| 64 | !( fTrack->GetDefinition()->GetPDGStable()) && |
---|
| 65 | fStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Target" ) { |
---|
| 66 | // G4String particleName = fTrack->GetDefinition()->GetParticleName(); |
---|
| 67 | G4double particleName = G4double(fTrack->GetDefinition()->GetPDGEncoding()); |
---|
| 68 | G4double time = fStep->GetPreStepPoint()->GetGlobalTime() ; |
---|
| 69 | // - fStep->GetPreStepPoint()->GetLocalTime(); // do we have to take out the local time? |
---|
| 70 | G4double weight = fStep->GetPreStepPoint()->GetWeight() ; |
---|
| 71 | // get the analysis manager |
---|
| 72 | exrdmAnalysisManager* analysis = exrdmAnalysisManager::getInstance(); |
---|
| 73 | // G4cout << particleName << " " << weight << " " << time/s << G4endl; |
---|
| 74 | analysis->AddIsotope(particleName, weight, time); |
---|
| 75 | } |
---|
| 76 | if (fTrack->GetTrackID() != 1 ){ |
---|
| 77 | if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") { |
---|
| 78 | // emitted particles |
---|
| 79 | if (fTrack->GetDefinition()->GetParticleType() != "nucleus") { |
---|
| 80 | // G4String particleName = fTrack->GetDefinition()->GetParticleName(); |
---|
| 81 | G4double particleName = G4double (fTrack->GetDefinition()->GetPDGEncoding()); |
---|
| 82 | G4double time = fStep->GetPreStepPoint()->GetGlobalTime() ; |
---|
| 83 | //- fStep->GetPreStepPoint()->GetLocalTime(); |
---|
| 84 | G4double weight = fStep->GetPreStepPoint()->GetWeight() ; |
---|
| 85 | G4double energy = fStep->GetPreStepPoint()->GetKineticEnergy(); |
---|
| 86 | // |
---|
| 87 | exrdmAnalysisManager::getInstance()->AddParticle(particleName, energy, weight, time); |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | } |
---|
[1230] | 92 | // energy deposition |
---|
[807] | 93 | if (fTrack->GetTrackID() != 1 ) { |
---|
[1230] | 94 | // if (fTrack->GetCreatorProcess()->GetProcessName() == "RadioactiveDecay") { |
---|
[807] | 95 | if (fStep->GetTotalEnergyDeposit() ) { |
---|
| 96 | G4double time = fStep->GetPreStepPoint()->GetGlobalTime() ; |
---|
| 97 | // - fStep->GetPreStepPoint()->GetLocalTime(); |
---|
| 98 | // G4double time = fStep->GetPreStepPoint()->GetLocalTime(); // time since the track was created |
---|
| 99 | G4double edep = fStep->GetTotalEnergyDeposit(); |
---|
| 100 | G4double weight = fStep->GetPreStepPoint()->GetWeight() ; |
---|
| 101 | if (fStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Detector") edep = -edep; |
---|
| 102 | exrdmAnalysisManager::getInstance()->AddEnergy(edep,weight,time); |
---|
| 103 | } |
---|
[1230] | 104 | // } |
---|
[807] | 105 | } |
---|
[1230] | 106 | #endif |
---|
[807] | 107 | } |
---|
| 108 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 109 | |
---|
| 110 | |
---|