Index: trunk/source/processes/hadronic/models/neutron_hp/History
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/History	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/History	(revision 962)
@@ -1,3 +1,2 @@
-$Id: History,v 1.23.2.2 2008/04/29 07:05:37 gcosmo Exp $
 -------------------------------------------------------------------
 
@@ -14,9 +13,188 @@
      ---------------------------------------------------------------
      * Please list in reverse chronological order (last date on top)
-      ---------------------------------------------------------------
-
-29 April 2008 Gabriele Cosmo (hadr-hpn-V09-00-07)
--------------------------------------------------
-- Tag for release 9.1.p02.
+     ---------------------------------------------------------------
+
+3 December 2008  Tatsumi Koi  (hadr-hpn-V09-01-28)
+- Fix bug in Register in G4NeutronHPChannel 
+  and add limitation of trial of creating final states and proctection for pure 1H case in G4NeutronHPInelastic
+	G4NeutronHPChannel.cc
+        G4NeutronHPInelastic.cc
+
+2 December 2008  Tatsumi Koi  (hadr-hpn-V09-01-27)
+- Remove unused variable
+        G4NeutronHPThermalScattering.cc
+
+1 December 2008  Tatsumi Koi  (hadr-hpn-V09-01-26)
+- Fix for Memory Leak 
+        G4NeutronHPThermalScattering.cc
+
+24 November 2008  Tatsumi Koi  (hadr-hpn-V09-01-25)
+- Protect invalid read which caused run time errors
+        G4NeutronHPFissionData.cc
+
+05 November 2008  Dennis Wright  (hadr-hpn-V09-01-24)
+  G4NeutronHPNames.cc: put parentheses around && in || (line 324) to 
+  satisfy gcc 4.3 compiler.
+
+27 October 2008 Tatsumi Koi (hadr-hpn-V09-01-23)
+  Z,A to A,Z for functions of NucleiProperties 
+	recommit and re tag hadr-hpn-V09-01-22 
+
+27 October 2008 Tatsumi Koi (hadr-hpn-V09-01-22)
+  Z,A to A,Z for functions of NucleiProperties 
+	G4NeutronHPThermalBoost.hh
+        G4NeutronHPCaptureData.cc
+        G4NeutronHPCaptureFS.cc
+        G4NeutronHPContAngularPar.cc
+        G4NeutronHPElasticData.cc
+        G4NeutronHPFissionData.cc
+        G4NeutronHPInelasticBaseFS.cc
+        G4NeutronHPInelasticCompFS.cc
+        G4NeutronHPInelasticData.cc
+        G4NeutronHPorLCaptureData.cc
+        G4NeutronHPorLEInelasticData.cc
+        G4NeutronHPorLElasticData.cc
+        G4NeutronHPorLFissionData.cc
+
+24 October 2008 Tatsumi Koi (hadr-hpn-V09-01-21)
+- Migarate to "particles-V09-01-09"
+	G4NeutronHPThermalBoost.hh
+        G4NeutronHPCaptureData.cc
+        G4NeutronHPCaptureFS.cc
+        G4NeutronHPContAngularPar.cc
+        G4NeutronHPElasticData.cc
+        G4NeutronHPFissionData.cc
+        G4NeutronHPInelasticBaseFS.cc
+        G4NeutronHPInelasticCompFS.cc
+        G4NeutronHPInelasticData.cc
+        G4NeutronHPorLCaptureData.cc
+        G4NeutronHPorLEInelasticData.cc
+        G4NeutronHPorLElasticData.cc
+        G4NeutronHPorLFissionData.cc
+
+4 September 2008 Tatsumi Koi (hadr-hpn-V09-01-20)
+---------------------------------------------
+- Delete output for debugging
+	G4NeutronHPProduct.cc
+
+4 September 2008 Tatsumi Koi (hadr-hpn-V09-01-19)
+---------------------------------------------
+- Add Protection for negative energy results in very low energy ( 1E-6 eV ) scattering 
+	G4NeutronHPElasticFS.cc
+
+1 September 2008 Tatsumi Koi (hadr-hpn-V09-01-18)
+---------------------------------------------
+- Bug fix of too many secondaries production in nd rections
+	G4NeutronHPProduct.cc
+- Set protection for selecting data in hydrogen and alpha
+	G4NeutronHPName.cc
+- Avoiding troubles which caused by G4PhysicsVecotor of length 0 
+	G4NeutronHPIsoData.cc
+
+11 August 2008 Tatsumi Koi (hadr-hpn-V09-01-17)
+---------------------------------------------
+- Bug fix G4NeutronHPLabAngularEnergy
+	G4NeutronHPLabAngularEnergy.cc
+  Change interpolation scheme for histogram  
+	G4NeutronHPInterpolator.hh
+  Bug fix in Sample and GetXsec in G4NeutronHpVector 
+	G4NeutronHPVector.hh
+	G4NeutronHPVector.cc
+  Prohibit level transition to oneself
+	G4NeutronHPDeExGammas.cc
+  Fix memory leak and Correcting data disorder which happened 
+      when both InitPartial and InitAnglurar methods 
+      was called in a same instance 
+	G4NeutronHPPhotonDist.cc
+
+1 August 2008 Tatsumi Koi (hadr-hpn-V09-01-16)
+---------------------------------------------
+- Introduce theNDLDataA,Z which has A and Z of used NDL data
+  residual reconstraction with theNDLDataA,Z
+  several fixes and protection for G4FPE_DEBUF and checking with valgrind 
+	G4NeutronHPFinalState.hh
+	G4NeutronHPFinalState.cc
+	G4NeutronHPInelasticCompFS.cc
+	G4NeutronHPInelasticBaseFS.cc
+	G4NeutronHPKallbachMannSyst.cc
+	G4NeutronHPContAngularPar.cc
+
+21 July 2008 Tatsumi Koi (hadr-hpn-V09-01-15)
+---------------------------------------------
+- Adjusting final states based on the energy and momentum conservation
+	G4NeutronHPFinalState.hh
+	G4NeutronHPFinalState.cc
+	G4NeutronHPInelasticCompFS.cc
+	G4NeutronHPInelasticBaseFS.cc
+
+21 July 2008 Tatsumi Koi (hadr-hpn-V09-01-14)
+---------------------------------------------
+- Limiting the sum of secondary energies
+	G4VNeutronHPEnergyAngular.hh
+	G4NeutronHPContEnergyAngular.hh
+	G4NeutronHPContAngularPar.hh
+	G4NeutronHPProduct.cc
+	G4NeutronHPEnAngCorrelation.cc
+	G4NeutronHPContEnergyAngular.cc
+	G4NeutronHPContAngularPar.cc
+
+17 July 2008 Tatsumi Koi (hadr-hpn-V09-01-13)
+---------------------------------------------
+- Fix of calculation of residual momentum
+	G4NeutronHPInelasticCompFS.cc
+	G4NeutronHPDiscreteTwoBody.cc
+
+26 June 2008 Tatsumi Koi (hadr-hpn-V09-01-12)
+---------------------------------------------
+- Fix for Memory Leak 
+	G4NeutronHPPhotonDist.hh
+
+18 June 2008 Tatsumi Koi (hadr-hpn-V09-01-11)
+---------------------------------------------
+- Fix for tag hadr-hpn-V09-01-09 and 10 
+	G4NeutronHPDiscreteTwoBody.cc
+
+13 June 2008 Tatsumi Koi (hadr-hpn-V09-01-10)
+---------------------------------------------
+- Bug fixes contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) 
+	G4NeutronHPContAngularPar.cc 
+
+12 June 2008 Tatsumi Koi (hadr-hpn-V09-01-09)
+---------------------------------------------
+- Bug fixes contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) 
+	G4NeutronHPLegendreStore.hh
+	G4NeutronHPAngular.cc
+	G4NeutronHPDiscreteTwoBody.cc
+	G4NeutronHPInelasticCompFS.cc
+	G4NeutronHPLegendreStore.cc
+
+
+03 June 2008 Tatsumi Koi (hadr-hpn-V09-01-08)
+---------------------------------------------
+- Bug fixe for codition jump by uninitialised value by T. Koi
+	G4NeutronHPInelasticData.cc
+	G4NeutronHPCaptureData.cc
+
+03 June 2008 Tatsumi Koi (hadr-hpn-V09-01-07)
+---------------------------------------------
+- Bug fixes for Hadron Hyper News #932 by T. Koi
+	G4NeutronHPInelasticCompFS.cc
+
+20 May 2008 Tatsumi Koi (hadr-hpn-V09-01-06)
+---------------------------------------------
+- Delete unnecessary dependencies by T. Koi
+	G4NeutronHPChannel.hh
+	G4NeutronHPElementData.hh
+
+28 April 2008 Tatsumi Koi (hadr-hpn-V09-01-05)
+---------------------------------------------
+- Change checking point of "neglecting doppler broadening" flag 
+  from GetCrossSection to BuildPhysicsTable by T. Koi
+	G4NeutronHPElasticData.hh
+	G4NeutronHPInelasticData.hh
+	G4NeutronHPCaptureData.hh
+	G4NeutronHPElasticData.cc
+	G4NeutronHPInelasticData.cc
+	G4NeutronHPCaptureData.cc
 
 22 April 2008 Tatsumi Koi (hadr-hpn-V09-01-04)
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationIterator.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationIterator.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationIterator.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4InterpolationIterator.hh,v 1.9 2006/06/29 20:46:13 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4InterpolationIterator_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationManager.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationManager.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationManager.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4InterpolationManager.hh,v 1.13 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4InterpolationManager_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationScheme.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationScheme.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4InterpolationScheme.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4InterpolationScheme.hh,v 1.8 2006/06/29 20:46:17 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4InterpolationScheme_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP2AInelasticFS.hh,v 1.9 2006/06/29 20:46:19 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP2AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2N2AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2N2AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2N2AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP2N2AInelasticFS.hh,v 1.9 2006/06/29 20:46:21 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP2N2AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NAInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NAInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NAInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP2NAInelasticFS.hh,v 1.9 2006/06/29 20:46:23 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP2NAInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NDInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NDInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NDInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP2NDInelasticFS.hh,v 1.9 2006/06/29 20:46:25 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP2NDInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP2NInelasticFS.hh,v 1.9 2006/06/29 20:46:27 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP2NInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NPInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NPInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2NPInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP2NPInelasticFS.hh,v 1.9 2006/06/29 20:46:29 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP2NPInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2PInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2PInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP2PInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP2PInelasticFS.hh,v 1.9 2006/06/29 20:46:31 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP2PInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP3AInelasticFS.hh,v 1.9 2006/06/29 20:46:33 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP3AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NAInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NAInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NAInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP3NAInelasticFS.hh,v 1.9 2006/06/29 20:46:35 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP3NAInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP3NInelasticFS.hh,v 1.9 2006/06/29 20:46:37 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP3NInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NPInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NPInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP3NPInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP3NPInelasticFS.hh,v 1.9 2006/06/29 20:46:39 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP3NPInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP4NInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP4NInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHP4NInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHP4NInelasticFS.hh,v 1.9 2006/06/29 20:46:41 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHP4NInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPAInelasticFS.hh,v 1.9 2006/06/29 20:46:43 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPAInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAngular.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAngular.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAngular.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPAngular.hh,v 1.12 2007/06/22 09:23:47 gcosmo Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 070613 fix memory leaking by T. Koi
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAngularP.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAngularP.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPAngularP.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPAngularP.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPAngularP_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPArbitaryTab.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPArbitaryTab.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPArbitaryTab.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPArbitaryTab.hh,v 1.12 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPArbitaryTab_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCapture.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCapture.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCapture.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPCapture.hh,v 1.10 2006/06/29 20:46:51 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: Very Low Energy Neutron X-Sections
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCaptureData.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCaptureData.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCaptureData.hh	(revision 962)
@@ -25,8 +25,9 @@
 //
 //
-// $Id: G4NeutronHPCaptureData.hh,v 1.9.2.1 2008/04/29 07:05:37 gcosmo Exp $
-// GEANT4 tag $Name: geant4-09-01-patch-02 $
+// $Id: G4NeutronHPCaptureData.hh,v 1.11 2008/04/28 19:07:54 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 080417 Add IsZAApplicable method (return false) by T. Koi
+// 080428 Add bool onFlightDB by T. Koi
 //
 #ifndef G4NeutronHPCaptureData_h
@@ -70,4 +71,6 @@
    
    G4PhysicsTable * theCrossSections;
+
+      G4bool onFlightDB;
 };
 
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCaptureFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCaptureFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPCaptureFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPCaptureFS.hh,v 1.11 2006/06/29 20:46:55 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPCaptureFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPChannel.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPChannel.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPChannel.hh	(revision 962)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4NeutronHPChannel.hh,v 1.14 2007/06/14 17:17:30 tkoi Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPChannel.hh,v 1.15 2008/05/20 21:24:28 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: Very Low Energy Neutron X-Sections
@@ -34,4 +34,6 @@
 // Bug fixes and workarounds in the destructor, F.W.Jones 06-Jul-1999
 // 070612 Fix memory leaking by T. Koi
