Geant4 Cross Reference |
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 // 27 //--------------------------------------------------------------------------- 28 // 29 // ClassName: G4NeutronKiller 30 // 31 // Description: The process to kill particles to save CPU 32 // 33 // Author: V.Ivanchenko 26/09/00 for HARP software 34 // 35 //---------------------------------------------------------------------------- 36 // 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 39 40 #include "G4NeutronKiller.hh" 41 42 #include "G4SystemOfUnits.hh" 43 #include "G4NeutronKillerMessenger.hh" 44 #include "G4TransportationProcessType.hh" 45 46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 48 G4NeutronKiller::G4NeutronKiller(const G4String& processName, G4ProcessType aType) 49 : G4VDiscreteProcess(processName, aType) 50 { 51 // set Process Sub Type 52 SetProcessSubType(NEUTRON_KILLER); 53 54 kinEnergyThreshold = 0.0; 55 timeThreshold = DBL_MAX; 56 pMess = new G4NeutronKillerMessenger(this); 57 } 58 59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 60 61 G4NeutronKiller::~G4NeutronKiller() 62 { 63 delete pMess; 64 } 65 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 67 68 G4bool G4NeutronKiller::IsApplicable(const G4ParticleDefinition& particle) 69 { 70 return (particle.GetParticleName() == "neutron"); 71 } 72 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 74 75 void G4NeutronKiller::SetTimeLimit(G4double val) 76 { 77 timeThreshold = val; 78 if(verboseLevel > 0) 79 G4cout << "### G4NeutronKiller: timeLimit(ns) = " 80 << timeThreshold/ns << G4endl; 81 } 82 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 85 void G4NeutronKiller::SetKinEnergyLimit(G4double val) 86 { 87 kinEnergyThreshold = val; 88 if(verboseLevel > 0) 89 G4cout << "### G4NeutronKiller: Tracking cut E(MeV) = " 90 << kinEnergyThreshold/MeV << G4endl; 91 } 92 93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 94 95 G4double G4NeutronKiller::PostStepGetPhysicalInteractionLength( 96 const G4Track& aTrack, 97 G4double, G4ForceCondition* condition) 98 { 99 // condition is set to "Not Forced" 100 *condition = NotForced; 101 102 return (aTrack.GetGlobalTime() > timeThreshold || 103 aTrack.GetKineticEnergy() < kinEnergyThreshold) ? 0.0 : DBL_MAX; 104 } 105 106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 107 108 G4double G4NeutronKiller::GetMeanFreePath(const G4Track&,G4double, 109 G4ForceCondition*) 110 { 111 return DBL_MAX; 112 } 113 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 115 116 G4VParticleChange* G4NeutronKiller::PostStepDoIt(const G4Track& aTrack, 117 const G4Step&) 118 { 119 pParticleChange->Initialize(aTrack); 120 pParticleChange->ProposeTrackStatus(fStopAndKill); 121 return pParticleChange; 122 } 123 124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 125