Index: trunk/source/global/management/include/G4Allocator.hh
===================================================================
--- trunk/source/global/management/include/G4Allocator.hh	(revision 1337)
+++ trunk/source/global/management/include/G4Allocator.hh	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4Allocator.hh,v 1.20 2010/03/30 08:17:24 gcosmo Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4Allocator.hh,v 1.21 2010/04/01 12:43:12 gcosmo Exp $
+// GEANT4 tag $Name: global-V09-03-22 $
 //
 // 
@@ -66,10 +66,15 @@
 
     inline void ResetStorage();
-      // Returns allocated storage to the free store, resets
-      // allocator and page sizes.
+      // Returns allocated storage to the free store, resets allocator.
       // Note: contents in memory are lost using this call !
 
     inline size_t GetAllocatedSize() const;
       // Returns the size of the total memory allocated
+    inline int GetNoPages() const;
+      // Returns the total number of allocated pages
+    inline size_t GetPageSize() const;
+      // Returns the current size of a page
+    inline void IncreasePageSize( unsigned int sz );
+      // Resets allocator and increases default page size of a given factor
 
   public:  // without description
@@ -213,4 +218,35 @@
 
 // ************************************************************
+// GetNoPages
+// ************************************************************
+//
+template <class Type>
+int G4Allocator<Type>::GetNoPages() const
+{
+  return mem.GetNoPages();
+}
+
+// ************************************************************
+// GetPageSize
+// ************************************************************
+//
+template <class Type>
+size_t G4Allocator<Type>::GetPageSize() const
+{
+  return mem.GetPageSize();
+}
+
+// ************************************************************
+// IncreasePageSize
+// ************************************************************
+//
+template <class Type>
+void G4Allocator<Type>::IncreasePageSize( unsigned int sz )
+{
+  ResetStorage();
+  mem.GrowPageSize(sz); 
+}
+
+// ************************************************************
 // operator==
 // ************************************************************
Index: trunk/source/global/management/include/G4AllocatorPool.hh
===================================================================
--- trunk/source/global/management/include/G4AllocatorPool.hh	(revision 1337)
+++ trunk/source/global/management/include/G4AllocatorPool.hh	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4AllocatorPool.hh,v 1.5 2006/06/29 19:01:18 gunter Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4AllocatorPool.hh,v 1.7 2010/07/14 10:45:46 gcosmo Exp $
+// GEANT4 tag $Name: global-V09-03-22 $
 //
 // 
@@ -58,7 +58,4 @@
       // Destructor. Return storage to the free store
 
-    G4AllocatorPool(const G4AllocatorPool& right);
-      // Copy constructor
-
     inline void* Alloc();
       // Allocate one element
@@ -71,6 +68,15 @@
       // Return storage to the free store
 
+    inline int  GetNoPages() const;
+      // Return the total number of allocated pages
+    inline unsigned int  GetPageSize() const;
+      // Accessor for default page size
+    inline void GrowPageSize( unsigned int factor );
+      // Increase default page size by a given factor
+
   private:
 
+    G4AllocatorPool(const G4AllocatorPool& right);
+      // Provate copy constructor
     G4AllocatorPool& operator= (const G4AllocatorPool& right);
       // Private equality operator
@@ -97,5 +103,5 @@
 
     const unsigned int esize;
-    const unsigned int csize;
+    unsigned int csize;
     G4PoolChunk* chunks;
     G4PoolLink* head;
@@ -142,3 +148,33 @@
 }
 
+// ************************************************************
+// GetNoPages
+// ************************************************************
+//
+inline int
+G4AllocatorPool::GetNoPages() const
+{
+  return nchunks;
+}
+
+// ************************************************************
+// GetPageSize
+// ************************************************************
+//
+inline unsigned int
+G4AllocatorPool::GetPageSize() const
+{
+  return csize;
+}
+
+// ************************************************************
+// GrowPageSize
+// ************************************************************
+//
+inline void
+G4AllocatorPool::GrowPageSize( unsigned int sz )
+{
+  csize = (sz) ? sz*csize : csize; 
+}
+
 #endif