+//
+// 080520 Delete unnecessary dependencies by T. Koi
  
 #ifndef G4NeutronHPChannel_h
@@ -42,8 +44,8 @@
 #include "G4Material.hh"
 #include "G4HadProjectile.hh"
-#include "G4NeutronInelasticProcess.hh"
-#include "G4HadronFissionProcess.hh"
-#include "G4HadronElasticProcess.hh"
-#include "G4HadronCaptureProcess.hh"
+//#include "G4NeutronInelasticProcess.hh"
+//#include "G4HadronFissionProcess.hh"
+//#include "G4HadronElasticProcess.hh"
+//#include "G4HadronCaptureProcess.hh"
 #include "G4StableIsotopes.hh"
 #include "G4NeutronHPCaptureFS.hh"
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPChannelList.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPChannelList.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPChannelList.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPChannelList.hh,v 1.10 2006/06/29 20:46:59 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: Very Low Energy Neutron X-Sections
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPContAngularPar.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPContAngularPar.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPContAngularPar.hh	(revision 962)
@@ -25,6 +25,8 @@
 //
 //
-// $Id: G4NeutronHPContAngularPar.hh,v 1.12 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPContAngularPar.hh,v 1.13 2008/07/21 23:26:29 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 080718 Add ClearHistories method and related class member
 //
 #ifndef G4NeutronHPContAngularPar_h
@@ -47,4 +49,5 @@
     theAngular = 0;
     currentMeanEnergy = -2;
+     fresh = true;
   }
   ~G4NeutronHPContAngularPar()
@@ -148,4 +151,11 @@
   
   G4double currentMeanEnergy;
+
+//080718
+   public:
+      void ClearHistories(){ fresh = true; };
+   private:
+      G4bool fresh; 
+      G4double remaining_energy; // represent energy rest of cascade chain
 };
 #endif
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPContEnergyAngular.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPContEnergyAngular.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPContEnergyAngular.hh	(revision 962)
@@ -25,6 +25,8 @@
 //
 //
-// $Id: G4NeutronHPContEnergyAngular.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPContEnergyAngular.hh,v 1.12 2008/07/21 23:26:29 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 080721 Add ClearHistories() method by T. Koi
 //
 #ifndef G4NeutronHPContEnergyAngular_h
@@ -83,4 +85,7 @@
   
   G4double currentMeanEnergy;
+
+   public:
+      void ClearHistories(); 
   
 };
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPD2AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPD2AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPD2AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPD2AInelasticFS.hh,v 1.9 2006/06/29 20:47:05 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPD2AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDAInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDAInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDAInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPDAInelasticFS.hh,v 1.9 2006/06/29 20:47:07 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPDAInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPDInelasticFS.hh,v 1.9 2006/06/29 20:47:09 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPDInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPData.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPData.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPData.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPData.hh,v 1.9 2006/06/29 20:47:11 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: Very Low Energy Neutron X-Sections
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDataPoint.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDataPoint.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDataPoint.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPDataPoint.hh,v 1.8 2006/06/29 20:47:13 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPDataPoint_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDeExGammas.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDeExGammas.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDeExGammas.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPDeExGammas.hh,v 1.13 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPDeExGammas_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDiscreteTwoBody.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDiscreteTwoBody.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPDiscreteTwoBody.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPDiscreteTwoBody.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPDiscreteTwoBody_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElastic.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElastic.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElastic.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPElastic.hh,v 1.10 2006/06/29 20:47:21 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: High Precision low E neutron tracking
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElasticData.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElasticData.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElasticData.hh	(revision 962)
@@ -25,8 +25,9 @@
 //
 //
-// $Id: G4NeutronHPElasticData.hh,v 1.9.2.1 2008/04/29 07:05:37 gcosmo Exp $
-// GEANT4 tag $Name: geant4-09-01-patch-02 $
+// $Id: G4NeutronHPElasticData.hh,v 1.11 2008/04/28 19:07:53 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 080417 Add IsZAApplicable method (return false) by T. Koi
+// 080428 Add bool onFlightDB by T. Koi
 //
 #ifndef G4NeutronHPElasticData_h
@@ -70,4 +71,6 @@
    
    G4PhysicsTable * theCrossSections;
+      G4bool onFlightDB;
+   
 };
 
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPElasticFS.hh,v 1.12 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 25-08-06 New Final State type (refFlag==3 , Legendre (Low Energy) + Probability (High Energy) )
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElementData.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElementData.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPElementData.hh	(revision 962)
@@ -25,10 +25,12 @@
 //
 //
-// $Id: G4NeutronHPElementData.hh,v 1.9 2006/06/29 20:47:27 gunter Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPElementData.hh,v 1.10 2008/05/20 21:24:28 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: Very Low Energy Neutron X-Sections
  // original by H.P. Wellisch, TRIUMF, 14-Feb-97
  // Builds and has the Cross-section data for one material.
+//
+// 080520 Delete unnecessary dependencies by T. Koi
  
 #ifndef G4NeutronHPElementData_h
@@ -39,7 +41,9 @@
 #include "G4Material.hh"
 #include "G4HadronCrossSections.hh"
-#include "G4NeutronInelasticProcess.hh"
-#include "G4HadronFissionProcess.hh"
-#include "G4HadronCaptureProcess.hh"
+#include "G4ReactionProduct.hh"
+#include "G4Nucleus.hh"
+//#include "G4NeutronInelasticProcess.hh"
+//#include "G4HadronFissionProcess.hh"
+//#include "G4HadronCaptureProcess.hh"
 #include "G4NeutronHPElasticData.hh"
 #include "G4NeutronHPFissionData.hh"
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEnAngCorrelation.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEnAngCorrelation.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEnAngCorrelation.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPEnAngCorrelation.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPEnAngCorrelation_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEnergyDistribution.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEnergyDistribution.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEnergyDistribution.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPEnergyDistribution.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPEnergyDistribution_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEvapSpectrum.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEvapSpectrum.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPEvapSpectrum.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPEvapSpectrum.hh,v 1.10 2006/06/29 20:47:33 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPEvapSpectrum_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFCFissionFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFCFissionFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFCFissionFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFCFissionFS.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPFCFissionFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFSFissionFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFSFissionFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFSFissionFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFSFissionFS.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPFSFissionFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFastLegendre.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFastLegendre.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFastLegendre.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFastLegendre.hh,v 1.11 2006/06/29 20:47:39 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPFastLegendre_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPField.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPField.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPField.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPField.hh,v 1.8 2006/06/29 20:47:41 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPField_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFieldPoint.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFieldPoint.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFieldPoint.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFieldPoint.hh,v 1.9 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPFieldPoint_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFinalState.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFinalState.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFinalState.hh	(revision 962)
@@ -25,6 +25,9 @@
 //
 //
-// $Id: G4NeutronHPFinalState.hh,v 1.13 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPFinalState.hh,v 1.15 2008/08/05 22:43:26 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 080721 Create adjust_final_state method by T. Koi  
+// 080801 Introduce theNDLDataA,Z which has A and Z of NDL data by T. Koi
 //
 #ifndef G4NeutronHPFinalState_h
@@ -49,4 +52,11 @@
     theBaseZ = 0;
     theBaseA = 0;
+
+    theNDLDataZ = 0;
+    theNDLDataA = 0;
+
+     adjustResult = true;
+     if ( getenv( "G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE" ) ) adjustResult = false;
+
   };
   
@@ -58,5 +68,5 @@
     throw G4HadronicException(__FILE__, __LINE__, "G4HadFinalState * ApplyYourself(const G4HadProjectile & theTrack) needs implementation");
     return 0;
-  }
+  };
   
   // of course this would better be Done templating G4NeutronHPChannel..., 
@@ -65,14 +75,14 @@
   virtual G4NeutronHPFinalState * New() = 0;
   
-  G4bool HasXsec() {return hasXsec;}
-  G4bool HasFSData() {return hasFSData;}
-  G4bool HasAnyData() {return hasAnyData;}
+  G4bool HasXsec() {return hasXsec;};
+  G4bool HasFSData() {return hasFSData;};
+  G4bool HasAnyData() {return hasAnyData;};
   
-  virtual G4double GetXsec(G4double ) { return 0; }
-  virtual G4NeutronHPVector * GetXsec() { return 0; }
+  virtual G4double GetXsec(G4double ) { return 0; };
+  virtual G4NeutronHPVector * GetXsec() { return 0; };
   
-  void     SetA_Z(G4double anA, G4double aZ) {theBaseA = anA; theBaseZ = aZ; }
-  G4double GetZ() { return theBaseZ; }
-  G4double GetN() { return theBaseA; }
+  void     SetA_Z(G4double anA, G4double aZ) {theBaseA = anA; theBaseZ = aZ; };
+  G4double GetZ() { return theBaseZ; };
+  G4double GetN() { return theBaseA; };
   
   protected:
@@ -88,6 +98,15 @@
   G4double theBaseZ;
 
-  private:
-  
+
+//080721
+   protected:
+      void adjust_final_state ( G4LorentzVector );
+      G4int theNDLDataZ;
+      G4int theNDLDataA;
+
+   private:
+      G4bool adjustResult;
+
+
 };
 #endif
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFission.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFission.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFission.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFission.hh,v 1.10 2006/06/29 20:47:47 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: High Precision low E neutron tracking
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionBaseFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionBaseFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionBaseFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFissionBaseFS.hh,v 1.13 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPFissionBaseFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionData.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionData.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionData.hh	(revision 962)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4NeutronHPFissionData.hh,v 1.9.2.1 2008/04/29 07:05:37 gcosmo Exp $
-// GEANT4 tag $Name: geant4-09-01-patch-02 $
+// $Id: G4NeutronHPFissionData.hh,v 1.10 2008/04/16 23:39:56 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 080417 Add IsZAApplicable method (return false) by T. Koi
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionERelease.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionERelease.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionERelease.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFissionERelease.hh,v 1.12 2007/06/08 22:39:50 tkoi Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 070606 fix for Valgrind by T. Koi
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFissionFS.hh,v 1.9 2006/06/29 20:47:55 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPFissionFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionSpectrum.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionSpectrum.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPFissionSpectrum.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPFissionSpectrum.hh,v 1.11 2006/06/29 20:47:57 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPFissionSpectrum_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPGamma.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPGamma.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPGamma.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPGamma.hh,v 1.14 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPGamma_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPHe3InelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPHe3InelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPHe3InelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPHe3InelasticFS.hh,v 1.9 2006/06/29 20:48:03 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPHe3InelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelastic.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelastic.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelastic.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPInelastic.hh,v 1.9 2006/06/29 20:48:05 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: High Precision low E neutron tracking
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticBaseFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticBaseFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticBaseFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPInelasticBaseFS.hh,v 1.12 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPInelasticBaseFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticCompFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticCompFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticCompFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPInelasticCompFS.hh,v 1.13 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPInelasticCompFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticData.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticData.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInelasticData.hh	(revision 962)
@@ -25,8 +25,9 @@
 //
 //
-// $Id: G4NeutronHPInelasticData.hh,v 1.9.2.1 2008/04/29 07:05:37 gcosmo Exp $
-// GEANT4 tag $Name: geant4-09-01-patch-02 $
+// $Id: G4NeutronHPInelasticData.hh,v 1.11 2008/04/28 19:07:54 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 080417 Add IsZAApplicable method (return false) by T. Koi
+// 080428 Add bool onFlightDB by T. Koi
 //
 #ifndef G4NeutronHPInelasticData_h
@@ -70,4 +71,6 @@
    
    G4PhysicsTable * theCrossSections;
+
+      G4bool onFlightDB;
 };
 
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInterpolator.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInterpolator.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPInterpolator.hh	(revision 962)
@@ -25,6 +25,9 @@
 //
 //
-// $Id: G4NeutronHPInterpolator.hh,v 1.19 2006/06/29 20:48:13 gunter Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPInterpolator.hh,v 1.20 2008/08/12 00:42:31 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 080809 Change interpolation scheme of "histogram", now using LinearLinear
+//        For multidimensional interpolations By T. Koi
 //
 #ifndef G4NeutronHPInterpolator_h
