Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 //-------------------------------------------- 27 //--------------------------------------------------------------------------- 28 // 28 // 29 // ClassName: G4NeutronKiller 29 // ClassName: G4NeutronKiller 30 // 30 // 31 // Description: The process to kill particles 31 // Description: The process to kill particles to save CPU 32 // 32 // 33 // Author: V.Ivanchenko 26/09/00 for HARP 33 // Author: V.Ivanchenko 26/09/00 for HARP software 34 // 34 // 35 //-------------------------------------------- 35 //---------------------------------------------------------------------------- 36 // 36 // 37 //....oooOO0OOooo........oooOO0OOooo........oo 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 38 //....oooOO0OOooo........oooOO0OOooo........oo 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 39 39 40 #include "G4NeutronKiller.hh" 40 #include "G4NeutronKiller.hh" 41 41 42 #include "G4SystemOfUnits.hh" 42 #include "G4SystemOfUnits.hh" 43 #include "G4NeutronKillerMessenger.hh" 43 #include "G4NeutronKillerMessenger.hh" 44 #include "G4TransportationProcessType.hh" 44 #include "G4TransportationProcessType.hh" 45 45 46 //....oooOO0OOooo........oooOO0OOooo........oo 46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 47 48 G4NeutronKiller::G4NeutronKiller(const G4Strin 48 G4NeutronKiller::G4NeutronKiller(const G4String& processName, G4ProcessType aType) 49 : G4VDiscreteProcess(processName, aType) 49 : G4VDiscreteProcess(processName, aType) 50 { 50 { 51 // set Process Sub Type 51 // set Process Sub Type 52 SetProcessSubType(NEUTRON_KILLER); 52 SetProcessSubType(NEUTRON_KILLER); 53 53 54 kinEnergyThreshold = 0.0; 54 kinEnergyThreshold = 0.0; 55 timeThreshold = DBL_MAX; 55 timeThreshold = DBL_MAX; 56 pMess = new G4NeutronKillerMessenger(this); 56 pMess = new G4NeutronKillerMessenger(this); 57 } 57 } 58 58 59 //....oooOO0OOooo........oooOO0OOooo........oo 59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 60 60 61 G4NeutronKiller::~G4NeutronKiller() 61 G4NeutronKiller::~G4NeutronKiller() 62 { 62 { 63 delete pMess; 63 delete pMess; 64 } 64 } 65 65 66 //....oooOO0OOooo........oooOO0OOooo........oo 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 67 67 68 G4bool G4NeutronKiller::IsApplicable(const G4P 68 G4bool G4NeutronKiller::IsApplicable(const G4ParticleDefinition& particle) 69 { 69 { 70 return (particle.GetParticleName() == "neutr 70 return (particle.GetParticleName() == "neutron"); 71 } 71 } 72 72 73 //....oooOO0OOooo........oooOO0OOooo........oo 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 74 74 75 void G4NeutronKiller::SetTimeLimit(G4double va 75 void G4NeutronKiller::SetTimeLimit(G4double val) 76 { 76 { 77 timeThreshold = val; 77 timeThreshold = val; 78 if(verboseLevel > 0) 78 if(verboseLevel > 0) 79 G4cout << "### G4NeutronKiller: timeLimit( 79 G4cout << "### G4NeutronKiller: timeLimit(ns) = " 80 << timeThreshold/ns << G4endl; 80 << timeThreshold/ns << G4endl; 81 } 81 } 82 82 83 //....oooOO0OOooo........oooOO0OOooo........oo 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 84 85 void G4NeutronKiller::SetKinEnergyLimit(G4doub 85 void G4NeutronKiller::SetKinEnergyLimit(G4double val) 86 { 86 { 87 kinEnergyThreshold = val; 87 kinEnergyThreshold = val; 88 if(verboseLevel > 0) 88 if(verboseLevel > 0) 89 G4cout << "### G4NeutronKiller: Tracking c 89 G4cout << "### G4NeutronKiller: Tracking cut E(MeV) = " 90 << kinEnergyThreshold/MeV << G4endl; 90 << kinEnergyThreshold/MeV << G4endl; 91 } 91 } 92 92 93 //....oooOO0OOooo........oooOO0OOooo........oo 93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 94 94 95 G4double G4NeutronKiller::PostStepGetPhysicalI 95 G4double G4NeutronKiller::PostStepGetPhysicalInteractionLength( 96 const G4Track& aTrack, 96 const G4Track& aTrack, 97 G4double, G4ForceCondition* condition 97 G4double, G4ForceCondition* condition) 98 { 98 { 99 // condition is set to "Not Forced" 99 // condition is set to "Not Forced" 100 *condition = NotForced; 100 *condition = NotForced; 101 101 102 return (aTrack.GetGlobalTime() > timeThresho 102 return (aTrack.GetGlobalTime() > timeThreshold || 103 aTrack.GetKineticEnergy() < kinEnerg 103 aTrack.GetKineticEnergy() < kinEnergyThreshold) ? 0.0 : DBL_MAX; 104 } 104 } 105 105 106 //....oooOO0OOooo........oooOO0OOooo........oo 106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 107 107 108 G4double G4NeutronKiller::GetMeanFreePath(cons 108 G4double G4NeutronKiller::GetMeanFreePath(const G4Track&,G4double, 109 G4ForceCondition*) 109 G4ForceCondition*) 110 { 110 { 111 return DBL_MAX; 111 return DBL_MAX; 112 } 112 } 113 113 114 //....oooOO0OOooo........oooOO0OOooo........oo 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 115 115 116 G4VParticleChange* G4NeutronKiller::PostStepDo 116 G4VParticleChange* G4NeutronKiller::PostStepDoIt(const G4Track& aTrack, 117 const G4Step&) 117 const G4Step&) 118 { 118 { 119 pParticleChange->Initialize(aTrack); 119 pParticleChange->Initialize(aTrack); 120 pParticleChange->ProposeTrackStatus(fStopAnd 120 pParticleChange->ProposeTrackStatus(fStopAndKill); 121 return pParticleChange; 121 return pParticleChange; 122 } 122 } 123 123 124 //....oooOO0OOooo........oooOO0OOooo........oo 124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 125 125