Index: trunk/source/global/management/include/G4FPEDetection.hh
===================================================================
--- trunk/source/global/management/include/G4FPEDetection.hh	(revision 1337)
+++ trunk/source/global/management/include/G4FPEDetection.hh	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4FPEDetection.hh,v 1.2 2006/11/15 16:00:18 gcosmo Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4FPEDetection.hh,v 1.5 2010/10/14 17:02:52 mkelsey Exp $
+// GEANT4 tag $Name: global-V09-03-22 $
 //
 // 
@@ -32,7 +32,7 @@
 //
 // -----------------------------------------------------------------------
-// This global method should be used on LINUX platforms with gcc compiler
-// for activating NaN detection and FPE signals, and forcing abortion of
-// the application at the time these are detected.
+// This global method should be used on LINUX or MacOSX platforms with gcc
+// compiler for activating NaN detection and FPE signals, and forcing
+// abortion of the application at the time these are detected.
 // Meant to be used for debug purposes, can be activated by compiling the
 // "run" module with the flag G4FPE_DEBUG set in the environment.
@@ -41,4 +41,7 @@
 #ifndef G4FPEDetection_h
 #define G4FPEDetection_h 1
+
+#include <iostream>
+#include <stdlib.h>  /* abort(), exit() */
 
 #ifdef __linux__
@@ -48,14 +51,16 @@
   #include <csignal>
 
-  #include <iostream>
-
   struct sigaction termaction, oldaction;
 
-  void TerminationSignalHandler(int sig)
+  static void TerminationSignalHandler(int sig, siginfo_t* sinfo, void* /* context */)
   {
     std::cerr << "ERROR: " << sig;
-    std::string message;
-    switch (SIGFPE)
-    {
+    std::string message = "Floating-point exception (FPE).";
+
+    if (sinfo) {
+      switch (sinfo->si_code) {
+#ifdef FPE_NOOP		/* BUG: MacOSX uses this instead of INTDIV */
+      case FPE_NOOP:
+#endif
       case FPE_INTDIV:
         message = "Integer divide by zero.";
@@ -85,11 +90,13 @@
         message = "Unknown error.";
         break;
-    }
+      }
+    }
+
     std::cerr << " - " << message << std::endl;
-
+    
     ::abort();
   }
 