@@ -91,5 +94,7 @@
   {
     case 1:
-      result = Histogram(x, x1, x2, y1, y2);
+      //080809
+      //result = Histogram(x, x1, x2, y1, y2);
+      result = LinearLinear(x, x1, x2, y1, y2);
       break;
     case 2:
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPIsoData.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPIsoData.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPIsoData.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPIsoData.hh,v 1.16 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPIsoData_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPIsotropic.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPIsotropic.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPIsotropic.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPIsotropic.hh,v 1.10 2006/06/29 20:48:17 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPIsotropic_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPKallbachMannSyst.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPKallbachMannSyst.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPKallbachMannSyst.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPKallbachMannSyst.hh,v 1.8 2006/06/29 20:48:19 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPKallbachMannSyst_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLCFissionFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLCFissionFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLCFissionFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPLCFissionFS.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPLCFissionFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLabAngularEnergy.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLabAngularEnergy.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLabAngularEnergy.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPLabAngularEnergy.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPLabAngularEnergy_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLegendreStore.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLegendreStore.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLegendreStore.hh	(revision 962)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4NeutronHPLegendreStore.hh,v 1.11 2006/06/29 20:48:25 gunter Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPLegendreStore.hh,v 1.12 2008/06/13 00:29:26 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPLegendreStore_h
@@ -72,4 +72,5 @@
   inline G4int GetNumberOfPoly(G4int i) {return theCoeff[i].GetNumberOfPoly();}
   
+  G4double SampleDiscreteTwoBody (G4double anEnergy);
   G4double SampleElastic (G4double anEnergy);
   G4double Sample (G4double energy);
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLegendreTable.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLegendreTable.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLegendreTable.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPLegendreTable.hh,v 1.12 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPLegendreTable_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLevel.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLevel.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPLevel.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPLevel.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPLevel_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPMadlandNixSpectrum.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPMadlandNixSpectrum.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPMadlandNixSpectrum.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPMadlandNixSpectrum.hh,v 1.12 2006/06/29 20:48:33 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPMadlandNixSpectrum_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN2AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN2AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN2AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPN2AInelasticFS.hh,v 1.9 2006/06/29 20:48:35 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPN2AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN2PInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN2PInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN2PInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPN2PInelasticFS.hh,v 1.9 2006/06/29 20:48:37 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPN2PInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN3AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN3AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPN3AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPN3AInelasticFS.hh,v 1.9 2006/06/29 20:48:39 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPN3AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNAInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNAInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNAInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNAInelasticFS.hh,v 1.9 2006/06/29 20:48:41 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNAInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNBodyPhaseSpace.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNBodyPhaseSpace.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNBodyPhaseSpace.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNBodyPhaseSpace.hh,v 1.12 2006/06/29 20:48:43 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNBodyPhaseSpace_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPND2AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPND2AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPND2AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPND2AInelasticFS.hh,v 1.9 2006/06/29 20:48:45 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPND2AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNDInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNDInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNDInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNDInelasticFS.hh,v 1.9 2006/06/29 20:48:47 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNDInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNHe3InelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNHe3InelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNHe3InelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNHe3InelasticFS.hh,v 1.9 2006/06/29 20:48:49 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNHe3InelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNInelasticFS.hh,v 1.9 2006/06/29 20:48:51 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNPAInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNPAInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNPAInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNPAInelasticFS.hh,v 1.9 2006/06/29 20:48:53 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNPAInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNPInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNPInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNPInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNPInelasticFS.hh,v 1.9 2006/06/29 20:48:55 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNPInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNT2AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNT2AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNT2AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNT2AInelasticFS.hh,v 1.9 2006/06/29 20:48:57 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNT2AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNTInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNTInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNTInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNTInelasticFS.hh,v 1.9 2006/06/29 20:48:59 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNTInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNXInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNXInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNXInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNXInelasticFS.hh,v 1.9 2006/06/29 20:49:01 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNXInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNames.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNames.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNames.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNames.hh,v 1.15 2006/06/29 20:49:03 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNames_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNeutronYield.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNeutronYield.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPNeutronYield.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNeutronYield.hh,v 1.10 2006/06/29 20:49:05 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPNeutronYield_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPAInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPAInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPAInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPPAInelasticFS.hh,v 1.9 2006/06/29 20:49:07 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPPAInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPDInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPDInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPDInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPPDInelasticFS.hh,v 1.9 2006/06/29 20:49:09 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPPDInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPPInelasticFS.hh,v 1.9 2006/06/29 20:49:11 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPPInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPTInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPTInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPTInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPPTInelasticFS.hh,v 1.9 2006/06/29 20:49:13 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPPTInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPartial.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPartial.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPartial.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPPartial.hh,v 1.13 2007/06/18 20:56:05 tkoi Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 070618 Comment out unused private member leaking by T. Koi
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPhotonDist.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPhotonDist.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPhotonDist.hh	(revision 962)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4NeutronHPPhotonDist.hh,v 1.16 2007/06/22 09:23:47 gcosmo Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPPhotonDist.hh,v 1.17 2008/06/26 02:40:23 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: Very Low Energy Neutron X-Sections
@@ -34,4 +34,5 @@
 // 070612 fix memory leaking by T. Koi
 // 070615 fix memory leaking by T. Koi
+// 080625 fix memory leaking by T. Koi
 //
  
@@ -102,18 +103,23 @@
      delete [] theGammas;
      delete [] nNeu;
-     delete [] theLegendre;
      delete [] theAngular;
      delete [] distribution;
      delete [] probs;
 
-// TKDB
+     if ( theLegendre != NULL )
+     {
+        for ( G4int i = 0 ; i < (nDiscrete2-nIso) ; i++ )
+           if ( theLegendre[i] != NULL ) delete[] theLegendre[i]; 
+
+        delete [] theLegendre;
+     }
+
      if ( partials != 0 ) 
      {
         for ( G4int i = 0 ; i < nPartials ; i++ )
-           { delete partials[ i ]; }
+           { delete partials[i]; }
 
         delete [] partials;
      }
-     // delete [] partials;
 
      delete [] actualMult;
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPhotonXSection.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPhotonXSection.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPhotonXSection.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPPhotonXSection.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPPhotonXSection_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPolynomExpansion.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPolynomExpansion.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPPolynomExpansion.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPPolynomExpansion.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPPolynomExpansion_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPProduct.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPProduct.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPProduct.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPProduct.hh,v 1.12 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPProduct_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPSCFissionFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPSCFissionFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPSCFissionFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPSCFissionFS.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPSCFissionFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPSimpleEvapSpectrum.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPSimpleEvapSpectrum.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPSimpleEvapSpectrum.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPSimpleEvapSpectrum.hh,v 1.11 2006/06/29 20:49:27 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPSimpleEvapSpectrum_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPT2AInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPT2AInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPT2AInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPT2AInelasticFS.hh,v 1.9 2006/06/29 20:49:29 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPT2AInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPTCFissionFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPTCFissionFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPTCFissionFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPTCFissionFS.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPTCFissionFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPTInelasticFS.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPTInelasticFS.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPTInelasticFS.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPTInelasticFS.hh,v 1.9 2006/06/29 20:49:33 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPTInelasticFS_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPThermalBoost.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPThermalBoost.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPThermalBoost.hh	(revision 962)
@@ -24,4 +24,6 @@
 // ********************************************************************
 //
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
+//
 #ifndef G4NeutronHPThermalBoost_h
 #define G4NeutronHPThermalBoost_h
@@ -31,5 +33,5 @@
 #include "G4ReactionProduct.hh"
 #include "G4Nucleus.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4Electron.hh"
 #include "G4Neutron.hh"
@@ -62,6 +64,5 @@
     G4double eps = 0.0001;
     G4double eleMass; 
-    eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
-  	       ) / G4Neutron::Neutron()->GetPDGMass();
+    eleMass = ( G4NucleiProperties::GetNuclearMass( static_cast<G4int>(theA+eps) , static_cast<G4int>(theZ+eps) ) ) / G4Neutron::Neutron()->GetPDGMass();
   
     G4ReactionProduct aThermalNuc = aNuc.GetBiasedThermalNucleus(eleMass, neuVelo, aT);
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPVector.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPVector.hh	(revision 962)
@@ -26,4 +26,6 @@
 // 070606 fix with Valgrind by T. Koi
 // 080409 Fix div0 error with G4FPE by T. Koi
+// 080811 Comment out unused method SetBlocked and SetBuffered
+//        Add required cleaning up in CleanUp by T. Koi
 //
 #ifndef G4NeutronHPVector_h
@@ -253,4 +255,7 @@
     maxValue = -DBL_MAX;
     theHash.Clear();
+//080811 TK DB 
+    delete[] theIntegral;
+    theIntegral = NULL;
   }
 
@@ -491,4 +496,5 @@
   }
   
+/*
   void Block(G4double aX)
   {
@@ -500,10 +506,11 @@
     theBuffered.push_back(aX);
   }
+*/
   
   std::vector<G4double> GetBlocked() {return theBlocked;}
   std::vector<G4double> GetBuffered() {return theBuffered;}
   
-  void SetBlocked(const std::vector<G4double> &aBlocked) {theBlocked = aBlocked;}
-  void SetBuffered(const std::vector<G4double> &aBuffer) {theBuffered = aBuffer;}
+//  void SetBlocked(const std::vector<G4double> &aBlocked) {theBlocked = aBlocked;}
+//  void SetBuffered(const std::vector<G4double> &aBuffer) {theBuffered = aBuffer;}
 
   G4double Get15percentBorder();
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPWattSpectrum.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPWattSpectrum.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPWattSpectrum.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPWattSpectrum.hh,v 1.11 2006/06/29 20:49:39 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4NeutronHPWattSpectrum_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4VNeutronHPEDis.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4VNeutronHPEDis.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4VNeutronHPEDis.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VNeutronHPEDis.hh,v 1.10 2006/06/29 20:50:05 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #ifndef G4VNeutronHPEDis_h
Index: trunk/source/processes/hadronic/models/neutron_hp/include/G4VNeutronHPEnergyAngular.hh
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/include/G4VNeutronHPEnergyAngular.hh	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/include/G4VNeutronHPEnergyAngular.hh	(revision 962)
@@ -25,6 +25,8 @@
 //
 //
-// $Id: G4VNeutronHPEnergyAngular.hh,v 1.11 2007/06/06 12:45:13 ahoward Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4VNeutronHPEnergyAngular.hh,v 1.12 2008/07/21 23:26:29 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// 080718 Add ClearHistories() method by T. Koi
 //
 #ifndef G4VNeutronHPEnergyAngular_h
@@ -87,4 +89,6 @@
   G4ReactionProduct theCMS;
     
+   public:
+      virtual void ClearHistories(){;};
 };
 #endif
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPAngular.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPAngular.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPAngular.cc	(revision 962)
@@ -29,4 +29,5 @@
 //
 // 070523 bug fix for G4FPE_DEBUG on by A. Howard ( and T. Koi)
+// 080612 bug fix contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #5
 //
 #include "G4NeutronHPAngular.hh"
