00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // $Id: G4NeutronKiller.hh 69887 2013-05-17 08:17:02Z gcosmo $ 00027 // 00028 //--------------------------------------------------------------------------- 00029 // 00030 // ClassName: G4NeutronKiller 00031 // 00032 // Description: The process to kill neutrons to save CPU 00033 // 00034 // Author: V.Ivanchenko 26/09/00 for HARP software 00035 // 00036 //---------------------------------------------------------------------------- 00037 // 00038 // Class description: 00039 // 00040 // G4NeutronKiller allows to remove unwanted neutrons from simulation in 00041 // order to improve CPU performance. There are two parameters: 00042 // 00043 // 1) low energy threshold for neutron kinetic energy (default 0) 00044 // 2) time limit for neutron track (default DBL_MAX) 00045 // 00046 // These parameters can be changed via Set methods or by UI commands: 00047 // /physics_engine/neutron/energyCut 00048 // /physics_engine/neutron/timeLimit 00049 // 00050 // If a neutron track is killed no energy deposition is added to the step 00051 // 00052 00053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00055 00056 #ifndef NeutronKiller_h 00057 #define NeutronKiller_h 1 00058 00059 #include "globals.hh" 00060 #include "G4VDiscreteProcess.hh" 00061 #include "G4ParticleDefinition.hh" 00062 #include "G4Step.hh" 00063 #include "G4Track.hh" 00064 00065 class G4NeutronKillerMessenger; 00066 00067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00068 00069 class G4NeutronKiller : public G4VDiscreteProcess 00070 { 00071 public: 00072 00073 G4NeutronKiller(const G4String& processName = "nKiller", 00074 G4ProcessType aType = fGeneral ); 00075 00076 virtual ~G4NeutronKiller(); 00077 00078 G4bool IsApplicable(const G4ParticleDefinition&); 00079 00080 void SetTimeLimit(G4double); 00081 00082 void SetKinEnergyLimit(G4double); 00083 00084 G4double PostStepGetPhysicalInteractionLength( const G4Track& track, 00085 G4double previousStepSize, 00086 G4ForceCondition* condition); 00087 00088 G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 00089 00090 G4double GetMeanFreePath(const G4Track&, G4double,G4ForceCondition*); 00091 00092 private: 00093 00094 // hide assignment operator as private 00095 G4NeutronKiller(const G4NeutronKiller&); 00096 G4NeutronKiller& operator = (const G4NeutronKiller &right); 00097 00098 G4double kinEnergyThreshold; 00099 G4double timeThreshold; 00100 00101 G4NeutronKillerMessenger* pMess; 00102 }; 00103 00104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00105 00106 inline G4double G4NeutronKiller::PostStepGetPhysicalInteractionLength( 00107 const G4Track& aTrack, 00108 G4double, G4ForceCondition* condition) 00109 { 00110 // condition is set to "Not Forced" 00111 *condition = NotForced; 00112 00113 G4double limit = DBL_MAX; 00114 if(aTrack.GetGlobalTime() > timeThreshold || 00115 aTrack.GetKineticEnergy() < kinEnergyThreshold) limit = 0.0; 00116 return limit; 00117 } 00118 00119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00120 00121 inline G4double G4NeutronKiller::GetMeanFreePath(const G4Track&,G4double, 00122 G4ForceCondition*) 00123 { 00124 return DBL_MAX; 00125 } 00126 00127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00128 00129 inline G4VParticleChange* G4NeutronKiller::PostStepDoIt(const G4Track& aTrack, 00130 const G4Step&) 00131 { 00132 pParticleChange->Initialize(aTrack); 00133 pParticleChange->ProposeTrackStatus(fStopAndKill); 00134 return pParticleChange; 00135 } 00136 00137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00138 00139 #endif 00140