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 // neutron_hp -- source file 00027 // J.P. Wellisch, Nov-1996 00028 // A prototype of the low energy neutron transport model. 00029 // 00030 // 080721 To be "ClearHistories" effective, the selection scheme of angular distribution is modified by T. Koi 00031 // 00032 // 00033 #include "G4NeutronHPContEnergyAngular.hh" 00034 00035 G4ReactionProduct * G4NeutronHPContEnergyAngular::Sample(G4double anEnergy, G4double massCode, G4double /*mass*/) 00036 { 00037 G4ReactionProduct * result; 00038 G4int i(0); 00039 G4int it(0); 00040 for(i=0;i<nEnergy;i++) 00041 { 00042 it = i; 00043 if(theAngular[i].GetEnergy()>anEnergy) break; 00044 } 00045 G4double targetMass = GetTarget()->GetMass(); 00046 if(it==0) 00047 { 00048 theAngular[0].SetTarget(GetTarget()); 00049 theAngular[0].SetTargetCode(theTargetCode); 00050 theAngular[0].SetPrimary(GetNeutron()); 00051 result = theAngular[0].Sample(anEnergy, massCode, targetMass, 00052 theAngularRep, theInterpolation); 00053 currentMeanEnergy = theAngular[0].MeanEnergyOfThisInteraction(); 00054 } 00055 else 00056 { 00057 // interpolation through alternating sampling. This needs improvement @@@ 00058 // This is the cause of the He3 problem !!!!!!!! 00059 // See to it, if you can improve this. 00060 //080714 TK commnet Randomizing use angular distribution 00061 //080714 TK Always use the upper side distribution. enabling ClearHistories method. 00062 //G4double random = G4UniformRand(); 00063 //G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy(); 00064 //G4double offset = theAngular[it].GetEnergy()-anEnergy; 00065 //if(random<offset/deltaE) it--; 00066 theAngular[it].SetTarget(GetTarget()); 00067 theAngular[it].SetTargetCode(theTargetCode); 00068 theAngular[it].SetPrimary(GetNeutron()); 00069 result = theAngular[it].Sample(anEnergy, massCode, targetMass, 00070 theAngularRep, theInterpolation); 00071 currentMeanEnergy = theAngular[it].MeanEnergyOfThisInteraction(); 00072 } 00073 return result; 00074 } 00075 00076 G4double G4NeutronHPContEnergyAngular:: 00077 MeanEnergyOfThisInteraction() 00078 { 00079 G4double result(0); 00080 if(currentMeanEnergy<-1) 00081 { 00082 throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPContEnergyAngular: Logical error in Product class"); 00083 } 00084 else 00085 { 00086 result = currentMeanEnergy; 00087 } 00088 currentMeanEnergy = -2; 00089 return result; 00090 } 00091 00092 00093 00094 void G4NeutronHPContEnergyAngular::ClearHistories() 00095 { 00096 if ( theAngular!= NULL ) 00097 { 00098 for ( G4int i = 0 ; i< nEnergy ; i++ ) 00099 theAngular[i].ClearHistories(); 00100 } 00101 }