diff --git a/ReleaseNotes/Patch4.8.1-2.txt b/ReleaseNotes/Patch4.8.1-2.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9248b896b0cfd3679a967b450c98a95bbc849f21
--- /dev/null
+++ b/ReleaseNotes/Patch4.8.1-2.txt
@@ -0,0 +1,112 @@
+
+                 Geant4 8.1 - patch-02 Release Notes
+                 -----------------------------------
+
+                                                           10 November 2006
+
+List of fixes included in this public patch since the public release 8.1.p01:
+
+  o Geometry:
+    --------
+    + management
+      o Added empty virtual method CheckOverlaps() to G4VPhysicalVolume to
+        allow for proper overloading from subclasses. Implementation returns
+        always 'false', which is the case for replicas.
+
+  o Global:
+    ------
+    + Corrected inclusion of CLHEP headers in wrapper files
+      G4SystemOfUnits.hh and G4PhysicalConstants.hh.
+
+  o Electromagnetic processes:
+    -------------------------
+    + standard:
+      o Fixed energy non-conservation in G4PAIModel for positrons. Fix also
+        concerning 'Tmax' for electrons and positrons: 'Tmax' is defined
+        now for each particle independently.
+      o Fixed problem of positron zero incident energy in G4eeToTwoGammaModel.
+      o Added extra protection inside G4BetheBlochModel.
+      o Fixed problems and add comments in the classes prototype Coulomb
+        elastic scattering: G4CoulombScattering, G4CoulombScatteringModel,
+        G4eCoulombScatteringModel. Set default limit on scattering angle to
+        zero.
+    + utils:
+      o G4VEnergyLossProcess: made LambdaPhysicsVector() method protected.
+      o G4ionEffectiveCharge: added protection for NULL pointer to material.
+
+  o Hadronic Processes:
+    ------------------
+    + models/coherent_elastic:
+      o Introduced NaN check inside G4HadronElastic, G4ChargeExchange, and
+        G4UHadronElasticProcess.
+      o Removed HP data from G4UHadronElasticProcess (it is set in physics
+        lists); added low energy threshold of 20 MeV in G4HadronElastic for
+        QElastic. For any particle with kinetic energy below 10 KeV, the
+        primary particle is returned unchanged and no scattering is sampled.
+        This prevents situations of low-energy neutrons scattering forever,
+        and reduces precision in computing scattering for low-energy hadrons.
+    + models/utils:
+      o Reduced warning output from G4Fragment on negative excitation energy;
+        a maximum of 10 warnings is printed now.
+      o G4Fancy3DNucleus:ChoosePositions(): correctly use std::vector.
+        Correction addressing problem report #887 on WIN32/VC8.
+      o Removed meaningless 'const' qualifier from return type of method
+        G4Fancy3DNucleusHelper().
+
+  o Particles:
+    ---------
+    + Fixed bug in G4ParticleDefinition constructor causing not filling quark
+      contents when G4VERBOSE is not set.
+    + Fixed bug in k2(1770) decay. Addresses problem report #894.
+
+  o Persistency:
+    -----------
+    + Get Rid of useless forward declarations in G4MCTEvent and
+      G4MCTGenParticle header files. Clearing compilation warnings on
+      icc-9.X compilers.
+
+  o Track:
+    -----
+    + Made G4StepPoint::operator=() inline for optimisation.
+
+  o Physics Lists:
+    -------------
+    + G4HadronElasticPhysics: added explicit inclusions of data headers
+      in the header file.
+
+  o Configuration:
+    -------------
+    + Linux-icc: updated setup to support Intel icc compiler 9.X series.
+    + liblist.c: added .dylib search for list of libraries.
+      Addressing problem report #885.
+    + architecture.gmk: added variables for commands: echo, cat, cut, sed;
+      to be eventually overloaded in system dependent configurations.
+      Overloaded variables for WIN32-VC to force usage of the original
+      CygWin built-in commands. Use standard 'echo' command for Darwin-g++.
+      Replaced system commands with variables defined at architecture level
+      in source/GNUmakefile.
+
+  o Examples:
+    --------
+    + Updated reference outputs.
+    + advanced/underground_physics
+      o Fixed bug: removed uninitialized 'UserLimitsForXenon'.
+    + extended/analysis/AnaEx01
+      o Corrected text in README for AIDA setup.
+
+ ----------------------------------------------------------------------------
+
+                             Technical Notes
+                             --------------- 
+
+  o  This patch should be applied on top of release 8.1.p01
+  o  Technical notes distributed for release 8.1 are also applicable and
+     valid for this patch.
+
+The code and rebuilt binary libraries for release 8.1.p02 are available
+through our "Source Code" Web page:
+   http://cern.ch/geant4/support/download.shtml
+
+Please refer to the Geant4 User Documentation:
+   http://cern.ch/geant4/support/userdocuments.shtml
+for further information about using Geant4.
diff --git a/config/History b/config/History
index 519ee53f7b178536e818a980080c5f88ce7d1645..dcf6f6fcc725b8c08716174e5c009242c65c9866 100644
--- a/config/History
+++ b/config/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.278 2006/06/13 15:37:35 gcosmo Exp $
+$Id: History,v 1.285.2.1 2006/11/02 12:21:48 gcosmo Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -16,6 +16,27 @@ committal in the CVS repository !
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+10th October 2006  Gabriele Cosmo (config-V08-01-05a)
+- Darwin-g++.gmk: use standard -echo- command.
+  Removed ECHO overloaded variable.
+
+5th October 2006  Gabriele Cosmo (config-V08-01-04)
+- liblist.c: added .dylib search for list of libraries.
+  Addressing problem report #885.
+
+3rd October 2006  Gabriele Cosmo (config-V08-01-03)
+- architecture.gmk: added variables for commands: echo, cat, cut, sed;
+  to be eventually overloaded in system dependent configurations.
+- WIN32-VC.gmk: overload commands [echo, grep, cat, cut, sed], to force
+  usage of the original CygWin built-in commands.
+
+18th August 2006  Gabriele Cosmo (config-V08-01-01)
+- Linux-icc: corrected G4RUNPATHOPTION flag to allow linking of applications
+  with shared libraries.
+
+18th August 2006  Gabriele Cosmo (config-V08-01-00)
+- Linux-icc: updated setup to support icc-9.X series.
+
 13th June 2006  Gabriele Cosmo (config-V08-00-02)
 - Removed defaults for X11, XM, XAW flags in architecture.gmk and added
   explicit settings in sys/*.gmk setups protected by ifndef statements for
diff --git a/config/architecture.gmk b/config/architecture.gmk
index ccd878034568348d7e4475457817dae5365ffb9d..3a1acc6acc6e9b755306df204babab6d6347ee6a 100644
--- a/config/architecture.gmk
+++ b/config/architecture.gmk
@@ -1,4 +1,4 @@
-# $Id: architecture.gmk,v 1.105 2006/06/13 15:36:30 gcosmo Exp $
+# $Id: architecture.gmk,v 1.106 2006/10/03 13:45:37 gcosmo Exp $
 # ------------------------------------------------------------------------
 #       GEANT 4 - Architecture configuration script for GNU Make
 #
@@ -267,14 +267,26 @@ G4TREP := $(G4TMP)/$(G4TEMPLATE_REPOSITORY)
 #
 AR := ar r
 
-# Default echo used with makedepend. Changed for SUN-CC, Linux-g++.
+# Default echo used with makedepend. Changed for SUN-CC, Linux-g++, WIN32.
 #
 ECHO:= echo
 
-# Default grep used with source/GNUmakfile.  Changed for SUN-CC.
+# Default grep used with source/GNUmakefile.  Changed for SUN-CC.
 #
 GREP := grep
 
+# Default cut used with source/GNUmakefile.  Changed for WIN32.
+#
+CUT := cut
+
+# Default cat used with source/GNUmakefile.  Changed for WIN32.
+#
+CAT := cat
+
+# Default sed used with source/GNUmakefile.  Changed for WIN32.
+#
+SED := sed
+
 # Include architecture dependent setups...
 #
 include $(G4INSTALL)/config/sys/$(G4SYSTEM).gmk
diff --git a/config/liblist.c b/config/liblist.c
index 6c1c88b07d8913d9e52248d1ac8420ec36edf515..0a2b90402f53afb77e3ed4d9c046b100cc25ac75 100644
--- a/config/liblist.c
+++ b/config/liblist.c
@@ -1,4 +1,4 @@
-/* $Id: liblist.c,v 1.17 2002/11/22 11:53:10 gcosmo Exp $ */
+/* $Id: liblist.c,v 1.18 2006/10/05 14:22:06 gcosmo Exp $ */
 
 /*
 Given a "libname.map" file on standard input and a list or directory
@@ -549,6 +549,14 @@ int main (int argc, char** argv) {
 	  {
             printf("-l%s ",libmapPtr->lib);
 	  }
+          else  /* case MacOS .dylib */
+          {
+	    sprintf(libname, "%s/lib%s.dylib", libpath, libmapPtr->lib);
+            if (!access(libname,R_OK))
+	    {
+              printf("-l%s ",libmapPtr->lib);
+	    }
+          }
 	}
         else
 	{
diff --git a/config/sys/Darwin-g++.gmk b/config/sys/Darwin-g++.gmk
index d043a988ba509f026c12da836c5e1c15cc448544..79ebc33fa039d965d8d5c8a10b27f54df778270b 100644
--- a/config/sys/Darwin-g++.gmk
+++ b/config/sys/Darwin-g++.gmk
@@ -31,7 +31,6 @@ ifeq ($(G4SYSTEM),Darwin-g++)
   FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
   LDFLAGS += -bind_at_load
   FCLIBS := -lg2c -lnsl
-  ECHO    := /bin/echo -n
   SHEXT   := dylib
   ifndef X11FLAGS
     X11FLAGS  := -I/usr/include/X11/extensions -I/usr/include/X11
diff --git a/config/sys/Linux-icc.gmk b/config/sys/Linux-icc.gmk
index eaa6cbe297fcca6d0671dc390ec1c64007767fa1..85ca26041f86dc12e59649f19e3e20bd7fbe7b14 100644
--- a/config/sys/Linux-icc.gmk
+++ b/config/sys/Linux-icc.gmk
@@ -1,13 +1,13 @@
 #
-# ------ GNU/LINUX ------     !!! not supported !!!
-#                                 Intel icc 8.0
+# ------ GNU/LINUX ------         Intel icc 9.1
+#
 ifeq ($(G4SYSTEM),Linux-icc)
   CXX       := icc
   CXXFLAGS  := -ansi -mp -no-gcc -w1
   ifdef G4OPTIMISE
-    CXXFLAGS  += -O
-    FCFLAGS   := -O
-    CCFLAGS   := -O
+    CXXFLAGS  += -O2
+    FCFLAGS   := -O2
+    CCFLAGS   := -O2
   else
     ifdef G4DEBUG
       CXXFLAGS  += -g
@@ -25,12 +25,12 @@ ifeq ($(G4SYSTEM),Linux-icc)
     FCFLAGS   += -fPIC
     CCFLAGS   += -fPIC
   endif
-  G4RUNPATHOPTION := -Xlinker -rpath 
+  G4RUNPATHOPTION := -Wl,-rpath -Wl,
   CC := gcc
   FC := g77
   FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
   FCLIBS := -lg2c -lnsl
-  AR := xiar r
+  AR := ar r
   ECHO    := /bin/echo -e
   SHEXT   := so
   ifndef X11FLAGS
@@ -52,6 +52,7 @@ ifeq ($(G4SYSTEM),Linux-icc)
     XAWLIBS    := -lXaw
   endif
   DLDLIBS   := -ldl
+  LOADLIBS  += -lcxa -lunwind
   ifndef OGLFLAGS
     OGLFLAGS  := -I$(OGLHOME)/include 
   endif
diff --git a/config/sys/WIN32-VC.gmk b/config/sys/WIN32-VC.gmk
index bc0802b33b2be0fb5efd28c98faee0b7c1b5374e..4a494875ac68ca988ca5debcf443428c4b824420 100644
--- a/config/sys/WIN32-VC.gmk
+++ b/config/sys/WIN32-VC.gmk
@@ -1,5 +1,5 @@
 #
-# ------ WIN32/VC ------    Visual-C++ 7 .NET
+# ------ WIN32/VC ------    Visual-C++ 7 .NET and higher
 #
 ifeq ($(G4SYSTEM),WIN32-VC)
   CXX       := CL
@@ -17,7 +17,12 @@ ifeq ($(G4SYSTEM),WIN32-VC)
 
   SHEXT := dll
   AR := LIB
-  ECHO := echo -e
+  ECHO := /usr/bin/echo -e
+  GREP := /usr/bin/grep
+  SED  := /usr/bin/sed
+  CAT  := /usr/bin/cat
+  CUT  := /usr/bin/cut
+
   FC := g77
 #  FCLIBS := -lf2c
   ifndef OGLFLAGS
@@ -57,20 +62,20 @@ ifeq ($(G4SYSTEM),WIN32-VC)
   define build-granular-shared-lib
     @libdir=`(cd $(@D);/bin/pwd)`;\
     cd $(G4TMP)/$(G4SYSTEM);\
-    echo "Building $(name).dumpbin file ...";\
+    $(ECHO) "Building $(name).dumpbin file ...";\
     $(RM) $(name).dumpbin;\
     dumpbin /symbols $(G4LIBDIR)/lib$(name).a > $(name).dumpbin;\
-    echo "Building $(name).def file ...";\
+    $(ECHO) "Building $(name).def file ...";\
     $(RM) $(name).def;\
     $(G4LIB)/$(G4SYSTEM)/win32def.exe $(name) < $(name).dumpbin > $(name).def;\
     $(RM) $(name).dumpbin;\
-    echo "Building lib$(name).exp and lib$(name).lib file ...";\
+    $(ECHO) "Building lib$(name).exp and lib$(name).lib file ...";\
     $(RM) $(G4LIBDIR)/lib$(name).exp;\
     $(RM) $(G4LIBDIR)/lib$(name).lib;\
     lib.exe /nologo /machine:ix86 /def:$(name).def \
             /out:$(G4LIBDIR)/lib$(name).lib;\
     $(RM) $(G4LIBDIR)/$(name).dll;\
-    echo "Building $(name).dll file ...";\
+    $(ECHO) "Building $(name).dll file ...";\
     link.exe /nologo /dll /out:$(G4LIBDIR)/$(name).dll \
              $(G4LIBDIR)/lib$(name).exp $(G4LIBDIR)/lib$(name).a \
              /libpath:$(G4LIBDIR) $(GLOBLIBS) \
@@ -80,20 +85,20 @@ ifeq ($(G4SYSTEM),WIN32-VC)
   define build-global-shared-lib
     @libdir=`(cd $(@D);/bin/pwd)`;\
     cd $(G4TMP)/$(G4SYSTEM);\
-    echo "Building $(name).dumpbin file ...";\
+    $(ECHO) "Building $(name).dumpbin file ...";\
     $(RM) $(name).dumpbin;\
     dumpbin /symbols $(G4LIBDIR)/lib$(name).a > $(name).dumpbin;\
-    echo "Building $(name).def file ...";\
+    $(ECHO) "Building $(name).def file ...";\
     $(RM) $(name).def;\
     $(G4LIB)/$(G4SYSTEM)/win32def.exe $(name) < $(name).dumpbin > $(name).def;\
     $(RM) $(name).dumpbin;\
-    echo "Building lib$(name).exp and lib$(name).lib ...";\
+    $(ECHO) "Building lib$(name).exp and lib$(name).lib ...";\
     $(RM) $(G4LIBDIR)/lib$(name).exp;\
     $(RM) $(G4LIBDIR)/lib$(name).lib;\
     lib.exe /nologo /machine:ix86 /def:$(name).def \
             /out:$(G4LIBDIR)/lib$(name).lib;\
     $(RM) $(G4LIBDIR)/$(name).dll;\
-    echo "Building $(name).dll ...";\
+    $(ECHO) "Building $(name).dll ...";\
     link.exe /nologo /dll /out:$(G4LIBDIR)/$(name).dll \
              $(G4LIBDIR)/lib$(name).exp $(G4LIBDIR)/lib$(name).a \
              /libpath:$(G4LIBDIR) $(GLOBLIBS) \
diff --git a/config/sys/WIN32-g++.gmk b/config/sys/WIN32-g++.gmk
index 959e5a5f621810d775305aacc616acf2641e778e..895ba1d439e350c943aae599db15978d68d5a5d9 100644
--- a/config/sys/WIN32-g++.gmk
+++ b/config/sys/WIN32-g++.gmk
@@ -1,7 +1,7 @@
 #
-# ------ GNU/WIN32 CYGNUS ------   !!! not supported !!!
+# ------ GNU/WIN32 CYGWIN ------   !!! not supported !!!
 #                             Cygnus CygWin - gcc-3.2 and higher
-#                                     Windows 2000/XP
+#                                       Windows XP
 #
 # Stefano Agostinelli (agos001@pn.itnet.it) - IST Group, Genova
 #
@@ -25,12 +25,18 @@ ifeq ($(G4SYSTEM),WIN32-g++)
     FCFLAGS   += -fPIC
     CCFLAGS   += -fPIC
   endif
+
   G4RUNPATHOPTION := -Wl,-rpath 
+  SHEXT   := so
+  ECHO    := echo -e
+  GREP := /usr/bin/grep
+  SED  := /usr/bin/sed
+  CAT  := /usr/bin/cat
+  CUT  := /usr/bin/cut
+
   FC := g77
   FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
   FCLIBS := -lg2c -lnsl
-  ECHO    := echo -e
-  SHEXT   := so
   ifndef X11FLAGS
     X11FLAGS  := -I/usr/include/X11/extensions -I/usr/include/X11
   endif
diff --git a/examples/advanced/lAr_calorimeter/src/FCALEMModuleSD.cc b/examples/advanced/lAr_calorimeter/src/FCALEMModuleSD.cc
index 023f89f7bbb36da57ad6a5a68a366c5c43b4c7be..44b41beb9020272028931a8704210d7c3eb6babb 100644
--- a/examples/advanced/lAr_calorimeter/src/FCALEMModuleSD.cc
+++ b/examples/advanced/lAr_calorimeter/src/FCALEMModuleSD.cc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: FCALEMModuleSD.cc,v 1.12 2006/07/21 11:45:53 ribon Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 
diff --git a/examples/advanced/lAr_calorimeter/src/FCALHadModuleSD.cc b/examples/advanced/lAr_calorimeter/src/FCALHadModuleSD.cc
index 8d03bc7b2040db5092f71782067490b65f3a7fc9..488055d324c4f0e0ec1897d58ed5df17a385ef57 100644
--- a/examples/advanced/lAr_calorimeter/src/FCALHadModuleSD.cc
+++ b/examples/advanced/lAr_calorimeter/src/FCALHadModuleSD.cc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: FCALHadModuleSD.cc,v 1.10 2006/07/21 11:45:53 ribon Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 
diff --git a/examples/advanced/lAr_calorimeter/src/FCALPrimaryGeneratorAction.cc b/examples/advanced/lAr_calorimeter/src/FCALPrimaryGeneratorAction.cc
index 80ca6db0cdea844ce7c326f64f12fe759b7e0e56..ef6bfd115569bb85c72a990c37a31c32ad2a9290 100644
--- a/examples/advanced/lAr_calorimeter/src/FCALPrimaryGeneratorAction.cc
+++ b/examples/advanced/lAr_calorimeter/src/FCALPrimaryGeneratorAction.cc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: FCALPrimaryGeneratorAction.cc,v 1.9 2006/07/21 08:19:33 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 
diff --git a/examples/advanced/radioprotection/remsim.cc b/examples/advanced/radioprotection/remsim.cc
index 55c4e33517758b57e8d832113f188bee182f1328..a3d209a148898d478e4dc11cccba3fc57427f095 100644
--- a/examples/advanced/radioprotection/remsim.cc
+++ b/examples/advanced/radioprotection/remsim.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: remsim.cc,v 1.14 2006/07/24 09:53:27 guatelli Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 
 #include "G4RunManager.hh"
 #include "G4UImanager.hh"
diff --git a/examples/advanced/raredecay_calorimetry/PhotIn.out b/examples/advanced/raredecay_calorimetry/PhotIn.out
index 3500839229bcff5863cdae5ec4c5fad0ae54ee53..d739264af679bbf7920029cf694b7ab26fcf2b3e 100644
--- a/examples/advanced/raredecay_calorimetry/PhotIn.out
+++ b/examples/advanced/raredecay_calorimetry/PhotIn.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: global-V08-00-04    (30-June-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
diff --git a/examples/advanced/underground_physics/History b/examples/advanced/underground_physics/History
index 7b8bcd381e380089f8504fc25f994decc4832dc3..28b5d5aa3e73109052c3afd5a282237204b13d6a 100644
--- a/examples/advanced/underground_physics/History
+++ b/examples/advanced/underground_physics/History
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------
-$Id: History,v 1.9 2005/12/07 16:26:39 guatelli Exp $
+$Id: History,v 1.10 2006/10/13 10:09:10 ahoward Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -8,6 +8,9 @@ $Id: History,v 1.9 2005/12/07 16:26:39 guatelli Exp $
 
                       Category History file
                       ---------------------
+13.10.2006 - A. Howard (DMX-V08-01-00)
+	     Removed uninitialized UserLimitsForXenon (bug)
+
 07.12.2005 - S. Guatelli (DMX-V07-01-02)
              Compiles with CLHEP 2.0.2.2
 
diff --git a/examples/advanced/underground_physics/include/DMXDetectorConstruction.hh b/examples/advanced/underground_physics/include/DMXDetectorConstruction.hh
index 7e3a310f9c5d878069c5bdb585732fa4e54c4642..01a6e625ff0700a46020dd955493d3c6fd49496d 100644
--- a/examples/advanced/underground_physics/include/DMXDetectorConstruction.hh
+++ b/examples/advanced/underground_physics/include/DMXDetectorConstruction.hh
@@ -80,7 +80,7 @@ private:
 
   G4UserLimits*    theUserLimitsForRoom; 
   G4UserLimits*    theUserLimitsForDetector; 
-  G4UserLimits*    theUserLimitsForXenon; 
+  //  G4UserLimits*    theUserLimitsForXenon; 
 
   G4double         theMaxTimeCuts;
   G4double         theMaxStepSize;
diff --git a/examples/advanced/underground_physics/src/DMXDetectorConstruction.cc b/examples/advanced/underground_physics/src/DMXDetectorConstruction.cc
index 776fd39c39be2925f03b8a0a6c411d5856f9cab7..afbd4e3ed37dc138fc4b92f7cedfece98b9a1cf8 100644
--- a/examples/advanced/underground_physics/src/DMXDetectorConstruction.cc
+++ b/examples/advanced/underground_physics/src/DMXDetectorConstruction.cc
@@ -971,7 +971,8 @@ G4VPhysicalVolume* DMXDetectorConstruction::Construct() {
      vacuum_log->SetUserLimits(theUserLimitsForRoom);
      vessel_log->SetUserLimits(theUserLimitsForRoom);
         GXe_log->SetUserLimits(theUserLimitsForDetector);
-        LXe_log->SetUserLimits(theUserLimitsForXenon);
+	//        LXe_log->SetUserLimits(theUserLimitsForXenon);
+        LXe_log->SetUserLimits(theUserLimitsForDetector);
    CuShield_log->SetUserLimits(theUserLimitsForDetector);
        ring_log->SetUserLimits(theUserLimitsForDetector);
      mirror_log->SetUserLimits(theUserLimitsForDetector);
diff --git a/examples/extended/analysis/AnaEx01/History b/examples/extended/analysis/AnaEx01/History
index ac1e689df7ac75144f0a6b11bf81d45e08d0c986..b5d394d7f159c3c0368ae3c246c8dd3fa81482c8 100644
--- a/examples/extended/analysis/AnaEx01/History
+++ b/examples/extended/analysis/AnaEx01/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.14 2005/12/06 11:07:17 gcosmo Exp $
+$Id: History,v 1.15 2006/08/16 15:43:44 gcosmo Exp $
 --------------------------------------------------
 
      =========================================================
@@ -15,6 +15,9 @@ track of all tags.
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+16th August 2006  Gabriele Cosmo (AnaEx01-V08-01-00)
+- Corrected text in README for AIDA setup.
+
 6th December 2005  Gabriele Cosmo
 - Trivial change in main() for support of CLHEP-2.0.X series.
 
diff --git a/examples/extended/analysis/AnaEx01/README b/examples/extended/analysis/AnaEx01/README
index d73e7b310a8fdce1184928fa16b28244c056ab73..b4e9a23bc3f71b47b105b3cf099d4e47ec607c9a 100644
--- a/examples/extended/analysis/AnaEx01/README
+++ b/examples/extended/analysis/AnaEx01/README
@@ -1,4 +1,4 @@
-$Id: README,v 1.14 2005/10/25 13:45:42 gbarrand Exp $
+$Id: README,v 1.15 2006/08/16 15:42:16 gcosmo Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -23,19 +23,10 @@ $Id: README,v 1.14 2005/10/25 13:45:42 gbarrand Exp $
   The first one permits to validate/devalidate the AIDA analysis code
  in the example code. The two others permit to give the compilation 
  and link flags of the AIDA compliant system used.
-  An AIDA compliant system should define the command 'aida-config' that 
- permits to retrieve the correct values. For example under some 
- UNIX csh flavour :
-    csh> source <your Geant4 setup script>.csh
-    csh> source <AIDA_SYSTEM setup>.csh     (or some equivalent)
-    csh> setenv G4ANALYSIS_USE 1
-    csh> setenv G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --cflags`
-    csh> setenv G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --libs`
-    csh> cd $G4INSTALL/examples/extended/analysis/AnaEx01
-    csh> gmake
-
-  For info, the CPP macros G4ANALYSIS_*_AIDA_* are used in the 
- config/analysis.gmk file of the Geant4 GNUmakefile system.
+
+  The variable G4ANALYSIS_USE must be defined in the environment, and the
+ the system properly configured to use one of the AIDA compliant analysis
+ tools (i.e. path set to retrieve the 'aida-config' command).
 
  Working with the OpenScientist/Lab package :
  ------------------------------------------
@@ -52,8 +43,6 @@ $Id: README,v 1.14 2005/10/25 13:45:42 gbarrand Exp $
    csh> source <some directory>/Lab/<version>/cmt/setup.csh
    csh> source <your Geant4 setup script>.csh
    csh> setenv G4ANALYSIS_USE 1
-   csh> setenv G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --cflags`
-   csh> setenv G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --libs`
    csh> cd $G4INSTALL/examples/extended/analysis/AnaEx01
    csh> gmake
 
@@ -109,8 +98,6 @@ $Id: README,v 1.14 2005/10/25 13:45:42 gbarrand Exp $
    csh> source <your Geant4 setup script>.csh
    csh> source <some directory>/Falsetto/<version>/cmt/setup.csh
    csh> setenv G4ANALYSIS_USE 1
-   csh> setenv G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --cflags`
-   csh> setenv G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --libs`
    csh> cd $G4INSTALL/examples/extended/analysis/AnaEx01
    csh> gmake
 
diff --git a/examples/extended/biasing/B01/exampleB01.out b/examples/extended/biasing/B01/exampleB01.out
index 67dcb4749da789a059f82cf69cb755f7dddd6114..56abc4544b0883c46493e38118f6177bdeec60d2 100644
--- a/examples/extended/biasing/B01/exampleB01.out
+++ b/examples/extended/biasing/B01/exampleB01.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
diff --git a/examples/extended/electromagnetic/TestEm0/TestEm0.out b/examples/extended/electromagnetic/TestEm0/TestEm0.out
index 306a738e6e8d7e65bfda787fe5d3ae438317cbc8..473e4ff5d4a4a7707b60d419302f9d783e39a3f3 100644
--- a/examples/extended/electromagnetic/TestEm0/TestEm0.out
+++ b/examples/extended/electromagnetic/TestEm0/TestEm0.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
diff --git a/examples/extended/electromagnetic/TestEm1/TestEm1.out b/examples/extended/electromagnetic/TestEm1/TestEm1.out
index 707070532502980e6792db1f7ee242aee5d4d5c1..b7559baee0877a5a0cc10691cbabd21429aef5eb 100644
--- a/examples/extended/electromagnetic/TestEm1/TestEm1.out
+++ b/examples/extended/electromagnetic/TestEm1/TestEm1.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -289,7 +289,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 2000
-  User=93.62s Real=105.76s Sys=9.45s
+  User=93.46s Real=276.55s Sys=28.48s
 
  ======================== run summary ======================
 
@@ -355,7 +355,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 2000
-  User=178.47s Real=198.7s Sys=17.44s
+  User=184.6s Real=520s Sys=51.54s
 
  ======================== run summary ======================
 
diff --git a/examples/extended/electromagnetic/TestEm10/TestEm10.out b/examples/extended/electromagnetic/TestEm10/TestEm10.out
index e4fb1a4763d7d18d166eeeaf866f4f4ffd638aeb..34ef4d375d8ad476ea8a470c6598b8ee577f9cbe 100644
--- a/examples/extended/electromagnetic/TestEm10/TestEm10.out
+++ b/examples/extended/electromagnetic/TestEm10/TestEm10.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -159,7 +159,7 @@ Lorentz Factor	XTR photon number
 8.085e+04	3.149
 9.283e+04	3.149
 
-total time for build X-ray TR energy loss tables = 0.44 s
+total time for build X-ray TR energy loss tables = 0.61 s
 
 SynRad:  Incoherent Synchrotron Radiation
       good description for long magnets at all energies
@@ -233,7 +233,7 @@ Lorentz Factor	XTR photon number
 8.085e+04	3.149
 9.283e+04	3.149
 
-total time for build X-ray TR energy loss tables = 0.44 s
+total time for build X-ray TR energy loss tables = 0.61 s
 
 msc:  Model variant of multiple scattering for proton
       Lambda tables from 100 eV  to 100 TeV in 120 bins.
@@ -341,26 +341,26 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 1000
-  User=21.78s Real=23.68s Sys=1.87s
+  User=26.44s Real=81.81s Sys=11.64s
  ================== run summary =====================
  end of Run TotNbofEvents = 1000
-    mean charged track length   in absorber=44.1278 +- 0.523115  mm  
+    mean charged track length   in absorber=112.506 +- 1.71978  mm  
 
-            mean energy deposit in absorber=0.0532311 +- 0.000922791  MeV 
+            mean energy deposit in absorber=0.0511574 +- 0.00074976  MeV 
 
- mean number of steps in absorber (charged) =15.908 +- 0.424502      
- mean number of steps in absorber (neutral) =2.863 +- 0.0542423      
+ mean number of steps in absorber (charged) =65.861 +- 1.50358      
+ mean number of steps in absorber (neutral) =2.829 +- 0.0533457      
 
-   mean number of charged secondaries = 5.422 +- 0.107907
+   mean number of charged secondaries = 4.993 +- 0.0890671
 
-   mean number of neutral secondaries = 0.043 +- 0.00671945
+   mean number of neutral secondaries = 0.118 +- 0.0109579
 
-   mean number of e-s =5.421  and e+s =0.001
+   mean number of e-s =4.993  and e+s =0
 
-(number) transmission coeff=0.492  reflection coeff=0.024
+(number) transmission coeff=0.514  reflection coeff=0.075
 
  energy deposit distribution 
-#entries=1000    #underflows=0    #overflows=60
+#entries=1000    #underflows=0    #overflows=45
  bin nb      Elow      entries     normalized 
     0         0           0           0
     1   1.53846           0           0
@@ -368,73 +368,73 @@ Run Summary
     3   4.61538           0           0
     4   6.15385           0           0
     5   7.69231           0           0
-    6   9.23077           1       0.001
-    7   10.7692           1       0.001
-    8   12.3077           2       0.002
-    9   13.8462           1       0.001
-   10   15.3846           7       0.007
-   11   16.9231          14       0.014
-   12   18.4615           9       0.009
-   13        20          22       0.022
-   14   21.5385          24       0.024
-   15   23.0769          18       0.018
-   16   24.6154          27       0.027
-   17   26.1538          21       0.021
-   18   27.6923          28       0.028
-   19   29.2308          25       0.025
-   20   30.7692          29       0.029
-   21   32.3077          26       0.026
-   22   33.8462          30        0.03
-   23   35.3846          27       0.027
-   24   36.9231          32       0.032
-   25   38.4615          22       0.022
-   26        40          36       0.036
-   27   41.5385          30        0.03
-   28   43.0769          26       0.026
-   29   44.6154          35       0.035
-   30   46.1538          25       0.025
-   31   47.6923          21       0.021
-   32   49.2308          27       0.027
+    6   9.23077           0           0
+    7   10.7692           0           0
+    8   12.3077           3       0.003
+    9   13.8462           5       0.005
+   10   15.3846           9       0.009
+   11   16.9231          15       0.015
+   12   18.4615          21       0.021
+   13        20          23       0.023
+   14   21.5385          15       0.015
+   15   23.0769          16       0.016
+   16   24.6154          15       0.015
+   17   26.1538          20        0.02
+   18   27.6923          29       0.029
+   19   29.2308          16       0.016
+   20   30.7692          22       0.022
+   21   32.3077          27       0.027
+   22   33.8462          37       0.037
+   23   35.3846          25       0.025
+   24   36.9231          29       0.029
+   25   38.4615          47       0.047
+   26        40          28       0.028
+   27   41.5385          27       0.027
+   28   43.0769          35       0.035
+   29   44.6154          25       0.025
+   30   46.1538          24       0.024
+   31   47.6923          31       0.031
+   32   49.2308          23       0.023
    33   50.7692          21       0.021
-   34   52.3077          25       0.025
-   35   53.8462          20        0.02
+   34   52.3077          19       0.019
+   35   53.8462          26       0.026
    36   55.3846          24       0.024
-   37   56.9231          18       0.018
-   38   58.4615          16       0.016
-   39        60          15       0.015
-   40   61.5385          11       0.011
-   41   63.0769          14       0.014
-   42   64.6154          14       0.014
-   43   66.1538          12       0.012
-   44   67.6923          18       0.018
-   45   69.2308          18       0.018
-   46   70.7692          16       0.016
-   47   72.3077          15       0.015
-   48   73.8462          16       0.016
-   49   75.3846          13       0.013
-   50   76.9231          10        0.01
-   51   78.4615           9       0.009
-   52        80           3       0.003
-   53   81.5385          11       0.011
-   54   83.0769           6       0.006
-   55   84.6154           7       0.007
-   56   86.1538           5       0.005
-   57   87.6923           3       0.003
-   58   89.2308           7       0.007
-   59   90.7692           3       0.003
-   60   92.3077           6       0.006
+   37   56.9231          25       0.025
+   38   58.4615          25       0.025
+   39        60          17       0.017
+   40   61.5385          23       0.023
+   41   63.0769          22       0.022
+   42   64.6154          16       0.016
+   43   66.1538          18       0.018
+   44   67.6923          16       0.016
+   45   69.2308          13       0.013
+   46   70.7692          12       0.012
+   47   72.3077           9       0.009
+   48   73.8462           6       0.006
+   49   75.3846           5       0.005
+   50   76.9231           6       0.006
+   51   78.4615          12       0.012
+   52        80           9       0.009
+   53   81.5385           3       0.003
+   54   83.0769           5       0.005
+   55   84.6154          12       0.012
+   56   86.1538           7       0.007
+   57   87.6923           5       0.005
+   58   89.2308           2       0.002
+   59   90.7692           4       0.004
+   60   92.3077           5       0.005
    61   93.8462           4       0.004
-   62   95.3846           4       0.004
+   62   95.3846           6       0.006
    63   96.9231           7       0.007
-   64   98.4615           3       0.003
+   64   98.4615           4       0.004
 
- Emp =            0.04   width=      0.0492308  MeV 
+ Emp =       0.0384615   width=      0.0307692  MeV 
 
 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer.
 
 --------- Ranecu engine status ---------
  Initial seed (index) = 0
- Current couple of seeds = 591453591, 1204852694
+ Current couple of seeds = 2133173338, 1099224346
 ----------------------------------------
 
 ========= Table of registered couples ==============================
diff --git a/examples/extended/electromagnetic/TestEm11/TestEm11.out b/examples/extended/electromagnetic/TestEm11/TestEm11.out
index cb96353e08c26e351bdea7908dbe8e8ed71cf6b9..b7a5db2992fd65073f9ee125262dbdc79c268dbf 100644
--- a/examples/extended/electromagnetic/TestEm11/TestEm11.out
+++ b/examples/extended/electromagnetic/TestEm11/TestEm11.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -289,7 +289,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 20000
-  User=152.76s Real=222.24s Sys=47.12s
+  User=161.11s Real=728.84s Sys=141.69s
 
  ======================== run summary ======================
 
diff --git a/examples/extended/electromagnetic/TestEm12/TestEm12.out b/examples/extended/electromagnetic/TestEm12/TestEm12.out
index cd99795651758b3ddef4d57caea17e90c0e06d29..ca925b5f1bce8d276ca007051a68526ddc92cf21 100644
--- a/examples/extended/electromagnetic/TestEm12/TestEm12.out
+++ b/examples/extended/electromagnetic/TestEm12/TestEm12.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -311,7 +311,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10000
-  User=622.58s Real=678.09s Sys=42.64s
+  User=621.85s Real=1541.25s Sys=124.6s
 
  ======================== run summary ======================
 
diff --git a/examples/extended/electromagnetic/TestEm13/TestEm13.out b/examples/extended/electromagnetic/TestEm13/TestEm13.out
index 3ae3fa2d7a8fe7b7f8ef52c9cfb3dda70da97f5f..bdf4b1ac5dcf09722c7b75d2da6ed499b73836dc 100644
--- a/examples/extended/electromagnetic/TestEm13/TestEm13.out
+++ b/examples/extended/electromagnetic/TestEm13/TestEm13.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -276,7 +276,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100000
-  User=18.76s Real=18.79s Sys=0.01s
+  User=21.12s Real=49.38s Sys=0.01s
 
  The run consists of 100000 gamma of 100 keV through 1 cm  of Water (density: 1 g/cm3 )
 
@@ -343,7 +343,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100000
-  User=19.52s Real=19.52s Sys=0s
+  User=21.87s Real=51.33s Sys=0.01s
 
  The run consists of 100000 e- of 100 MeV through 1 cm  of Water (density: 1 g/cm3 )
 
diff --git a/examples/extended/electromagnetic/TestEm14/TestEm14.out b/examples/extended/electromagnetic/TestEm14/TestEm14.out
index f09e4c16c55764aa5a0374216f4274124b4e0fd8..269e15e0fb1dcc3be72a5e85fcde06c75ff45ece 100644
--- a/examples/extended/electromagnetic/TestEm14/TestEm14.out
+++ b/examples/extended/electromagnetic/TestEm14/TestEm14.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -277,7 +277,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100000
-  User=21s Real=21s Sys=0.01s
+  User=24s Real=55s Sys=0s
 
  The run consists of 100000 gamma of 100 keV through 100 m   of Water (density: 1 g/cm3 )
 
@@ -344,7 +344,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100000
-  User=21s Real=21s Sys=0s
+  User=24s Real=57s Sys=0s
 
  The run consists of 100000 e- of 100 MeV through 100 m   of Water (density: 1 g/cm3 )
 
diff --git a/examples/extended/electromagnetic/TestEm15/TestEm15.out b/examples/extended/electromagnetic/TestEm15/TestEm15.out
index d1c735958123c1509379b6371e291ece6eb858a2..23f9dc34f31b469d46af59adda6196b089c0714a 100644
--- a/examples/extended/electromagnetic/TestEm15/TestEm15.out
+++ b/examples/extended/electromagnetic/TestEm15/TestEm15.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -292,7 +292,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10000
-  User=3.1s Real=3.1s Sys=0s
+  User=3.5s Real=7.5s Sys=0s
 
  The run consists of 10000 e- of 5 MeV through 100 m   of Water (density: 1 g/cm3 )
 
@@ -356,7 +356,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10000
-  User=3s Real=3s Sys=0s
+  User=3.3s Real=6.7s Sys=0s
 
  The run consists of 10000 e- of 100 keV through 100 m   of Water (density: 1 g/cm3 )
 
diff --git a/examples/extended/electromagnetic/TestEm16/TestEm16.out b/examples/extended/electromagnetic/TestEm16/TestEm16.out
index a392a1e370d0e01dec123e0371b4da241c88bd4b..b1a1485cbf476a77643b81280b7896f89d53ad81 100644
--- a/examples/extended/electromagnetic/TestEm16/TestEm16.out
+++ b/examples/extended/electromagnetic/TestEm16/TestEm16.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -222,7 +222,7 @@ G4SynchrotronRadiation::GetRandomEnergySR :
 Run terminated.
 Run Summary
   Number of events processed : 100
-  User=6.17s Real=6.47s Sys=0.01s
+  User=4.87s Real=10.61s Sys=0.17s
 Summary for synchrotron radiation :
   Number of photons = 27201
   Emean             = 2.016 +/- 0.02196 keV
diff --git a/examples/extended/electromagnetic/TestEm17/TestEm17.out b/examples/extended/electromagnetic/TestEm17/TestEm17.out
index 87fcfa03805f6e0f8252209d87a19f78948311ed..ab4a9093793c9d97951481133a86784299e1405e 100644
--- a/examples/extended/electromagnetic/TestEm17/TestEm17.out
+++ b/examples/extended/electromagnetic/TestEm17/TestEm17.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -141,7 +141,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10000
-  User=68.41s Real=81.98s Sys=3.28s
+  User=73.95s Real=235.01s Sys=14.32s
 
  The run consists of 10000 mu+ of 10 TeV through 1 m   of Iron (density: 7.9 g/cm3 )
 
diff --git a/examples/extended/electromagnetic/TestEm2/TestEm2.out b/examples/extended/electromagnetic/TestEm2/TestEm2.out
index 3b6d141b0e658e0b4db81e39acb494bacc7a8c62..5386d387077fd135be5bd66baa53959d4e75a60a 100644
--- a/examples/extended/electromagnetic/TestEm2/TestEm2.out
+++ b/examples/extended/electromagnetic/TestEm2/TestEm2.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -279,7 +279,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100
-  User=158.98s Real=176.18s Sys=16.9s
+  User=168.89s Real=473.25s Sys=48.33s
 
  SUMMARY 
 
diff --git a/examples/extended/electromagnetic/TestEm3/TestEm3.out b/examples/extended/electromagnetic/TestEm3/TestEm3.out
index 3f235fe4cd47e98c7a9f406a4dadf588d5a04c2a..ab4106d332c4a923938c6e52283073585987e545 100644
--- a/examples/extended/electromagnetic/TestEm3/TestEm3.out
+++ b/examples/extended/electromagnetic/TestEm3/TestEm3.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -289,7 +289,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100
-  User=108.16s Real=122.02s Sys=13.58s
+  User=110.64s Real=323.31s Sys=41.14s
 
 ------------------------------------------------------------
 material             Total Edep   sqrt(E0(GeV))*rmsE/Emean     total tracklen 
diff --git a/examples/extended/electromagnetic/TestEm4/TestEm4.out b/examples/extended/electromagnetic/TestEm4/TestEm4.out
index 5589180496f2fab35e1a31cc71fa2e566c73fbc7..d44595ffc54ba7912e8f76fa20d96b518b4419b3 100644
--- a/examples/extended/electromagnetic/TestEm4/TestEm4.out
+++ b/examples/extended/electromagnetic/TestEm4/TestEm4.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -143,7 +143,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100000
-  User=56.18s Real=198.79s Sys=34.46s
+  User=102.79s Real=847.84s Sys=129.73s
 
 --------- Ranecu engine status ---------
  Initial seed (index) = 0
diff --git a/examples/extended/electromagnetic/TestEm5/TestEm5.out b/examples/extended/electromagnetic/TestEm5/TestEm5.out
index 54c1c31ccc9c7be77ef0832ea7103f7211b943eb..c9b233ffbc0e95464bcfc75c8eace15bfb429263 100644
--- a/examples/extended/electromagnetic/TestEm5/TestEm5.out
+++ b/examples/extended/electromagnetic/TestEm5/TestEm5.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -270,7 +270,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100000
-  User=85.5s Real=226.44s Sys=37.98s
+  User=150.29s Real=1012.48s Sys=149.15s
 
  ======================== run summary ======================
 
diff --git a/examples/extended/electromagnetic/TestEm6/TestEm6.out b/examples/extended/electromagnetic/TestEm6/TestEm6.out
index 13ea84d9ace7d2bc028edea195c02935bf4cae2f..68cb8f72b18079de9b8c773dfac20c16c06a1c47 100644
--- a/examples/extended/electromagnetic/TestEm6/TestEm6.out
+++ b/examples/extended/electromagnetic/TestEm6/TestEm6.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -349,7 +349,7 @@ Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng
 Run terminated.
 Run Summary
   Number of events processed : 5
-  User=0.01s Real=0.08s Sys=0.01s
+  User=0.03s Real=0.31s Sys=0.04s
 
 --------- Ranecu engine status ---------
  Initial seed (index) = 0
@@ -1232,7 +1232,7 @@ Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng
 Run terminated.
 Run Summary
   Number of events processed : 5
-  User=0.16s Real=0.22s Sys=0.06s
+  User=0.27s Real=1.76s Sys=0.19s
 
 --------- Ranecu engine status ---------
  Initial seed (index) = 0
@@ -1397,7 +1397,7 @@ Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng
 Run terminated.
 Run Summary
   Number of events processed : 2
-  User=0.03s Real=0.04s Sys=0.01s
+  User=0.06s Real=0.09s Sys=0.02s
 
 --------- Ranecu engine status ---------
  Initial seed (index) = 0
diff --git a/examples/extended/electromagnetic/TestEm7/TestEm7.out b/examples/extended/electromagnetic/TestEm7/TestEm7.out
index 3c25c8983b14af7ab16470f2c38e3419c9345656..aeb0f9a6eabca381da7921b2f31ac9b6b62b4b9f 100644
--- a/examples/extended/electromagnetic/TestEm7/TestEm7.out
+++ b/examples/extended/electromagnetic/TestEm7/TestEm7.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -299,7 +299,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10000
-  User=180.63s Real=218.03s Sys=25.31s
+  User=187.48s Real=584.61s Sys=62.72s
 
  The run consists of 10000 proton of 160 MeV through 20 cm  of Water (density: 1 g/cm3 )
 
@@ -360,7 +360,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 1000
-  User=63.69s Real=73.56s Sys=8.5s
+  User=74.01s Real=209.62s Sys=22.44s
 
  The run consists of 1000 C12[0.0] of 3.5 GeV through 20 cm  of Water (density: 1 g/cm3 )
 
diff --git a/examples/extended/electromagnetic/TestEm8/TestEm8.out b/examples/extended/electromagnetic/TestEm8/TestEm8.out
index 237cc1b7777ef2a070363e473aef31bf971673bb..83703ca3b5a6af1900e2f5dde2033d2bf0bc6d5a 100644
--- a/examples/extended/electromagnetic/TestEm8/TestEm8.out
+++ b/examples/extended/electromagnetic/TestEm8/TestEm8.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -288,47 +288,47 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 1000
-  User=3.36s Real=3.41s Sys=0.03s
+  User=1.83s Real=4.01s Sys=0.12s
  ================== run summary =====================
  end of Run TotNbofEvents = 1000
-    mean charged track length   in absorber=23.6512 +- 0.214181  mm  
+    mean charged track length   in absorber=23.6036 +- 0.221755  mm  
 
-            mean energy deposit in absorber=0.0161746 +- 0.000367275  MeV 
+            mean energy deposit in absorber=0.0158001 +- 0.000280482  MeV 
 
- mean number of steps in absorber (charged) =0.344 +- 0.11522      
+ mean number of steps in absorber (charged) =0.272 +- 0.129174      
  mean number of steps in absorber (neutral) =0.001 +- 0.0009995      
 
-   mean number of charged secondaries = 0.015 +- 0.00384383
+   mean number of charged secondaries = 0.012 +- 0.00344325
 
    mean number of neutral secondaries = 0.001 +- 0.0009995
 
-   mean number of e-s =0.015  and e+s =0
+   mean number of e-s =0.012  and e+s =0
 
-(number) transmission coeff=0.497  reflection coeff=0
+(number) transmission coeff=0.503  reflection coeff=0
 
  energy deposit distribution 
-#entries=1000    #underflows=0    #overflows=11
+#entries=1000    #underflows=0    #overflows=7
  bin nb      Elow      entries     normalized 
     0         0           0           0
-    1         3           4       0.004
-    2         6          92       0.092
-    3         9         260        0.26
+    1         3           3       0.003
+    2         6          99       0.099
+    3         9         257       0.257
     4        12         264       0.264
-    5        15         145       0.145
-    6        18          79       0.079
-    7        21          46       0.046
-    8        24          31       0.031
-    9        27          17       0.017
-   10        30          18       0.018
-   11        33          10        0.01
-   12        36           8       0.008
-   13        39           4       0.004
-   14        42           3       0.003
+    5        15         150        0.15
+    6        18          72       0.072
+    7        21          47       0.047
+    8        24          32       0.032
+    9        27          18       0.018
+   10        30          15       0.015
+   11        33          12       0.012
+   12        36           7       0.007
+   13        39           5       0.005
+   14        42           4       0.004
    15        45           1       0.001
-   16        48           0           0
-   17        51           4       0.004
+   16        48           1       0.001
+   17        51           2       0.002
    18        54           1       0.001
-   19        57           2       0.002
+   19        57           3       0.003
 
  Emp =           0.012   width=          0.006  MeV 
 
@@ -337,7 +337,7 @@ ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer.
 
 --------- Ranecu engine status ---------
  Initial seed (index) = 0
- Current couple of seeds = 946924133, 1481012020
+ Current couple of seeds = 1356166741, 1119662032
 ----------------------------------------
 #
 Graphics systems deleted.
diff --git a/examples/extended/electromagnetic/TestEm9/TestEm9.out b/examples/extended/electromagnetic/TestEm9/TestEm9.out
index e9608953737075bde01c3babb8f3012c5d511a5e..4c3a61f4c5c6fe0e938894ea87c76305fbd11371 100644
--- a/examples/extended/electromagnetic/TestEm9/TestEm9.out
+++ b/examples/extended/electromagnetic/TestEm9/TestEm9.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -322,7 +322,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100
-  User=49.84s Real=52.32s Sys=2.43s
+  User=51.74s Real=124.48s Sys=7.06s
 RunAction: End of run actions are started
 HistoManager: End of run actions are started
 ========================================================
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/hepmcEx01-clhep.cc b/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/hepmcEx01-clhep.cc
index 6f65dd752bc1f730fd52bd31bb9e9b896a28e314..69fbe437194db8aa7638c72da31b872220fb17b0 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/hepmcEx01-clhep.cc
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/hepmcEx01-clhep.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: hepmcEx01-clhep.cc,v 1.4 2006/07/05 09:50:45 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // --------------------------------------------------------------
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/include/ExN04RunAction.hh b/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/include/ExN04RunAction.hh
index ebe3458c5d1c0d40961738b4e104b3a2c46bc031..b55dee2a4b77f1aacca006fdb4f44663a8dbd720 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/include/ExN04RunAction.hh
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/include/ExN04RunAction.hh
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ExN04RunAction.hh,v 1.3 2006/07/05 09:50:45 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/src/ExN04RunAction.cc b/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/src/ExN04RunAction.cc
index 2a7e76aa3f6d4be8e8943e27b5296128cb6bbb0e..77b84334d8d5ac1e2a050a6512ec2c52288776bd 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/src/ExN04RunAction.cc
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx01-clhep/src/ExN04RunAction.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ExN04RunAction.cc,v 1.3 2006/07/05 09:50:45 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx01/hepmcEx01.cc b/examples/extended/eventgenerator/HepMC/HepMCEx01/hepmcEx01.cc
index ce8071b640ce2aa7daa2353619306ced351344e9..eb13754fe576bda0d802859cba1cd231a03705da 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx01/hepmcEx01.cc
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx01/hepmcEx01.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: hepmcEx01.cc,v 1.5 2006/07/05 11:06:36 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // --------------------------------------------------------------
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx01/include/ExN04RunAction.hh b/examples/extended/eventgenerator/HepMC/HepMCEx01/include/ExN04RunAction.hh
index 30323a43f5fea07288268ea4e3ec467cbf4dd424..356005887a54a312a72ec13e725f56d63291c308 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx01/include/ExN04RunAction.hh
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx01/include/ExN04RunAction.hh
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ExN04RunAction.hh,v 1.3 2006/07/05 11:06:36 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx01/src/ExN04RunAction.cc b/examples/extended/eventgenerator/HepMC/HepMCEx01/src/ExN04RunAction.cc
index f51b91a204e23f169066fe151beeeba4352e5d2e..1ba0f7a1d19f0a1837be91ad0672f1261d46c65b 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx01/src/ExN04RunAction.cc
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx01/src/ExN04RunAction.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ExN04RunAction.cc,v 1.3 2006/07/05 11:06:36 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/hepmcEx02-clhep.cc b/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/hepmcEx02-clhep.cc
index 648bf01904aa69f9f1a13380799015e50d727aeb..06d895840a18e3f51e96dca9a19962744cf56345 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/hepmcEx02-clhep.cc
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/hepmcEx02-clhep.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: hepmcEx02-clhep.cc,v 1.4 2006/07/05 11:41:21 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // --------------------------------------------------------------
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/include/H02PhysicsList.hh b/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/include/H02PhysicsList.hh
index b24e999c9b058ad0f33de7b92adb553c84b1565a..4d056d82ea489257b7865e9bb069ac1e6b02a7ae 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/include/H02PhysicsList.hh
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/include/H02PhysicsList.hh
@@ -25,7 +25,7 @@
 //
 //
 // $Id: H02PhysicsList.hh,v 1.3 2006/07/05 11:41:23 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/src/H02PhysicsList.cc b/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/src/H02PhysicsList.cc
index fc0569d5c90c5c6788d967be2f778ad91777d79d..1a490c82992b88872421e3f4744a3b779829be0f 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/src/H02PhysicsList.cc
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx02-clhep/src/H02PhysicsList.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: H02PhysicsList.cc,v 1.4 2006/07/05 11:41:26 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx02/hepmcEx02.cc b/examples/extended/eventgenerator/HepMC/HepMCEx02/hepmcEx02.cc
index 77ca0124f6db05a7b8e3ddd4b77ce003c60de07d..f7482b4dbc419a8c4b3e345fd98bc0b552c8a85b 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx02/hepmcEx02.cc
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx02/hepmcEx02.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: hepmcEx02.cc,v 1.5 2006/07/05 12:04:07 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // --------------------------------------------------------------
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx02/include/H02PhysicsList.hh b/examples/extended/eventgenerator/HepMC/HepMCEx02/include/H02PhysicsList.hh
index d9a372699f01126bfa7d4986b8f57724640ea28a..e1ba1b8b23d8288237437c22075f501bde46dfc2 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx02/include/H02PhysicsList.hh
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx02/include/H02PhysicsList.hh
@@ -25,7 +25,7 @@
 //
 //
 // $Id: H02PhysicsList.hh,v 1.3 2006/07/05 12:04:12 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/eventgenerator/HepMC/HepMCEx02/src/H02PhysicsList.cc b/examples/extended/eventgenerator/HepMC/HepMCEx02/src/H02PhysicsList.cc
index 9990cfbd4d12bfbb309591264af0a6b44d3637af..4828b44b62d43494bb2f0c9619186e0f2716bf1c 100644
--- a/examples/extended/eventgenerator/HepMC/HepMCEx02/src/H02PhysicsList.cc
+++ b/examples/extended/eventgenerator/HepMC/HepMCEx02/src/H02PhysicsList.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: H02PhysicsList.cc,v 1.5 2006/07/05 12:04:13 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/field/field01/field01.out b/examples/extended/field/field01/field01.out
index 7b7bd52543857c0fa297503b5f97a20169ec9976..f58319e3f5d4c264ed28714688568905454c5502 100644
--- a/examples/extended/field/field01/field01.out
+++ b/examples/extended/field/field01/field01.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -235,7 +235,7 @@ Step#          X             Y             Z    Direction x      dir y      dir
 Run terminated.
 Run Summary
   Number of events processed : 1
-  User=0.01s Real=0.03s Sys=0s
+  User=0s Real=0.21s Sys=0.01s
 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer.
 
 ========= Table of registered couples ==============================
@@ -442,7 +442,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100
-  User=0.04s Real=0.04s Sys=0s
+  User=0.05s Real=0.21s Sys=0s
 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer.
 Graphics systems deleted.
 Visualization Manager deleting...
diff --git a/examples/extended/field/field02/field02.out b/examples/extended/field/field02/field02.out
index 55301f39e83c25a0f01fa620a39e1dff03d9501b..3aa70ccc0d6a24b63d0176554026ec3237978d8d 100644
--- a/examples/extended/field/field02/field02.out
+++ b/examples/extended/field/field02/field02.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -4598,7 +4598,7 @@ Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng  Ne
 Run terminated.
 Run Summary
   Number of events processed : 100
-  User=0.68s Real=0.97s Sys=0.26s
+  User=1.36s Real=9.96s Sys=2.15s
 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer.
 Graphics systems deleted.
 Visualization Manager deleting...
diff --git a/examples/extended/field/field03/field03.out b/examples/extended/field/field03/field03.out
index 4845b6486f3bf89138af379c72903f8d1b29bf8c..70101a87214e21b069591c9d0a32ecf5e9865389 100644
--- a/examples/extended/field/field03/field03.out
+++ b/examples/extended/field/field03/field03.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -247,7 +247,7 @@ Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng
 Run terminated.
 Run Summary
   Number of events processed : 1
-  User=0s Real=0.05s Sys=0s
+  User=0.01s Real=0.17s Sys=0s
 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer.
 
 ========= Table of registered couples ==============================
@@ -272,7 +272,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 100
-  User=0.36s Real=0.36s Sys=0s
+  User=0.33s Real=0.81s Sys=0s
 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer.
 Set field value to (0,0,1000) Gauss 
 
@@ -296,7 +296,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10
-  User=0.04s Real=0.04s Sys=0s
+  User=0.03s Real=0.03s Sys=0s
 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer.
 Graphics systems deleted.
 Visualization Manager deleting...
diff --git a/examples/extended/g3tog4/clGeometry/clGeometry.out b/examples/extended/g3tog4/clGeometry/clGeometry.out
index 8ece0b2515600be3f50eaf94756fcc58f847467d..e8a2cb8f6ad4a2a36ece48473c476f89f7f1277a 100644
--- a/examples/extended/g3tog4/clGeometry/clGeometry.out
+++ b/examples/extended/g3tog4/clGeometry/clGeometry.out
@@ -1,12 +1,12 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
 *************************************************************
 
-Instantiated G3toG4DetectorConstruction using call list file "/afs/cern.ch/sw/geant4/stt/dev1/src/geant4/examples/extended/g3tog4/data/testmodel.dat"
+Instantiated G3toG4DetectorConstruction using call list file "/afs/cern.ch/sw/geant4/stt/dev2/src/geant4/examples/extended/g3tog4/data/testmodel.dat"
 G4VUserPhysicsList::SetVerboseLevel  : Verbose level is set to 2
 Visualization Manager instantiating...
 Visualization Manager initialising...
@@ -48,7 +48,7 @@ Registered filters:
 /tracking/storeTrajectory 1
 /run/initialize
 Instantiated unit rotation matrix irot=0
-Reading the call List file /afs/cern.ch/sw/geant4/stt/dev1/src/geant4/examples/extended/g3tog4/data/testmodel.dat...
+Reading the call List file /afs/cern.ch/sw/geant4/stt/dev2/src/geant4/examples/extended/g3tog4/data/testmodel.dat...
 G4ggclos: setting top-level VolTableEntry
 Dump of VTD - 26 entries:
 Instantiated 26 volume table entries 
@@ -92,7 +92,7 @@ Top-level G3toG4 logical volume HALL G4VisAttributes: invisible, daughters visib
 G4VUserPhysicsList::Construct()
 Construct processes 
 G3toG4PhysicsList::SetCuts:CutLength : 2 mm 
-/control/execute /afs/cern.ch/sw/geant4/stt/dev1/src/geant4/tests/test601/test601.in
+/control/execute /afs/cern.ch/sw/geant4/stt/dev2/src/geant4/tests/test601/test601.in
 /run/verbose 2
 /process/eLoss/verbose 1
 /gun/position   0. -1.5 0. mm
@@ -288,7 +288,7 @@ WARNING: G4VisManager::IsValidView(): Attempt to draw when no graphics system
 Run terminated.
 Run Summary
   Number of events processed : 1
-  User=0s Real=0.07000000000000001s Sys=0s
+  User=0.01s Real=0.04s Sys=0.01s
 /gun/particle mu+
 /run/beamOn 1
 
@@ -325,7 +325,7 @@ Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolu
 Run terminated.
 Run Summary
   Number of events processed : 1
-  User=0s Real=0s Sys=0s
+  User=0s Real=0.02s Sys=0s
 /gun/particle e-
 /run/beamOn 1
 
@@ -399,7 +399,7 @@ Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolu
 Run terminated.
 Run Summary
   Number of events processed : 1
-  User=0s Real=0s Sys=0s
+  User=0s Real=0.01s Sys=0.01s
 /gun/position   0. 1.5 0. mm
 /gun/direction  1.  0.   0.
 /gun/energy 1 GeV
@@ -439,7 +439,7 @@ Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolu
 Run terminated.
 Run Summary
   Number of events processed : 1
-  User=0s Real=0s Sys=0s
+  User=0.01s Real=0.01s Sys=0s
 /gun/particle mu+
 /run/beamOn 1
 
@@ -476,7 +476,7 @@ Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolu
 Run terminated.
 Run Summary
   Number of events processed : 1
-  User=0.01s Real=0.01s Sys=0s
+  User=0s Real=0.01s Sys=0.01s
 /gun/particle e-
 /run/beamOn 1
 
@@ -550,7 +550,7 @@ Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolu
 Run terminated.
 Run Summary
   Number of events processed : 1
-  User=0s Real=0s Sys=0s
+  User=0.01s Real=0.01s Sys=0s
 Graphics systems deleted.
 Visualization Manager deleting...
 UserDetectorConstruction deleted.
diff --git a/examples/extended/g3tog4/cltog4/cltog4.out b/examples/extended/g3tog4/cltog4/cltog4.out
index 03b390a4d6fa404addf5d3627b991ea0327f41a7..b92cd64b00bff3348a900e5252e980797555ec9b 100644
--- a/examples/extended/g3tog4/cltog4/cltog4.out
+++ b/examples/extended/g3tog4/cltog4/cltog4.out
@@ -1,18 +1,18 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
 *************************************************************
 
-Instantiated G3toG4DetectorConstruction using call list file "/afs/cern.ch/sw/geant4/stt/dev1/src/geant4/examples/extended/g3tog4/data/testmodel.dat"
+Instantiated G3toG4DetectorConstruction using call list file "/afs/cern.ch/sw/geant4/stt/dev2/src/geant4/examples/extended/g3tog4/data/testmodel.dat"
 /run/verbose 1
 /tracking/verbose 1
 /tracking/storeTrajectory 1
 /run/initialize
 Instantiated unit rotation matrix irot=0
-Reading the call List file /afs/cern.ch/sw/geant4/stt/dev1/src/geant4/examples/extended/g3tog4/data/testmodel.dat...
+Reading the call List file /afs/cern.ch/sw/geant4/stt/dev2/src/geant4/examples/extended/g3tog4/data/testmodel.dat...
 G4ggclos: setting top-level VolTableEntry
 Dump of VTD - 26 entries:
 Instantiated 26 volume table entries 
@@ -54,7 +54,7 @@ Top-level G3toG4 logical volume HALL G4VisAttributes: invisible, daughters visib
   drawing style: not forced, auxiliary edge visibility: not forced
   G4AttValue pointer is zero, G4AttDef pointer is zero
 G3toG4PhysicsList::SetCuts:CutLength : 2 mm 
-/control/execute /afs/cern.ch/sw/geant4/stt/dev1/src/geant4/tests/test602/test602.in
+/control/execute /afs/cern.ch/sw/geant4/stt/dev2/src/geant4/tests/test602/test602.in
 /control/verbose 1
 /tracking/verbose 1
 /run/initialize
@@ -288,5 +288,5 @@ Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolu
 Run terminated.
 Run Summary
   Number of events processed : 10
-  User=0.01s Real=0.05s Sys=0.01s
+  User=0.04s Real=0.1s Sys=0.01s
 G4 kernel has come to Quit state.
diff --git a/examples/extended/hadronic/Hadr01/hadr01.out b/examples/extended/hadronic/Hadr01/hadr01.out
index fc86f1f94f6af2aa7820b23cb7a5e83d92ffb834..36a81228fc6fe36f5ca5535bf6214d9ffbd3490f 100644
--- a/examples/extended/hadronic/Hadr01/hadr01.out
+++ b/examples/extended/hadronic/Hadr01/hadr01.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: global-V08-00-04    (30-June-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -180,6 +180,8 @@ muPairProd:   tables are built for  mu-
       Lambda tables from threshold to 100 TeV in 120 bins.
       Parametrised model 
 
+G4UHadronElasticProcess for neutron PDGcode= 2112  Elow(MeV)= 0  Elowest(eV)= 0
+
 hIoni:   tables are built for  pi+
       dE/dx and range tables from 100 eV  to 100 TeV in 120 bins.
       Lambda tables from threshold to 100 TeV in 120 bins.
@@ -231,32 +233,32 @@ EventAction: Event # 90 started
 Run terminated.
 Run Summary
   Number of events processed : 100
-  User=8.93s Real=12.49s Sys=3.36s
+  User=8.4s Real=24.34s Sys=3.01s
 RunAction: End of run actions are started
 HistoManager: End of run actions are started
 ========================================================
 Beam particle                        proton
 Beam Energy(MeV)                     3000
 Number of events                     100
-Average number of steps              641.6
-Average number of gamma              2.58
-Average number of e-                 4.67
-Average number of e+                 0.11
-Average number of neutrons           1.32
-Average number of protons            1.22
+Average number of steps              606.5
+Average number of gamma              2.46
+Average number of e-                 4.05
+Average number of e+                 0.07
+Average number of neutrons           1.19
+Average number of protons            1.2
 Average number of antiprotons        0
-Average number of pi+ & pi-          0.3
-Average number of pi0                0.23
+Average number of pi+ & pi-          0.28
+Average number of pi0                0.21
 Average number of kaons              0
-Average number of muons              0.02
-Average number of deuterons+tritons  0.15
-Average number of He3+alpha          0.18
-Average number of ions               0.5
-Average number of forward neutrons   0.18
-Average number of reflected neutrons 0.03
-Average number of leaked neutrons    1.06
-Average number of proton leak        2.08
-Average number of pion leak          1
+Average number of muons              0
+Average number of deuterons+tritons  0.09
+Average number of He3+alpha          0.09
+Average number of ions               0.43
+Average number of forward neutrons   0.11
+Average number of reflected neutrons 0.02
+Average number of leaked neutrons    0.97
+Average number of proton leak        2.12
+Average number of pion leak          0.84
 ========================================================
 
 #
diff --git a/examples/extended/parallel/ParN02/ParN02.cc b/examples/extended/parallel/ParN02/ParN02.cc
index c5fc577b5c15da311f329edf20cdbb59081e4799..72dc25ec0534c66419c4c5d5dadaeee6a5d04722 100644
--- a/examples/extended/parallel/ParN02/ParN02.cc
+++ b/examples/extended/parallel/ParN02/ParN02.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ParN02.cc,v 1.5 2006/07/05 12:45:59 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/parallel/ParN02/include/ExN02RunAction.hh b/examples/extended/parallel/ParN02/include/ExN02RunAction.hh
index 87fffac4ff71fcd9336f7fbad74398f3599ca8e0..90a40ceaf74e4b66052f553e5fe2ff870374e7ae 100644
--- a/examples/extended/parallel/ParN02/include/ExN02RunAction.hh
+++ b/examples/extended/parallel/ParN02/include/ExN02RunAction.hh
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ExN02RunAction.hh,v 1.3 2006/07/05 12:46:00 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/parallel/ParN02/src/ExN02RunAction.cc b/examples/extended/parallel/ParN02/src/ExN02RunAction.cc
index d2bb9f67d608383694ca8a41e179fe7bc0c0a571..934f4637b392a8c0f120f51297dba25b8671b832 100644
--- a/examples/extended/parallel/ParN02/src/ExN02RunAction.cc
+++ b/examples/extended/parallel/ParN02/src/ExN02RunAction.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ExN02RunAction.cc,v 1.3 2006/07/05 12:46:00 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/parallel/ParN04/ParN04.cc b/examples/extended/parallel/ParN04/ParN04.cc
index 1acd3747711919a686326ee5a336025e50011ca3..58bfc569fe9445caf796b480d67e3b818025cefa 100644
--- a/examples/extended/parallel/ParN04/ParN04.cc
+++ b/examples/extended/parallel/ParN04/ParN04.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ParN04.cc,v 1.6 2006/07/05 13:07:54 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // --------------------------------------------------------------
diff --git a/examples/extended/parallel/ParN04/include/ExN04RunAction.hh b/examples/extended/parallel/ParN04/include/ExN04RunAction.hh
index 3769e7ada61e947771892874ecf8ad470ee6c0d2..b83b5e991e98c33087114d628a69224d4851be19 100644
--- a/examples/extended/parallel/ParN04/include/ExN04RunAction.hh
+++ b/examples/extended/parallel/ParN04/include/ExN04RunAction.hh
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ExN04RunAction.hh,v 1.3 2006/07/05 13:07:55 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/extended/parallel/ParN04/src/ExN04RunAction.cc b/examples/extended/parallel/ParN04/src/ExN04RunAction.cc
index ae514f67422bfcb493d27fdefe56e063ffef069c..0ab3f3134ff4bc9b63cb37fdc35bfe539a0935a4 100644
--- a/examples/extended/parallel/ParN04/src/ExN04RunAction.cc
+++ b/examples/extended/parallel/ParN04/src/ExN04RunAction.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: ExN04RunAction.cc,v 1.3 2006/07/05 13:07:56 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/examples/novice/N01/exampleN01.out b/examples/novice/N01/exampleN01.out
index c42da589d3a0d2c4d0bda180e51caeba27298eaa..bc12284350dccca88cbb3a66e940c53ba4dff358 100644
--- a/examples/novice/N01/exampleN01.out
+++ b/examples/novice/N01/exampleN01.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -222,5 +222,5 @@ Terminate current event processing.
 Run terminated.
 Run Summary
   Number of events processed : 3
-  User=0.01s Real=0.04s Sys=0.02s
+  User=0.05s Real=0.1s Sys=0.03s
 G4 kernel has come to Quit state.
diff --git a/examples/novice/N02/exampleN02.out b/examples/novice/N02/exampleN02.out
index 8661b962c5c5d9549730c04d4cb1884d8b413fa7..e2a0d707091fc82679f93c466559749ac1c25296 100644
--- a/examples/novice/N02/exampleN02.out
+++ b/examples/novice/N02/exampleN02.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
diff --git a/examples/novice/N03/exampleN03.out b/examples/novice/N03/exampleN03.out
index 21994272262426e457e46038c25844243b2e87e6..6242ca18a163bf1fcf490c7d6358fb716f811d13 100644
--- a/examples/novice/N03/exampleN03.out
+++ b/examples/novice/N03/exampleN03.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
diff --git a/examples/novice/N04/exampleN04.EMtest.out b/examples/novice/N04/exampleN04.EMtest.out
index 2683c1533a74a8c673345ce4baab0112192bdc54..7a9f57254f288689d524b682c1641ac0a714e1fb 100644
--- a/examples/novice/N04/exampleN04.EMtest.out
+++ b/examples/novice/N04/exampleN04.EMtest.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -157,6 +157,8 @@ muPairProd:   tables are built for  mu-
       Lambda tables from threshold to 100 TeV in 120 bins.
       Parametrised model 
 
+G4UHadronElasticProcess for neutron PDGcode= 2112  Elow(MeV)= 0  Elowest(eV)= 0
+
 hIoni:   tables are built for  pi+
       dE/dx and range tables from 100 eV  to 100 TeV in 120 bins.
       Lambda tables from threshold to 100 TeV in 120 bins.
diff --git a/examples/novice/N04/exampleN04.out b/examples/novice/N04/exampleN04.out
index 35168606270b81dc9672ec072bd8f3e5682d321d..a95f04dc7ac0cbcb305efcfbc01129084e5a7413 100644
--- a/examples/novice/N04/exampleN04.out
+++ b/examples/novice/N04/exampleN04.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -160,6 +160,8 @@ muPairProd:   tables are built for  mu-
       Lambda tables from threshold to 100 TeV in 120 bins.
       Parametrised model 
 
+G4UHadronElasticProcess for neutron PDGcode= 2112  Elow(MeV)= 0  Elowest(eV)= 0
+
 hIoni:   tables are built for  pi+
       dE/dx and range tables from 100 eV  to 100 TeV in 120 bins.
       Lambda tables from threshold to 100 TeV in 120 bins.
@@ -245,7 +247,7 @@ Stage 1->2 : 0 isolated muon found.
 Run terminated.
 Run Summary
   Number of events processed : 3
-  User=1.03s Real=1.18s Sys=0.04s
+  User=1.2s Real=2.44s Sys=0.05s
 Graphics systems deleted.
 Visualization Manager deleting...
 G4 kernel has come to Quit state.
diff --git a/examples/novice/N05/exampleN05.out b/examples/novice/N05/exampleN05.out
index 9fa5e4ae0279db1efdaa1737430c4535e5c6a5f4..f2ca4abf02aa1a218a2846a1ce1e3351dfda75cf 100644
--- a/examples/novice/N05/exampleN05.out
+++ b/examples/novice/N05/exampleN05.out
@@ -1,7 +1,7 @@
 RunManager construction starting....
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
diff --git a/examples/novice/N06/exampleN06.out b/examples/novice/N06/exampleN06.out
index 5917dca3758db830787cc8c8b68c0373254e5974..c9cc4745b725f19735a793880002a13aed6ce4bd 100644
--- a/examples/novice/N06/exampleN06.out
+++ b/examples/novice/N06/exampleN06.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -1108,7 +1108,7 @@ Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng
     1  -1.98 m   -10.1 cm     -5 m     511 keV     0 eV   5.38 m    5.38 m          Tank  Transportation
     2  -3.96 m   -20.3 cm    -10 m     511 keV     0 eV   5.38 m    10.8 m    OutOfWorld  Transportation
 Number of optical photons produces in this event : 62
-number of event = 1 User=0.1s Real=0.14s Sys=0.02s
+number of event = 1 User=0.11s Real=0.8s Sys=0.23s
 #
 /process/inactivate Scintillation
 /run/physicsModified
@@ -1557,6 +1557,6 @@ Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng
     1  -3.05 m       5 m    1.19 m     511 keV     0 eV   5.98 m    5.98 m          Tank  Transportation
     2  -6.11 m      10 m    2.38 m     511 keV     0 eV   5.98 m      12 m    OutOfWorld  Transportation
 Number of optical photons produces in this event : 33
-number of event = 1 User=0.03s Real=0.05s Sys=0.02s
+number of event = 1 User=0.13s Real=0.6s Sys=0.03s
 Graphics systems deleted.
 Visualization Manager deleting...
diff --git a/examples/novice/N07/exampleN07.out b/examples/novice/N07/exampleN07.out
index 341a6d3037c7303bc9f0bd3cb3c6cafa047dd917..089535b4d0d92a3592caa505fb899080efc1d477 100644
--- a/examples/novice/N07/exampleN07.out
+++ b/examples/novice/N07/exampleN07.out
@@ -1,6 +1,6 @@
 
 *************************************************************
- Geant4 version Name: geant4-08-01-patch-01-ref    (27-July-2006)
+ Geant4 version Name: geant4-08-01-patch-02-ref    (10-November-2006)
                       Copyright : Geant4 Collaboration
                       Reference : NIM A 506 (2003), 250-303
                             WWW : http://cern.ch/geant4
@@ -243,7 +243,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10
-  User=23.77s Real=25.33s Sys=1.47s
+  User=22.09s Real=56.16s Sys=4.33s
 ############################################################
  Run Summary - Number of events : 10
 ############################################################
@@ -556,7 +556,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10
-  User=27.17s Real=28.74s Sys=1.57s
+  User=25.69s Real=62.39s Sys=4.5s
 ############################################################
  Run Summary - Number of events : 10
 ############################################################
@@ -898,7 +898,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10
-  User=7.03s Real=7.41s Sys=0.37s
+  User=6.58s Real=14.61s Sys=1.13s
 ############################################################
  Run Summary - Number of events : 10
 ############################################################
@@ -1271,7 +1271,7 @@ Start Run processing.
 Run terminated.
 Run Summary
   Number of events processed : 10
-  User=12.95s Real=13.7s Sys=0.74s
+  User=11.98s Real=29.95s Sys=2.17s
 ############################################################
  Run Summary - Number of events : 10
 ############################################################
diff --git a/physics_lists/History b/physics_lists/History
index 4de901c98eb08fb7d3c12bfdae7b5effc28c3388..4c556095305b6a854fd163ef5dfd876a8f9a4dac 100644
--- a/physics_lists/History
+++ b/physics_lists/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.28 2006/07/26 09:45:25 vnivanch Exp $
+$Id: History,v 1.28.2.1 2006/11/03 11:39:47 gcosmo Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -15,6 +15,9 @@ track of all tags.
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+15.08.2006, V.Ivanchenko - phys-lists-V08-01-03a
+- G4HadronElasticPhysics - added includes from .cc to .hh
+
 26.07.2006, V.Ivanchenko - phys-lists-V08-01-03
 - Return pLimit= 20 MeV/c
 
diff --git a/physics_lists/hadronic/LHEP_HP/include/LHEP_HP.icc b/physics_lists/hadronic/LHEP_HP/include/LHEP_HP.icc
index 5bf2ed6a7cf2de15503c7efd77be9f682cd0e21b..3973d1aa6ee5657345e4a44a769386240fb5ab2c 100644
--- a/physics_lists/hadronic/LHEP_HP/include/LHEP_HP.icc
+++ b/physics_lists/hadronic/LHEP_HP/include/LHEP_HP.icc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: LHEP_HP.icc,v 1.11 2006/07/14 15:27:27 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/physics_lists/hadronic/LHEP_PRECO_HP/include/LHEP_PRECO_HP.icc b/physics_lists/hadronic/LHEP_PRECO_HP/include/LHEP_PRECO_HP.icc
index dc0200a56ed54228361243a8f59d21b401115e78..cf00bb0bbef2feda83114b66425c4ddbb6e5646b 100644
--- a/physics_lists/hadronic/LHEP_PRECO_HP/include/LHEP_PRECO_HP.icc
+++ b/physics_lists/hadronic/LHEP_PRECO_HP/include/LHEP_PRECO_HP.icc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: LHEP_PRECO_HP.icc,v 1.11 2006/07/14 06:08:16 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/physics_lists/hadronic/Packaging/include/G4HadronElasticPhysics.hh b/physics_lists/hadronic/Packaging/include/G4HadronElasticPhysics.hh
index 0f9abfcfe21c358472bb1efdeea42a2942bb51d3..665d53910e571e1598d7379aebcf3f4072c84373 100644
--- a/physics_lists/hadronic/Packaging/include/G4HadronElasticPhysics.hh
+++ b/physics_lists/hadronic/Packaging/include/G4HadronElasticPhysics.hh
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4HadronElasticPhysics.hh,v 1.6 2006/07/05 16:12:43 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4HadronElasticPhysics.hh,v 1.7 2006/08/15 14:19:32 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
@@ -45,6 +45,8 @@
 #include "G4VPhysicsConstructor.hh"
 #include "G4UHadronElasticProcess.hh"
 #include "G4HadronElastic.hh"
+#include "G4NeutronHPElastic.hh"
+#include "G4NeutronHPElasticData.hh"
 #include <vector>
 
 class G4HadronElasticPhysics : public G4VPhysicsConstructor
diff --git a/physics_lists/hadronic/Packaging/src/G4HadronElasticPhysics.cc b/physics_lists/hadronic/Packaging/src/G4HadronElasticPhysics.cc
index b5d460a938e59f48ae8175bb3738aa434d6e7d27..7f0e6cdc59ce69e949ba463a4d011876414ef4b6 100644
--- a/physics_lists/hadronic/Packaging/src/G4HadronElasticPhysics.cc
+++ b/physics_lists/hadronic/Packaging/src/G4HadronElasticPhysics.cc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: G4HadronElasticPhysics.cc,v 1.13 2006/07/26 09:45:25 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/physics_lists/hadronic/QBBC/include/G4HadronInelasticQBBC.hh b/physics_lists/hadronic/QBBC/include/G4HadronInelasticQBBC.hh
index b9a72eb5c4d674c9e5f38d9c7065a0b0e1b76e79..8dad6810935a282bf105366d806e97290ca440a6 100644
--- a/physics_lists/hadronic/QBBC/include/G4HadronInelasticQBBC.hh
+++ b/physics_lists/hadronic/QBBC/include/G4HadronInelasticQBBC.hh
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: G4HadronInelasticQBBC.hh,v 1.5 2006/07/05 16:12:43 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/physics_lists/hadronic/QBBC/include/G4HadronInelasticQLHEP.hh b/physics_lists/hadronic/QBBC/include/G4HadronInelasticQLHEP.hh
index 276a818628d969e674a81b040a1665e371a7880f..0d3d43d49a2c403d1136f559cedc8d6c54591010 100644
--- a/physics_lists/hadronic/QBBC/include/G4HadronInelasticQLHEP.hh
+++ b/physics_lists/hadronic/QBBC/include/G4HadronInelasticQLHEP.hh
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: G4HadronInelasticQLHEP.hh,v 1.4 2006/07/05 16:12:43 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/physics_lists/hadronic/QBBC/include/QBBC.icc b/physics_lists/hadronic/QBBC/include/QBBC.icc
index b16c23b553a0ca96b17c68c5fbc86d5676adc279..c2729f8855c1f2630ea2b0e1b7b4db7d44691fbd 100644
--- a/physics_lists/hadronic/QBBC/include/QBBC.icc
+++ b/physics_lists/hadronic/QBBC/include/QBBC.icc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: QBBC.icc,v 1.17 2006/07/05 17:17:11 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/physics_lists/hadronic/QBBC/src/G4HadronInelasticQBBC.cc b/physics_lists/hadronic/QBBC/src/G4HadronInelasticQBBC.cc
index ea237ef363dd139d35bd93df58ae20c141927ba8..4460b0b28bff3bbd2f4d9d77dcfba7f711f36073 100644
--- a/physics_lists/hadronic/QBBC/src/G4HadronInelasticQBBC.cc
+++ b/physics_lists/hadronic/QBBC/src/G4HadronInelasticQBBC.cc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: G4HadronInelasticQBBC.cc,v 1.10 2006/07/05 17:17:11 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/physics_lists/hadronic/QBBC/src/G4HadronInelasticQLHEP.cc b/physics_lists/hadronic/QBBC/src/G4HadronInelasticQLHEP.cc
index a1b6c35dc4343c49098150436539272d2d64f8ae..d20c0f6ee31114d1691a9bd49a7b420bcddb3849 100644
--- a/physics_lists/hadronic/QBBC/src/G4HadronInelasticQLHEP.cc
+++ b/physics_lists/hadronic/QBBC/src/G4HadronInelasticQLHEP.cc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: G4HadronInelasticQLHEP.cc,v 1.8 2006/07/05 17:17:11 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/physics_lists/hadronic/QGSP_HP/include/QGSP_HP.icc b/physics_lists/hadronic/QGSP_HP/include/QGSP_HP.icc
index ef0115c9719cc3487cccd9e17f07f99a68e656c6..7efda6ee7f24a7054f4b3cd72de35ed84adaf118 100644
--- a/physics_lists/hadronic/QGSP_HP/include/QGSP_HP.icc
+++ b/physics_lists/hadronic/QGSP_HP/include/QGSP_HP.icc
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: QGSP_HP.icc,v 1.12 2006/07/14 15:27:28 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/source/GNUmakefile b/source/GNUmakefile
index 40440e41b1a2d47bddfe85850a07b2484e90dd97..f4f465474903c9e209c77df7a182f9c1ae6042d4 100644
--- a/source/GNUmakefile
+++ b/source/GNUmakefile
@@ -1,4 +1,4 @@
-# $Id: GNUmakefile,v 1.79 2006/06/07 10:18:10 gcosmo Exp $
+# $Id: GNUmakefile,v 1.80 2006/10/03 13:49:30 gcosmo Exp $
 # -----------------------------------------------------------------
 # "gmake" makes default libraries for each subdomain.
 # "gmake global" makes global libraries for each subdomain.
@@ -53,29 +53,29 @@ kernel:
 	@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE)); done;:
 
 libmap: $(G4LIBDIR)/liblist
-	@echo "libmap stage:"
-	@echo "Searching for GNUmakefiles and sorting ..."
+	@$(ECHO) "libmap stage:"
+	@$(ECHO) "Searching for GNUmakefiles and sorting ..."
 	@find . \
 	  -name GNUmakefile -exec $(GREP) -l '^ *name *:=' {} \; \
 	  | sort \
 	  > /tmp/G4_all_lib_makefiles.$(unique);
-	@echo "Weeding out paths and files ..."
-	@for i in `cat /tmp/G4_all_lib_makefiles.$(unique)`; \
+	@$(ECHO) "Weeding out paths and files ..."
+	@for i in `$(CAT) /tmp/G4_all_lib_makefiles.$(unique)`; \
 	do \
-	  echo $$i | $(GREP) -q -e '/tests\?/' -e 'models/verification' || \
+	  $(ECHO) $$i | $(GREP) -q -e '/tests\?/' -e 'models/verification' || \
 	  $(GREP) -q -e SUBDIR -e G4hepgeometry $$i || \
-	  echo $$i >> /tmp/G4_granlib_makefiles.$(unique); \
+	  $(ECHO) $$i >> /tmp/G4_granlib_makefiles.$(unique); \
 	done
-	@echo "Making libname.map starter file ..."
+	@$(ECHO) "Making libname.map starter file ..."
 	@touch /tmp/G4libname.map.starter.$(unique);
-	@for i in `cat /tmp/G4_granlib_makefiles.$(unique)`; \
+	@for i in `$(CAT) /tmp/G4_granlib_makefiles.$(unique)`; \
 	do \
-	  $(GREP) '^ *name *:=' $$i | cut -d \  -f 3 \
+	  $(GREP) '^ *name *:=' $$i | $(CUT) -d \  -f 3 \
 	  >> /tmp/G4libname.map.starter.$(unique); \
-	  echo $$i | sed "s/^\\./source/" \
+	  $(ECHO) $$i | $(SED) "s/^\\./source/" \
 	  >> /tmp/G4libname.map.starter.$(unique); \
 	done
-	@echo "Making libname.map ..."
+	@$(ECHO) "Making libname.map ..."
 	@rm -f $(G4LIBDIR)/libname.map;
 	@G4TMP=$(G4TMP); export G4TMP; \
 	  $(G4LIBDIR)/liblist -l -d $(G4TMPDIR) \
@@ -86,40 +86,40 @@ libmap: $(G4LIBDIR)/liblist
 	@rm -f /tmp/G4libname.map.starter.$(unique);
 
 $(G4LIBDIR)/liblist: $(G4INSTALL)/config/liblist.c
-	@echo "Building library management utility liblist ..."
+	@$(ECHO) "Building library management utility liblist ..."
 	@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
 	@$(CC) $(CCFLAGS) -o $(G4LIBDIR)/liblist $(G4INSTALL)/config/liblist.c
 
 dll: banner win32def
 ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
-	@echo "Verifying existence of global libraries for DLLs ..."
+	@$(ECHO) "Verifying existence of global libraries for DLLs ..."
 	@$(MAKE) kernel_global G4LIB_BUILD_DLL=1
-	@echo "Building Windows DLL libraries ..."
+	@$(ECHO) "Building Windows DLL libraries ..."
 	@$(MAKE) kernel_global G4LIB_BUILD_DLL=1 G4LIB_BUILD_SHARED=1
-	@echo "Clearing temporary DLL objects and temporaries ..."
+	@$(ECHO) "Clearing temporary DLL objects and temporaries ..."
 	@rm -rf $(G4LIBDIR)/*.def $(G4LIBDIR)/*.exp
 	@rm -rf $(G4TMPDIR)/*
 ifdef G4LIB_USE_G3TOG4
 	@for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;:
 	@mv $(G4LIBDIR)/libG3toG4.a $(G4LIBDIR)/libG3toG4.lib
 endif
-	@echo "Done !"
+	@$(ECHO) "Done !"
 else
-	@echo "Sorry !"
+	@$(ECHO) "Sorry !"
 endif
 
 win32def: $(G4INSTALL)/config/win32def.c
 ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
-	@echo "Building DLL management utility win32def ..."
+	@$(ECHO) "Building DLL management utility win32def ..."
 	@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
 	@$(CC) $(CCFLAGS) -o $(G4LIBDIR)/win32def $(G4INSTALL)/config/win32def.c
 else
-	@echo "Build of DLLs is only supported on Windows platforms !"
-	@echo "The system you have currently selected is $(G4SYSTEM)."
+	@$(ECHO) "Build of DLLs is only supported on Windows platforms !"
+	@$(ECHO) "The system you have currently selected is $(G4SYSTEM)."
 endif
 
 includes:
-	@echo Installing header files in $(G4INCLUDE) ...
+	@$(ECHO) Installing header files in $(G4INCLUDE) ...
 	@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) $@); done
 	@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) $@); done
 	@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) $@); done
@@ -128,13 +128,13 @@ ifdef G4LIB_USE_G3TOG4
 endif
 
 banner:
-	@echo "*************************************************************"
-	@echo " Installation Geant4 version $$Name: geant4-08-01-patch-01 $ "
-	@echo " Copyright (C) 1994-2006 Geant4 Collaboration                            "
-	@echo "*************************************************************"
+	@$(ECHO) "*************************************************************"
+	@$(ECHO) " Installation Geant4 version $$Name: geant4-08-01-patch-02 $ "
+	@$(ECHO) " Copyright (C) 1994-2006 Geant4 Collaboration                            "
+	@$(ECHO) "*************************************************************"
 
 clean_libs::
-	@echo Removing all libraries ...
+	@$(ECHO) Removing all libraries ...
 	@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) clean_libs); done
 	@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) clean_libs); done
 	@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) clean_libs); done
@@ -144,12 +144,12 @@ endif
 	@rm -rf $(G4LIBDIR)/libname.map
 
 clean::
-	@echo Removing current $(G4SYSTEM) installation ...
+	@$(ECHO) Removing current $(G4SYSTEM) installation ...
 	@rm -rf $(G4TMPDIR)
 	@rm -rf $(G4LIBDIR)
 	@rm -rf $(G4BINDIR)
 	@rm -rf $(G4INSTALL)/.config/bin/$(G4SYSTEM)
-	@echo Removing physics-lists installation ...
+	@$(ECHO) Removing physics-lists installation ...
 ifndef G4LISTS_BASE
 	@rm -rf $(G4LIB)/plists/$(G4SYSTEM)
 	@rm -rf $(G4TMP)/plists/$(G4SYSTEM)
@@ -162,7 +162,7 @@ ifdef CFRONT
 endif
 
 clean_lists::
-	@echo Removing physics-lists installation ...
+	@$(ECHO) Removing physics-lists installation ...
 ifndef G4LISTS_BASE
 	@rm -rf $(G4LIB)/plists/$(G4SYSTEM)
 	@rm -rf $(G4TMP)/plists/$(G4SYSTEM)
@@ -174,18 +174,18 @@ endif
 # Pay _extremely_ attention before executing the following target !!
 #
 clean_all::
-	@echo Removing all installations ...
-	@echo Removing $(G4TMP) ...
+	@$(ECHO) Removing all installations ...
+	@$(ECHO) Removing $(G4TMP) ...
 	@rm -rf $(G4TMP)
-	@echo Removing $(G4LIB) ...
+	@$(ECHO) Removing $(G4LIB) ...
 	@rm -rf $(G4LIB)
-	@echo Removing $(G4BIN) ...
+	@$(ECHO) Removing $(G4BIN) ...
 	@rm -rf $(G4BIN)
-	@echo Removing $(G4INCLUDE) ...
+	@$(ECHO) Removing $(G4INCLUDE) ...
 	@rm -rf $(G4INCLUDE)
 ifdef G4LISTS_BASE
-	@echo Removing physics-lists installation ...
+	@$(ECHO) Removing physics-lists installation ...
 	@rm -rf $(G4LISTS_BASE)/hadronic/plists
 endif
-	@echo Removing installation configurations ...
+	@$(ECHO) Removing installation configurations ...
 	@rm -rf $(G4INSTALL)/.config
diff --git a/source/geometry/management/History b/source/geometry/management/History
index 7288215dfabcceab31e9088c169c57086c0a5310..057e14e34ca7f6ba90995d0d6022da3012b5bd53 100644
--- a/source/geometry/management/History
+++ b/source/geometry/management/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.102 2006/07/17 08:36:46 asaim Exp $
+$Id: History,v 1.103 2006/09/18 14:03:43 gcosmo Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -17,6 +17,11 @@ committal in the CVS repository !
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+September 18, 2006  G.Cosmo                geommng-V08-01-01
+- Added empty virtual method CheckOverlaps() to G4VPhysicalVolume to allow
+  for proper overloading from subclasses. Implementation returns always
+  'false', which the case for replicas.
+
 July 17, 2006  M.Asai                      geommng-V08-01-00
 - Fix a bug in G4Region.cc for nested parameterization.
 
diff --git a/source/geometry/management/include/G4VPhysicalVolume.hh b/source/geometry/management/include/G4VPhysicalVolume.hh
index df57a32f4c4b34917fd5332de2094e1c5d822a53..40b2016fedf94039daf59ecc4cf36514492e7643 100644
--- a/source/geometry/management/include/G4VPhysicalVolume.hh
+++ b/source/geometry/management/include/G4VPhysicalVolume.hh
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4VPhysicalVolume.hh,v 1.14 2006/06/29 18:32:35 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4VPhysicalVolume.hh,v 1.15 2006/09/18 14:03:25 gcosmo Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 // class G4VPhysicalVolume
@@ -165,6 +165,12 @@ class G4VPhysicalVolume
       //  is regular, voxel-like.  Value is id for structure type.
       //  If non-zero the volume is a candidate for specialised 
       //  navigation such as 'nearest neighbour' directly on volumes.
+    virtual G4bool CheckOverlaps(G4int res=1000);
+      // Verifies if the placed volume is overlapping with existing
+      // daughters or with the mother volume. Provides default resolution
+      // for the number of points to be generated and verified.
+      // Concrete implementation is done and required only for placed and
+      // parameterised volumes. Returns true if the volume is overlapping.
 
   public:  // without description
 
diff --git a/source/geometry/management/src/G4Region.cc b/source/geometry/management/src/G4Region.cc
index 5c5495a8b3d9b7d9f39b1ed973611882dc5e73d2..02ade6de1bb7d99f106f63982f1146cbe1caebe3 100644
--- a/source/geometry/management/src/G4Region.cc
+++ b/source/geometry/management/src/G4Region.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: G4Region.cc,v 1.21 2006/07/17 08:36:47 asaim Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // class G4Region Implementation
diff --git a/source/geometry/management/src/G4VPhysicalVolume.cc b/source/geometry/management/src/G4VPhysicalVolume.cc
index bd6c0eff08325a2e37551610533fbcc68ede1119..800113c73fe8ef5e2a9d1a20cd886e273245a80d 100644
--- a/source/geometry/management/src/G4VPhysicalVolume.cc
+++ b/source/geometry/management/src/G4VPhysicalVolume.cc
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4VPhysicalVolume.cc,v 1.11 2006/06/29 18:34:07 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4VPhysicalVolume.cc,v 1.12 2006/09/18 14:03:25 gcosmo Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // class G4VPhysicalVolume Implementation
@@ -91,3 +91,11 @@ G4RotationMatrix* G4VPhysicalVolume::GetObjectRotation() const
   }
   return retval;
 }
+
+// Only implemented for placed and parameterised volumes.
+// Not required for replicas.
+//
+G4bool G4VPhysicalVolume::CheckOverlaps(G4int)
+{
+  return false;
+}
diff --git a/source/global/History b/source/global/History
index 5e9a7b0efa09df29ee41c27263753c20292ec6ed..42b6f16509c4dc955765fee270db379b573ad61e 100644
--- a/source/global/History
+++ b/source/global/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.162 2006/07/20 16:04:21 gcosmo Exp $
+$Id: History,v 1.166.2.1 2006/11/02 15:01:35 gcosmo Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -17,9 +17,19 @@ committal in the CVS repository !
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+Nov 02, 2006  G.Cosmo (global-V08-01-02a)
+- Changed date for release 8.1.p02.
+
+Sep 15, 2006  G.Cosmo (global-V08-01-02)
+- Corrected inclusion of CLHEP headers in wrapper files
+  G4SystemOfUnits.hh and G4PhysicalConstants.hh
+
 Jul 20, 2006  G.Cosmo (global-V08-01-00)
 - Changed date for release 8.1.p01.
 
+Jun 13, 2006  V.Grichine
+- Extended unit test G4IntegratorTest in HEPNumerics.
+
 May 03, 2006  G.Cosmo (global-V08-00-04)
 - Updated date for release 8.1 in G4Version.hh.
 
diff --git a/source/global/management/include/G4PhysicalConstants.hh b/source/global/management/include/G4PhysicalConstants.hh
index 63872943fbde77dba57bcf5bd0ce22d252434abf..5123a2ac7cb31c29b21faf254ccf39c0e0751700 100644
--- a/source/global/management/include/G4PhysicalConstants.hh
+++ b/source/global/management/include/G4PhysicalConstants.hh
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 
-#include "CLHEP/Units/PhysicalConstants.h"
+#include <CLHEP/Units/PhysicalConstants.h>
 
 using CLHEP::pi;
 using CLHEP::twopi;
diff --git a/source/global/management/include/G4SIunits.hh b/source/global/management/include/G4SIunits.hh
index 0045256aa7bbef034e92c1649b101bdf43461cce..06b0989e7a2afd4de0298958046dea73fdbdb081 100644
--- a/source/global/management/include/G4SIunits.hh
+++ b/source/global/management/include/G4SIunits.hh
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4SIunits.hh,v 1.4 2006/06/29 19:02:56 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4SIunits.hh,v 1.5 2006/09/15 08:16:10 gcosmo Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 // 
 // ----------------------------------------------------------------------
 //
@@ -67,8 +67,6 @@
 #ifndef G4UNITSTEST_HH
 #define G4UNITSTEST_HH
 
-#include <CLHEP/config/CLHEP.h>
-
 // 
 // Length [L]
 //
diff --git a/source/global/management/include/G4SystemOfUnits.hh b/source/global/management/include/G4SystemOfUnits.hh
index f20e59c81bc5a4f9253a9c5b3a0a1b270d831aba..c58ae3a4eabd5a6f9ecbe32ec664b3cc651397df 100644
--- a/source/global/management/include/G4SystemOfUnits.hh
+++ b/source/global/management/include/G4SystemOfUnits.hh
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 
-#include "CLHEP/Units/SystemOfUnits.h"
+#include <CLHEP/Units/SystemOfUnits.h>
 
 using CLHEP::millimeter;
 using CLHEP::millimeter2;
diff --git a/source/global/management/include/G4Version.hh b/source/global/management/include/G4Version.hh
index 01a51b2fcf111cef8253fe5f681b5e56e9502c6a..fa8e5ae278b40ef5b13f269c359a15fb3a0703c4 100644
--- a/source/global/management/include/G4Version.hh
+++ b/source/global/management/include/G4Version.hh
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4Version.hh,v 1.5 2006/07/20 16:02:52 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4Version.hh,v 1.6 2006/11/02 15:00:17 gcosmo Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // Version information
 //
@@ -46,18 +46,18 @@
 //     |--> patch number
 
 #ifndef G4VERSION_NUMBER
-#define G4VERSION_NUMBER  811
+#define G4VERSION_NUMBER  812
 #endif
 
 #ifndef G4VERSION_TAG
-#define G4VERSION_TAG "$Name: geant4-08-01-patch-01 $"
+#define G4VERSION_TAG "$Name: geant4-08-01-patch-02 $"
 #endif
 
 // as variables
 
 #include "G4String.hh"
 
-static const G4String G4Version = "$Name: geant4-08-01-patch-01 $";
-static const G4String G4Date    = "(27-July-2006)";
+static const G4String G4Version = "$Name: geant4-08-01-patch-02 $";
+static const G4String G4Date    = "(10-November-2006)";
 
 #endif
diff --git a/source/particles/History b/source/particles/History
index 97e84fd2a5933fb5167abfb8e8226f1c561f9277..fa16ecb922a9c45b46b829979091a680cf18efcc 100644
--- a/source/particles/History
+++ b/source/particles/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.132 2006/06/27 23:33:31 asaim Exp $
+$Id: History,v 1.134 2006/09/26 16:44:13 kurasige Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -17,6 +17,13 @@ committal in the CVS repository !
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+- Sep. 5, 2006    H.Kurashige (particles-V08-01-02)
+- Fix the bug in k2(1770) decay 
+
+- Sep. 5, 2006    H.Kurashige (particles-V08-01-01)
+- Fix the bug of not filling quark contents without G4VERBOSE   
+   in G4ParticleDefinition constructor
+
 - Jun. 27, 2006    M.Asai (particles-V08-01-00)
 -  Code polish of G4PrimaryVertex
 
diff --git a/source/particles/management/include/G4PrimaryVertex.hh b/source/particles/management/include/G4PrimaryVertex.hh
index f86813cebd0256c9f27a04376cacec653060c29f..de31b0d1972b99d703801081ce20d6238a1cb2d6 100644
--- a/source/particles/management/include/G4PrimaryVertex.hh
+++ b/source/particles/management/include/G4PrimaryVertex.hh
@@ -25,7 +25,7 @@
 //
 //
 // $Id: G4PrimaryVertex.hh,v 1.4 2006/07/20 15:14:43 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 
diff --git a/source/particles/management/src/G4ParticleDefinition.cc b/source/particles/management/src/G4ParticleDefinition.cc
index 859af4cdb2f2bb03c9979d90b76acceb394fb5eb..d30f389853e8130a20d020ebd967bc17e00d1a85 100644
--- a/source/particles/management/src/G4ParticleDefinition.cc
+++ b/source/particles/management/src/G4ParticleDefinition.cc
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4ParticleDefinition.cc,v 1.27 2006/06/29 19:25:52 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4ParticleDefinition.cc,v 1.28 2006/09/05 01:15:11 kurasige Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // --------------------------------------------------------------
@@ -114,14 +114,14 @@ G4ParticleDefinition::G4ParticleDefinition(
    if (anti_encoding !=0) theAntiPDGEncoding = anti_encoding;
 
    // check quark contents
-#ifdef G4VERBOSE
    if (this->FillQuarkContents() != thePDGEncoding) {
+#ifdef G4VERBOSE
      if (verboseLevel>0) {
        // Using G4cerr expecting that it is available in construction of static objects 
        G4cerr << "Particle " << aName << " has a strange PDGEncoding " <<G4endl;
      }
-   }
 #endif
+   }
 }
 
 G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &)
diff --git a/source/particles/management/src/G4PrimaryVertex.cc b/source/particles/management/src/G4PrimaryVertex.cc
index f97d8c704d50fbbf7f2b835773259d0df8647fb5..855b0464104140e4b3988277753242085078309e 100644
--- a/source/particles/management/src/G4PrimaryVertex.cc
+++ b/source/particles/management/src/G4PrimaryVertex.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: G4PrimaryVertex.cc,v 1.3 2006/07/20 15:14:43 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 
 #include "G4PrimaryVertex.hh"
diff --git a/source/particles/shortlived/src/G4ExcitedMesonConstructor.cc b/source/particles/shortlived/src/G4ExcitedMesonConstructor.cc
index ec6905ee246ff4671260d2f9e79d00f5b3ed6fb3..ffa5e064695e5eda3e00d858d329d4a15464f9e8 100644
--- a/source/particles/shortlived/src/G4ExcitedMesonConstructor.cc
+++ b/source/particles/shortlived/src/G4ExcitedMesonConstructor.cc
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4ExcitedMesonConstructor.cc,v 1.17 2006/06/29 19:27:04 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4ExcitedMesonConstructor.cc,v 1.18 2006/09/26 16:44:13 kurasige Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // 
 // --------------------------------------------------------------
@@ -388,34 +388,34 @@ G4DecayTable*  G4ExcitedMesonConstructor::AddKTwoPiMode(
   if (iIso3 == +1) {
     if (iType == TK) {    
       mode = new G4PhaseSpaceDecayChannel(nameParent, br/3., 2,
-					   "k2(1770)+","pi0");
+					   "k2_star(1430)+","pi0");
       decayTable->Insert(mode);
       mode = new G4PhaseSpaceDecayChannel(nameParent, br*2./3., 2,
-					   "k2(1770)0","pi+");
+					   "k2_star(1430)0","pi+");
       decayTable->Insert(mode);
     }else if (iType==TAntiK) {
       mode = new G4PhaseSpaceDecayChannel(nameParent, br/3., 2,
-					   "anti_k2(1770)0","pi0");
+					   "anti_k2_star(1430)0","pi0");
       decayTable->Insert(mode);
       mode = new G4PhaseSpaceDecayChannel(nameParent, br*2./3., 2,
-					   "k2(1770)-","pi+");
+					   "k2_star(1430)-","pi+");
       decayTable->Insert(mode);
    }
   } else if (iIso3 == -1) {
     if (iType == TK) {    
       mode = new G4PhaseSpaceDecayChannel(nameParent, br/3., 2,
-					   "k2(1770)0","pi0");
+					   "k2_star(1430)0","pi0");
       decayTable->Insert(mode);
       mode = new G4PhaseSpaceDecayChannel(nameParent, br*2./3., 2,
-					   "k2(1770)+","pi-");
+					   "k2_star(1430)+","pi-");
       decayTable->Insert(mode);
  
     }else if (iType==TAntiK) {
       mode = new G4PhaseSpaceDecayChannel(nameParent, br/3., 2,
-					   "k2(1770)-","pi0");
+					   "k2_star(1430)-","pi0");
       decayTable->Insert(mode);
       mode = new G4PhaseSpaceDecayChannel(nameParent, br*2./3., 2,
-					   "anti_k2(1770)0","pi-");
+					   "anti_k2_star(1430)0","pi-");
       decayTable->Insert(mode);
     }
   }
diff --git a/source/persistency/History b/source/persistency/History
index 57e73dd76c84f9d85ddcae3fd1696d3604c57ff4..2ce5e4adf776d33249341ae0081548515bf56513 100644
--- a/source/persistency/History
+++ b/source/persistency/History
@@ -15,6 +15,10 @@ committal in the CVS repository !
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+22 August, 06  G.Cosmo (persistency-V08-01-00)
+- Get Rid of useless forward declarations in G4MCTEvent and G4MCTGenParticle
+  header files. Clearing compilation warnings on icc-9.X compilers.
+
 28 June, 05  G.Cosmo (persistency-V07-01-01)
 - Trivial fixes to G4MCTSimParticle and G4MCTSimVertex to support for
   CLHEP-2.0.X series.
diff --git a/source/persistency/include/G4MCTEvent.hh b/source/persistency/include/G4MCTEvent.hh
index 27e41b2c98fbea7892d2431a89633fdea7948677..c110c15d3d28ea2c418d170cc54f7787c62d14b6 100644
--- a/source/persistency/include/G4MCTEvent.hh
+++ b/source/persistency/include/G4MCTEvent.hh
@@ -42,8 +42,6 @@
 class G4MCTGenEvent;
 class G4MCTSimEvent;
 class G4MCTSimParticle;
-class HepMC::GenEvent;
-class HepMC::GenParticle;
 
 typedef std::map<G4MCTGenParticle, G4MCTSimParticle*> MCTGen2SimParticleMap;
 typedef std::map<G4MCTSimParticle*, G4MCTGenParticle> MCTSim2GenParticleMap;
diff --git a/source/persistency/include/G4MCTGenParticle.hh b/source/persistency/include/G4MCTGenParticle.hh
index 7e8351a8035b1b7155a66cab9feac9ae0eaab84e..1313300343ec950760670c00ce76400ed74211de 100644
--- a/source/persistency/include/G4MCTGenParticle.hh
+++ b/source/persistency/include/G4MCTGenParticle.hh
@@ -34,9 +34,6 @@
 #include "CLHEP/HepMC/GenEvent.h"
 #include "CLHEP/HepMC/GenParticle.h"
 
-class HepMC::GenEvent;
-class HepMC::GenParticle;
-
 typedef std::pair<HepMC::GenEvent*, HepMC::GenParticle*> G4MCTGenParticle;
 
 #endif
diff --git a/source/processes/electromagnetic/muons/include/G4EnergyLossForExtrapolator.hh b/source/processes/electromagnetic/muons/include/G4EnergyLossForExtrapolator.hh
index 8a8991c36ab3aa031947218184e46b4b9a868a04..0c3d9edb23efea23780ba59bab46d5f6406cfcb0 100644
--- a/source/processes/electromagnetic/muons/include/G4EnergyLossForExtrapolator.hh
+++ b/source/processes/electromagnetic/muons/include/G4EnergyLossForExtrapolator.hh
@@ -24,7 +24,7 @@
 // ********************************************************************
 //
 // $Id: G4EnergyLossForExtrapolator.hh,v 1.7 2006/07/21 09:39:02 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //---------------------------------------------------------------------------
 //
diff --git a/source/processes/electromagnetic/standard/History b/source/processes/electromagnetic/standard/History
index 55b7007e993bdaf5e6d4a6db6b6b1dcca31c54e9..9c5d15fb26eed549376be0149b367328659d4c3c 100644
--- a/source/processes/electromagnetic/standard/History
+++ b/source/processes/electromagnetic/standard/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.239 2006/05/22 18:22:00 vnivanch Exp $
+$Id: History,v 1.245 2006/08/29 20:24:58 vnivanch Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -17,6 +17,26 @@ committal in the CVS repository !
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+30 Aug 06: V.Ivanchenko (emstand-V08-01-03)
+- Provide changings required for new processes/models with  polarization:
+  G4KleinNishinaCompton - make some members protected
+  G4MollerBhabhaModel - make some members protected
+  G4eBremsstrahlungModel - reorganize SelectRandomAom method and make 
+	some members protected
+
+29 Aug 06: V.Ivanchenko (emstand-V08-01-02)
+- Fix problem of positron zero incident energy in G4eeToTwoGammaModel
+- Add extra protection inside G4BetheBlochModel
+
+19 Aug 06: V.Ivanchenko (emstand-V08-01-01)
+- Fix energy non-conservation in G4PAIModel for positrons (V.Grichine)
+
+08 Aug 06: V.Ivanchenko (emstand-V08-01-00)
+- Fix problems and add comments in the classes prototype Coulomb 
+  elastic scattering:  G4CoulombScattering,  G4CoulombScatteringModel,
+  G4eCoulombScatteringModel
+- Set default limit on scattering angle to zero 
+
 22 May 06: V.Ivanchenko (emstand-V08-00-25)
 - G4eBremsstrahlung - use gammaThreshold from G4LossTableManager for
   more easier initialisation (CMS request)
diff --git a/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh b/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh
index 5cca2d475490f208bccc33967c2348369f9e97aa..93c697c0ab018be134832ce59d9d67e93383ae27 100644
--- a/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh
+++ b/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4CoulombScattering.hh,v 1.2 2006/06/29 19:50:14 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4CoulombScattering.hh,v 1.4 2006/08/09 17:57:03 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -58,7 +58,7 @@ class G4CoulombScattering : public G4VEmProcess
 
 public:
 
-  G4CoulombScattering(const G4String& name = "CoulombScat");
+  G4CoulombScattering(const G4String& name = "eCoulombScat");
 
   virtual ~G4CoulombScattering();
 
@@ -70,6 +70,8 @@ public:
 
   void SetQ2Max(G4double);
 
+  void SetBuildTableFlag(G4bool);
+
   // Print out of the class parameters
   virtual void PrintInfo();
 
@@ -92,6 +94,7 @@ private:
   G4double thetaMax;
   G4double q2Max;
   G4bool isInitialised;
+  G4bool buildTableFlag;
 
 };
 
@@ -126,6 +129,13 @@ inline void G4CoulombScattering::SetQ2Max(G4double val)
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+inline void G4CoulombScattering::SetBuildTableFlag(G4bool val)
+{
+  buildTableFlag = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 inline std::vector<G4DynamicParticle*>* G4CoulombScattering::SecondariesPostStep(
                                                   G4VEmModel* model,
                                             const G4MaterialCutsCouple* couple,
diff --git a/source/processes/electromagnetic/standard/include/G4CoulombScatteringModel.hh b/source/processes/electromagnetic/standard/include/G4CoulombScatteringModel.hh
index a92da2cc0209cf0a596567bdb7e16770bfbf9c68..ea4c804cc0c4df2e3e452c6cd090cc70ef836eb1 100644
--- a/source/processes/electromagnetic/standard/include/G4CoulombScatteringModel.hh
+++ b/source/processes/electromagnetic/standard/include/G4CoulombScatteringModel.hh
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4CoulombScatteringModel.hh,v 1.2 2006/06/29 19:50:16 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4CoulombScatteringModel.hh,v 1.4 2006/08/09 09:47:17 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -38,12 +38,18 @@
 // Creation date: 19.02.2006
 //
 // Modifications:
+// 01.08.06 V.Ivanchenko extend upper limit of table to TeV and review the
+//          logic of building - only elements from G4ElementTable
+// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
 //
 // Class Description:
 //
 // Implementation of CoulombScattering of pointlike charge particle 
 // on Atomic Nucleus for interval of scattering anles in CM system 
 // thetaMin - ThetaMax
+//   The model based on analysis of J.M.Fernandez-Varea et al. 
+// NIM B73(1993)447 originated from G.Wentzel Z.Phys. 40(1927)590 with 
+// screening parameter from H.A.Bethe Phys. Rev. 89 (1953) 1256.
 // 
 
 // -------------------------------------------------------------------
@@ -109,12 +115,15 @@ private:
   G4double                  a0;
   G4double                  cosThetaMin;
   G4double                  cosThetaMax;
-  G4double                  lowMomentum;
-  G4double                  highMomentum;
+  G4double                  lowKEnergy;
+  G4double                  highKEnergy;
   G4double                  q2Limit;
+  G4double                  alpha2;
+  G4double                  faclim;
 
   G4int                     nbins;
   G4int                     nmax;
+  G4int                     index[100];
 
   G4bool                    buildTable;             
   G4bool                    isInitialised;             
@@ -129,15 +138,11 @@ inline G4double G4CoulombScatteringModel::ComputeCrossSectionPerAtom(
                                              G4double, G4double)
 {
   G4double x;
+  G4bool b;
   if(theCrossSectionTable) {
-    G4bool b;
-    G4double mass = p->GetPDGMass();
-    G4double momentum2 = kinEnergy*(kinEnergy + 2.0*mass);
-    G4double e     = kinEnergy + mass;
-    G4double beta2 = momentum2/(e*e);
-    x = (((*theCrossSectionTable)[G4int(Z)]))->GetValue(momentum2, b)
-      / (momentum2*beta2);
+    x = std::exp((((*theCrossSectionTable)[index[G4int(Z)]]))->GetValue(kinEnergy, b));
   } else x = CalculateCrossSectionPerAtom(p, kinEnergy, Z);
+
   return x;
 }
 
diff --git a/source/processes/electromagnetic/standard/include/G4PAIModel.hh b/source/processes/electromagnetic/standard/include/G4PAIModel.hh
index 9f65fc2d0c5f14e3e25b2b82b01d797894c98882..81beafe95a137ab324810c8284c3fd878b23a73c 100644
--- a/source/processes/electromagnetic/standard/include/G4PAIModel.hh
+++ b/source/processes/electromagnetic/standard/include/G4PAIModel.hh
@@ -104,7 +104,7 @@ public:
 
   void     DefineForRegion(const G4Region* r) ;
   void     ComputeSandiaPhotoAbsCof();
-  void     BuildPAIonisationTable();
+  void     BuildPAIonisationTable(const G4ParticleDefinition*);
   void     BuildLambdaVector(const G4MaterialCutsCouple* matCutsCouple);
   G4double GetdNdxCut( G4int iPlace, G4double transferCut);
   G4double GetdEdxCut( G4int iPlace, G4double transferCut);
@@ -132,11 +132,13 @@ private:
 
   // The vector over proton kinetic energies: the range of gammas
   G4int                fVerbose; 
+  G4double             fLowestGamma;
+  G4double             fHighestGamma;
   G4double             fLowestKineticEnergy;
   G4double             fHighestKineticEnergy;
   G4int                fTotBin;
   G4int                fMeanNumber;
-  G4PhysicsLogVector*  fProtonEnergyVector ;
+  G4PhysicsLogVector*  fParticleEnergyVector ;
 
 
 
diff --git a/source/processes/electromagnetic/standard/include/G4eCoulombScatteringModel.hh b/source/processes/electromagnetic/standard/include/G4eCoulombScatteringModel.hh
index 065324ad838da071c0e3ff8de12199d8ab1b0305..88d0a5a20acea0b51f909031ac1f3ca07ce2da15 100644
--- a/source/processes/electromagnetic/standard/include/G4eCoulombScatteringModel.hh
+++ b/source/processes/electromagnetic/standard/include/G4eCoulombScatteringModel.hh
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4eCoulombScatteringModel.hh,v 1.2 2006/06/29 19:52:06 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4eCoulombScatteringModel.hh,v 1.4 2006/08/09 09:47:17 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -38,12 +38,18 @@
 // Creation date: 19.02.2006
 //
 // Modifications:
+// 01.08.06 V.Ivanchenko extend upper limit of table to TeV and review the
+//          logic of building - only elements from G4ElementTable
+// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
 //
 // Class Description:
 //
 // Implementation of eCoulombScattering of pointlike charge particle 
 // on Atomic Nucleus for interval of scattering anles in Lab system 
-// thetaMin - ThetaMax, nucleus recoil is neglected
+// thetaMin - ThetaMax, nucleus recoil is neglected.
+//   The model based on analysis of J.M.Fernandez-Varea et al. 
+// NIM B73(1993)447 originated from G.Wentzel Z.Phys. 40(1927)590 with 
+// screening parameter from H.A.Bethe Phys. Rev. 89 (1953) 1256.
 // 
 
 // -------------------------------------------------------------------
@@ -54,6 +60,7 @@
 
 #include "G4VEmModel.hh"
 #include "G4PhysicsTable.hh"
+#include "globals.hh"
 
 class G4ParticleChangeForGamma;
 
@@ -101,12 +108,15 @@ private:
   G4double                  a0;
   G4double                  cosThetaMin;
   G4double                  cosThetaMax;
-  G4double                  lowMomentum;
-  G4double                  highMomentum;
+  G4double                  lowKEnergy;
+  G4double                  highKEnergy;
   G4double                  q2Limit;
+  G4double                  alpha2;
+  G4double                  faclim;
 
   G4int                     nbins;
   G4int                     nmax;
+  G4int                     index[100];
 
   G4bool                    buildTable;             
   G4bool                    isInitialised;             
@@ -121,15 +131,12 @@ inline G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
                                              G4double, G4double)
 {
   G4double x;
+  G4bool b;
   if(theCrossSectionTable) {
-    G4bool b;
-    G4double mass = p->GetPDGMass();
-    G4double momentum2 = kinEnergy*(kinEnergy + 2.0*mass);
-    G4double e     = kinEnergy + mass;
-    G4double beta2 = momentum2/(e*e);
-    x = (((*theCrossSectionTable)[G4int(Z)]))->GetValue(momentum2, b)
-      / (momentum2*beta2);
+    x = std::exp((((*theCrossSectionTable)[index[G4int(Z)]]))->GetValue(kinEnergy, b));
   } else x = CalculateCrossSectionPerAtom(p, kinEnergy, Z);
+
+  //  G4cout << "G4eCoulombScatteringModel: e= " << kinEnergy << "  cs= " << x << G4endl;
   return x;
 }
 
diff --git a/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc b/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc
index d0d0c3d2df814b945fb1f66b00525a63c8dedece..ef6e6f95097d89db41fe26b3ccf6275dffe85b6d 100644
--- a/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc
+++ b/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4BetheBlochModel.cc,v 1.11 2006/06/29 19:52:38 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4BetheBlochModel.cc,v 1.12 2006/08/29 20:21:34 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -270,7 +270,21 @@ vector<G4DynamicParticle*>* G4BetheBlochModel::SampleSecondaries(
            sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
   G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
                                    (deltaMomentum * totMomentum);
-  G4double sint = sqrt(1.0 - cost*cost);
+  if(cost > 1.0) {
+    G4cout << "### G4BetheBlochModel WARNING: cost= " 
+	   << cost << " > 1 for "
+	   << dp->GetDefinition()->GetParticleName()
+	   << " Ekin(MeV)= " <<  kineticEnergy
+	   << " p(MeV/c)= " <<  totMomentum
+	   << " delEkin(MeV)= " << deltaKinEnergy
+	   << " delMom(MeV/c)= " << deltaMomentum
+	   << " tmin(MeV)= " << minKinEnergy
+	   << " tmax(MeV)= " << maxKinEnergy
+           << " dir= " << dp->GetMomentumDirection()
+	   << G4endl;
+    cost = 1.0;
+  }
+  G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
 
   G4double phi = twopi * G4UniformRand() ;
 
diff --git a/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc b/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc
index a0ba92d32cf2ed3a15364f7a6f323072d01d62fb..01489d53ccef4a7573a61dae5be69b9ab293c3d8 100644
--- a/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc
+++ b/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4CoulombScattering.cc,v 1.2 2006/06/29 19:52:52 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4CoulombScattering.cc,v 1.6 2006/08/10 08:43:56 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -38,6 +38,8 @@
 // Creation date: 22.08.2004
 //
 // Modifications:
+// 01.08.06 V.Ivanchenko add choice between G4eCoulombScatteringModel and
+//          G4CoulombScatteringModel
 //
 
 //
@@ -55,11 +57,13 @@
 using namespace std;
 
 G4CoulombScattering::G4CoulombScattering(const G4String& name)
-  : G4VEmProcess(name),thetaMin(0.5),thetaMax(pi),q2Max(DBL_MAX),isInitialised(false)
+  : G4VEmProcess(name),thetaMin(0.0),thetaMax(pi),q2Max(DBL_MAX),
+    isInitialised(false)
 {
   SetLambdaBinning(80);
   SetMinKinEnergy(1.0*keV);
   SetMaxKinEnergy(100.0*GeV);
+  buildTableFlag = true;
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -74,17 +78,26 @@ void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition*)
   if(!isInitialised) {
     isInitialised = true;
     //    SetVerboseLevel(3);
-    SetBuildTableFlag(true);
+    //    SetBuildTableFlag(buildTableFlag);
+    SetBuildTableFlag(false);
     SetStartFromNullFlag(false);
     SetLambdaFactor(0.8);
     SetSecondaryParticle(0);
     G4double emin = MinKinEnergy();
     G4double emax = MaxKinEnergy();
-    G4CoulombScatteringModel* model = 
-      new G4CoulombScatteringModel(thetaMin,thetaMax,true,q2Max);
-    model->SetLowEnergyLimit(emin);
-    model->SetHighEnergyLimit(emax);
-    AddEmModel(1, model);
+    if(GetProcessName() == "eCoulombScat") {
+      G4eCoulombScatteringModel* model = 
+	new G4eCoulombScatteringModel(thetaMin,thetaMax,buildTableFlag,q2Max);
+      model->SetLowEnergyLimit(emin);
+      model->SetHighEnergyLimit(emax);
+      AddEmModel(1, model);
+    } else {
+      G4CoulombScatteringModel* model = 
+	new G4CoulombScatteringModel(thetaMin,thetaMax,buildTableFlag,q2Max);
+      model->SetLowEnergyLimit(emin);
+      model->SetHighEnergyLimit(emax);
+      AddEmModel(1, model);
+    }
   }
 }
 
@@ -93,7 +106,7 @@ void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition*)
 void G4CoulombScattering::PrintInfo()
 {
   G4cout << "      Coulomb scattering with ThetaMin(degree)= " << thetaMin/degree
-	 << "; ThetaMax(degree)= " << thetaMin/degree
+	 << "; ThetaMax(degree)= " << thetaMax/degree
          << "; q2Max(GeV^2)= " << q2Max/(GeV*GeV)
          << G4endl;
 }
diff --git a/source/processes/electromagnetic/standard/src/G4CoulombScatteringModel.cc b/source/processes/electromagnetic/standard/src/G4CoulombScatteringModel.cc
index f30c6327e1f03a96ce5e674821e3bfd6b73b554f..fe852437e14cd3d86809ac48f074d211c60db4e8 100644
--- a/source/processes/electromagnetic/standard/src/G4CoulombScatteringModel.cc
+++ b/source/processes/electromagnetic/standard/src/G4CoulombScatteringModel.cc
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4CoulombScatteringModel.cc,v 1.2 2006/06/29 19:52:54 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4CoulombScatteringModel.cc,v 1.6 2006/08/10 11:57:52 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -38,6 +38,9 @@
 // Creation date: 22.08.2005
 //
 // Modifications:
+// 01.08.06 V.Ivanchenko extend upper limit of table to TeV and review the
+//          logic of building - only elements from G4ElementTable
+// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
 //
 // Class Description:
 //
@@ -67,17 +70,18 @@ G4CoulombScatteringModel::G4CoulombScatteringModel(
     theCrossSectionTable(0),
     cosThetaMin(cos(thetaMin)),
     cosThetaMax(cos(thetaMax)),
-    lowMomentum(keV),
-    highMomentum(MeV),
+    lowKEnergy(keV),
+    highKEnergy(TeV),
     q2Limit(tlim),
+    alpha2(fine_structure_const*fine_structure_const),
+    faclim(10.0),
     nbins(12),
     nmax(100),
     buildTable(build),
     isInitialised(false)
 {
-  G4double p0 = hbarc/(Bohr_radius*0.885);
-  a0 = 0.25*p0*p0;
-  p0 = electron_mass_c2*classic_electr_radius;
+  a0 = 0.25*alpha2*electron_mass_c2*electron_mass_c2/(0.885*0.885);
+  G4double p0 = electron_mass_c2*classic_electr_radius;
   coeff = twopi*p0*p0;
   theMatManager    = G4NistManager::Instance();
   theParticleTable = G4ParticleTable::GetParticleTable();
@@ -103,32 +107,33 @@ void G4CoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
   isInitialised = true;
 
   if(pParticleChange)
-    fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
+    fParticleChange = 
+      reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
   else
     fParticleChange = new G4ParticleChangeForGamma();
 
   if(!buildTable || p->GetParticleName() == "GenericIon") return;
 
   // Compute cross section multiplied by Ptot^2*beta^2
-  G4double mass  = p->GetPDGMass();
-  G4double mass2 = mass*mass;
-
   theCrossSectionTable = new G4PhysicsTable(nmax);
   G4PhysicsLogVector* ptrVector;
-  G4double mom2, value;
-  G4double pmin = lowMomentum*lowMomentum;
-  G4double pmax = highMomentum*highMomentum;
-  nbins = G4int(log10(pmax/pmin)/2.0) + 1;
+  G4double e, value;
+  nbins = 2*G4int(log10(highKEnergy/lowKEnergy));
+
+  const  G4ElementTable* elmt = G4Element::GetElementTable();
+  size_t nelm =  G4Element::GetNumberOfElements();
 
-  for(G4int j=1; j<nmax; j++) { 
+  for(size_t j=0; j<nelm; j++) { 
 
-    ptrVector  = new G4PhysicsLogVector(pmin, pmax, nbins);
+    ptrVector  = new G4PhysicsLogVector(lowKEnergy, highKEnergy, nbins);
+    const G4Element* elm = (*elmt)[j]; 
+    G4double Z =  elm->GetZ();
+    index[G4int(Z)] = j;
  
     for(G4int i=0; i<=nbins; i++) {
-      mom2   = ptrVector->GetLowEdgeEnergy( i ) ;
-      value  = CalculateCrossSectionPerAtom(p, mom2, j);  
-      value *= mom2*mom2/(mom2 + mass2);
-      ptrVector->PutValue( i, value );
+      e     = ptrVector->GetLowEdgeEnergy( i ) ;
+      value = CalculateCrossSectionPerAtom(p, e, Z);  
+      ptrVector->PutValue( i, log(value) );
     }
 
     theCrossSectionTable->insert(ptrVector);
@@ -139,16 +144,17 @@ void G4CoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
 
 G4double G4CoulombScatteringModel::CalculateCrossSectionPerAtom(
 		             const G4ParticleDefinition* p,      
-			     G4double mom2, 
+			     G4double kinEnergy, 
 			     G4double Z)
 {
   G4double cross= 0.0;
   G4int iz      = G4int(Z);
   G4double m    = p->GetPDGMass();
+  G4double mom2 = kinEnergy*(kinEnergy + 2.0*m);
   G4double mass2= m*m;
   G4double q    = p->GetPDGCharge()/eplus;
   G4double m1   = theMatManager->GetAtomicMassAmu(iz)*amu_c2;
-  G4double etot = sqrt(mom2 + mass2) + m1;
+  G4double etot = kinEnergy + m + m1;
   G4double ptot = sqrt(mom2);
   G4double bet  = ptot/etot;
   G4double gam  = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
@@ -160,10 +166,12 @@ G4double G4CoulombScatteringModel::CalculateCrossSectionPerAtom(
   // Cross section in CM system 
   if(costm < cosThetaMin) {
     G4double invbeta2 = 1.0 +  mass2/momentum2;
-    G4double a = 2.0*pow(Z,0.666666667)*a0*
-      (1.13 + 3.76*invbeta2*Z*Z*fine_structure_const*fine_structure_const)/momentum2 + 1.0;
+    G4double fac = std::min(faclim, 1.13 + 3.76*invbeta2*Z*Z*alpha2);
+    G4double A = pow(Z,0.6666667)*a0*fac/mom2;
+    G4double a = 2.0*A + 1.0;
     G4double f = q * Z * m1 /(m + m1);
-    cross = coeff*f*f*(cosThetaMin - costm)/((a - cosThetaMin)*(a - costm));
+    cross = coeff*f*f*invbeta2*(cosThetaMin - costm)/
+      ((a - cosThetaMin)*(a - costm)*momentum2);
   }
   //G4cout << "p= " << mom << "  Z= " << Z << "  a= " << a 
   //<< " cross= " << cross << " m1(GeV)=  " << m1/GeV <<G4endl;
@@ -185,7 +193,8 @@ G4double G4CoulombScatteringModel::SelectIsotope(const G4Element* elm)
       if (x <= 0.0) break;
     }
     if(idx >= ni) {
-      G4cout << "G4CoulombScatteringModel::SelectIsotope WARNING: abandance vector for"
+      G4cout << "G4CoulombScatteringModel::SelectIsotope WARNING: "
+	     << "abandance vector for"
 	     << elm->GetName() << " is not normalised to unit" << G4endl;
     } else {
       N = G4double(elm->GetIsotope(idx)->GetN());
@@ -206,7 +215,8 @@ std::vector<G4DynamicParticle*>* G4CoulombScatteringModel::SampleSecondaries(
   const G4Material* aMaterial = couple->GetMaterial();
   const G4ParticleDefinition* p = dp->GetDefinition();
 
-  const G4Element* elm = SelectRandomAtom(aMaterial, p, dp->GetKineticEnergy());
+  const G4Element* elm = 
+    SelectRandomAtom(aMaterial, p, dp->GetKineticEnergy());
   G4double Z  = elm->GetZ();
   G4double N  = SelectIsotope(elm);
   G4int iz    = G4int(Z);
@@ -225,21 +235,38 @@ std::vector<G4DynamicParticle*>* G4CoulombScatteringModel::SampleSecondaries(
   G4double momentum2 = p1.mag2();
   G4double invbeta2  = 1.0 + m1*m1/momentum2;
 
-  G4double a = 2.*pow(Z,0.666666667)*a0*
-    (1.13 + 3.76*invbeta2*Z*Z*fine_structure_const*fine_structure_const)/momentum2 + 1.0;
+  G4double fac = std::min(faclim, 1.13 + 3.76*invbeta2*Z*Z*alpha2);
+  G4double a = 2.*pow(Z,0.666666667)*a0*fac/momentum2 + 1.0;
 
-  G4double costm = std::max(cosThetaMax, 1.0 - q2Limit/2.0*momentum2);
+  G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/momentum2);
   if(1 == iz && p == theProton) costm = std::max(0.0, costm);
   if(costm > cosThetaMin) return fvect; 
 
+  /*
   G4double cost = a - (a - cosThetaMin)*(a - costm)/
     (a - cosThetaMin + G4UniformRand()*(cosThetaMin - costm));
   if(std::abs(cost) > 1.) {
-    G4cout << "G4CoulombScatteringModel::SampleSecondaries WARNING cost= " << cost << G4endl;
+    G4cout << "G4CoulombScatteringModel::SampleSecondaries WARNING cost= " 
+	   << cost << G4endl;
     if(cost < -1.) cost = -1.0;
     else           cost =  1.0;
   }
   G4double sint = sqrt((1.0 + cost)*(1.0 - cost));
+  */
+  G4double c1  = 1.0 - costm;
+  G4double c2  = 1.0 - cosThetaMin;
+  G4double x   = G4UniformRand();
+  G4double y   = (a + c2)/(c1 - c2);
+  G4double st2 = 0.5*(c1*y - a*x)/(y + x); 
+  if(st2 < 0.0) {
+    G4cout << "G4CoulombScatteringModel::SampleSecondaries WARNING st2= " 
+	   << st2 << G4endl;
+    st2 = 0.0;
+  }
+
+  G4double tet = 2.0*asin(sqrt(st2));
+  G4double cost= cos(tet);
+  G4double sint= sin(tet);
 
   G4double phi  = twopi * G4UniformRand();
 
@@ -252,7 +279,8 @@ std::vector<G4DynamicParticle*>* G4CoulombScatteringModel::SampleSecondaries(
   lfv1.boost(bst);
   lfv2.boost(bst);
 
-  fParticleChange->ProposeMomentumDirection(lfv1.vect().unit());   
+  G4ThreeVector newdir = lfv1.vect().unit();
+  fParticleChange->ProposeMomentumDirection(newdir);   
   G4double ekin = lfv1.e() - m1;
   if(ekin < 0.0) ekin = 0.0;
   fParticleChange->SetProposedKineticEnergy(ekin);
diff --git a/source/processes/electromagnetic/standard/src/G4PAIModel.cc b/source/processes/electromagnetic/standard/src/G4PAIModel.cc
index 69413d800ec117e2f3e758fd972e145af6821918..d569c7c929bb3a83fdcaecbdb5ccfe278a2e34d1 100644
--- a/source/processes/electromagnetic/standard/src/G4PAIModel.cc
+++ b/source/processes/electromagnetic/standard/src/G4PAIModel.cc
@@ -62,7 +62,9 @@ using namespace std;
 
 G4PAIModel::G4PAIModel(const G4ParticleDefinition* p, const G4String& nam)
   : G4VEmModel(nam),G4VEmFluctuationModel(nam),
-    fVerbose(0),
+  fVerbose(0),
+  fLowestGamma(1.005),
+  fHighestGamma(10000.),
   fTotBin(200),
   fMeanNumber(20),
   fParticle(0),
@@ -73,11 +75,16 @@ G4PAIModel::G4PAIModel(const G4ParticleDefinition* p, const G4String& nam)
   fTaulim(8.4146e-3)
 {
   if(p) SetParticle(p);
-  fLowestKineticEnergy  = LowEnergyLimit();
-  fHighestKineticEnergy = HighEnergyLimit();
-  fProtonEnergyVector = new G4PhysicsLogVector(fLowestKineticEnergy,
-							   fHighestKineticEnergy,
-							   fTotBin);
+  
+  // fLowestKineticEnergy  = LowEnergyLimit();
+  // fHighestKineticEnergy = HighEnergyLimit();
+
+  fLowestKineticEnergy  = fMass*fLowestGamma;
+  fHighestKineticEnergy = fMass*fHighestGamma;
+
+  fParticleEnergyVector = new G4PhysicsLogVector(fLowestKineticEnergy,
+						 fHighestKineticEnergy,
+						 fTotBin                );
   fPAItransferTable  = 0;
   fPAIdEdxTable      = 0;
   fSandiaPhotoAbsCof = 0;
@@ -90,7 +97,7 @@ G4PAIModel::G4PAIModel(const G4ParticleDefinition* p, const G4String& nam)
 
 G4PAIModel::~G4PAIModel()
 {
-  if(fProtonEnergyVector) delete fProtonEnergyVector;
+  if(fParticleEnergyVector) delete fParticleEnergyVector;
   if(fdEdxVector)         delete fdEdxVector ;
   if ( fLambdaVector)     delete fLambdaVector;
   if ( fdNdxCutVector)    delete fdNdxCutVector;
@@ -167,7 +174,7 @@ void G4PAIModel::Initialise(const G4ParticleDefinition* p,
       fMatIndex = iMatGlob;
 
       ComputeSandiaPhotoAbsCof();
-      BuildPAIonisationTable();
+      BuildPAIonisationTable(p);
 
       fPAIxscBank.push_back(fPAItransferTable);
       fPAIdEdxBank.push_back(fPAIdEdxTable);
@@ -233,7 +240,7 @@ void G4PAIModel::ComputeSandiaPhotoAbsCof()
 //                           *********
 
 void
-G4PAIModel::BuildPAIonisationTable()
+G4PAIModel::BuildPAIonisationTable(const G4ParticleDefinition* p)
 {
   G4double LowEdgeEnergy , ionloss ;
   G4double massRatio, tau, Tmax, Tmin, Tkin, deltaLow, gamma, bg2 ;
@@ -263,14 +270,28 @@ G4PAIModel::BuildPAIonisationTable()
 
   for (G4int i = 0 ; i < fTotBin ; i++)  //The loop for the kinetic energy
   {
-    LowEdgeEnergy = fProtonEnergyVector->GetLowEdgeEnergy(i) ;
-    tau = LowEdgeEnergy/proton_mass_c2 ;
+    LowEdgeEnergy = fParticleEnergyVector->GetLowEdgeEnergy(i) ;
+    tau = LowEdgeEnergy/fMass ;
     //    if(tau < 0.01)  tau = 0.01 ;
     gamma = tau +1. ;
     // G4cout<<"gamma = "<<gamma<<endl ;
-    bg2 = tau*(tau + 2. ) ;
-    massRatio = electron_mass_c2/proton_mass_c2 ;
-    Tmax = 2.*electron_mass_c2*bg2/(1.+2.*gamma*massRatio+massRatio*massRatio) ;
+    bg2 = tau*( tau + 2. );
+
+    if(p->GetParticleName() == "e-")
+    {
+      Tmax = 0.5*LowEdgeEnergy;
+    }
+    else if(p->GetParticleName() == "e+")
+    {
+      Tmax = LowEdgeEnergy;   // Unclear??
+    }
+    else
+    {
+      massRatio = electron_mass_c2/fMass ;
+      Tmax = 2.*electron_mass_c2*bg2/(1. + 2.*gamma*massRatio+massRatio*massRatio);
+    }
+
+
     // G4cout<<"proton Tkin = "<<LowEdgeEnergy/MeV<<" MeV"
     // <<" Tmax = "<<Tmax/MeV<<" MeV"<<G4endl;
     // Tkin = DeltaCutInKineticEnergyNow ;
@@ -472,7 +493,7 @@ G4double G4PAIModel::ComputeDEDX(const G4MaterialCutsCouple* matCC,
 {
   G4int iTkin,iPlace;
   size_t jMat;
-  G4double massRatio  = proton_mass_c2/p->GetPDGMass();
+  G4double massRatio  = fMass/p->GetPDGMass();
   G4double scaledTkin = kineticEnergy*massRatio;
   G4double charge     = p->GetPDGCharge();
   G4double charge2    = charge*charge, dEdx;
@@ -487,7 +508,7 @@ G4double G4PAIModel::ComputeDEDX(const G4MaterialCutsCouple* matCC,
   fdEdxVector = fdEdxTable[jMat];
   for(iTkin = 0 ; iTkin < fTotBin ; iTkin++)
   {
-    if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin)) break ;    
+    if(scaledTkin < fParticleEnergyVector->GetLowEdgeEnergy(iTkin)) break ;    
   }
   iPlace = iTkin - 1;
   if(iPlace < 0) iPlace = 0;
@@ -508,7 +529,7 @@ G4double G4PAIModel::CrossSection( const G4MaterialCutsCouple* matCC,
   G4int iTkin,iPlace;
   size_t jMat;
   G4double tmax = min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
-  G4double massRatio  = proton_mass_c2/p->GetPDGMass();
+  G4double massRatio  = fMass/p->GetPDGMass();
   G4double scaledTkin = kineticEnergy*massRatio;
   G4double charge     = p->GetPDGCharge();
   G4double charge2    = charge*charge, cross, cross1, cross2;
@@ -523,7 +544,7 @@ G4double G4PAIModel::CrossSection( const G4MaterialCutsCouple* matCC,
 
   for(iTkin = 0 ; iTkin < fTotBin ; iTkin++)
   {
-    if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin)) break ;    
+    if(scaledTkin < fParticleEnergyVector->GetLowEdgeEnergy(iTkin)) break ;    
   }
   iPlace = iTkin - 1;
   if(iPlace < 0) iPlace = 0;
@@ -573,7 +594,7 @@ G4PAIModel::SampleSecondaries( const G4MaterialCutsCouple* matCC,
   G4double particleMass  = dp->GetMass();
   G4double kineticEnergy = dp->GetKineticEnergy();
 
-  G4double massRatio     = proton_mass_c2/particleMass;
+  G4double massRatio     = fMass/particleMass;
   G4double scaledTkin    = kineticEnergy*massRatio;
   G4double totalEnergy   = kineticEnergy + particleMass;
   G4double pSquare       = kineticEnergy*(totalEnergy+particleMass);
@@ -586,6 +607,7 @@ G4PAIModel::SampleSecondaries( const G4MaterialCutsCouple* matCC,
   {
     G4cout<<"Tkin of secondary e- <= 0."<<G4endl;
     G4cout<<"G4PAIModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
+    G4cout<<"G4PAIModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
     // deltaTkin = 10*eV;
     G4cout<<"Set G4PAIModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
   }
@@ -594,7 +616,8 @@ G4PAIModel::SampleSecondaries( const G4MaterialCutsCouple* matCC,
   if(deltaTkin > kineticEnergy && 
      particleMass != electron_mass_c2) deltaTkin = kineticEnergy;
   if (deltaTkin > 0.5*kineticEnergy && 
-     dp->GetDefinition()->GetParticleName() == "e-") deltaTkin = 0.5*kineticEnergy;
+     (dp->GetDefinition()->GetParticleName() == "e-" || 
+     dp->GetDefinition()->GetParticleName() == "e+")    ) deltaTkin = 0.5*kineticEnergy;
 
   G4double deltaTotalMomentum = sqrt(deltaTkin*(deltaTkin + 2. * electron_mass_c2 ));
   G4double totalMomentum      = sqrt(pSquare);
@@ -650,7 +673,7 @@ G4PAIModel::GetPostStepTransfer( G4double scaledTkin )
 
   for(iTkin=0;iTkin<fTotBin;iTkin++)
   {
-    if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))  break ;
+    if(scaledTkin < fParticleEnergyVector->GetLowEdgeEnergy(iTkin))  break ;
   }
   iPlace = iTkin - 1 ;
   // G4cout<<"from search, iPlace = "<<iPlace<<G4endl ;
@@ -687,8 +710,8 @@ G4PAIModel::GetPostStepTransfer( G4double scaledTkin )
     } 
     else // general case: Tkin between two vectors of the material
     {
-      E1 = fProtonEnergyVector->GetLowEdgeEnergy(iTkin - 1) ; 
-      E2 = fProtonEnergyVector->GetLowEdgeEnergy(iTkin)     ;
+      E1 = fParticleEnergyVector->GetLowEdgeEnergy(iTkin - 1) ; 
+      E2 = fParticleEnergyVector->GetLowEdgeEnergy(iTkin)     ;
       W  = 1.0/(E2 - E1) ;
       W1 = (E2 - scaledTkin)*W ;
       W2 = (scaledTkin - E1)*W ;
@@ -782,16 +805,17 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
   G4double position, E1, E2, W1, W2, W, dNdxCut1, dNdxCut2, meanNumber;
   G4bool numb = true;
   G4double Tkin       = aParticle->GetKineticEnergy() ;
-  G4double MassRatio  = proton_mass_c2/aParticle->GetDefinition()->GetPDGMass() ;
+  G4double MassRatio  = fMass/aParticle->GetDefinition()->GetPDGMass() ;
   G4double charge     = aParticle->GetDefinition()->GetPDGCharge() ;
   charge2             = charge*charge ;
   G4double TkinScaled = Tkin*MassRatio ;
 
   for(iTkin=0;iTkin<fTotBin;iTkin++)
   {
-    if(TkinScaled < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))   break ;
+    if(TkinScaled < fParticleEnergyVector->GetLowEdgeEnergy(iTkin))   break ;
   }
   iPlace = iTkin - 1 ; 
+  if(iPlace < 0) iPlace = 0;
   //  G4cout<<"from search, iPlace = "<<iPlace<<G4endl ;
   dNdxCut1 = (*fdNdxCutVector)(iPlace) ;  
   //  G4cout<<"dNdxCut1 = "<<dNdxCut1<<G4endl ;
@@ -871,8 +895,8 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
     } 
     else // general case: Tkin between two vectors of the material
     {
-      E1 = fProtonEnergyVector->GetLowEdgeEnergy(iTkin - 1) ; 
-      E2 = fProtonEnergyVector->GetLowEdgeEnergy(iTkin)     ;
+      E1 = fParticleEnergyVector->GetLowEdgeEnergy(iTkin - 1) ; 
+      E2 = fParticleEnergyVector->GetLowEdgeEnergy(iTkin)     ;
        W = 1.0/(E2 - E1) ;
       W1 = (E2 - TkinScaled)*W ;
       W2 = (TkinScaled - E1)*W ;
diff --git a/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc b/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc
index 9338a66ed2949d0612d33f6e78ac9ef6d4f1854e..3d3b18d76dde350dc5edb17e79d98787f47c24c4 100644
--- a/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc
+++ b/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4eCoulombScatteringModel.cc,v 1.2 2006/06/29 19:53:49 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4eCoulombScatteringModel.cc,v 1.8 2006/08/10 11:57:52 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -38,6 +38,9 @@
 // Creation date: 22.08.2005
 //
 // Modifications:
+// 01.08.06 V.Ivanchenko extend upper limit of table to TeV and review the
+//          logic of building - only elements from G4ElementTable
+// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
 //
 // Class Description:
 //
@@ -49,6 +52,7 @@
 #include "G4eCoulombScatteringModel.hh"
 #include "Randomize.hh"
 #include "G4DataVector.hh"
+#include "G4ElementTable.hh"
 #include "G4PhysicsLogVector.hh"
 #include "G4ParticleChangeForGamma.hh"
 
@@ -63,17 +67,18 @@ G4eCoulombScatteringModel::G4eCoulombScatteringModel(
     theCrossSectionTable(0),
     cosThetaMin(cos(thetaMin)),
     cosThetaMax(cos(thetaMax)),
-    lowMomentum(keV),
-    highMomentum(MeV),
+    lowKEnergy(keV),
+    highKEnergy(TeV),
     q2Limit(tlim),
+    alpha2(fine_structure_const*fine_structure_const),
+    faclim(10.0),
     nbins(12),
     nmax(100),
     buildTable(build),
     isInitialised(false)
 {
-  G4double p0 = hbarc/(Bohr_radius*0.885);
-  a0 = 0.25*p0*p0;
-  p0 = electron_mass_c2*classic_electr_radius;
+  a0 = alpha2*electron_mass_c2*electron_mass_c2/(0.885*0.885);
+  G4double p0 = electron_mass_c2*classic_electr_radius;
   coeff = twopi*p0*p0;
 }
 
@@ -90,38 +95,38 @@ G4eCoulombScatteringModel::~G4eCoulombScatteringModel()
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
 void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
-					  const G4DataVector&)
+					   const G4DataVector&)
 {
   if(isInitialised) return;
   isInitialised = true;
 
   if(pParticleChange)
-    fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
+    fParticleChange = 
+      reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
   else
     fParticleChange = new G4ParticleChangeForGamma();
 
   if(!buildTable || p->GetParticleName() == "GenericIon") return;
 
   // Compute cross section multiplied by Ptot^2*beta^2
-  G4double mass  = p->GetPDGMass();
-  G4double mass2 = mass*mass;
-
-  theCrossSectionTable = new G4PhysicsTable(nmax);
+  theCrossSectionTable = new G4PhysicsTable();
   G4PhysicsLogVector* ptrVector;
-  G4double mom2, value;
-  G4double pmin = lowMomentum*lowMomentum;
-  G4double pmax = highMomentum*highMomentum;
-  nbins = G4int(log10(pmax/pmin)/2.0) + 1;
+  G4double e, value;
+  nbins = 2*G4int(log10(highKEnergy/lowKEnergy));
 
-  for(G4int j=1; j<nmax; j++) { 
+  const  G4ElementTable* elmt = G4Element::GetElementTable();
+  size_t nelm =  G4Element::GetNumberOfElements();
 
-    ptrVector  = new G4PhysicsLogVector(pmin, pmax, nbins);
- 
+  for(size_t j=0; j<nelm; j++) { 
+
+    ptrVector  = new G4PhysicsLogVector(lowKEnergy, highKEnergy, nbins);
+    const G4Element* elm = (*elmt)[j]; 
+    G4double Z =  elm->GetZ();
+    index[G4int(Z)] = j;
     for(G4int i=0; i<=nbins; i++) {
-      mom2   = ptrVector->GetLowEdgeEnergy( i ) ;
-      value  = CalculateCrossSectionPerAtom(p, mom2, j);  
-      value *= mom2*mom2/(mom2 + mass2);
-      ptrVector->PutValue( i, value );
+      e     = ptrVector->GetLowEdgeEnergy( i ) ;
+      value = CalculateCrossSectionPerAtom(p, e, Z);  
+      ptrVector->PutValue( i, log(value) );
     }
 
     theCrossSectionTable->insert(ptrVector);
@@ -132,22 +137,39 @@ void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
 
 G4double G4eCoulombScatteringModel::CalculateCrossSectionPerAtom(
 		             const G4ParticleDefinition* p,      
-			     G4double momentum2, 
+			     G4double kinEnergy, 
 			     G4double Z)
 {
   G4double cross = 0.0;
   G4double m     = p->GetPDGMass();
-  G4double q     = p->GetPDGCharge()/eplus;
-  G4double mass2 = m*m;
-  G4double costm = std::max(cosThetaMax, 1.0 - q2Limit/2.0*momentum2);
+  G4double mom2  = kinEnergy*(kinEnergy + 2.0*m);
+  G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
   if(costm < cosThetaMin) {
-    G4double invbeta2 = 1.0 +  mass2/momentum2;
-    G4double a = 2.0*pow(Z,0.666666667)*a0*
-      (1.13 + 3.76*invbeta2*Z*Z*fine_structure_const*fine_structure_const)/momentum2 + 1.0;
-    cross = coeff*q*q*Z*Z*(cosThetaMin - costm)/((a - cosThetaMin)*(a - costm));
+    G4double q        = p->GetPDGCharge()/eplus;
+    G4double Z2       = Z*Z*q*q;
+    G4double invbeta2 = 1.0 +  m*m/mom2;
+    G4double fac = std::min(faclim, 1.13 + 3.76*invbeta2*Z2*alpha2);
+    G4double A = pow(Z,0.6666667)*a0*fac/mom2;
+    G4double a = 2.0*A + 1.0;
+    cross = coeff*Z2*invbeta2*(cosThetaMin - costm)/
+      ((a - cosThetaMin)*(a - costm)*mom2);
+    /*
+    if(Z == 13 || Z == 79) {
+      G4cout << "## e= " << kinEnergy << "  beta= " << sqrt (1.0/invbeta2)
+	     <<"  Z= " << Z 
+	     << " sig(bn)= " << cross/barn 
+	     << "  cosMax= " <<  costm 
+	     << "  cosMin= " <<  cosThetaMin 
+	     << G4endl;
+      G4double atommass = 27.0;
+      if(Z == 79) atommass = 197.0;
+      G4double u0 = 1.e+6*atommass*cm2/(cross*Avogadro);
+      G4double u1 = 0.5*u0/( A* ( (1.0 + A)*log(1.0 + 1.0/A) -1.0 ) );
+      G4cout << "  l0= " << u0 << "  l1= " << u1 
+	     << "   A= " << A << G4endl;
+    }
+    */
   }
-  //G4cout << "p= " << sqrt(momentum2) << "  Z= " << Z << "  a= " << a 
-  //<< " cross= " << cross << " " <<G4endl;
   return cross;
 }
 
@@ -164,25 +186,43 @@ std::vector<G4DynamicParticle*>* G4eCoulombScatteringModel::SampleSecondaries(
   
   G4double mass      = dp->GetMass();
   G4double kinEnergy = dp->GetKineticEnergy();
-  G4double momentum2 = kinEnergy*(kinEnergy + 2.0*mass);
-  G4double invbeta2  = (kinEnergy + mass)*(kinEnergy + mass)/momentum2;
+  G4double mom2      = kinEnergy*(kinEnergy + 2.0*mass);
 
   const G4Element* elm = SelectRandomAtom(aMaterial, p, kinEnergy);
   G4double Z  = elm->GetZ();
+  G4double q  = p->GetPDGCharge()/eplus;
+  G4double Z2 = Z*Z*q*q;
 
-  G4double a = 2.*pow(Z,0.666666667)*a0*
-    (1.13 + 3.76*invbeta2*Z*Z*fine_structure_const*fine_structure_const)/momentum2 + 1.0;
-  G4double costm = std::max(cosThetaMax, 1.0 - q2Limit/2.0*momentum2);
+  G4double invbeta2  = 1.0 + mass*mass/mom2;
+  G4double fac = std::min(faclim, 1.13 + 3.76*invbeta2*Z2*alpha2);
+  G4double a = 2.*pow(Z,0.666666667)*a0*fac/mom2;
+  G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
   if(costm > cosThetaMin) return 0; 
-
-  G4double cost = a - (a - cosThetaMin)*(a - costm)/
-    (a - cosThetaMin + G4UniformRand()*(cosThetaMin - costm));
+  /*
+  G4double cost = a - (a - costm)/
+    (1.0 + G4UniformRand()*(cosThetaMin - costm)/(a - cosThetaMin));
   if(std::abs(cost) > 1.) {
-    G4cout << "G4eCoulombScatteringModel::SampleSecondaries WARNING cost= " << cost << G4endl;
+    G4cout << "G4eCoulombScatteringModel::SampleSecondaries WARNING cost= " 
+	   << cost << G4endl;
     if(cost < -1.) cost = -1.0;
     else           cost =  1.0;
   }
   G4double sint = sqrt((1.0 + cost)*(1.0 - cost));
+  */
+  G4double c1  = 1.0 - costm;
+  G4double c2  = 1.0 - cosThetaMin;
+  G4double x   = G4UniformRand();
+  G4double y   = (a + c2)/(c1 - c2);
+  G4double st2 = 0.5*(c1*y - a*x)/(y + x); 
+  if(st2 < 0.0) {
+    G4cout << "G4eCoulombScatteringModel::SampleSecondaries WARNING st2= " 
+	   << st2 << G4endl;
+    st2 = 0.0;
+  }
+
+  G4double tet = 2.0*asin(sqrt(st2));
+  G4double cost= cos(tet);
+  G4double sint= sin(tet);
 
   G4double phi  = twopi * G4UniformRand();
 
@@ -190,7 +230,7 @@ std::vector<G4DynamicParticle*>* G4eCoulombScatteringModel::SampleSecondaries(
   G4ThreeVector newDirection(cos(phi)*sint,sin(phi)*sint,cost);
   newDirection.rotateUz(direction);   
 
-  fParticleChange->ProposeMomentumDirection(direction);   
+  fParticleChange->ProposeMomentumDirection(newDirection);   
  
   return 0;
 }
diff --git a/source/processes/electromagnetic/standard/src/G4eeToTwoGammaModel.cc b/source/processes/electromagnetic/standard/src/G4eeToTwoGammaModel.cc
index 0cd50e1f65cc8da54c1e622e219d6f78013f3396..cd2ebeb4687b705a5c79599cef5509fbbe5a76d9 100644
--- a/source/processes/electromagnetic/standard/src/G4eeToTwoGammaModel.cc
+++ b/source/processes/electromagnetic/standard/src/G4eeToTwoGammaModel.cc
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4eeToTwoGammaModel.cc,v 1.10 2006/06/29 19:53:55 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4eeToTwoGammaModel.cc,v 1.11 2006/08/29 20:02:04 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -38,9 +38,10 @@
 // Creation date: 02.08.2004
 //
 // Modifications:
-// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
-// 18-04-05 Compute CrossSectionPerVolume (V.Ivantchenko)
+// 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
+// 18-04-05 Compute CrossSectionPerVolume (V.Ivanchenko)
 // 06-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
+// 29-06-06 Fix problem for zero energy incident positron (V.Ivanchenko) 
 //
 //
 // Class Description:
@@ -151,66 +152,96 @@ vector<G4DynamicParticle*>* G4eeToTwoGammaModel::SampleSecondaries(
                                    G4double,
                                    G4double)
 {
-  G4double PositKinEnergy = dp->GetKineticEnergy();
-  G4ThreeVector PositDirection = dp->GetMomentumDirection();
-
-  G4double tau     = PositKinEnergy/electron_mass_c2;
-  G4double gam     = tau + 1.0;
-  G4double tau2    = tau + 2.0;
-  G4double sqgrate = sqrt(tau/tau2)*0.5;
-  G4double sqg2m1  = sqrt(tau*tau2);
-
-  // limits of the energy sampling
-  G4double epsilmin = 0.5 - sqgrate;
-  G4double epsilmax = 0.5 + sqgrate;
-  G4double epsilqot = epsilmax/epsilmin;
-
-  //
-  // sample the energy rate of the created gammas
-  //
-  G4double epsil, greject;
-
-  do {
-     epsil = epsilmin*pow(epsilqot,G4UniformRand());
-     greject = 1. - epsil + (2.*gam*epsil-1.)/(epsil*tau2*tau2);
-  } while( greject < G4UniformRand() );
-
-  //
-  // scattered Gamma angles. ( Z - axis along the parent positron)
-  //
-
-  G4double cost = (epsil*tau2-1.)/(epsil*sqg2m1);
-  G4double sint = sqrt((1.+cost)*(1.-cost));
-  G4double phi  = twopi * G4UniformRand();
-
-  G4double dirx = sint*cos(phi) , diry = sint*sin(phi) , dirz = cost;
-
-  //
-  // kinematic of the created pair
-  //
-
-  G4double TotalAvailableEnergy = PositKinEnergy + 2.0*electron_mass_c2;
-  G4double Phot1Energy = epsil*TotalAvailableEnergy;
-
   vector<G4DynamicParticle*>* vdp = new vector<G4DynamicParticle*>;
+  G4double PositKinEnergy = dp->GetKineticEnergy();
 
-  G4ThreeVector Phot1Direction (dirx, diry, dirz);
-  Phot1Direction.rotateUz(PositDirection);
-  G4DynamicParticle* aParticle1 = new G4DynamicParticle (G4Gamma::Gamma(),
-                                                 Phot1Direction, Phot1Energy);
-  vdp->push_back(aParticle1);
-
-  G4double Phot2Energy =(1.-epsil)*TotalAvailableEnergy;
-  G4double Eratio= Phot1Energy/Phot2Energy;
-  G4double PositP= sqrt(PositKinEnergy*(PositKinEnergy+2.*electron_mass_c2));
-  G4ThreeVector Phot2Direction (-dirx*Eratio, -diry*Eratio,
-                                    (PositP-dirz*Phot1Energy)/Phot2Energy);
-  Phot2Direction.unit();
-  Phot2Direction.rotateUz(PositDirection);
-  // create G4DynamicParticle object for the particle2
-  G4DynamicParticle* aParticle2= new G4DynamicParticle (G4Gamma::Gamma(),
-                                                 Phot2Direction, Phot2Energy);
-  vdp->push_back(aParticle2);
+  // Case at rest
+  if(PositKinEnergy == 0.0) {
+    G4double cost = 2.*G4UniformRand()-1.;
+    G4double sint = sqrt((1. - cost)*(1. + cost));
+    G4double phi  = twopi * G4UniformRand();
+    G4ThreeVector dir (sint*cos(phi), sint*sin(phi), cost);
+    G4DynamicParticle* aGamma1 = new G4DynamicParticle(G4Gamma::Gamma(),
+						       dir, electron_mass_c2);
+    G4DynamicParticle* aGamma2 = new G4DynamicParticle(G4Gamma::Gamma(),
+						       -dir, electron_mass_c2);
+    vdp->push_back(aGamma1);
+    vdp->push_back(aGamma2);
+
+  } else {
+
+    G4ThreeVector PositDirection = dp->GetMomentumDirection();
+
+    G4double tau     = PositKinEnergy/electron_mass_c2;
+    G4double gam     = tau + 1.0;
+    G4double tau2    = tau + 2.0;
+    G4double sqgrate = sqrt(tau/tau2)*0.5;
+    G4double sqg2m1  = sqrt(tau*tau2);
+
+    // limits of the energy sampling
+    G4double epsilmin = 0.5 - sqgrate;
+    G4double epsilmax = 0.5 + sqgrate;
+    G4double epsilqot = epsilmax/epsilmin;
+
+    //
+    // sample the energy rate of the created gammas
+    //
+    G4double epsil, greject;
+
+    do {
+      epsil = epsilmin*pow(epsilqot,G4UniformRand());
+      greject = 1. - epsil + (2.*gam*epsil-1.)/(epsil*tau2*tau2);
+    } while( greject < G4UniformRand() );
+
+    //
+    // scattered Gamma angles. ( Z - axis along the parent positron)
+    //
+
+    G4double cost = (epsil*tau2-1.)/(epsil*sqg2m1);
+    if(std::abs(cost) > 1.0) {
+      G4cout << "### G4eeToTwoGammaModel WARNING cost= " << cost
+	     << " positron Ekin(MeV)= " << PositKinEnergy
+	     << " gamma epsil= " << epsil
+	     << G4endl;
+      if(cost > 1.0) cost = 1.0;
+      else cost = -1.0; 
+    }
+    G4double sint = sqrt((1.+cost)*(1.-cost));
+    G4double phi  = twopi * G4UniformRand();
+
+    G4double dirx = sint*cos(phi) , diry = sint*sin(phi) , dirz = cost;
+
+    //
+    // kinematic of the created pair
+    //
+
+    G4double TotalAvailableEnergy = PositKinEnergy + 2.0*electron_mass_c2;
+    G4double Phot1Energy = epsil*TotalAvailableEnergy;
+
+    G4ThreeVector Phot1Direction (dirx, diry, dirz);
+    Phot1Direction.rotateUz(PositDirection);
+    G4DynamicParticle* aGamma1 = new G4DynamicParticle (G4Gamma::Gamma(),
+							Phot1Direction, Phot1Energy);
+    vdp->push_back(aGamma1);
+
+    G4double Phot2Energy =(1.-epsil)*TotalAvailableEnergy;
+    G4double PositP= sqrt(PositKinEnergy*(PositKinEnergy+2.*electron_mass_c2));
+    G4ThreeVector dir = PositDirection*PositP - Phot1Direction*Phot1Energy;
+    G4ThreeVector Phot2Direction = dir.unit();
+
+    // create G4DynamicParticle object for the particle2
+    G4DynamicParticle* aGamma2= new G4DynamicParticle (G4Gamma::Gamma(),
+						       Phot2Direction, Phot2Energy);
+    vdp->push_back(aGamma2);
+    /*
+      G4cout << "Annihilation in fly: e0= " << PositKinEnergy
+      << " m= " << electron_mass_c2
+      << " e1= " << Phot1Energy 
+      << " e2= " << Phot2Energy << " dir= " <<  dir 
+      << " -> " << Phot1Direction << " " 
+      << Phot2Direction << G4endl;
+    */
+  }
   return vdp;
 }
 
diff --git a/source/processes/electromagnetic/standard/src/G4eplusAnnihilation52.cc b/source/processes/electromagnetic/standard/src/G4eplusAnnihilation52.cc
index 4be7359dfcd24b7420f3aefd96b3315a1d11c13c..dd35f80c55a43ed28c0d97efe2fe187b0fda2c4c 100644
--- a/source/processes/electromagnetic/standard/src/G4eplusAnnihilation52.cc
+++ b/source/processes/electromagnetic/standard/src/G4eplusAnnihilation52.cc
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4eplusAnnihilation52.cc,v 1.2 2006/06/29 19:53:59 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4eplusAnnihilation52.cc,v 1.3 2006/10/16 15:26:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
@@ -298,7 +298,8 @@ G4VParticleChange* G4eplusAnnihilation52::PostStepDoIt(const G4Track& aTrack,
 
    // Do not make anything if particle is stopped, the Annihilation52 then
    // should be performed by the AtRestDoIt!
-   if (aTrack.GetTrackStatus() == fStopButAlive) return &aParticleChange;
+   if (aTrack.GetTrackStatus() == fStopButAlive || PositKinEnergy == 0.0) 
+     return &aParticleChange;
 
    G4double gamam1 = PositKinEnergy/electron_mass_c2;
    G4double gama   = gamam1+1. , gamap1 = gamam1+2.;
@@ -493,6 +494,8 @@ void G4eplusAnnihilation52::PrintInfoDefinition()
 	           << G4BestUnit(LowestEnergyLimit ,"Energy")
          << " to " << G4BestUnit(HighestEnergyLimit,"Energy") 
          << " in " << NumbBinTable << " bins. \n";
+  G4cout << "        WARNING: This process is obsolete and will be soon removed" 
+	 << G4endl;
 }         
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
diff --git a/source/processes/electromagnetic/utils/History b/source/processes/electromagnetic/utils/History
index 3e58bf5893cb6fb481f02a5bb0bd4c572d3ccf92..e34997bbc76bbf6e8119aa9cdd9bcd82c521ea4c 100644
--- a/source/processes/electromagnetic/utils/History
+++ b/source/processes/electromagnetic/utils/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.254 2006/07/05 17:44:51 vnivanch Exp $
+$Id: History,v 1.255 2006/08/15 16:21:39 vnivanch Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -17,8 +17,12 @@ committal in the CVS repository !
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+15 June 06: V.Ivant (emutils-V08-01-01)
+- G4VEnergyLossProcess - make protected LambdaPhysicsVector method
+- G4ionEffectiveCharge - add protection for NULL pointer to material
+
 05 July 06: V.Ivant (emutils-V08-01-00)
-- G$LossTableManager - do not clear loss table map to avoid crash for
+- G4LossTableManager - do not clear loss table map to avoid crash for
                        activate/desactivate regime with ion gun, 
                        propagate 'RandomStep' flag to processes
 
diff --git a/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh b/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh
index c614771c02fb150000d4683a60e69477d5dc12e1..9a48922346521800be053414d7cabce24cfcd2d4 100644
--- a/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh
+++ b/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4VEnergyLossProcess.hh,v 1.56 2006/06/29 19:54:49 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4VEnergyLossProcess.hh,v 1.57 2006/08/15 16:21:39 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -335,13 +335,14 @@ protected:
 
   G4double GetCurrentRange() const;
 
+  G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, G4double cut);
+
 private:
 
   // Clear tables
   void Clear();
 
   void DefineMaterial(const G4MaterialCutsCouple* couple);
-  G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, G4double cut);
 
   // Returnd values for scaled energy and base particles mass
   //
diff --git a/source/processes/electromagnetic/utils/include/G4ionEffectiveCharge.hh b/source/processes/electromagnetic/utils/include/G4ionEffectiveCharge.hh
index f60c733c31e0c798f88be68018a692af34c53608..4b52b9deeaa974ef81610289d50632ca628972a4 100644
--- a/source/processes/electromagnetic/utils/include/G4ionEffectiveCharge.hh
+++ b/source/processes/electromagnetic/utils/include/G4ionEffectiveCharge.hh
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4ionEffectiveCharge.hh,v 1.7 2006/06/29 19:54:53 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4ionEffectiveCharge.hh,v 1.8 2006/08/15 16:21:39 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -99,8 +99,8 @@ inline G4double G4ionEffectiveCharge::EffectiveChargeSquareRatio(
                            const G4Material* material,
 			         G4double kineticEnergy)
 {
-  G4double charge = EffectiveCharge(p,material,kineticEnergy)*chargeCorrection
-                  / eplus;
+  G4double charge = EffectiveCharge(p,material,kineticEnergy)/eplus;
+  charge *= chargeCorrection;
 
   return charge*charge;
 }
diff --git a/source/processes/electromagnetic/utils/src/G4LossTableManager.cc b/source/processes/electromagnetic/utils/src/G4LossTableManager.cc
index 1e3be2295b544384e38351d2a8223bef96b96d65..ab51bc196930f63432ed578c85b11f476634a0ab 100644
--- a/source/processes/electromagnetic/utils/src/G4LossTableManager.cc
+++ b/source/processes/electromagnetic/utils/src/G4LossTableManager.cc
@@ -21,7 +21,7 @@
 // ********************************************************************
 //
 // $Id: G4LossTableManager.cc,v 1.74 2006/07/05 17:44:51 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
diff --git a/source/processes/electromagnetic/utils/src/G4ionEffectiveCharge.cc b/source/processes/electromagnetic/utils/src/G4ionEffectiveCharge.cc
index 10876ea1902b31aed2d7fe2650d8eb6d1bd6294d..0fab48550eb45be1540955ed92c9ac82c501fb4a 100644
--- a/source/processes/electromagnetic/utils/src/G4ionEffectiveCharge.cc
+++ b/source/processes/electromagnetic/utils/src/G4ionEffectiveCharge.cc
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4ionEffectiveCharge.cc,v 1.13 2006/06/29 19:55:27 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4ionEffectiveCharge.cc,v 1.14 2006/08/15 16:21:39 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // -------------------------------------------------------------------
 //
@@ -42,6 +42,7 @@
 // 25.01.2005 Add protection - min Charge 0.1 eplus (V.Ivanchenko) 
 // 28.04.2006 Set upper energy limit to 50 MeV (V.Ivanchenko) 
 // 23.05.2006 Set upper energy limit to Z*10 MeV (V.Ivanchenko) 
+// 15.08.2006 Add protection for not defined material (V.Ivanchenko) 
 //
 
 // -------------------------------------------------------------------
@@ -89,7 +90,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
   // Vol.1, Pergamon Press, 1985
   // Fast ions or hadrons
   G4double reducedEnergy = kineticEnergy * proton_mass_c2/mass ;
-  if( reducedEnergy > Zi*energyHighLimit || Zi < 1.5 ) return charge;
+  if( reducedEnergy > Zi*energyHighLimit || Zi < 1.5 || !material) return charge;
 
   static G4double vFermi[92] = {
     1.0309,  0.15976, 0.59782, 1.0781,  1.0486,  1.0,     1.058,   0.93942, 0.74562, 0.3424,
diff --git a/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadron.hh b/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadron.hh
index bc3d24574a826e188338e5401db904db7df1be44..3299967660941aa0d904e4d0a618bb6c13ae8745 100644
--- a/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadron.hh
+++ b/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadron.hh
@@ -25,7 +25,7 @@
 //
 //
 // $Id: G4QHadron.hh,v 1.32 2006/07/05 08:24:16 mkossov Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //      ---------------- G4QHadron ----------------
 //             by Mikhail Kossov, Sept 1999.
diff --git a/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QEnvironment.cc b/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QEnvironment.cc
index 2affe35916c5b3b68214698fa4bb16ab8f6c846f..0804220877650d9c324baeb9c1a13949df3aa077 100644
--- a/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QEnvironment.cc
+++ b/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QEnvironment.cc
@@ -28,7 +28,7 @@
 //
 //
 // $Id: G4QEnvironment.cc,v 1.113 2006/07/05 08:24:16 mkossov Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //      ---------------- G4QEnvironment ----------------
 //             by Mikhail Kossov, August 2000.
diff --git a/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QHadron.cc b/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QHadron.cc
index 8e1274806870e8d02dda53d10096a9cf13192e0c..df36de49737c83b18868bbcf6c35a00770a99f8f 100644
--- a/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QHadron.cc
+++ b/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QHadron.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: G4QHadron.cc,v 1.43 2006/07/05 08:24:17 mkossov Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //      ---------------- G4QHadron ----------------
 //             by Mikhail Kossov, Sept 1999.
diff --git a/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4Quasmon.cc b/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4Quasmon.cc
index f0797a4ad22cb0d021c4762e2db53d16b23751d2..35896128890b4fafe2867324b90828213693b6c5 100644
--- a/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4Quasmon.cc
+++ b/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4Quasmon.cc
@@ -28,7 +28,7 @@
 //
 //
 // $Id: G4Quasmon.cc,v 1.88 2006/07/05 08:24:17 mkossov Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //      ---------------- G4Quasmon ----------------
 //             by Mikhail Kossov, July 1999.
diff --git a/source/processes/hadronic/models/coherent_elastic/History b/source/processes/hadronic/models/coherent_elastic/History
index 08f73ce02d394b06feeede88dbcecbd74dba099b..9a34b8c9835c44eacf14310d03ee9c0c77fe1650 100644
--- a/source/processes/hadronic/models/coherent_elastic/History
+++ b/source/processes/hadronic/models/coherent_elastic/History
@@ -14,6 +14,16 @@ code and to keep track of all tags.
      * Please list in reverse chronological order (last date on top)
      ---------------------------------------------------------------
 
+10 August 2006 - V.Ivanchenko (hadr-cohe-V08-01-03)
+---------------------------------------------------
+  Introduce NaN check inside G4HadronElastic, G4ChargeExchange,
+  and G4UHadronElasticProcess;  
+
+24 July 2006 - V.Ivanchenko (hadr-cohe-V08-01-02)
+-----------------------------------------------
+  Remove HP data from G4UHadronElasticProcess (it is set in physics lists)
+  Add low energy threshold for QElastic 20 MeV inside G4HadronElastic
+
 13 July 2006 - V.Ivanchenko (hadr-cohe-V08-01-01)
 -----------------------------------------------
   Fix bug: remove 1 keV limit from G4UHadronElasticProcess 
diff --git a/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchange.hh b/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchange.hh
index 3e7379f7f05ba511e626638e393755dff7b9e654..194ba1a1d0c39a9d24e36cf6c9dea47d0a0dc530 100644
--- a/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchange.hh
+++ b/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchange.hh
@@ -24,14 +24,15 @@
 // ********************************************************************
 //
 //
-// $Id: G4ChargeExchange.hh,v 1.2 2006/06/29 20:08:55 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4ChargeExchange.hh,v 1.3 2006/08/02 10:55:54 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 // G4 Model: Charge and strangness exchange based on G4LightMedia model
 //           28 May 2006 V.Ivanchenko
 //
 // Modified:
+// 25-Jul-06 V.Ivanchenko add 19 MeV low energy, below which S-wave is sampled
 //
 //
 
@@ -58,7 +59,6 @@ public:
 
   G4ChargeExchange(G4HadronElastic* hel = 0,
                    G4double elim = 100.*keV,
-	           G4double plow = 200.*MeV,
 		   G4double ehigh= GeV);
 
   virtual ~G4ChargeExchange();
@@ -67,7 +67,7 @@ public:
                    const G4HadProjectile & aTrack,
                    G4Nucleus & targetNucleus);
 
-  void SetMomentumLow(G4double value);
+  void SetKinEnergyLow(G4double value);
 
   void SetKinEnergyHigh(G4double value);
 
@@ -108,14 +108,14 @@ private:
   G4ParticleDefinition* theA;
   G4ParticleDefinition* theHe3;
 
-  G4double ekinlim;  // in MeV
-  G4double plablow;  // in MeV/c
-  G4double ekinhigh;  // in MeV/c
+  G4double ekinlim;  
+  G4double ekinlow;  
+  G4double ekinhigh;  
 };
 
-inline void G4ChargeExchange::SetMomentumLow(G4double value)
+inline void G4ChargeExchange::SetKinEnergyLow(G4double value)
 {
-  plablow = value;
+  ekinlow = value;
 }
 
 inline void G4ChargeExchange::SetKinEnergyHigh(G4double value)
diff --git a/source/processes/hadronic/models/coherent_elastic/include/G4HadronElastic.hh b/source/processes/hadronic/models/coherent_elastic/include/G4HadronElastic.hh
index 35b4fb18aa73f02c8759cd554a5fb5ed122519e4..4616c1a8721aedf0b4121befb04aab56b313d6d0 100644
--- a/source/processes/hadronic/models/coherent_elastic/include/G4HadronElastic.hh
+++ b/source/processes/hadronic/models/coherent_elastic/include/G4HadronElastic.hh
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4HadronElastic.hh,v 1.11 2006/06/29 20:09:03 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4HadronElastic.hh,v 1.15 2006/08/10 15:59:38 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 // G4 Model: Low energy elastic scattering with 4-momentum balance 
@@ -35,6 +35,7 @@
 // Modified:
 // 14-Dec-05 V.Ivanchenko rename the class
 // 13-Apr-06 V.Ivanchenko move to coherent_elastic 
+// 25-Jul-06 V.Ivanchenko add 19 MeV low energy, below which S-wave is sampled
 //
 //
 // Class Description
@@ -66,8 +67,8 @@ class G4HadronElastic : public G4HadronicInteraction
 {
 public:
 
-  G4HadronElastic(G4double elim = 100.*keV, 
-		  G4double plow = 20.*MeV, 
+  G4HadronElastic(G4double plow = 20.0*MeV,
+                  G4double elim = 100.*keV, 
 		  G4double ehigh= DBL_MAX);
 
   virtual ~G4HadronElastic();
@@ -79,7 +80,11 @@ public:
 
   G4ElasticHadrNucleusHE* GetHElastic();
 
-  void SetMomentumLow(G4double value);
+  void SetIonKinEnergyLimit(G4double value);
+
+  void SetPlabLow(G4double value);
+
+  void SetKinEnergyLow(G4double value);
 
   void SetKinEnergyHigh(G4double value);
 
@@ -107,17 +112,31 @@ private:
   const G4ParticleDefinition* theNeutron;
   const G4ParticleDefinition* theDeuteron;
   const G4ParticleDefinition* theAlpha;
-
-  G4double ekinlim;  // in MeV
-  G4double plablow;  // in MeV/c
-  G4double ekinhigh;  // in MeV/c
+  const G4ParticleDefinition* thePionPlus;
+  const G4ParticleDefinition* thePionMinus;
+
+  G4double ekinIon;  
+  G4double ekinlow;  
+  G4double ekinhigh;  
+  G4double ekinpi;  
+  G4double plablow;
 };
 
-inline void G4HadronElastic::SetMomentumLow(G4double value)
+inline void G4HadronElastic::SetIonKinEnergyLimit(G4double value)
+{
+  ekinIon = value;
+}
+
+inline void G4HadronElastic::SetPlabLow(G4double value)
 {
   plablow = value;
 }
 
+inline void G4HadronElastic::SetKinEnergyLow(G4double value)
+{
+  ekinlow = value;
+}
+
 inline void G4HadronElastic::SetKinEnergyHigh(G4double value)
 {
   ekinhigh = value;
diff --git a/source/processes/hadronic/models/coherent_elastic/include/G4UHadronElasticProcess.hh b/source/processes/hadronic/models/coherent_elastic/include/G4UHadronElasticProcess.hh
index 549de27af4dd911db0a89f5c097ce29408ce05a9..f94feb4d42586e6c39cee8957906fb4d201426c0 100644
--- a/source/processes/hadronic/models/coherent_elastic/include/G4UHadronElasticProcess.hh
+++ b/source/processes/hadronic/models/coherent_elastic/include/G4UHadronElasticProcess.hh
@@ -24,14 +24,15 @@
 // ********************************************************************
 //
 //
-// $Id: G4UHadronElasticProcess.hh,v 1.5 2006/06/29 20:09:17 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4UHadronElasticProcess.hh,v 1.9 2006/10/20 15:22:24 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // Geant4 Hadron Elastic Scattering Process -- header file
 // 
 // Created 21 April 2006 V.Ivanchenko
 //  
 // Modified:
+// 26.09.06 V.Ivanchenko add lowestEnergy
 //
 
 // Class Description
@@ -54,7 +55,7 @@ class G4UHadronElasticProcess : public G4HadronicProcess
 {
 public:
 
-  G4UHadronElasticProcess(const G4String& procName = "hElastic", G4bool fl = true);
+  G4UHadronElasticProcess(const G4String& procName = "hElastic", G4double elow = 19.*MeV);
 
   virtual ~G4UHadronElasticProcess();
  
@@ -86,12 +87,12 @@ private:
   G4Nucleus                targetNucleus;
 
   G4double        xsec[40];
-  G4double        xsecH[2];
+  G4double        xsecH[4];
   G4double        cross;
   G4double        thEnergy;
+  G4double        lowestEnergy;
 
   G4int    pPDG;
-  G4bool   flagHP;
   G4bool   first;
 };
 
diff --git a/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchange.cc b/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchange.cc
index 52d245f4c9b5b62dfe79cb50194477e99088797b..57e25a898d14f833582959c12c27a54cfc8cd406 100644
--- a/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchange.cc
+++ b/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchange.cc
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4ChargeExchange.cc,v 1.4 2006/07/06 18:10:50 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4ChargeExchange.cc,v 1.6 2006/08/10 15:44:28 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 // G4 Model: Charge and strangness exchange based on G4LightMedia model
@@ -33,6 +33,7 @@
 //
 // Modified:
 // 07-Jun-06 V.Ivanchenko fix problem of rotation of final state
+// 25-Jul-06 V.Ivanchenko add 19 MeV low energy, below which S-wave is sampled
 //
 
 #include "G4ChargeExchange.hh"
@@ -47,20 +48,21 @@
 
 
 G4ChargeExchange::G4ChargeExchange(G4HadronElastic* hel, G4double elim,
-                                   G4double plow, G4double ehigh)
+                                   G4double ehigh)
 : G4HadronicInteraction(),
   fElastic(hel),
   native(false),
   ekinlim(elim),
-  plablow(plow),
   ekinhigh(ehigh)
 {
   SetMinEnergy( 0.0*GeV );
-  SetMaxEnergy( DBL_MAX );
+  SetMaxEnergy( 100.*TeV );
+  ekinlow = 19.0*MeV;
+
   verboseLevel= 0;
   if(!fElastic) {
     native = true;
-    fElastic = new G4HadronElastic(elim, plow, ehigh);
+    fElastic = new G4HadronElastic();
   }
   qCManager   = fElastic->GetCS();
   hElastic    = fElastic->GetHElastic();
@@ -262,14 +264,12 @@ G4HadFinalState* G4ChargeExchange::ApplyYourself(
 
   // Choose generator
   G4ElasticGenerator gtype = fLElastic;
-  if ((theParticle == theProton || theParticle == theNeutron) && Z <= 2) {
+  if ((theParticle == theProton || theParticle == theNeutron) && 
+      Z <= 2 && ekin >= ekinlow) {
     gtype = fQElastic;
-    if(Z == 1 && N == 2) N = 1;
-    else if (Z == 2 && N == 1) N = 2;
-  } else if(ekin >= ekinhigh) {
-    gtype = fHElastic;
-  } else if(plab <= plablow) {
-    gtype = fSWave;
+  } else {
+    if(ekin >= ekinlow)       gtype = fSWave;
+    else if(ekin >= ekinhigh) gtype = fHElastic;
   }
 
   // Sample t
@@ -278,14 +278,41 @@ G4HadFinalState* G4ChargeExchange::ApplyYourself(
       G4cout << "G4ChargeExchange: Z= " << Z << " N= "
 	     << N << " pdg= " <<  projPDG
 	     << " mom(GeV)= " << plab/GeV << "  " << qCManager << G4endl;
+    if(Z == 1 && N == 2) N = 1;
+    else if (Z == 2 && N == 1) N = 2;
     G4double cs = qCManager->GetCrossSection(false,plab,Z,N,projPDG);
     if(cs > 0.0) t = qCManager->GetExchangeT(Z,N,projPDG);
     else gtype = fSWave;
   }
 
-  if(gtype == fSWave)         t = G4UniformRand()*tmax;
-  else if(gtype == fHElastic) t = hElastic->SampleT(theParticle,plab,Z,A);
-  else if(gtype == fLElastic) t = GeV*GeV*fElastic->SampleT(ptot,m1,m2,aTarget);
+  if(gtype == fHElastic) {
+    t = hElastic->SampleT(theParticle,plab,Z,A);
+    if(t > tmax) gtype = fSWave;
+  }
+
+  if(gtype == fLElastic) {
+    t = GeV*GeV*fElastic->SampleT(ptot,m1,m2,aTarget);
+    if(t > tmax) gtype = fSWave;
+  }
+
+  // NaN finder
+  if(!(t < 0.0 || t >= 0.0)) {
+    if (verboseLevel > -1) {
+      G4cout << "G4ChargeExchange:WARNING: Z= " << Z << " N= " 
+	     << N << " pdg= " <<  projPDG
+	     << " mom(GeV)= " << plab/GeV 
+	     << " the model type " << gtype;
+      if(gtype ==  fQElastic) G4cout << " CHIPS ";
+      else if(gtype ==  fLElastic) G4cout << " LElastic ";
+      else if(gtype ==  fHElastic) G4cout << " HElastic ";
+      G4cout << " t= " << t
+	     << " S-wave will be sampled" 
+	     << G4endl; 
+    }
+    gtype = fSWave;
+  }
+
+  if(gtype == fSWave) t = G4UniformRand()*tmax;
 
   if(verboseLevel>1)
     G4cout <<"type= " << gtype <<" t= " << t << " tmax= " << tmax
diff --git a/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchangeProcess.cc b/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchangeProcess.cc
index cddad0596fa7eb1d8017aa846d66eec2485f4fae..24d2038663a8e3feb7339d4e21e767cbc1360c6c 100644
--- a/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchangeProcess.cc
+++ b/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchangeProcess.cc
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4ChargeExchangeProcess.cc,v 1.5 2006/07/06 18:11:08 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4ChargeExchangeProcess.cc,v 1.7 2006/08/10 15:44:28 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 // Geant4 Hadron Elastic Scattering Process -- header file
@@ -35,6 +35,7 @@
 // Modified:
 // 24-Apr-06 V.Ivanchenko add neutron scattering on hydrogen from CHIPS
 // 07-Jun-06 V.Ivanchenko fix problem of rotation of final state
+// 25-Jul-06 V.Ivanchenko add 19 MeV low energy for CHIPS
 //
 //
 
@@ -56,7 +57,7 @@
 G4ChargeExchangeProcess::G4ChargeExchangeProcess(const G4String& procName)
   : G4HadronicProcess(procName), first(true)
 {
-  thEnergy = 1.*keV;
+  thEnergy = 19.*MeV;
   verboseLevel= 1;
   qCManager = 0;
   AddDataSet(new G4HadronElasticDataSet);
@@ -188,7 +189,8 @@ G4double G4ChargeExchangeProcess::GetMicroscopicCrossSection(
   if(iz == 1) return x;
   // CHIPS cross sections
   G4double momentum = dp->GetTotalMomentum();
-  if(iz <= -2 && (theParticle == theProton || theParticle == theNeutron)) {
+  if(iz == 2 && dp->GetKineticEnergy() > thEnergy &&
+     (theParticle == theProton || theParticle == theNeutron)) {
     G4double momentum = dp->GetTotalMomentum();
     if(verboseLevel>1)
       G4cout << "G4ChargeExchangeProcess compute CHIPS CS for Z= 2, N=2 "
@@ -202,6 +204,20 @@ G4double G4ChargeExchangeProcess::GetMicroscopicCrossSection(
 	     << G4endl;
     x = store->GetCrossSection(dp, elm, temp);
   }
+
+  // NaN finder
+  if(!(x < 0.0 || x >= 0.0)) {
+    if (verboseLevel > -1) {
+      G4cout << "G4ChargeExchangeProcess WARNING: Z= " << iz  
+	     << " pdg= " <<  pPDG
+	     << " mom(GeV)= " << dp->GetTotalMomentum()/GeV 
+	     << " cross= " << x 
+	     << " set to zero"
+	     << G4endl; 
+    }
+    x = 0.0;
+  }
+
   if(verboseLevel>1)
     G4cout << "G4ChargeExchangeProcess cross(mb)= " << x/millibarn
            << "  E(MeV)= " << dp->GetKineticEnergy()
diff --git a/source/processes/hadronic/models/coherent_elastic/src/G4ElasticHadrNucleusHE.cc b/source/processes/hadronic/models/coherent_elastic/src/G4ElasticHadrNucleusHE.cc
index d465ca17faee88d95de597e4fe33e56c08618beb..fc903d02c6973229b99ac81c92b6261654bc9cf0 100644
--- a/source/processes/hadronic/models/coherent_elastic/src/G4ElasticHadrNucleusHE.cc
+++ b/source/processes/hadronic/models/coherent_elastic/src/G4ElasticHadrNucleusHE.cc
@@ -25,7 +25,7 @@
 //
 //
 // $Id: G4ElasticHadrNucleusHE.cc,v 1.34 2006/07/06 18:11:11 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //G4ElasticHadrNucleusHE.cc
 //
 //
diff --git a/source/processes/hadronic/models/coherent_elastic/src/G4HadronElastic.cc b/source/processes/hadronic/models/coherent_elastic/src/G4HadronElastic.cc
index b3f32e7783762047c0a0e7df7d370b5441cad674..49075a6a167b0ffa651025b64309ed5511461a51 100644
--- a/source/processes/hadronic/models/coherent_elastic/src/G4HadronElastic.cc
+++ b/source/processes/hadronic/models/coherent_elastic/src/G4HadronElastic.cc
@@ -23,8 +23,8 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4HadronElastic.cc,v 1.20 2006/07/06 17:44:46 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4HadronElastic.cc,v 1.30 2006/10/31 18:36:04 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 // Physics model class G4HadronElastic (derived from G4LElastic)
@@ -49,6 +49,11 @@
 //           add s-wave regim below some momentum        
 // 24-Apr-06 V.Ivanchenko add neutron scattering on hydrogen from CHIPS
 // 07-Jun-06 V.Ivanchenko fix problem of rotation
+// 25-Jul-06 V.Ivanchenko add 19 MeV low energy, below which S-wave is sampled
+// 02-Aug-06 V.Ivanchenko introduce energy cut on the aria of S-wave for pions
+// 24-Aug-06 V.Ivanchenko switch on G4ElasticHadrNucleusHE
+// 31-Aug-06 V.Ivanchenko do not sample sacttering for particles with kinetic 
+//                        energy below 10 keV
 //
 
 #include "G4HadronElastic.hh"
@@ -63,16 +68,21 @@
 #include "G4Neutron.hh"
 #include "G4Deuteron.hh"
 #include "G4Alpha.hh"
+#include "G4PionPlus.hh"
+#include "G4PionMinus.hh"
 
-G4HadronElastic::G4HadronElastic(G4double elim, G4double plow, G4double ehigh) 
+G4HadronElastic::G4HadronElastic(G4double plow, G4double elim, G4double ehigh) 
   : G4HadronicInteraction()
 {
   SetMinEnergy( 0.0*GeV );
-  SetMaxEnergy( DBL_MAX );
+  SetMaxEnergy( 100.*TeV );
   verboseLevel= 0;
-  plablow     = plow;
+  ekinIon     = elim;
   ekinhigh    = ehigh;
-  ekinlim     = elim;
+  ekinlow     = 19.*MeV;
+  ekinpi      = MeV;
+  plablow     = plow;
+
   qCManager   = G4QElasticCrossSection::GetPointer();
   hElastic    = new G4ElasticHadrNucleusHE();
 
@@ -80,6 +90,8 @@ G4HadronElastic::G4HadronElastic(G4double elim, G4double plow, G4double ehigh)
   theNeutron  = G4Neutron::Neutron();
   theDeuteron = G4Deuteron::Deuteron();
   theAlpha    = G4Alpha::Alpha();
+  thePionPlus = G4PionPlus::PionPlus();
+  thePionMinus= G4PionMinus::PionMinus();
 }
 
 G4HadronElastic::~G4HadronElastic()
@@ -101,14 +113,19 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
 		 const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
 {
   theParticleChange.Clear();
+
   const G4HadProjectile* aParticle = &aTrack;
+  G4double ekin = aParticle->GetKineticEnergy();
+  if(ekin <= 10.0*keV) {
+    theParticleChange.SetEnergyChange(ekin);
+    theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
+    return &theParticleChange;
+  }
+
   G4double aTarget = targetNucleus.GetN();
   G4double zTarget = targetNucleus.GetZ();
 
-  // Elastic scattering off Hydrogen
-
   G4double plab = aParticle->GetTotalMomentum();
-  G4double ekin = aParticle->GetKineticEnergy();
   if (verboseLevel >1) 
     G4cout << "G4HadronElastic::DoIt: Incident particle plab=" 
 	   << plab/GeV << " GeV/c " 
@@ -131,7 +148,7 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
 
   G4ParticleDefinition * theDef = 0;
 
-  if(Z == 1 && A == 1) theDef = G4Proton::Proton();
+  if(Z == 1 && A == 1)       theDef = G4Proton::Proton();
   else if (Z == 1 && A == 2) theDef = G4Deuteron::Deuteron();
   else if (Z == 1 && A == 3) theDef = G4Triton::Triton();
   else if (Z == 2 && A == 3) theDef = G4He3::He3();
@@ -140,12 +157,11 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
  
   G4double m2 = theDef->GetPDGMass();
   G4LorentzVector lv1 = aParticle->Get4Momentum();
-  G4LorentzVector lv0(0.0,0.0,0.0,m2);   
-  G4LorentzVector lv  = lv0 + lv1;
+  G4LorentzVector lv(0.0,0.0,0.0,m2);   
+  lv += lv1;
 
   G4ThreeVector bst = lv.boostVector();
   lv1.boost(-bst);
-  lv0.boost(-bst);
 
   G4ThreeVector p1 = lv1.vect();
   G4double ptot = p1.mag();
@@ -154,13 +170,22 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
 
   // Choose generator
   G4ElasticGenerator gtype = fLElastic;
-  if ((theParticle == theProton || theParticle == theNeutron) && Z == 1
-    && N == 0) {
+
+  // CHIPS Elastic
+  if ((theParticle == theProton || theParticle == theNeutron) && 
+      Z <= 2 && ekin > ekinlow) {
     gtype = fQElastic;
-  } else if(ekin >= ekinhigh) {
-    gtype = fHElastic;
-  } else if(plab <= plablow) {
-    gtype = fSWave;
+  } else {
+
+    // High energy elastic 
+    if(ekin >= ekinhigh && A != 2 && A != 3 && A < 238) gtype = fHElastic;
+
+    // Simplification - s-wave
+    else if((theParticle == thePionPlus || 
+	     theParticle == thePionMinus) && 
+	    (ekin <= ekinpi) ) 
+      gtype = fSWave;
+    else if(plab <= plablow) gtype = fSWave;
   }
 
   // Sample t
@@ -169,9 +194,11 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
       G4cout << "G4HadronElastic: Z= " << Z << " N= " 
 	     << N << " pdg= " <<  projPDG
 	     << " mom(GeV)= " << plab/GeV << "  " << qCManager << G4endl; 
+    if(Z == 1 && N == 2) N = 1;
+    else if(Z == 2 && N == 1) N = 2;
     G4double cs = qCManager->GetCrossSection(false,plab,Z,N,projPDG);
     if(cs > 0.0) t = qCManager->GetExchangeT(Z,N,projPDG);
-    else gtype = fSWave;
+    else gtype = fLElastic;
   }
 
   if(gtype == fLElastic) {
@@ -184,6 +211,22 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
     if(t > tmax) gtype = fSWave;
   }
 
+  // NaN finder
+  if(!(t < 0.0 || t >= 0.0)) {
+    if (verboseLevel > 0) {
+      G4cout << "G4HadronElastic:WARNING: Z= " << Z << " N= " 
+	     << N << " pdg= " <<  projPDG
+	     << " mom(GeV)= " << plab/GeV 
+	     << " the model type " << gtype;
+      if(gtype ==  fQElastic) G4cout << " CHIPS ";
+      else if(gtype ==  fLElastic) G4cout << " LElastic ";
+      else if(gtype ==  fHElastic) G4cout << " HElastic ";
+      G4cout << " S-wave will be sampled" 
+	     << G4endl; 
+    }
+    gtype = fSWave;
+  }
+
   if(gtype == fSWave) t = G4UniformRand()*tmax;
 
   if(verboseLevel>1)
@@ -202,17 +245,14 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
   G4ThreeVector v1(sint*std::cos(phi),sint*std::sin(phi),cost);
   v1 *= ptot;
   G4LorentzVector nlv1(v1.x(),v1.y(),v1.z(),std::sqrt(ptot*ptot + m1*m1));
-  G4LorentzVector nlv0 = lv0 + lv1 - nlv1;
 
-  nlv0.boost(bst);
   nlv1.boost(bst); 
 
   G4double eFinal = nlv1.e() - m1;
   if (verboseLevel > 1) 
-    G4cout << " P0= "<< nlv0 << "   P1= "
-	   << nlv1<<" m= " << m1 << " ekin0= " << eFinal 
-	   << " ekin1= " << nlv0.e() - m2
-	   << " 4-mom " << lv1 
+    G4cout << "Scattered: "
+	   << nlv1<<" m= " << m1 << " ekin(MeV)= " << eFinal 
+	   << " Proj: 4-mom " << lv1 
 	   <<G4endl;
   if(eFinal < 0.0) {
     G4cout << "G4HadronElastic WARNING ekin= " << eFinal
@@ -222,16 +262,24 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
 	   << " on " << theDef->GetParticleName()
 	   << G4endl;
     eFinal = 0.0;
+    nlv1.setE(m1);
   }
 
   theParticleChange.SetMomentumChange(nlv1.vect().unit());
   theParticleChange.SetEnergyChange(eFinal);
   
+  G4LorentzVector nlv0 = lv - nlv1;
   G4double erec =  nlv0.e() - m2;
-  if(erec > ekinlim) {
+  if (verboseLevel > 1) 
+    G4cout << "Recoil: "
+	   << nlv0<<" m= " << m2 << " ekin(MeV)= " << erec 
+	   <<G4endl;
+
+  if(erec > ekinIon) {
     G4DynamicParticle * aSec = new G4DynamicParticle(theDef, nlv0);
     theParticleChange.AddSecondary(aSec);
   } else {
+    if(erec < 0.0) erec = 0.0;
     theParticleChange.SetLocalEnergyDeposit(erec);
   }
 
diff --git a/source/processes/hadronic/models/coherent_elastic/src/G4UHadronElasticProcess.cc b/source/processes/hadronic/models/coherent_elastic/src/G4UHadronElasticProcess.cc
index 5d8865a3269e33082cf89ca11a5585e2abfcc197..04f2adbbd8fc7f40300c09f86b82a89af598d052 100644
--- a/source/processes/hadronic/models/coherent_elastic/src/G4UHadronElasticProcess.cc
+++ b/source/processes/hadronic/models/coherent_elastic/src/G4UHadronElasticProcess.cc
@@ -23,16 +23,19 @@
 // * acceptance of all terms of the Geant4 Software license.          *
 // ********************************************************************
 //
-// $Id: G4UHadronElasticProcess.cc,v 1.18 2006/07/12 17:15:41 vnivanch Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4UHadronElasticProcess.cc,v 1.27 2006/10/26 08:44:25 vnivanch Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 // Geant4 Hadron Elastic Scattering Process -- header file
 // 
 // Created 21 April 2006 V.Ivanchenko
 //  
 // Modified:
-// 24-Apr-06 V.Ivanchenko add neutron scattering on hydrogen from CHIPS
-// 07-Jun-06 V.Ivanchenko fix problem of rotation of final state
+// 24.04.06 V.Ivanchenko add neutron scattering on hydrogen from CHIPS
+// 07.06.06 V.Ivanchenko fix problem of rotation of final state
+// 25.07.06 V.Ivanchenko add 19 MeV low energy for CHIPS
+// 26.09.06 V.Ivanchenko add lowestEnergy
+// 20.10.06 V.Ivanchenko initialise lowestEnergy=0 for neitrals, eV for charged
 //
 //
 
@@ -48,16 +51,14 @@
 #include "G4IsotopeVector.hh"
 #include "G4Neutron.hh"
 #include "G4Proton.hh"
-#include "G4NeutronHPElasticData.hh"
 #include "G4HadronElastic.hh"
  
-G4UHadronElasticProcess::G4UHadronElasticProcess(const G4String& pName, G4bool fl)
-  : G4HadronicProcess(pName), flagHP(fl), first(true)
+G4UHadronElasticProcess::G4UHadronElasticProcess(const G4String& pName, G4double elow)
+  : G4HadronicProcess(pName), thEnergy(elow), lowestEnergy(0.0), first(true)
 {
   AddDataSet(new G4HadronElasticDataSet);
   theProton = G4Proton::Proton();
   theNeutron = G4Neutron::Neutron();
-  thEnergy = 1.*keV;
   verboseLevel= 1;
   qCManager = 0;
 }
@@ -79,15 +80,22 @@ BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
     if(!qCManager) qCManager = G4QElasticCrossSection::GetPointer();
     theParticle = &aParticleType;
     pPDG = theParticle->GetPDGEncoding();
-    if(theParticle == theNeutron && flagHP) 
-      AddDataSet(new G4NeutronHPElasticData());
 
     store = G4HadronicProcess::GetCrossSectionDataStore();
+
+    // defined lowest threshold for the projectile
+    if(theParticle->GetPDGCharge() != 0.0) lowestEnergy = eV;
      
-    if(verboseLevel>1) 
+    if(verboseLevel>1 || 
+       (verboseLevel==1 && theParticle == theNeutron)) {
+      G4cout << G4endl;
       G4cout << "G4UHadronElasticProcess for " 
-	     << theParticle->GetParticleName() 
-	     << G4endl; 
+	     << theParticle->GetParticleName()
+             << " PDGcode= " << pPDG
+	     << "  Elow(MeV)= " << thEnergy/MeV 
+	     << "  Elowest(eV)= " << lowestEnergy/eV 
+	     << G4endl;
+    } 
   }
   store->BuildPhysicsTable(aParticleType);
 }
@@ -102,16 +110,11 @@ G4double G4UHadronElasticProcess::GetMeanFreePath(const G4Track& track,
   cross = 0.0;
   G4double x = DBL_MAX;
 
-  // The process is effective only above the threshold
-  //  if(dp->GetKineticEnergy() < thEnergy) return x;
-
   // Compute cross sesctions
   const G4ElementVector* theElementVector = material->GetElementVector();
   const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
   G4double temp = material->GetTemperature();
   G4int nelm   = material->GetNumberOfElements();
-  xsecH[0] = 0.0;
-  xsecH[1] = 0.0;
   if(verboseLevel>1) 
     G4cout << "G4UHadronElasticProcess get mfp for " 
 	   << theParticle->GetParticleName() 
@@ -145,42 +148,41 @@ G4double G4UHadronElasticProcess::GetMicroscopicCrossSection(
   G4int iz = G4int(elm->GetZ());
   G4double x = 0.0;
   // CHIPS cross sections
-  if(iz <= 2 && (theParticle == theProton || theParticle == theNeutron)) {
+  if(iz <= 2 && dp->GetKineticEnergy() > thEnergy && 
+     (theParticle == theProton || theParticle == theNeutron)) {
     G4double momentum = dp->GetTotalMomentum();
-    if(iz == 1) {
-      G4IsotopeVector* isv = elm->GetIsotopeVector(); 
-      G4int ni = 0;
-      if(isv) ni = isv->size();
-      if(ni > 0) {
-	G4double* ab = elm->GetRelativeAbundanceVector();
-	x = 0.0;
-	for(G4int j=0; j<ni; j++) {
-	  G4int N = elm->GetIsotope(j)->GetN() - 1;
-	  if(N == 0 || N == 1) {
-	    if(verboseLevel>1) 
-	      G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= 1, N= " 
-		     << N << " pdg= " << pPDG 
-		     << " mom(GeV)= " << momentum/GeV 
-		     << "  " << qCManager << G4endl; 
-	    G4double y = ab[j]*
-	      qCManager->GetCrossSection(false,momentum,1,N,pPDG);
-	    xsecH[N] += y;
-	    x += y;
-	  }
+    G4IsotopeVector* isv = elm->GetIsotopeVector(); 
+    G4int ni = 0;
+    if(isv) ni = isv->size();
+    //    if(iz == 1) {
+    if(ni > 0) {
+      G4double* ab = elm->GetRelativeAbundanceVector();
+      x = 0.0;
+      for(G4int j=0; j<ni; j++) {
+	G4int N = elm->GetIsotope(j)->GetN() - iz;
+	if(iz == 1) {
+	  if(N > 1) N = 1;
+	} else {
+	  N = 2;
 	}
-      } else {
 	if(verboseLevel>1) 
-	  G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= 1, N= 0" 
-		 << " pdg= " << pPDG 
-		 << " mom(GeV)= " << momentum/GeV << "  " << qCManager << G4endl; 
-	x = qCManager->GetCrossSection(false,momentum,1,0,pPDG);
-	xsecH[0] = x;
+	  G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= " << iz
+		 << " N= "  << N << " pdg= " << pPDG 
+		 << " mom(GeV)= " << momentum/GeV 
+		 << "  " << qCManager << G4endl; 
+	G4double y = ab[j]*qCManager->GetCrossSection(false,momentum,iz,N,pPDG);
+	x += y;
+	xsecH[j] = x;
       }
     } else {
+      G4int N = 0;
+      if(iz == 2) N = 2;
       if(verboseLevel>1) 
-	G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= 2, N=2 " 
+	G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= " << iz
+	       << " N= " << N 
+               << " pdg= " << pPDG
 	       << G4endl; 
-      x = qCManager->GetCrossSection(false,momentum,2,2,pPDG);
+      x = qCManager->GetCrossSection(false,momentum,iz,N,pPDG);
     }
   } else {
     if(verboseLevel>1) 
@@ -189,6 +191,19 @@ G4double G4UHadronElasticProcess::GetMicroscopicCrossSection(
 	     << G4endl; 
     x = store->GetCrossSection(dp, elm, temp);
   }
+  // NaN finder
+  if(!(x < 0.0 || x >= 0.0)) {
+    if (verboseLevel > 1) {
+      G4cout << "G4UHadronElasticProcess:WARNING: Z= " << iz  
+	     << " pdg= " <<  pPDG
+	     << " mom(GeV)= " << dp->GetTotalMomentum()/GeV 
+	     << " cross= " << x 
+	     << " set to zero"
+	     << G4endl; 
+    }
+    x = 0.0;
+  }
+
   if(verboseLevel>1) 
     G4cout << "G4UHadronElasticProcess cross(mb)= " << x/millibarn 
            << "  E(MeV)= " << dp->GetKineticEnergy()
@@ -205,10 +220,13 @@ G4VParticleChange* G4UHadronElasticProcess::PostStepDoIt(
 {
   G4ForceCondition   cn;
   aParticleChange.Initialize(track);
+  G4double kineticEnergy = track.GetKineticEnergy();
+  if(kineticEnergy <= lowestEnergy) 
+    return G4VDiscreteProcess::PostStepDoIt(track,step);
   G4double mfp = GetMeanFreePath(track, 0.0, &cn);
-  if(mfp == DBL_MAX) return G4VDiscreteProcess::PostStepDoIt(track,step);
+  if(mfp == DBL_MAX) 
+    return G4VDiscreteProcess::PostStepDoIt(track,step);
 
-  G4double kineticEnergy = track.GetKineticEnergy();
   G4Material* material = track.GetMaterial();
 
   // Select element
@@ -231,22 +249,28 @@ G4VParticleChange* G4UHadronElasticProcess::PostStepDoIt(
   if(isv) ni = isv->size();
   if(ni == 1) { 
     A = G4double(elm->GetIsotope(0)->GetN());
+  } else if(ni == 0) {
+    A = elm->GetN();
   } else if(ni > 1) {
-    if(iz == 1 && theParticle == theProton) {
-      A = 1.;
-      if(G4UniformRand()*(xsecH[0] + xsec[1]) > xsec[0]) A = 2.;
+
+    G4int j = -1;
+    ni--;
+    // Special treatment of hydrogen and helium for CHIPS
+    if(iz <= 2 && (theParticle == theProton || theParticle == theNeutron)) {
+      G4double x = G4UniformRand()*xsecH[ni];
+      do {j++;} while (x > xsecH[j] && j < ni);
+
+      // Abandance vector
     } else {
       G4double* ab = elm->GetRelativeAbundanceVector();
       G4double y = G4UniformRand();
-      G4int j = -1;
-      ni--;
       do {
 	j++;
 	y -= ab[j];
       } while (y > 0.0 && j < ni);
-      A = G4double(elm->GetIsotope(j)->GetN());
     }
-  }
+    A = G4double(elm->GetIsotope(j)->GetN());
+  } 
   G4HadronicInteraction* hadi = 
     ChooseHadronicInteraction( kineticEnergy, material, elm);
 
diff --git a/source/processes/hadronic/models/util/History b/source/processes/hadronic/models/util/History
index b646f064f24264d8981653436d4bb7ada7c5783e..8fc670907bb5bd5b991e64882d09b1a0b234367a 100644
--- a/source/processes/hadronic/models/util/History
+++ b/source/processes/hadronic/models/util/History
@@ -14,6 +14,22 @@ code and to keep track of all tags.
      * Please list in reverse chronological order (last date on top)
      ---------------------------------------------------------------
 
+
+5 Oct 2006 Gunter Folger   (hadr-mod-util-V08-01-01)
+-------------------------------------------------
+-  G4Fancy3DNucleus:ChoosePositions(): Correctly use std::vector.
+    This should fix bug 887 on WIN32/VC8
+    
+5 Oct 2006 Gunter Folger   (hadr-mod-util-V08-01-00)
+-------------------------------------------------
+-  Reduce warning output from G4Fragment on negative excitation energy; 
+   a max. of 10 warnings is printed now.
+   
+19 Aug 2006 Dennis Wright (hadr-modutl-V08-01-00)
+-------------------------------------------------
+- G4Fancy3DNucleus.cc : remove meaningless const in G4Fancy3DNucleusHelper
+  methods size() and index()
+
 30 Nov 2005 Gabriele Cosmo (hadr-modutl-V07-01-01)
 --------------------------------------------------
 - Trivial fix in G4Fancy3DNucleus for support of CLHEP-2.0.X series.
diff --git a/source/processes/hadronic/models/util/src/G4Fancy3DNucleus.cc b/source/processes/hadronic/models/util/src/G4Fancy3DNucleus.cc
index a52d924e93d67d216adffdff01eba0a717898c5e..5f73c0870694e1fa24da2b8728bd89c2c78191a3 100644
--- a/source/processes/hadronic/models/util/src/G4Fancy3DNucleus.cc
+++ b/source/processes/hadronic/models/util/src/G4Fancy3DNucleus.cc
@@ -288,9 +288,10 @@ void G4Fancy3DNucleus::ChoosePositions()
 	   if (G4UniformRand() < density)
 	   {
 	      freeplace= true;
-	      for( int j=0; j<i && freeplace; j++)
+	      std::vector<G4ThreeVector>::iterator iplace;
+	      for( iplace=places.begin(); iplace!=places.end() && freeplace;++iplace)
 	      {
-	        delta = places[j] - aPos;
+	        delta = *iplace - aPos;
 		freeplace= delta.mag2() > nd2;
 	      }
 	      
@@ -310,7 +311,7 @@ void G4Fancy3DNucleus::ChoosePositions()
 	      if ( freeplace )
 	      {
 		  theNucleons[i].SetPosition(aPos);
-		  places[i]=aPos;
+		  places.push_back(aPos);
 		  ++i;
 	      }
 	   }
@@ -397,11 +398,11 @@ void G4Fancy3DNucleus::ChooseFermiMomenta()
     	{
     		return Vector;
     	}
-    	const G4double size() const
+    	G4double size() const
     	{
     		return Size;
     	}
-    	const G4int index() const
+    	G4int index() const
     	{
     		return anInt;
     	}
diff --git a/source/processes/hadronic/models/util/src/G4Fragment.cc b/source/processes/hadronic/models/util/src/G4Fragment.cc
index 9fa287301d32c978ae2626f75a457d65223897ba..1565887a5e3be1e3dea067839b740a428b3d2e36 100644
--- a/source/processes/hadronic/models/util/src/G4Fragment.cc
+++ b/source/processes/hadronic/models/util/src/G4Fragment.cc
@@ -201,6 +201,7 @@ std::ostream& operator << (std::ostream &out, const G4Fragment &theFragment)
 
 G4double G4Fragment::CalculateExcitationEnergy(const G4LorentzVector value) const
 {
+	static G4int errCount(0);
 	G4double theMaxGroundStateMass = theZ*G4Proton::Proton()->GetPDGMass()+
 	                       (theA-theZ)*G4Neutron::Neutron()->GetPDGMass();
 	G4double U = value.m() - std::min(theMaxGroundStateMass, GetGroundStateMass());
@@ -209,8 +210,15 @@ G4double G4Fragment::CalculateExcitationEnergy(const G4LorentzVector value) cons
 			U = 0.0;
 		else 
 		{
-			G4cerr << "G4Fragment::G4Fragment Excitation Energy ="
+			if ( errCount < 10 ) 
+			{
+			    G4cerr << "G4Fragment::CalculateExcitationEnergy(): Excitation Energy ="
 			       <<U << " for A = "<<theA<<" and Z= "<<theZ<<G4endl;
+			    errCount++;
+			    if (errCount == 10 ) G4cerr << "G4Fragment::CalculateExcitationEnergy():" 
+			    			<< " further warnings on negative excitation will be supressed" << G4endl;
+			}  
+     
 			U=0.0;
 		}
 	return U;
diff --git a/source/track/History b/source/track/History
index 9953866988ca757d7f8bb5ccd9a4c7cd0f5fdfb2..eaeb69052a6ffebcecc4489600f0cbd080e6cb60 100644
--- a/source/track/History
+++ b/source/track/History
@@ -1,4 +1,4 @@
-$Id: History,v 1.86 2006/06/07 17:18:11 vnivanch Exp $
+$Id: History,v 1.86.2.1 2006/11/02 15:10:52 gcosmo Exp $
 -------------------------------------------------------------------
 
      =========================================================
@@ -17,6 +17,9 @@ committal in the CVS repository !
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
 
+Oct 31, 06 G.Cosmo (track-V08-00-03a)
+- Made operator=() inline.
+
 June 07, 06 V.Ivanchenko (track-V08-00-03)
 -  G4ParticleChangeForLoss - remove momentum change AlongStep
 
diff --git a/source/track/include/G4StepPoint.hh b/source/track/include/G4StepPoint.hh
index fc54325d6efc668e1bfe136a78ab2b75c7bf41a8..9bce71a2148fd1caaa95f8e898e8445233dc9c5f 100644
--- a/source/track/include/G4StepPoint.hh
+++ b/source/track/include/G4StepPoint.hh
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4StepPoint.hh,v 1.16 2006/06/29 21:14:39 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4StepPoint.hh,v 1.17 2006/10/31 10:01:43 gcosmo Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 //---------------------------------------------------------------
@@ -75,103 +75,103 @@ class G4StepPoint
 // Constructor/Destructor
    G4StepPoint();
 
-   ~G4StepPoint(){};
+   ~G4StepPoint(){}
 
 //--------
    
   public: // with description 
 
 // Get/Set functions
-  const G4ThreeVector& GetPosition() const;
-  void SetPosition(const G4ThreeVector& aValue);
-  void AddPosition(const G4ThreeVector& aValue);
+  inline const G4ThreeVector& GetPosition() const;
+  inline void SetPosition(const G4ThreeVector& aValue);
+  inline void AddPosition(const G4ThreeVector& aValue);
 
-  G4double GetLocalTime() const;
-  void SetLocalTime(const G4double aValue);
-  void AddLocalTime(const G4double aValue);
+  inline G4double GetLocalTime() const;
+  inline void SetLocalTime(const G4double aValue);
+  inline void AddLocalTime(const G4double aValue);
       // Time since the track is created.
      
-  G4double GetGlobalTime() const;
-  void SetGlobalTime(const G4double aValue);
-  void AddGlobalTime(const G4double aValue);
+  inline G4double GetGlobalTime() const;
+  inline void SetGlobalTime(const G4double aValue);
+  inline void AddGlobalTime(const G4double aValue);
       // Time since the event in which the track belongs is created.
      
-  G4double GetProperTime() const;
-  void SetProperTime(const G4double aValue);
-  void AddProperTime(const G4double aValue);
+  inline G4double GetProperTime() const;
+  inline void SetProperTime(const G4double aValue);
+  inline void AddProperTime(const G4double aValue);
       // Proper time of the particle.
      
-  const G4ThreeVector& GetMomentumDirection() const;
-  void SetMomentumDirection(const G4ThreeVector& aValue);
-  void AddMomentumDirection(const G4ThreeVector& aValue);
+  inline const G4ThreeVector& GetMomentumDirection() const;
+  inline void SetMomentumDirection(const G4ThreeVector& aValue);
+  inline void AddMomentumDirection(const G4ThreeVector& aValue);
      // Direction of momentum  (should be an unit vector)
     
-  G4ThreeVector GetMomentum() const;
+  inline G4ThreeVector GetMomentum() const;
       // Total momentum of the track
 
   
-  G4double GetTotalEnergy() const;
+  inline G4double GetTotalEnergy() const;
      // Total energy of the track
 
-  G4double GetKineticEnergy() const;
-  void SetKineticEnergy(const G4double aValue);
-  void AddKineticEnergy(const G4double aValue);
+  inline G4double GetKineticEnergy() const;
+  inline void SetKineticEnergy(const G4double aValue);
+  inline void AddKineticEnergy(const G4double aValue);
      // Kinetic Energy of the track
 
-  G4double GetVelocity() const;
-  void SetVelocity(G4double v);
+  inline G4double GetVelocity() const;
+  inline void SetVelocity(G4double v);
    //
 
-  G4double GetBeta() const;
+  inline G4double GetBeta() const;
     // Velocity of the track in unit of c(light velocity)
 
-  G4double GetGamma() const;
+  inline G4double GetGamma() const;
      // Gamma factor (1/sqrt[1-beta*beta]) of the track    
 
-  G4VPhysicalVolume* GetPhysicalVolume() const;
+  inline G4VPhysicalVolume* GetPhysicalVolume() const;
 
-  const G4VTouchable* GetTouchable() const;
-  const G4TouchableHandle& GetTouchableHandle() const;
-  void  SetTouchableHandle(const G4TouchableHandle& apValue);
+  inline const G4VTouchable* GetTouchable() const;
+  inline const G4TouchableHandle& GetTouchableHandle() const;
+  inline void  SetTouchableHandle(const G4TouchableHandle& apValue);
 
-  G4Material* GetMaterial() const;
-  void SetMaterial(G4Material*);
+  inline G4Material* GetMaterial() const;
+  inline void SetMaterial(G4Material*);
 
-  const G4MaterialCutsCouple* GetMaterialCutsCouple() const;
-  void SetMaterialCutsCouple(const G4MaterialCutsCouple*);
+  inline const G4MaterialCutsCouple* GetMaterialCutsCouple() const;
+  inline void SetMaterialCutsCouple(const G4MaterialCutsCouple*);
 
-  G4VSensitiveDetector* GetSensitiveDetector() const;
-  void SetSensitiveDetector(G4VSensitiveDetector*);
+  inline G4VSensitiveDetector* GetSensitiveDetector() const;
+  inline void SetSensitiveDetector(G4VSensitiveDetector*);
 
-  G4double GetSafety() const;
-  void SetSafety(const G4double aValue);
+  inline G4double GetSafety() const;
+  inline void SetSafety(const G4double aValue);
 
-  const G4ThreeVector& GetPolarization() const;
-  void SetPolarization(const G4ThreeVector& aValue);
-  void AddPolarization(const G4ThreeVector& aValue);
+  inline const G4ThreeVector& GetPolarization() const;
+  inline void SetPolarization(const G4ThreeVector& aValue);
+  inline void AddPolarization(const G4ThreeVector& aValue);
 
-  G4StepStatus GetStepStatus() const;
-  void SetStepStatus(const G4StepStatus aValue);
+  inline G4StepStatus GetStepStatus() const;
+  inline void SetStepStatus(const G4StepStatus aValue);
 
-  const G4VProcess* GetProcessDefinedStep() const;
+  inline const G4VProcess* GetProcessDefinedStep() const;
      // If the pointer is 0, this means the Step is defined
      // by the user defined limit in the current volume.
-  void SetProcessDefinedStep(G4VProcess* aValue);
+  inline void SetProcessDefinedStep(G4VProcess* aValue);
 
   
-  G4double GetMass() const;
-  void SetMass(G4double value);
+  inline G4double GetMass() const;
+  inline void SetMass(G4double value);
 
-  G4double GetCharge() const;
-  void SetCharge(G4double value);
+  inline G4double GetCharge() const;
+  inline void SetCharge(G4double value);
 
-  void SetWeight(G4double aValue);
-  G4double GetWeight() const;
+  inline void SetWeight(G4double aValue);
+  inline G4double GetWeight() const;
 
   public:
-  // copy constructor and assignment operaor as protected
+  // copy constructor and assignment operator as protected
   G4StepPoint(const G4StepPoint &right);
-  G4StepPoint & operator=(const G4StepPoint &right);
+  inline G4StepPoint & operator=(const G4StepPoint &right);
 
   
 
@@ -213,5 +213,5 @@ class G4StepPoint
 };
 
 #include "G4StepPoint.icc"
-#endif
 
+#endif
diff --git a/source/track/include/G4StepPoint.icc b/source/track/include/G4StepPoint.icc
index 36d60c53fcc2fc6971b816b56cfedcbee571dc8d..eaa75244c51f19fe4d1829eacf360043ba6fa769 100644
--- a/source/track/include/G4StepPoint.icc
+++ b/source/track/include/G4StepPoint.icc
@@ -24,10 +24,36 @@
 // ********************************************************************
 //
 //
-// $Id: G4StepPoint.icc,v 1.11 2006/06/29 21:14:41 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4StepPoint.icc,v 1.12 2006/10/31 10:01:43 gcosmo Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
+
+   inline G4StepPoint & G4StepPoint::operator=(const G4StepPoint &right)
+   {
+     if (this != &right) {
+       fPosition = right.fPosition;
+       fGlobalTime = right.fGlobalTime;
+       fLocalTime = right.fLocalTime;
+       fProperTime = right.fProperTime;
+       fMomentumDirection = right.fMomentumDirection;
+       fKineticEnergy = right.fKineticEnergy;
+       fpTouchable = right.fpTouchable;
+       fpMaterial = right.fpMaterial;
+       fpMaterialCutsCouple = right.fpMaterialCutsCouple;
+       fpSensitiveDetector = right.fpSensitiveDetector;
+       fSafety = right.fSafety;
+       fPolarization = right.fPolarization;
+       fStepStatus = right.fStepStatus;
+       fpProcessDefinedStep = right.fpProcessDefinedStep;
+       fMass = right.fMass;
+       fCharge = right.fCharge;
+       fWeight = right.fWeight;
+       fVelocity = right.fVelocity;
+     }
+     return *this;
+   }
+
    inline const G4ThreeVector& G4StepPoint::GetPosition() const
    { return fPosition; }
    inline void G4StepPoint::SetPosition(const G4ThreeVector& aValue)
diff --git a/source/track/src/G4StepPoint.cc b/source/track/src/G4StepPoint.cc
index 10a51e196331aec629de9abc95cfadc318ede147..783ca7ed9dd7173b6d404ed731a3ce194978c628 100644
--- a/source/track/src/G4StepPoint.cc
+++ b/source/track/src/G4StepPoint.cc
@@ -24,8 +24,8 @@
 // ********************************************************************
 //
 //
-// $Id: G4StepPoint.cc,v 1.11 2006/06/29 21:15:15 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4StepPoint.cc,v 1.12 2006/10/31 10:01:43 gcosmo Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-02 $
 //
 //
 //---------------------------------------------------------------
@@ -76,31 +76,3 @@ G4StepPoint::G4StepPoint(const G4StepPoint &right):
   fCharge(right.fCharge),
   fWeight(right.fWeight)
 {}
-
-
-//////////////////////////
-G4StepPoint & G4StepPoint::operator=(const G4StepPoint &right)
-//////////////////////////
-{
-  if (this != &right) {
-    fPosition = right.fPosition;
-    fGlobalTime = right.fGlobalTime;
-    fLocalTime = right.fLocalTime;
-    fProperTime = right.fProperTime;
-    fMomentumDirection = right.fMomentumDirection;
-    fKineticEnergy = right.fKineticEnergy;
-    fpTouchable = right.fpTouchable;
-    fpMaterial = right.fpMaterial;
-    fpMaterialCutsCouple = right.fpMaterialCutsCouple;
-    fpSensitiveDetector = right.fpSensitiveDetector;
-    fSafety = right.fSafety;
-    fPolarization = right.fPolarization;
-    fStepStatus = right.fStepStatus;
-    fpProcessDefinedStep = right.fpProcessDefinedStep;
-    fMass = right.fMass;
-    fCharge = right.fCharge;
-    fWeight = right.fWeight;
-    fVelocity = right.fVelocity;
-  }
-  return *this;
-}