-  void InvalidOperationDetection()
+  static void InvalidOperationDetection()
   {
     std::cout << std::endl
@@ -106,16 +113,159 @@
     //(void) feenableexcept( FE_UNDERFLOW );
 
-    sigset_t *def_set;
-    def_set=&termaction.sa_mask;
-    sigfillset(def_set);
-    sigdelset(def_set,SIGFPE);
-    termaction.sa_handler=TerminationSignalHandler;
-    termaction.sa_flags=0;
-    sigaction(SIGFPE, &termaction,&oldaction);
-  }
-#endif
-#else
-  void InvalidOperationDetection() {;}
-#endif
-
-#endif
+    sigdelset(&termaction.sa_mask,SIGFPE);
+    termaction.sa_sigaction=TerminationSignalHandler;
+    termaction.sa_flags=SA_SIGINFO;
+    sigaction(SIGFPE, &termaction, &oldaction);
+  }
+#endif
+#elif __MACH__      /* MacOSX */
+
+  #include <fenv.h>
+  #include <signal.h>
+
+  #define DEFINED_PPC      (defined(__ppc__) || defined(__ppc64__))
+  #define DEFINED_INTEL    (defined(__i386__) || defined(__x86_64__))
+
+  #if DEFINED_PPC
+
+    #define FE_EXCEPT_SHIFT 22  // shift flags right to get masks
+    #define FM_ALL_EXCEPT    FE_ALL_EXCEPT >> FE_EXCEPT_SHIFT 
+
+    static inline int feenableexcept (unsigned int excepts)
+    {
+      static fenv_t fenv;
+      unsigned int new_excepts = (excepts & FE_ALL_EXCEPT) >> FE_EXCEPT_SHIFT,
+                   old_excepts;  // all previous masks
+
+      if ( fegetenv (&fenv) )  { return -1; }
+      old_excepts = (fenv & FM_ALL_EXCEPT) << FE_EXCEPT_SHIFT;
+      fenv = (fenv & ~new_excepts) | new_excepts;
+
+      return ( fesetenv (&fenv) ? -1 : old_excepts );
+    }
+
+    static inline int fedisableexcept (unsigned int excepts)
+    {
+      static fenv_t fenv;
+      unsigned int still_on = ~((excepts & FE_ALL_EXCEPT) >> FE_EXCEPT_SHIFT),
+                   old_excepts;  // previous masks
+
+      if ( fegetenv (&fenv) )  { return -1; }
+      old_excepts = (fenv & FM_ALL_EXCEPT) << FE_EXCEPT_SHIFT;
+      fenv &= still_on;
+
+      return ( fesetenv (&fenv) ? -1 : old_excepts );
+    }
+
+  #elif DEFINED_INTEL
+
+    static inline int feenableexcept (unsigned int excepts)
+    {
+      static fenv_t fenv;
+      unsigned int new_excepts = excepts & FE_ALL_EXCEPT,
+                   old_excepts;  // previous masks
+
+      if ( fegetenv (&fenv) )  { return -1; }
+      old_excepts = fenv.__control & FE_ALL_EXCEPT;
+
+      // unmask
+      //
+      fenv.__control &= ~new_excepts;
+      fenv.__mxcsr   &= ~(new_excepts << 7);
+
+      return ( fesetenv (&fenv) ? -1 : old_excepts );
+    }
+
+    static inline int fedisableexcept (unsigned int excepts)
+    {
+      static fenv_t fenv;
+      unsigned int new_excepts = excepts & FE_ALL_EXCEPT,
+                   old_excepts;  // all previous masks
+
+      if ( fegetenv (&fenv) )  { return -1; }
+      old_excepts = fenv.__control & FE_ALL_EXCEPT;
+
+      // mask
+      //
+      fenv.__control |= new_excepts;
+      fenv.__mxcsr   |= new_excepts << 7;
+
+      return ( fesetenv (&fenv) ? -1 : old_excepts );
+    }
+
+  #endif  /* PPC or INTEL enabling */
+
+  static void TerminationSignalHandler(int sig, siginfo_t* sinfo, void* /* context */)
+  {
+    std::cerr << "ERROR: " << sig;
+    std::string message = "Floating-point exception (FPE).";
+
+    if (sinfo) {
+      switch (sinfo->si_code) {
+#ifdef FPE_NOOP		/* BUG: MacOSX uses this instead of INTDIV */
+      case FPE_NOOP:
+#endif
+      case FPE_INTDIV:
+        message = "Integer divide by zero.";
+        break;
+      case FPE_INTOVF:
+        message = "Integer overflow.";
+        break;
+      case FPE_FLTDIV:
+        message = "Floating point divide by zero.";
+        break;
+      case FPE_FLTOVF:
+        message = "Floating point overflow.";
+        break;
+      case FPE_FLTUND:
+        message = "Floating point underflow.";
+        break;
+      case FPE_FLTRES:
+        message = "Floating point inexact result.";
+        break;
+      case FPE_FLTINV:
+        message = "Floating point invalid operation.";
+        break;
+      case FPE_FLTSUB:
+        message = "Subscript out of range.";
+        break;
+      default:
+        message = "Unknown error.";
+        break;
+      }
+    }
+
+    std::cerr << " - " << message << std::endl;
+    
+    ::abort();
+  }
+
+  static void InvalidOperationDetection()
+  {
+    struct sigaction termaction, oldaction;
+
+    std::cout << std::endl
+              << "        "
+              << "############################################" << std::endl
+              << "        "
+              << "!!! WARNING - FPE detection is activated !!!" << std::endl
+              << "        "
+              << "############################################" << std::endl;
+
+    feenableexcept ( FE_DIVBYZERO );
+    feenableexcept ( FE_INVALID   );
+    // fedisableexcept( FE_OVERFLOW  );
+    // fedisableexcept( FE_UNDERFLOW );
+
+    sigdelset(&termaction.sa_mask,SIGFPE);
+    termaction.sa_sigaction=TerminationSignalHandler;
+    termaction.sa_flags=SA_SIGINFO;
+    sigaction(SIGFPE, &termaction, &oldaction);
+  }
+#else  /* Not Linux, nor MacOSX ... */
+
+  static void InvalidOperationDetection() {;}
+
+#endif
+
+#endif
Index: trunk/source/global/management/include/G4PhysicsVector.icc
===================================================================
--- trunk/source/global/management/include/G4PhysicsVector.icc	(revision 1337)
+++ trunk/source/global/management/include/G4PhysicsVector.icc	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsVector.icc,v 1.28 2010/05/28 05:13:43 kurasige Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4PhysicsVector.icc,v 1.30 2010/09/20 16:22:56 gcosmo Exp $
+// GEANT4 tag $Name: global-V09-03-22 $
 //
 // 