@@ -106,4 +107,31 @@
   else
   {
+    if(frameFlag == 1) // LAB
+    {
+      G4double en = aHadron.GetTotalMomentum();
+      G4ReactionProduct boosted;
+      boosted.Lorentz(theNeutron, theTarget);
+      G4double kineticEnergy = boosted.GetKineticEnergy();
+      G4double cosTh = 0.0; 
+      if(theAngularDistributionType == 1) cosTh = theCoefficients->SampleMax(kineticEnergy); 
+      if(theAngularDistributionType == 2) cosTh = theProbArray->Sample(kineticEnergy); 
+      G4double theta = std::acos(cosTh);
+      G4double phi = twopi*G4UniformRand();
+      G4double sinth = std::sin(theta);
+      G4ThreeVector temp(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
+      aHadron.SetMomentum( temp );
+    }
+    else if(frameFlag == 2) // costh in CMS
+    {
+      G4ReactionProduct boostedN;
+      boostedN.Lorentz(theNeutron, theTarget);
+      G4double kineticEnergy = boostedN.GetKineticEnergy();
+
+      G4double cosTh = 0.0; 
+      if(theAngularDistributionType == 1) cosTh = theCoefficients->SampleMax(kineticEnergy); 
+      if(theAngularDistributionType == 2) cosTh = theProbArray->Sample(kineticEnergy); 
+
+//080612TK bug fix contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) 
+/*
     if(theAngularDistributionType == 1) // LAB
     {
@@ -121,8 +149,11 @@
     else if(theAngularDistributionType == 2) // costh in CMS
     {
-      G4ReactionProduct boostedN;
-      boostedN.Lorentz(theNeutron, theTarget);
-      G4double kineticEnergy = boostedN.GetKineticEnergy();
-      G4double cosTh = theProbArray->Sample(kineticEnergy); 
+*/
+
+//      G4ReactionProduct boostedN;
+//      boostedN.Lorentz(theNeutron, theTarget);
+//      G4double kineticEnergy = boostedN.GetKineticEnergy();
+//      G4double cosTh = theProbArray->Sample(kineticEnergy); 
+
       G4double theta = std::acos(cosTh);
       G4double phi = twopi*G4UniformRand();
@@ -130,4 +161,7 @@
       
       G4ThreeVector temp(sinth*std::cos(phi), sinth*std::sin(phi), std::cos(theta) ); //CMS
+
+//080612TK bug fix contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #5
+/*
       G4double en = aHadron.GetTotalEnergy(); // Target rest
       
@@ -172,4 +206,40 @@
       aHadron.SetTotalEnergy( std::sqrt( mom*mom + aHadron.GetMass()*aHadron.GetMass() ) );
       aHadron.Lorentz(aHadron, trafo); // now in target rest frame
+*/
+      // Determination of the hadron kinetic energy in CMS
+      // aHadron.GetKineticEnergy() is actually the residual kinetic energy in CMS (or target frame)
+      // kineticEnergy is incident neutron kinetic energy  in CMS (or target frame)  
+      G4double QValue = aHadron.GetKineticEnergy() - kineticEnergy;
+      G4double A1     =   theTarget.GetMass()/boostedN.GetMass(); 
+      G4double A1prim =   aHadron.GetMass()/ boostedN.GetMass();
+      G4double kinE   = (A1+1-A1prim)/(A1+1)/(A1+1)*(A1*kineticEnergy+(1+A1)*QValue);
+      G4double totalE = kinE + aHadron.GetMass();
+      G4double mom2   = totalE*totalE - aHadron.GetMass()*aHadron.GetMass();
+      G4double mom;
+      if ( mom2 > 0.0 ) mom = std::sqrt( mom2 );
+      else mom = 0.0;     
+
+      aHadron.SetMomentum( mom*temp ); // Set momentum in CMS
+      aHadron.SetKineticEnergy(kinE);  // Set kinetic energy in CMS
+
+      // get trafo from Target rest frame to CMS
+      G4ReactionProduct boostedT;
+      boostedT.Lorentz(theTarget, theTarget);
+      
+      G4ThreeVector the3Neutron = boostedN.GetMomentum();
+      G4double nEnergy = boostedN.GetTotalEnergy();
+      G4ThreeVector the3Target = boostedT.GetMomentum();
+      G4double tEnergy = boostedT.GetTotalEnergy();
+      G4double totE = nEnergy+tEnergy;
+      G4ThreeVector the3trafo = -the3Target-the3Neutron;
+      G4ReactionProduct trafo; // for transformation from CMS to target rest frame
+      trafo.SetMomentum(the3trafo);
+      G4double cmsMom = std::sqrt(the3trafo*the3trafo);
+      G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
+      trafo.SetMass(sqrts);
+      trafo.SetTotalEnergy(totE);
+
+      aHadron.Lorentz(aHadron, trafo);
+
     }
     else
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPCaptureData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPCaptureData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPCaptureData.cc	(revision 962)
@@ -31,4 +31,7 @@
 // 070613 fix memory leaking by T. Koi
 // 071002 enable cross section dump by T. Koi
+// 080428 change checking point of "neglecting doppler broadening" flag 
+//        from GetCrossSection to BuildPhysicsTable by T. Koi
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 #include "G4NeutronHPCaptureData.hh"
@@ -49,4 +52,5 @@
 // TKDB
    theCrossSections = 0;
+   onFlightDB = true;
   BuildPhysicsTable(*G4Neutron::Neutron());
 }
@@ -65,4 +69,8 @@
   if(&aP!=G4Neutron::Neutron()) 
      throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");  
+
+//080428
+   if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) ) onFlightDB = false;
+
   size_t numberOfElements = G4Element::GetNumberOfElements();
   // G4cout << "CALLED G4NeutronHPCaptureData::BuildPhysicsTable "<<numberOfElements<<G4endl;
@@ -136,5 +144,5 @@
 }
 
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 
 G4double G4NeutronHPCaptureData::
@@ -148,5 +156,7 @@
   G4double eKinetic = aP->GetKineticEnergy();
 
-  if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) )
+//if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) )
+//080428
+  if ( !onFlightDB )
   {
      G4double factor = 1.0;
@@ -171,6 +181,5 @@
   G4double theZ = anE->GetZ();
   G4double eleMass; 
-  eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
-	     ) / G4Neutron::Neutron()->GetPDGMass();
+  eleMass = G4NucleiProperties::GetNuclearMass( static_cast<G4int>(theA+eps) , static_cast<G4int>(theZ+eps) ) / G4Neutron::Neutron()->GetPDGMass();
   
   G4ReactionProduct boosted;
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPCaptureFS.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPCaptureFS.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPCaptureFS.cc	(revision 962)
@@ -30,4 +30,5 @@
 // 12-April-06 Enable IC electron emissions T. Koi 
 // 26-January-07 Add G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION flag
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 #include "G4NeutronHPCaptureFS.hh"
@@ -56,5 +57,5 @@
     G4double eps = 0.0001;
     if(targetMass<500*MeV)
-      targetMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theBaseZ+eps), static_cast<G4int>(theBaseA+eps))) /
+      targetMass = ( G4NucleiProperties::GetNuclearMass( static_cast<G4int>(theBaseA+eps) , static_cast<G4int>(theBaseZ+eps) )) /
                      G4Neutron::Neutron()->GetPDGMass();
     G4ThreeVector neutronVelocity = 1./G4Neutron::Neutron()->GetPDGMass()*theNeutron.GetMomentum();
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPChannel.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPChannel.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPChannel.cc	(revision 962)
@@ -30,4 +30,5 @@
 // 070523 bug fix for G4FPE_DEBUG on by A. Howard ( and T. Koi)
 // 071031 bug fix T. Koi on behalf of A. Howard 
+// 081203 bug fix in Register method by T. Koi
 //
 #include "G4NeutronHPChannel.hh"
@@ -68,8 +69,14 @@
     registerCount++;
     G4int Z = G4lrint(theElement->GetZ());
+
+    Z = Z-registerCount;
+    if ( registerCount > 5 ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material"); // for Elastic, Capture, Fission case 
+    if ( Z < 1 ) return false; 
+/*
     if(registerCount<5)
     {
       Z = Z-registerCount;
     }
+*/
     //if(Z=theElement->GetZ()-5) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this material");
     // Bug fix by TK on behalf of AH
@@ -84,4 +91,5 @@
     delete [] active;
     active = new G4bool[niso];
+
     delete [] theFinalStates;
     theFinalStates = new G4NeutronHPFinalState * [niso];
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPContAngularPar.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPContAngularPar.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPContAngularPar.cc	(revision 962)
@@ -32,4 +32,8 @@
 //        (This fix has a real effect to the code.) 
 // 080409 Fix div0 error with G4FPE by T. Koi
+// 080612 Fix contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #1
+// 080714 Limiting the sum of energy of secondary particles by T. Koi
+// 080801 Fix div0 error wiht G4FPE and memory leak by T. Koi
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 
@@ -46,5 +50,5 @@
 #include "G4Alpha.hh"
 #include "G4NeutronHPVector.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4NeutronHPKallbachMannSyst.hh"
 #include "G4ParticleTable.hh"
@@ -67,5 +71,5 @@
   G4ReactionProduct * 
   G4NeutronHPContAngularPar::Sample(G4double anEnergy, G4double massCode, G4double /*targetMass*/, 
-                                    G4int angularRep, G4int /*interpolE*/)
+                                    G4int angularRep, G4int interpolE )
   {
     G4ReactionProduct * result = new G4ReactionProduct;
@@ -110,4 +114,76 @@
     if(angularRep==1)
     {
+// 080612 Fix contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #1
+	if (interpolE == 2)
+	{
+
+            //TK080711
+           if ( fresh == true ) 
+           { 
+              remaining_energy = theAngular[0].GetLabel();
+              fresh = false; 
+           }
+           //TK080711
+
+	   G4double random = G4UniformRand();
+	   G4double * running = new G4double[nEnergies+1];
+	   running[0]=0;
+
+	    for(i=1; i<nEnergies+1; i++)
+	    {
+               //TK080711
+               if ( remaining_energy >= theAngular[ i-1 ].GetLabel() ) 
+                  running[i] = running[i-1] + theAngular[i-1].GetValue(0);
+               else
+                  running[i] = running[i-1];
+               //TK080711
+	    }
+
+            //080730
+            if ( running[ nEnergies ] != 0 ) 
+            {
+
+	       for ( i = 1 ; i < nEnergies+1 ; i++ )
+	       {
+	 	it = i-1;
+		if ( random > running[ i-1 ]/running[ nEnergies ] && random <= running[ i ] / running[ nEnergies ] ) break;
+               }
+	       fsEnergy = theAngular[ it ].GetLabel();
+
+            }
+
+            //TK080711 
+            if ( i == nEnergies+1 || running[ nEnergies ] == 0 ) fsEnergy = remaining_energy;
+            //TK080711 //080730
+
+	    G4NeutronHPLegendreStore theStore(1);
+	    theStore.Init(0,fsEnergy,nAngularParameters);
+	    for(i=0;i<nAngularParameters;i++)
+	    {
+		theStore.SetCoeff(0,i,theAngular[it].GetValue(i));
+	    }
+	    // use it to sample.
+	    cosTh = theStore.SampleMax(fsEnergy);
+
+            //TK080711
+            remaining_energy -= fsEnergy;
+            //TK080711
+
+           //080801b
+	   delete[] running;
+           //080801b
+        }
+      else 
+      {
+
+            //080714 
+            if ( fresh == true )
+            {
+               remaining_energy = theAngular[ nEnergies-1 ].GetLabel();
+               fresh = false;
+            }
+            //080714 
+
+     
       G4double random = G4UniformRand();
       G4double * running = new G4double[nEnergies];
@@ -116,4 +192,5 @@
       for(i=1; i<nEnergies; i++)
       {
+/*
         if(i!=0) 
         {
@@ -126,20 +203,43 @@
                              theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
                              theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
+*/
+
+        running[i]=running[i-1];
+        if ( remaining_energy >= theAngular[i].GetLabel() )
+        {
+           running[i] += theInt.GetBinIntegral(theManager.GetScheme(i-1),
+                             theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
+                             theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
+           weighted += theInt.GetWeightedBinIntegral(theManager.GetScheme(i-1),
+                             theAngular[i-1].GetLabel(), theAngular[i].GetLabel(),
+                             theAngular[i-1].GetValue(0), theAngular[i].GetValue(0));
+        }
       }
       // cash the mean energy in this distribution
       //080409 TKDB
-      if ( nEnergies == 1 )  
+      if ( nEnergies == 1 || running[nEnergies-1] == 0 )  
          currentMeanEnergy = 0.0;
       else
+      { 
          currentMeanEnergy = weighted/running[nEnergies-1];
+      }
       
       //080409 TKDB
       if ( nEnergies == 1 ) it = 0; 
-      //for(i=1; i<nEnergies; i++)
-      for(i=1; i<nEnergies; i++)
-      {
-        it = i;
-        if(random<running[i]/running[nEnergies-1]) break;
-      }
+
+      //080729
+      if ( running[nEnergies-1] != 0 )  
+      {
+         for ( i = 1 ; i < nEnergies ; i++ )
+         {
+            it = i;
+            if ( random < running [ i ] / running [ nEnergies-1 ] ) break;
+         } 
+      }
+
+      //080714
+      if ( running [ nEnergies-1 ] == 0 ) it = 0;
+      //080714
+
       if(it<nDiscreteEnergies||it==0) 
       {
@@ -201,4 +301,11 @@
       }
       delete [] running;
+
+      //080714
+      remaining_energy -= fsEnergy;
+      //080714
+
+      }
+
     }
     else if(angularRep==2)
@@ -271,5 +378,5 @@
       G4double residualMass =  residualZ*G4Proton::Proton()->GetPDGMass();
                residualMass +=(residualA-residualZ)*G4Neutron::Neutron()->GetPDGMass();
-               residualMass -= G4NucleiPropertiesTable::GetBindingEnergy(residualZ, residualA);
+               residualMass -= G4NucleiProperties::GetBindingEnergy( residualA , residualZ );
       G4NeutronHPKallbachMannSyst theKallbach(compoundFraction,
                                               incidentEnergy, incidentMass,
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPContEnergyAngular.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPContEnergyAngular.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPContEnergyAngular.cc	(revision 962)
@@ -28,4 +28,7 @@
 // A prototype of the low energy neutron transport model.
 //
+// 080721 To be "ClearHistories" effective, the selection scheme of angular distribution is modified by T. Koi
+//
+//
 #include "G4NeutronHPContEnergyAngular.hh"
 
@@ -55,8 +58,10 @@
      // This is the cause of the He3 problem !!!!!!!!
      // See to it, if you can improve this.
-     G4double random = G4UniformRand();
-     G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
-     G4double offset = theAngular[it].GetEnergy()-anEnergy;
-     if(random<offset/deltaE) it--; 
+     //080714 TK commnet Randomizing use angular distribution
+     //080714 TK Always use the upper side distribution. enabling ClearHistories method.
+     //G4double random = G4UniformRand();
+     //G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
+     //G4double offset = theAngular[it].GetEnergy()-anEnergy;
+     //if(random<offset/deltaE) it--;
      theAngular[it].SetTarget(GetTarget());
      theAngular[it].SetTargetCode(theTargetCode);
@@ -84,2 +89,13 @@
    return result;
 }
+
+
+ 
+void G4NeutronHPContEnergyAngular::ClearHistories()
+{ 
+   if ( theAngular!= NULL )
+   { 
+      for ( G4int i = 0 ; i< nEnergy ; i++ ) 
+         theAngular[i].ClearHistories(); 
+   } 
+}
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPDeExGammas.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPDeExGammas.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPDeExGammas.cc	(revision 962)
@@ -27,4 +27,6 @@
 // J.P. Wellisch, Nov-1996
 // A prototype of the low energy neutron transport model.
+//
+// 080801 Prohibit level transition to oneself by T. Koi
 //
 #include "G4NeutronHPDeExGammas.hh"
@@ -123,4 +125,13 @@
       }
     }