Index: trunk/source/global/management/include/G4Pow.hh
===================================================================
--- trunk/source/global/management/include/G4Pow.hh	(revision 1337)
+++ trunk/source/global/management/include/G4Pow.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4Pow.hh,v 1.5 2010/05/28 08:18:03 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4Pow.hh,v 1.7 2010/08/24 08:12:08 gcosmo Exp $
+// GEANT4 tag $Name: global-V09-03-22 $
 //
 //
@@ -82,8 +82,10 @@
     inline G4double powZ(G4int Z, G4double y);
     inline G4double powA(G4double A, G4double y);
+           G4double powN(G4double x, G4int n);
 
     // Fast factorial
     //
     inline G4double factorial(G4int Z);
+    inline G4double logfactorial(G4int Z);
 
   private:
@@ -101,4 +103,5 @@
     G4DataVector lz;
     G4DataVector fact;
+    G4DataVector logfact;
 };
 
@@ -190,4 +193,9 @@
 }
 
+inline G4double G4Pow::logfactorial(G4int Z)
+{
+  return logfact[Z];
+}
+
 // -------------------------------------------------------------------
 
Index: trunk/source/global/management/include/G4ios.hh
===================================================================
--- trunk/source/global/management/include/G4ios.hh	(revision 1337)
+++ trunk/source/global/management/include/G4ios.hh	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ios.hh,v 1.10 2006/06/29 19:03:43 gunter Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4ios.hh,v 1.12 2010/10/27 07:40:06 gcosmo Exp $
+// GEANT4 tag $Name: global-V09-03-22 $
 //
 // 
@@ -42,5 +42,5 @@
 #include <iostream>
 
-#if defined G4IOS_EXPORT
+#if defined G4IOS_ALLOC_EXPORT
   extern G4DLLEXPORT std::ostream G4cout;
   extern G4DLLEXPORT std::ostream G4cerr;
Index: trunk/source/global/management/include/G4strstreambuf.hh
===================================================================
--- trunk/source/global/management/include/G4strstreambuf.hh	(revision 1337)
+++ trunk/source/global/management/include/G4strstreambuf.hh	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4strstreambuf.hh,v 1.16 2007/11/13 17:35:06 gcosmo Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4strstreambuf.hh,v 1.18 2010/10/27 07:40:06 gcosmo Exp $
+// GEANT4 tag $Name: global-V09-03-22 $
 // ====================================================================
 //
@@ -41,5 +41,5 @@
 class G4strstreambuf;
 
-#if defined G4IOS_EXPORT
+#if defined G4IOS_ALLOC_EXPORT
 extern G4DLLEXPORT G4strstreambuf G4coutbuf;
 extern G4DLLEXPORT G4strstreambuf G4cerrbuf;
Index: trunk/source/global/management/include/templates.hh
===================================================================
--- trunk/source/global/management/include/templates.hh	(revision 1337)
+++ trunk/source/global/management/include/templates.hh	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: templates.hh,v 1.13 2008/08/15 12:15:53 gcosmo Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: templates.hh,v 1.14 2010/07/16 15:48:51 gcosmo Exp $
+// GEANT4 tag $Name: global-V09-03-22 $
 //
 // 
@@ -109,4 +109,12 @@
 #endif
 
+#ifndef INT_MAX   /* Max decimal value of a int */
+#define INT_MAX   std::numeric_limits<int>::max()   // 2147483647
+#endif
+
+#ifndef INT_MIN   /* Min decimal value of a int */
+#define INT_MIN   std::numeric_limits<int>::min()   // -2147483648
+#endif
+
 //---------------------------------
 