+//080728
+    if ( it != -1 && currentLevelE == theLevels[it].GetLevelEnergy() )
+    {
+       //TK Comment; Some data file in /Inelastic/Gammas has inconsistent level data (no level to transit)
+       //G4cout << "DeExGammas Transition level error: it " << it << " " << currentLevelE << " " << gammaE << " " << theLevels[it-1].GetLevelEnergy() << " " << currentLevelE - theLevels[it-1].GetLevelEnergy() << G4endl;
+       // Forced to connect the next(previous) level 
+       it +=-1;
+    }
+//080728
     if(it!=-1) theGammas[i]->SetNext(&theLevels[it]);
   }
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPDiscreteTwoBody.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPDiscreteTwoBody.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPDiscreteTwoBody.cc	(revision 962)
@@ -28,4 +28,7 @@
 // A prototype of the low energy neutron transport model.
 //
+//080612 Bug fix contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #2,3
+//080709 Bug fix Sampling Legendre expansion by T. Koi   
+//
 #include "G4NeutronHPDiscreteTwoBody.hh"
 #include "G4Gamma.hh"
@@ -92,8 +95,11 @@
      if(theCoeff[it].GetRepresentation()==0)
      {
+//TK Legendre expansion
        G4NeutronHPLegendreStore theStore(1);
        theStore.SetCoeff(0, theCoeff);
        theStore.SetManager(theManager);
-       cosTh = theStore.SampleMax(anEnergy);
+       //cosTh = theStore.SampleMax(anEnergy);
+       //080612TK contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #3
+       cosTh = theStore.SampleDiscreteTwoBody(anEnergy);
      }
      else if(theCoeff[it].GetRepresentation()==12) // means LINLIN
@@ -136,4 +142,5 @@
        if(theCoeff[it].GetRepresentation()==0)
        {
+//TK Legendre expansion
 	 G4NeutronHPLegendreStore theStore(2);
 	 theStore.SetCoeff(0, &(theCoeff[it-1]));
@@ -142,5 +149,7 @@
          aManager.Init(theManager.GetScheme(it), 2);
          theStore.SetManager(aManager);
-	 cosTh = theStore.SampleMax(anEnergy);
+	 //cosTh = theStore.SampleMax(anEnergy);
+//080709 TKDB
+         cosTh = theStore.SampleDiscreteTwoBody(anEnergy);
        }
        else if(theCoeff[it].GetRepresentation()==12) // LINLIN
@@ -198,5 +207,5 @@
 	 cosTh = theStore.Sample();
        }
-       else if(theCoeff[it].GetRepresentation()==14) 
+       else if(theCoeff[it].GetRepresentation()==14) //TK LOG_LIN
        {
 	 G4NeutronHPVector theBuff1;
@@ -266,11 +275,17 @@
 // now get the energy from kinematics and Q-value.
 
-   G4double restEnergy = anEnergy+GetQValue();
+   //G4double restEnergy = anEnergy+GetQValue();
    
 // assumed to be in CMS @@@@@@@@@@@@@@@@@
 
-   G4double residualMass =   GetTarget()->GetMass() + GetNeutron()->GetMass()
-                           - result->GetMass() - GetQValue();
-   G4double kinE = restEnergy/(1+result->GetMass()/residualMass); // non relativistic @@
+   //080612TK contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #2
+   //G4double residualMass =   GetTarget()->GetMass() + GetNeutron()->GetMass()
+   //                        - result->GetMass() - GetQValue();
+   //G4double kinE = restEnergy/(1+result->GetMass()/residualMass); // non relativistic @@
+   G4double A1     =  GetTarget()->GetMass()/GetNeutron()->GetMass(); 
+   G4double A1prim =  result->GetMass()/GetNeutron()->GetMass();
+   G4double E1     =  (A1+1)*(A1+1)/A1/A1*anEnergy; 
+   G4double kinE = (A1+1-A1prim)/(A1+1)/(A1+1)*(A1*E1+(1+A1)*GetQValue());
+
    result->SetKineticEnergy(kinE); // non relativistic @@
    G4double phi = twopi*G4UniformRand();
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPElasticData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPElasticData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPElasticData.cc	(revision 962)
@@ -31,4 +31,7 @@
 // 070613 fix memory leaking by T. Koi
 // 071002 enable cross section dump by T. Koi
+// 080428 change checking point of "neglecting doppler broadening" flag 
+//        from GetCrossSection to BuildPhysicsTable by T. Koi
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 #include "G4NeutronHPElasticData.hh"
@@ -49,4 +52,5 @@
 // TKDB
    theCrossSections = 0;
+   onFlightDB = true;
   BuildPhysicsTable(*G4Neutron::Neutron());
 }
@@ -65,4 +69,8 @@
   if(&aP!=G4Neutron::Neutron()) 
      throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");  
+
+//080428
+   if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) ) onFlightDB = false;
+
   size_t numberOfElements = G4Element::GetNumberOfElements();
 // TKDB
@@ -131,5 +139,5 @@
 
 #include "G4Nucleus.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4Neutron.hh"
 #include "G4Electron.hh"
@@ -146,5 +154,7 @@
 
   // T. K. 
-  if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) )
+//  if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) )
+//080428
+  if ( !onFlightDB )
   {
      G4double factor = 1.0;
@@ -171,5 +181,5 @@
 
 
-  eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
+  eleMass = ( G4NucleiProperties::GetNuclearMass( static_cast<G4int>(theA+eps) , static_cast<G4int>(theZ+eps) )
 	     ) / G4Neutron::Neutron()->GetPDGMass();
   
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPElasticFS.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPElasticFS.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPElasticFS.cc	(revision 962)
@@ -30,4 +30,5 @@
 // 25-08-06 New Final State type (refFlag==3 , Legendre (Low Energy) + Probability (High Energy) ) 
 //          is added by T. KOI
+// 080904 Add Protection for negative energy results in very low energy ( 1E-6 eV ) scattering by T. Koi
 //
 #include "G4NeutronHPElasticFS.hh"
@@ -304,6 +305,33 @@
       G4double tM = theTarget.GetMass();
       theTarget.SetTotalEnergy(std::sqrt((tP+tM)*(tP+tM)-2.*tP*tM));
+
+/*
+For debug purpose. 
+Same transformation G4ReactionProduct.Lorentz() by 4vectors
+{
+G4LorentzVector n4p = G4LorentzVector ( theNeutron.GetMomentum() , theNeutron.GetKineticEnergy() + theNeutron.GetMass() );    
+G4cout << "before " << ( n4p.e() - n4p.m() ) / eV<< G4endl;
+G4LorentzVector cm4p = G4LorentzVector ( theCMS.GetMomentum() , theCMS.GetKineticEnergy() + theCMS.GetMass() );    
+n4p.boost( cm4p.boostVector() );
+G4cout << cm4p/eV << G4endl;
+G4cout << "after " <<  ( n4p.e() - n4p.m() ) / eV<< G4endl;
+}
+*/
+
       theNeutron.Lorentz(theNeutron, -1.*theCMS);
+//080904 Add Protection for very low energy (1e-6eV) scattering 
+      if ( theNeutron.GetKineticEnergy() < 0 )
+      {
+         theNeutron.SetMomentum( G4ThreeVector(0) ); 
+         theNeutron.SetTotalEnergy ( theNeutron.GetMass() );
+      }
+
       theTarget.Lorentz(theTarget, -1.*theCMS);
+//080904 Add Protection for very low energy (1e-6eV) scattering 
+      if ( theTarget.GetKineticEnergy() < 0 )
+      {
+         theTarget.SetMomentum( G4ThreeVector(0) ); 
+         theTarget.SetTotalEnergy ( theTarget.GetMass() );
+      }
     }
     else
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPEnAngCorrelation.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPEnAngCorrelation.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPEnAngCorrelation.cc	(revision 962)
@@ -134,2 +134,3 @@
   return result;
 }
+
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPFissionData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPFissionData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPFissionData.cc	(revision 962)
@@ -30,4 +30,6 @@
 // 070618 fix memory leaking by T. Koi
 // 071002 enable cross section dump by T. Koi
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
+// 081124 Protect invalid read which caused run time errors by T. Koi
 
 #include "G4NeutronHPFissionData.hh"
@@ -110,4 +112,11 @@
       G4cout << (*theElementTable)[i]->GetName() << G4endl;
 
+      if ( (*((*theCrossSections)(i))).GetVectorLength() == 0 ) 
+      {
+         G4cout << "The cross-section data of the fission of this element is not available." << G4endl; 
+         G4cout << G4endl; 
+         continue;
+      }
+
       G4int ie = 0;
 
@@ -130,5 +139,5 @@
 }
 
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 
 G4double G4NeutronHPFissionData::
@@ -152,5 +161,5 @@
   G4double theZ = anE->GetZ();
   G4double eleMass; 
-  eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
+  eleMass = ( G4NucleiProperties::GetNuclearMass( static_cast<G4int>(theA+eps) , static_cast<G4int>(theZ+eps) )
 	     ) / G4Neutron::Neutron()->GetPDGMass();
   
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelastic.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelastic.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelastic.cc	(revision 962)
@@ -33,8 +33,9 @@
 // and all its terms.
 //
-// $Id: G4NeutronHPInelastic.cc,v 1.23 2007/06/22 09:23:48 gcosmo Exp $
-// GEANT4 tag $Name:  $
+// $Id: G4NeutronHPInelastic.cc,v 1.24 2008/12/03 22:28:48 tkoi Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
-// 070523 bug fix for G4FPE_DEBUG on by A. Howard ( and T. Koi)
+// 070523 bug fix for G4FPE_DEBUG on by A. Howard (and T. Koi)
+// 081203 limit maximum trial for creating final states add protection for 1H isotope case by T. Koi
 //
 #include "G4NeutronHPInelastic.hh"
@@ -58,4 +59,5 @@
     { 
       theInelastic[i].Init((*(G4Element::GetElementTable()))[i], dirName);
+      G4int itry = 0;
       do
       {
@@ -97,6 +99,19 @@
 	theInelastic[i].Register(&theDAFS, "F36");
 	theInelastic[i].RestartRegistration();
+        itry++;
       }
-      while(!theInelastic[i].HasDataInAnyFinalState());
+      //while(!theInelastic[i].HasDataInAnyFinalState());
+      while( !theInelastic[i].HasDataInAnyFinalState() && itry < 6 );
+                                                              // 6 is corresponding to the value(5) of G4NeutronHPChannel. TK  
+      if ( itry == 6 ) 
+      {
+         // No Final State at all.
+         G4bool exceptional = false;
+         if ( (*(G4Element::GetElementTable()))[i]->GetNumberOfIsotopes() == 1 )
+         {
+            if ( (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetZ() == 1 && (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetN() == 1 ) exceptional = true;  //1H
+         } 
+         if ( !exceptional ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this element");
+      }
     }
   }
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticBaseFS.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticBaseFS.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticBaseFS.cc	(revision 962)
@@ -28,11 +28,17 @@
 // A prototype of the low energy neutron transport model.
 //
+// 080801 Give a warning message for irregular mass value in data file by T. Koi
+//        Introduce theNDLDataA,Z which has A and Z of NDL data by T. Koi
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
+//
 #include "G4NeutronHPInelasticBaseFS.hh"
 #include "G4Nucleus.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4He3.hh"
 #include "G4Alpha.hh"
 #include "G4Electron.hh"
 #include "G4NeutronHPDataUsed.hh"
+
+#include "G4ParticleTable.hh"
 
 void G4NeutronHPInelasticBaseFS::InitGammas(G4double AR, G4double ZR)
@@ -55,6 +61,6 @@
    G4double eps = 0.001;
    theNuclearMassDifference = 
-       G4NucleiPropertiesTable::GetBindingEnergy(static_cast<G4int>(ZR+eps),static_cast<G4int>(AR+eps)) -
-       G4NucleiPropertiesTable::GetBindingEnergy(static_cast<G4int>(theBaseZ+eps), static_cast<G4int>(theBaseA+eps));
+       G4NucleiProperties::GetBindingEnergy(static_cast<G4int>(AR+eps),static_cast<G4int>(ZR+eps)) -
+       G4NucleiProperties::GetBindingEnergy(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps));
    theGammas.Init(theGammaData);
    //   delete aName;
@@ -74,4 +80,6 @@
   theBaseA = aFile.GetA();
   theBaseZ = aFile.GetZ();
+   theNDLDataA = (int)aFile.GetA();
+   theNDLDataZ = aFile.GetZ();
   if(!dbool || ( Z<2.5 && ( std::abs(theBaseZ - Z)>0.0001 || std::abs(theBaseA - A)>0.0001)))
   {
@@ -170,5 +178,5 @@
   G4double targetMass;
   G4double eps = 0.0001;
-  targetMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theBaseZ+eps), static_cast<G4int>(theBaseA+eps))) /
+  targetMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps))) /
                G4Neutron::Neutron()->GetPDGMass();
   if(theEnergyAngData!=0)
@@ -176,4 +184,6 @@
   if(theAngularDistribution!=0)
      { targetMass = theAngularDistribution->GetTargetMass(); }
+//080731a
+if ( targetMass == 0 ) G4cout << "080731a It looks like something wrong value in G4NDL, please update the latest version. If you use the latest, then please report this problem to Geant4 Hyper news." << G4endl;
   G4Nucleus aNucleus;
   G4ReactionProduct theTarget; 
@@ -255,5 +265,5 @@
     }
     G4ReactionProduct * aHadron;
-    G4double localMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theBaseZ+eps), static_cast<G4int>(theBaseA+eps)));
+    G4double localMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps)));
     G4ThreeVector bufferedDirection(0,0,0);
     for(i0=0; i0<nDef; i0++)
@@ -291,5 +301,5 @@
 	    G4int z1 = static_cast<G4int>(theBaseZ+eps-theDefs[0]->GetPDGCharge()-theDefs[1]->GetPDGCharge());
 	    G4int a1 = static_cast<G4int>(theBaseA+eps)-theDefs[0]->GetBaryonNumber()-theDefs[1]->GetBaryonNumber();
-	    G4double concreteMass = G4NucleiPropertiesTable::GetNuclearMass(z1, a1);
+	    G4double concreteMass = G4NucleiProperties::GetNuclearMass(a1, z1);
 	    G4double availableEnergy = eKinetic+mn+localMass-m1-m2-concreteMass;
 	    // available kinetic energy in CMS (non relativistic)
@@ -357,8 +367,8 @@
     G4double eBindN = 0;
     G4double eBindP = 0;
-    G4double eBindD = G4NucleiPropertiesTable::GetBindingEnergy(1,2);
-    G4double eBindT = G4NucleiPropertiesTable::GetBindingEnergy(1,3);
-    G4double eBindHe3 = G4NucleiPropertiesTable::GetBindingEnergy(2,3);
-    G4double eBindA = G4NucleiPropertiesTable::GetBindingEnergy(2,4);
+    G4double eBindD = G4NucleiProperties::GetBindingEnergy(2,1);
+    G4double eBindT = G4NucleiProperties::GetBindingEnergy(3,1);
+    G4double eBindHe3 = G4NucleiProperties::GetBindingEnergy(3,2);
+    G4double eBindA = G4NucleiProperties::GetBindingEnergy(4,2);
     for(i=0; i<tmpHadrons->size(); i++)
     {
@@ -455,4 +465,11 @@
   delete tmpHadrons;
 
+//080721 
+   G4ParticleDefinition* targ_pd = G4ParticleTable::GetParticleTable()->GetIon ( (G4int)theBaseZ , (G4int)theBaseA , 0.0 );
+   G4LorentzVector targ_4p_lab ( theTarget.GetMomentum() , std::sqrt( targ_pd->GetPDGMass()*targ_pd->GetPDGMass() + theTarget.GetMomentum().mag2() ) );
+   G4LorentzVector proj_4p_lab = theTrack.Get4Momentum();
+   G4LorentzVector init_4p_lab = proj_4p_lab + targ_4p_lab;
+   adjust_final_state ( init_4p_lab ); 
+
 // clean up the primary neutron
   theResult.SetStatusChange(stopAndKill);
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticCompFS.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticCompFS.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticCompFS.cc	(revision 962)
@@ -30,8 +30,14 @@
 // 070523 bug fix for G4FPE_DEBUG on by A. Howard ( and T. Koi)
 // 070606 bug fix and migrate to enable to Partial cases by T. Koi 
+// 080603 bug fix for Hadron Hyper News #932 by T. Koi 
+// 080612 bug fix contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #4,6
+// 080717 bug fix of calculation of residual momentum by T. Koi
+// 080801 protect negative avalable energy by T. Koi
+//        introduce theNDLDataA,Z which has A and Z of NDL data by T. Koi
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 #include "G4NeutronHPInelasticCompFS.hh"
 #include "G4Nucleus.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4He3.hh"
 #include "G4Alpha.hh"
@@ -74,4 +80,6 @@
   theBaseA = aFile.GetA();
   theBaseZ = aFile.GetZ();
+   theNDLDataA = (int)aFile.GetA();
+   theNDLDataZ = aFile.GetZ();
   if(!dbool || ( Z<2.5 && ( std::abs(theBaseZ - Z)>0.0001 || std::abs(theBaseA - A)>0.0001)))
   {
@@ -185,8 +193,9 @@
 }
 
+
+                                                                                                       //n,p,d,t,he3,a
 void G4NeutronHPInelasticCompFS::CompositeApply(const G4HadProjectile & theTrack, G4ParticleDefinition * aDefinition)
 {
 
-    //G4cout << "G4NeutronHPInelasticCompFS::CompositeApply " << G4endl; 
 // prepare neutron
     theResult.Clear();
@@ -201,7 +210,8 @@
     for(i=0; i<50; i++)
     { if(theXsection[i] != 0) { break; } } 
+
     G4double targetMass=0;
     G4double eps = 0.0001;
-    targetMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theBaseZ+eps), static_cast<G4int>(theBaseA+eps))) /
+    targetMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theBaseA+eps), static_cast<G4int>(theBaseZ+eps))) /
                    G4Neutron::Neutron()->GetPDGMass();
 //    if(theEnergyAngData[i]!=0)
@@ -220,5 +230,5 @@
     G4double residualZ = theBaseZ - aDefinition->GetPDGCharge();
     G4double residualA = theBaseA - aDefinition->GetBaryonNumber()+1;
-    residualMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(residualZ+eps), static_cast<G4int>(residualA+eps)) ) /
+    residualMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(residualA+eps), static_cast<G4int>(residualZ+eps)) ) /
                      G4Neutron::Neutron()->GetPDGMass();
 
@@ -230,5 +240,5 @@
   
 // select exit channel for composite FS class.
-    G4int it = SelectExitChannel(eKinetic);
+    G4int it = SelectExitChannel( eKinetic );
    
 // set target and neutron in the relevant exit channel
@@ -241,20 +251,29 @@
     G4double availableEnergy = theNeutron.GetKineticEnergy() + theNeutron.GetMass() - aHadron.GetMass() +
                              (targetMass - residualMass)*G4Neutron::Neutron()->GetPDGMass();
+//080730c
+    if ( availableEnergy < 0 )
+    {
+       //G4cout << "080730c Adjust availavleEnergy " << G4endl; 
+       availableEnergy = 0; 
+    }
     G4int nothingWasKnownOnHadron = 0;
     G4int dummy;
     G4double eGamm = 0;
     G4int iLevel=it-1;
-//  TK debug 070530  (without photon has it = 0)
-    //if(50==it) 
-    if( 0 == it ) 
-    {
+
+//  TK without photon has it = 0
+    if( 50 == it ) 
+    {
+
+//    TK Excitation level is not determined
       iLevel=-1;
       aHadron.SetKineticEnergy(availableEnergy*residualMass*G4Neutron::Neutron()->GetPDGMass()/
                                (aHadron.GetMass()+residualMass*G4Neutron::Neutron()->GetPDGMass()));
 
-      //aHadron.SetMomentum(theNeutron.GetMomentum()*(1./theNeutron.GetTotalMomentum())*
-      //                  std::sqrt(aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()-
-      //                            aHadron.GetMass()*aHadron.GetMass()));
-
+      aHadron.SetMomentum(theNeutron.GetMomentum()*(1./theNeutron.GetTotalMomentum())*
+                        std::sqrt(aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()-
+                                  aHadron.GetMass()*aHadron.GetMass()));
+
+/*
       G4double p2 = ( aHadron.GetTotalEnergy()*aHadron.GetTotalEnergy()-aHadron.GetMass()*aHadron.GetMass() );
       G4double p = 0.0;
@@ -264,4 +283,5 @@
       } 
       aHadron.SetMomentum(theNeutron.GetMomentum()*(1./theNeutron.GetTotalMomentum())*p );
+*/
 
     }
@@ -270,7 +290,9 @@
       while( iLevel!=-1 && theGammas.GetLevel(iLevel)==0 ) { iLevel--; }
     }
-    if(theAngularDistribution[it]!= 0)
-    {
-      if(theEnergyDistribution[it]!=0)
+
+
+    if ( theAngularDistribution[it] != 0 ) // MF4
+    {
+      if(theEnergyDistribution[it]!=0) // MF5
       {
         aHadron.SetKineticEnergy(theEnergyDistribution[it]->Sample(eKinetic, dummy));
@@ -304,5 +326,6 @@
       }
       theAngularDistribution[it]->SampleAndUpdate(aHadron);
-      if(theFinalStatePhotons[it] == 0)
+
+      if( theFinalStatePhotons[it] == 0 )
       {
 // TK comment Most n,n* eneter to this  
@@ -324,5 +347,5 @@
       }
     }
-    else if(theEnergyAngData[it] != 0)  
+    else if(theEnergyAngData[it] != 0) // MF6  
     {
       theParticles = theEnergyAngData[it]->Sample(eKinetic);
@@ -333,14 +356,15 @@
       nothingWasKnownOnHadron = 1;
     }
+
     //G4cout << "theFinalStatePhotons it " << it << G4endl;
     //G4cout << "theFinalStatePhotons[it] " << theFinalStatePhotons[it] << G4endl;
-//  TK 070530
-    if ( it != 0 ) it = 50;  // it 50 has final state data for photon MF13 cross and MF14 ang
     //G4cout << "theFinalStatePhotons it " << it << G4endl;
     //G4cout << "theFinalStatePhotons[it] " << theFinalStatePhotons[it] << G4endl;
     //G4cout << "thePhotons " << thePhotons << G4endl;
-    if(theFinalStatePhotons[it]!=0) 
-    {
-      // the photon distributions are in the Nucleus rest frame.
+
+    if ( theFinalStatePhotons[it] != 0 ) 
+    {
+       // the photon distributions are in the Nucleus rest frame.
+       // TK residual rest frame
       G4ReactionProduct boosted;
       boosted.Lorentz(theNeutron, theTarget);
@@ -493,5 +517,10 @@
 	                          ->GetIon(static_cast<G4int>(residualZ), static_cast<G4int>(residualA), 0));  
         theResidual.SetKineticEnergy(aHadron.GetKineticEnergy()*aHadron.GetMass()/theResidual.GetMass());
-        theResidual.SetMomentum(-1.*aHadron.GetMomentum());
+
+        //080612TK contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #6
+        //theResidual.SetMomentum(-1.*aHadron.GetMomentum());
+	G4ThreeVector incidentNeutronMomentum = theNeutron.GetMomentum();
+        theResidual.SetMomentum(incidentNeutronMomentum - aHadron.GetMomentum());
+
 	theResidual.Lorentz(theResidual, -1.*theTarget);
 	G4ThreeVector totalPhotonMomentum(0,0,0);
@@ -529,5 +558,12 @@
 //        cout << "Kinetic energy of the residual = "<<resiualKineticEnergy<<endl;
 	theResidual.SetKineticEnergy(resiualKineticEnergy);
-        theResidual.SetMomentum(-1.*totalMomentum);
+
+        //080612TK contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #4
+        //theResidual.SetMomentum(-1.*totalMomentum);
+	//G4ThreeVector incidentNeutronMomentum = theNeutron.GetMomentum();
+        //theResidual.SetMomentum(incidentNeutronMomentum - aHadron.GetMomentum());
+//080717 TK Comment still do NOT include photon's mometum which produce by thePhotons
+        theResidual.SetMomentum( theNeutron.GetMomentum() + theTarget.GetMomentum() - totalMomentum );
+
         theSec = new G4DynamicParticle;   
         theSec->SetDefinition(theResidual.GetDefinition());
@@ -549,4 +585,12 @@
       delete thePhotons;
     }
+
+//080721 
+   G4ParticleDefinition* targ_pd = G4ParticleTable::GetParticleTable()->GetIon ( (G4int)theBaseZ , (G4int)theBaseA , 0.0 );
+   G4LorentzVector targ_4p_lab ( theTarget.GetMomentum() , std::sqrt( targ_pd->GetPDGMass()*targ_pd->GetPDGMass() + theTarget.GetMomentum().mag2() ) );
+   G4LorentzVector proj_4p_lab = theTrack.Get4Momentum();
+   G4LorentzVector init_4p_lab = proj_4p_lab + targ_4p_lab;
+   adjust_final_state ( init_4p_lab ); 
+
 // clean up the primary neutron
     theResult.SetStatusChange(stopAndKill);
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPInelasticData.cc	(revision 962)
@@ -31,4 +31,7 @@
 // 070613 fix memory leaking by T. Koi
 // 071002 enable cross section dump by T. Koi
+// 080428 change checking point of "neglecting doppler broadening" flag 
+//        from GetCrossSection to BuildPhysicsTable by T. Koi
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 #include "G4NeutronHPInelasticData.hh"
@@ -48,4 +51,5 @@
 {
 // TKDB
+   onFlightDB = true;
    theCrossSections = 0;
   BuildPhysicsTable(*G4Neutron::Neutron());
@@ -64,4 +68,8 @@
   if(&aP!=G4Neutron::Neutron()) 
      throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");  
+
+//080428
+   if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) ) onFlightDB = false;
+
   size_t numberOfElements = G4Element::GetNumberOfElements();
 //  theCrossSections = new G4PhysicsTable( numberOfElements );
@@ -130,5 +138,5 @@
 }
 
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 
 G4double G4NeutronHPInelasticData::
@@ -143,5 +151,7 @@
 
   // T. K. 
-  if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) )
+//if ( getenv( "G4NEUTRONHP_NEGLECT_DOPPLER" ) )
+//080428
+  if ( !onFlightDB )
   {
      G4double factor = 1.0;
@@ -166,5 +176,5 @@
   G4double theZ = anE->GetZ();
   G4double eleMass; 
-  eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
+  eleMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theA+eps), static_cast<G4int>(theZ+eps))
 	     ) / G4Neutron::Neutron()->GetPDGMass();
   
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPIsoData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPIsoData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPIsoData.cc	(revision 962)
@@ -28,4 +28,6 @@
 // A prototype of the low energy neutron transport model.
 //
+//080901 Avoiding troubles which caused by G4PhysicsVecotor of length 0 by T. Koi
+//
 #include "G4NeutronHPIsoData.hh"
 #include "G4NeutronHPDataUsed.hh"
@@ -45,6 +47,8 @@
     {
       if(getenv("NeutronHPNamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl;
-      theChannel.close();
-      return false;
+      //080901 TKDB No more necessary below protection, cross sections set to 0 in G4NeutronHPNames
+      //And below two lines causes trouble with G4PhysicsVector
+      //theChannel.close();
+      //return false;
     }
     if(!theChannel) {theChannel.close(); return false;}
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPKallbachMannSyst.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPKallbachMannSyst.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPKallbachMannSyst.cc	(revision 962)
@@ -27,4 +27,6 @@
 // J.P. Wellisch, Nov-1996
 // A prototype of the low energy neutron transport model.
+//
+// 080801 Protect div0 error, when theCompundFraction is 1 by T. Koi
 //
 #include "G4NeutronHPKallbachMannSyst.hh" 
@@ -69,4 +71,9 @@
 {
   G4double result;
+  if ( theCompoundFraction == 1 ) 
+  { 
+     //G4cout << "080730b Adjust theCompoundFraction " << G4endl;
+     theCompoundFraction *= (1-1.0e-15);   
+  } 
   result = 0.5 * (1./A(anEnergy)) * std::log((1-theCompoundFraction)/(1+theCompoundFraction));
   return result;
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPLabAngularEnergy.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPLabAngularEnergy.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPLabAngularEnergy.cc	(revision 962)
@@ -28,4 +28,6 @@
 // A prototype of the low energy neutron transport model.
 //
+// 080808 Bug fix in serching mu bin and index for theBuff2b by T. Koi
+//
 #include "G4NeutronHPLabAngularEnergy.hh"
 #include "G4Gamma.hh"
@@ -111,8 +113,11 @@
    {
      it = i;
-     if(anEnergy<theEnergies[i]) break;
-   }
-   if(it==0 || it == nEnergies-1) // it marks the energy bin
-   {
+     if ( anEnergy < theEnergies[i] ) break;
+   }
+   //080808
+   //if ( it == 0 || it == nEnergies-1 ) // it marks the energy bin
+   if ( it == 0 ) // it marks the energy bin
+   {
+if(it==0) G4cout << "080808 Something unexpected is happen in G4NeutronHPLabAngularEnergy " << G4endl;
      // integrate the prob for each costh, and select theta.
      G4double * running = new G4double [nCosTh[it]];
@@ -130,14 +135,19 @@
        if(random<running[i]) break;
      }
-     if(ith==0 || ith==nCosTh[it]-1)
-     {
-       cosTh = theData[it][ith].GetLabel();
-       secEnergy = theData[it][ith].Sample();
-       currentMeanEnergy = theData[it][ith].GetMeanX();
+     //080807
+     //if ( ith == 0 || ith == nCosTh[it]-1 ) //ith marks the angluar bin
+     if ( ith == 0 ) //ith marks the angluar bin
+     {
+        cosTh = theData[it][ith].GetLabel();
+        secEnergy = theData[it][ith].Sample();
+        currentMeanEnergy = theData[it][ith].GetMeanX();
      }
      else
      {
-       G4double x1 = theData[it][ith-1].GetIntegral();
-       G4double x2 = theData[it][ith].GetIntegral();
+       //080808
+       //G4double x1 = theData[it][ith-1].GetIntegral();
+       //G4double x2 = theData[it][ith].GetIntegral();
+       G4double x1 = running [ ith-1 ];
+       G4double x2 = running [ ith ];
        G4double x = random;
        G4double y1 = theData[it][ith-1].GetLabel();
@@ -157,4 +167,5 @@
          y1 = theData[it][ith-1].GetY(i);
          y2 = theData[it][ith].GetY(mu);
+
          y = theInt.Interpolate(theSecondManager[it].GetScheme(ith), 
                                 cosTh, x1,x2,y1,y2);
@@ -298,9 +309,14 @@
      G4NeutronHPVector theBuff2b;
      theBuff2b.SetInterpolationManager(theData[it][i2].GetInterpolationManager());
-     for(i=0;i<theData[it][i1].GetVectorLength(); i++)
-     {
-       E = theData[it][i1].GetX(i);
-       y1 = theData[it][i1-1].GetY(E);
-       y2 = theData[it][i1].GetY(i);
+     //080808  i1 -> i2
+     //for(i=0;i<theData[it][i1].GetVectorLength(); i++)
+     for(i=0;i<theData[it][i2].GetVectorLength(); i++)
+     {
+       //E = theData[it][i1].GetX(i);
+       //y1 = theData[it][i1-1].GetY(E);
+       //y2 = theData[it][i1].GetY(i);
+       E = theData[it][i2].GetX(i);
+       y1 = theData[it][i2-1].GetY(E);
+       y2 = theData[it][i2].GetY(i);
        y = theInt.Lin(x, x1,x2,y1,y2);
        theBuff2b.SetData(i, E, y); // wrong E, right theta.
@@ -339,5 +355,5 @@
      currentMeanEnergy = theOne.GetMeanX();
    }
-   
+
 // now do random direction in phi, and fill the result.
 
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPLegendreStore.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPLegendreStore.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPLegendreStore.cc	(revision 962)
@@ -28,4 +28,6 @@
 // A prototype of the low energy neutron transport model.
 //
+// 080612 SampleDiscreteTwoBody contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #3
+//
 #include "G4NeutronHPLegendreStore.hh"
 #include "G4NeutronHPVector.hh"
@@ -34,4 +36,82 @@
 #include "Randomize.hh"
 #include <iostream>
+
+
+
+//080612TK contribution from Benoit Pirard and Laurent Desorgher (Univ. Bern) #3 
+G4double G4NeutronHPLegendreStore::SampleDiscreteTwoBody (G4double anEnergy)
+{
+  G4double result;
+  
+  G4int i0;
+  G4int low(0), high(0);
+  G4NeutronHPFastLegendre theLeg;
+  for (i0=0; i0<nEnergy; i0++)
+  {
+    high = i0;
+    if(theCoeff[i0].GetEnergy()>anEnergy) break;
+  }
+  low = std::max(0, high-1);
+  G4NeutronHPInterpolator theInt;
+  G4double x, x1, x2;
+  x = anEnergy;
+  x1 = theCoeff[low].GetEnergy();
+  x2 = theCoeff[high].GetEnergy();
+  G4double theNorm = 0;
+  G4double try01=0, try02=0;
+  G4double max1, max2, costh;
+  max1 = 0; max2 = 0;
+  G4int l,m;
+  for(i0=0; i0<601; i0++)
+  {
+      costh = G4double(i0-300)/300.;
+      try01 = 0.5;
+      for(m=0; m<theCoeff[low].GetNumberOfPoly() ; m++)
+      {  
+	  l=m+1;
+	  try01 += (2.*l+1)/2.*theCoeff[low].GetCoeff(m)*theLeg.Evaluate(l, costh);
+      } 
+      if(try01>max1) max1=try01;
+      try02 = 0.5;
+      for(m=0; m<theCoeff[high].GetNumberOfPoly() ; m++)
+      {
+	  l=m+1;
+	  try02 += (2.*l+1)/2.*theCoeff[high].GetCoeff(m)*theLeg.Evaluate(l, costh);
+      }
+      if(try02>max2) max2=try02;
+  } 
+  theNorm = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, max1, max2);
+  
+  G4double value, random;
+  G4double v1, v2;
+  do
+  {
+    v1 = 0.5;
+    v2 = 0.5;
+    result = 2.*G4UniformRand()-1.;
+    for(m=0; m<theCoeff[low].GetNumberOfPoly() ; m++)
+    {
+	l=m+1;	
+	G4double legend = theLeg.Evaluate(l, result); // @@@ done to avoid optimization error on SUN
+	v1 += (2.*l+1)/2.*theCoeff[low].GetCoeff(m)*legend;
+    } 
+    for(m=0; m<theCoeff[high].GetNumberOfPoly() ; m++)
+    {	
+	l=m+1;
+	G4double legend = theLeg.Evaluate(l, result); // @@@ done to avoid optimization error on SUN
+	v2 += (2.*l+1)/2.*theCoeff[high].GetCoeff(m)*legend;
+    } 
+    // v1 = std::max(0.,v1); // Workaround in case one of the distributions is fully non-physical.
+    // v2 = std::max(0.,v2); 
+    value = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, v1, v2);
+    random = G4UniformRand();
+    if(0>=theNorm) break; // Workaround for negative cross-section values. @@@@ 31 May 2000
+  }
+  while(random>value/theNorm);
+
+  return result;
+}
+
+
 
 G4double G4NeutronHPLegendreStore::SampleMax (G4double anEnergy)
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPNBodyPhaseSpace.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPNBodyPhaseSpace.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPNBodyPhaseSpace.cc	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4NeutronHPNBodyPhaseSpace.cc,v 1.13 2006/06/29 20:53:11 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 #include "G4NeutronHPNBodyPhaseSpace.hh"
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPNames.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPNames.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPNames.cc	(revision 962)
@@ -34,4 +34,5 @@
 //          Natural Abundance data are allowed. by T. Koi
 // 07-07-06 Allow _nat_ final state even for isotoped cross sections by T. Koi
+// 08-09-01 Add protection that deuteron data do not selected for hydrogen and so on by T. Koi
 //
 #include "G4NeutronHPNames.hh"
@@ -319,5 +320,17 @@
           else
           { 
-             G4cout << "NeutronHP: " << reac << " file for Z = " << Z << ", A = " << A << " is not found and NeutronHP will use " << result.GetName() << G4endl;
+             //080901 Add protection that deuteron data do not selected for hydrogen and so on by T. Koi
+             if ( (reac.find("Inelastic") != reac.size() && 
+                   ((Z == 1 && A == 1) || (Z == 2 && A == 4) ) ) 
+                 ||   
+                  (reac.find("Capture") != reac.size() && (Z == 2 && A == 4) ) )
+             {
+                G4String new_name = base+"/"+rest+"0_0_Zero";
+                result.SetName( new_name );
+             }
+             else
+             {
+                G4cout << "NeutronHP: " << reac << " file for Z = " << Z << ", A = " << A << " is not found and NeutronHP will use " << result.GetName() << G4endl;
+             }
           }
        }
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPPhotonDist.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPPhotonDist.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPPhotonDist.cc	(revision 962)
@@ -33,4 +33,7 @@
 // 070606 Add Partial case by T. Koi 
 // 070618 fix memory leaking by T. Koi
+// 080801 fix memory leaking by T. Koi
+// 080801 Correcting data disorder which happened when both InitPartial 
+//        and InitAnglurar methods was called in a same instance by T. Koi
 //
 // there is a lot of unused (and undebugged) code in this file. Kept for the moment just in case. @@
@@ -109,4 +112,5 @@
 void G4NeutronHPPhotonDist::InitAngular(std::ifstream & aDataFile)
 {
+
   G4int i, ii;
   //angular distributions
@@ -115,11 +119,36 @@
   {
     aDataFile >> tabulationType >> nDiscrete2 >> nIso;
-    theShells = new G4double[nDiscrete2];
-    theGammas = new G4double[nDiscrete2];
+//080731
+      if ( theGammas != NULL && nDiscrete2 != nDiscrete ) G4cout << "080731c G4NeutronHPPhotonDist nDiscrete2 != nDiscrete, It looks like something wrong in your NDL files. Please update the latest. If you still have this messages after the update, then please report to Geant4 Hyper News." << G4endl;
+
+      // The order of cross section (InitPartials) and distribution (InitAngular here) data are different, we have to re-coordinate consistent data order.
+      std::vector < G4double > vct_gammas_par; 
+      std::vector < G4double > vct_shells_par; 
+      std::vector < G4int > vct_primary_par; 
+      std::vector < G4int > vct_distype_par; 
+      std::vector < G4NeutronHPVector* > vct_pXS_par;
+      if ( theGammas != NULL ) 
+      {
+         //copy the cross section data 
+         for ( i = 0 ; i < nDiscrete ; i++ )
+         {
+            vct_gammas_par.push_back( theGammas[ i ] );
+            vct_shells_par.push_back( theShells[ i ] );
+            vct_primary_par.push_back( isPrimary[ i ] );
+            vct_distype_par.push_back( disType[ i ] );
+            G4NeutronHPVector* hpv = new G4NeutronHPVector;
+            *hpv = thePartialXsec[ i ];
+            vct_pXS_par.push_back( hpv );
+         }
+      }
+     if ( theGammas == NULL ) theGammas = new G4double[nDiscrete2];
+     if ( theShells == NULL ) theShells = new G4double[nDiscrete2];
+//080731
+
     for (i=0; i< nIso; i++) // isotropic photons
     {
-        aDataFile >> theGammas[i] >> theShells[i];
-        theGammas[i]*=eV;
-        theShells[i]*=eV;
+       aDataFile >> theGammas[i] >> theShells[i];
+       theGammas[i]*=eV;
+       theShells[i]*=eV;
     }
     nNeu = new G4int [nDiscrete2-nIso];
@@ -157,4 +186,29 @@
       }
     }
+//080731
+     if ( vct_gammas_par.size() > 0 ) 
+     {
+        //Reordering cross section data to corrsponding distribution data 
+        for ( i = 0 ; i < nDiscrete ; i++ ) 
+        {
+           for ( G4int j = 0 ; j < nDiscrete ; j++ )  
+           {
+              // Checking gamma and shell to identification 
+              if ( theGammas[ i ] == vct_gammas_par [ j ] && theShells [ i ] == vct_shells_par[ j ] )
+              {
+                 isPrimary [ i ] = vct_primary_par [ j ];
+                 disType [ i ] = vct_distype_par [ j ];
+                 thePartialXsec[ i ] = ( *( vct_pXS_par[ j ] ) );
+              }
+           }
+        }
+        //Garbage collection 
+        for ( std::vector < G4NeutronHPVector* >::iterator 
+           it = vct_pXS_par.begin() ; it != vct_pXS_par.end() ; it++ )
+        {
+           delete *it;
+        }
+     }
+//080731
   }
 }
@@ -188,4 +242,5 @@
 void G4NeutronHPPhotonDist::InitPartials(std::ifstream & aDataFile)
 {
+
   //G4cout << "G4NeutronHPPhotonDist::InitPartials " << G4endl;
   aDataFile >> nDiscrete >> targetMass;
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPProduct.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPProduct.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPProduct.cc	(revision 962)
@@ -27,4 +27,13 @@
 // J.P. Wellisch, Nov-1996
 // A prototype of the low energy neutron transport model.
+//
+// 080718 As for secondary photons, if its mean value has a value of integer, 
+//        then a sampling of multiplicity that based on Poisson Distribution 
+//        is not carried out and the mean is used as a multiplicity.
+//        modified by T. Koi.
+// 080721 Using ClearHistories() methodl for limiting the sum of secondary energies
+//        modified by T. Koi.
+// 080901 bug fix of too many secnodaries production in nd reactinos by T. Koi
+//
 #include "G4NeutronHPProduct.hh" 
 #include "G4Poisson.hh"
@@ -38,5 +47,17 @@
   G4int multi;
   multi = G4int(mean+0.0001);
-  if(theMassCode==0) multi = G4Poisson(mean); // @@@@gammas. please X-check this
+  //if(theMassCode==0) multi = G4Poisson(mean); // @@@@gammas. please X-check this
+  //080718
+  if ( theMassCode == 0 )
+  { 
+     if ( G4int ( mean ) == mean )
+     {
+        multi = (G4int) mean;
+     }
+     else
+     {
+        multi = G4Poisson ( mean ); 
+     }
+  }
   theDist->SetTarget(theTarget);
   theDist->SetNeutron(theNeutron);
@@ -46,4 +67,5 @@
   theCurrentMultiplicity = static_cast<G4int>(mean);
   G4ReactionProduct * tmp;
+  theDist->ClearHistories();
   for(i=0;i<multi;i++)
   {
@@ -56,4 +78,6 @@
     delete  tmp;
   }
+/*
+//080901 TK Comment out, too many secondaries are produced in deuteron reactions
   if(theTarget->GetMass()<2*GeV) // @@@ take care of residuals in all cases
   {
@@ -62,4 +86,5 @@
     if(tmp != 0) { result->push_back(tmp); }
   }
+*/
   return result;
 }
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPThermalScattering.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPThermalScattering.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPThermalScattering.cc	(revision 962)
@@ -39,4 +39,5 @@
 
 // 070625 Fix memory leaking at destructor by T. Koi 
+// 081201 Fix memory leaking at destructor by T. Koi 
 
 #include "G4NeutronHPThermalScattering.hh"
@@ -103,7 +104,5 @@
 {
 
-   { // separate name scope of it 
-   std::map < G4int , std::map < G4double , std::vector < E_isoAng* >* >* >::iterator it;
-   for ( it = incoherentFSs.begin() ; it != incoherentFSs.end() ; it++ )
+   for ( std::map < G4int , std::map < G4double , std::vector < E_isoAng* >* >* >::iterator it = incoherentFSs.begin() ; it != incoherentFSs.end() ; it++ )
    {
       std::map < G4double , std::vector < E_isoAng* >* >::iterator itt;
@@ -119,9 +118,6 @@
       delete it->second;
    }
-   }
-
-   {
-   std::map < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* >::iterator it;
-   for ( it = coherentFSs.begin() ; it != coherentFSs.end() ; it++ )
+
+   for ( std::map < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* >::iterator it = coherentFSs.begin() ; it != coherentFSs.end() ; it++ )
    {
       std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >::iterator itt;
@@ -137,9 +133,6 @@
       delete it->second;
    }
-   }
-
-   {
-   std::map < G4int ,  std::map < G4double , std::vector < E_P_E_isoAng* >* >* >::iterator it;
-   for ( it = inelasticFSs.begin() ; it != inelasticFSs.end() ; it++ )
+
+   for ( std::map < G4int ,  std::map < G4double , std::vector < E_P_E_isoAng* >* >* >::iterator it = inelasticFSs.begin() ; it != inelasticFSs.end() ; it++ )
    {
       std::map < G4double , std::vector < E_P_E_isoAng* >* >::iterator itt;
@@ -160,6 +153,6 @@
       delete it->second;
    }
-   }
-
+
+   delete theHPElastic;
    delete theXSection;
 }
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPVector.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPVector.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPVector.cc	(revision 962)
@@ -29,4 +29,5 @@
 //
 // 070523 bug fix for G4FPE_DEBUG on by A. Howard ( and T. Koi)
+// 080808 bug fix in Sample() and GetXsec() by T. Koi
 //
 #include "G4NeutronHPVector.hh"
@@ -170,5 +171,7 @@
       //if( (theData[high].GetX()-theData[low].GetX())/theData[high].GetX() < 0.000001)
       if ( theData[high].GetX() !=0 
-       &&( theData[high].GetX()-theData[low].GetX())/theData[high].GetX() < 0.000001)
+       //080808 TKDB
+       //&&( theData[high].GetX()-theData[low].GetX())/theData[high].GetX() < 0.000001)
+       &&( std::abs( (theData[high].GetX()-theData[low].GetX())/theData[high].GetX() ) < 0.000001 ) )
       {
         y = theData[low].GetY();
@@ -366,7 +369,9 @@
       do
       {
+//080808
+/*
+        G4double rand;
         G4double value, test, baseline;
         baseline = theData[GetVectorLength()-1].GetX()-theData[0].GetX();
-        G4double rand;
         do
         {
@@ -379,4 +384,41 @@
         while( test < rand && test > 0 );
         result = value;
+*/
+        G4double rand;
+        G4double value, test;
+        do 
+        {
+           rand = G4UniformRand();
+           G4int ibin = -1;
+           for ( G4int i = 0 ; i < GetVectorLength() ; i++ )
+           {
+              if ( rand < theIntegral[i] ) 
+              {
+                 ibin = i; 
+                 break;
+              }
+           }
+           if ( ibin < 0 ) G4cout << "TKDB 080807 " << rand << G4endl; 
+           // result 
+           rand = G4UniformRand();
+           G4double x1, x2; 
+           if ( ibin == 0 ) 
+           {
+              x1 = theData[ ibin ].GetX(); 
+              value = x1; 
+              break;
+           }
+           else 
+           {
+              x1 = theData[ ibin-1 ].GetX();
+           }
+           
+           x2 = theData[ ibin ].GetX();
+           value = rand * ( x2 - x1 ) + x1;
+           test = GetY ( value ) / std::max ( GetY( ibin-1 ) , GetY ( ibin ) ); 
+        }
+        while ( G4UniformRand() > test );
+        result = value;
+//080807
       }
       while(IsBlocked(result));
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLCaptureData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLCaptureData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLCaptureData.cc	(revision 962)
@@ -29,4 +29,5 @@
 //          If NeutronHP data do not available for an element, then Low Energy 
 //          Parameterization models handle the interactions of the element.
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 
@@ -89,5 +90,5 @@
 
 #include "G4Nucleus.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4Neutron.hh"
 #include "G4Electron.hh"
@@ -114,5 +115,5 @@
   G4double theZ = anE->GetZ();
   G4double eleMass; 
-  eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
+  eleMass = ( G4NucleiProperties::GetNuclearMass( static_cast<G4int>(theA+eps), static_cast<G4int>(theZ+eps))
 	     ) / G4Neutron::Neutron()->GetPDGMass();
   
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLEInelasticData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLEInelasticData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLEInelasticData.cc	(revision 962)
@@ -29,4 +29,5 @@
 //          If NeutronHP data do not available for an element, then Low Energy 
 //          Parameterization models handle the interactions of the element.
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 
@@ -133,5 +134,5 @@
 
 #include "G4Nucleus.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4Neutron.hh"
 #include "G4Electron.hh"
@@ -158,5 +159,5 @@
   G4double theZ = anE->GetZ();
   G4double eleMass; 
-  eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
+  eleMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theA+eps), static_cast<G4int>(theZ+eps))
 	     ) / G4Neutron::Neutron()->GetPDGMass();
   
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLElasticData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLElasticData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLElasticData.cc	(revision 962)
@@ -29,4 +29,5 @@
 //          If NeutronHP data do not available for an element, then Low Energy 
 //          Parameterization models handle the interactions of the element.
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 
@@ -89,5 +90,5 @@
 
 #include "G4Nucleus.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4Neutron.hh"
 #include "G4Electron.hh"
@@ -114,5 +115,5 @@
   G4double theZ = anE->GetZ();
   G4double eleMass; 
-  eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
+  eleMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theA+eps), static_cast<G4int>(theZ+eps))
 	     ) / G4Neutron::Neutron()->GetPDGMass();
   
Index: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLFissionData.cc
===================================================================
--- trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLFissionData.cc	(revision 819)
+++ trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPorLFissionData.cc	(revision 962)
@@ -29,4 +29,5 @@
 //          If NeutronHP data do not available for an element, then Low Energy 
 //          Parameterization models handle the interactions of the element.
+// 081024 G4NucleiPropertiesTable:: to G4NucleiProperties::
 //
 
@@ -89,5 +90,5 @@
 
 #include "G4Nucleus.hh"
-#include "G4NucleiPropertiesTable.hh"
+#include "G4NucleiProperties.hh"
 #include "G4Neutron.hh"
 #include "G4Electron.hh"
@@ -114,5 +115,5 @@
   G4double theZ = anE->GetZ();
   G4double eleMass; 
-  eleMass = ( G4NucleiPropertiesTable::GetNuclearMass(static_cast<G4int>(theZ+eps), static_cast<G4int>(theA+eps))
+  eleMass = ( G4NucleiProperties::GetNuclearMass(static_cast<G4int>(theA+eps), static_cast<G4int>(theZ+eps))
 	     ) / G4Neutron::Neutron()->GetPDGMass();
   
