Index: trunk/source/global/management/include/G4LPhysicsFreeVector.hh
===================================================================
--- trunk/source/global/management/include/G4LPhysicsFreeVector.hh	(revision 850)
+++ trunk/source/global/management/include/G4LPhysicsFreeVector.hh	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4LPhysicsFreeVector.hh,v 1.10 2008/04/07 14:18:57 gcosmo Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4LPhysicsFreeVector.hh,v 1.11 2008/09/22 08:26:33 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -62,4 +62,8 @@
    ~G4LPhysicsFreeVector();
 
+   G4LPhysicsFreeVector(const G4LPhysicsFreeVector&);
+   G4LPhysicsFreeVector& operator=(const G4LPhysicsFreeVector&);
+     // Copy constructor and assignment operator.
+
    void PutValues(size_t binNumber, G4double binValue, G4double dataValue);
      // G4PhysicsVector has PutValue() but it is inconvenient.
Index: trunk/source/global/management/include/G4LPhysicsFreeVector.icc
===================================================================
--- trunk/source/global/management/include/G4LPhysicsFreeVector.icc	(revision 850)
+++ trunk/source/global/management/include/G4LPhysicsFreeVector.icc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4LPhysicsFreeVector.icc,v 1.11 2008/09/06 19:52:16 vnivanch Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4LPhysicsFreeVector.icc,v 1.13 2008/09/22 08:26:33 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -40,5 +40,4 @@
 //
 // F.W. Jones, TRIUMF, 04-JUN-96
-// 05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector
 // --------------------------------------------------------------------------
 
@@ -49,10 +48,10 @@
   // Want to simultaneously fill the bin and data vectors.
 {
-  if(binNumber <= numberOfBin) { 
-    binVector[binNumber] = binValue;
-    dataVector[binNumber]= dataValue;
-    if(0 == binNumber) edgeMin = binValue;
-    else if( numberOfBin - 1 == binNumber) edgeMax = binValue;
-  }
+   binVector[binNumber] = binValue;
+   dataVector[binNumber] = dataValue;
+   if(binNumber == 0)
+     { edgeMin = binValue; }
+   else if( numberOfBin - 1 == binNumber)
+     { edgeMax = binValue; }
 }
 
Index: trunk/source/global/management/include/G4PhysicsFreeVector.hh
===================================================================
--- trunk/source/global/management/include/G4PhysicsFreeVector.hh	(revision 850)
+++ trunk/source/global/management/include/G4PhysicsFreeVector.hh	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsFreeVector.hh,v 1.10 2006/06/29 19:02:18 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsFreeVector.hh,v 1.12 2008/09/22 14:49:57 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
Index: trunk/source/global/management/include/G4PhysicsLinearVector.hh
===================================================================
--- trunk/source/global/management/include/G4PhysicsLinearVector.hh	(revision 850)
+++ trunk/source/global/management/include/G4PhysicsLinearVector.hh	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsLinearVector.hh,v 1.10 2006/06/29 19:02:21 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsLinearVector.hh,v 1.11 2008/09/22 11:37:09 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -73,4 +73,8 @@
       // Destructor
 
+    G4PhysicsLinearVector(const G4PhysicsLinearVector&);
+    G4PhysicsLinearVector& operator=(const G4PhysicsLinearVector&);
+      // Copy constructor and assignment operator.
+
     G4bool Retrieve(std::ifstream& fIn, G4bool ascii);
 
Index: trunk/source/global/management/include/G4PhysicsLnVector.hh
===================================================================
--- trunk/source/global/management/include/G4PhysicsLnVector.hh	(revision 850)
+++ trunk/source/global/management/include/G4PhysicsLnVector.hh	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsLnVector.hh,v 1.12 2006/06/29 19:02:23 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsLnVector.hh,v 1.13 2008/09/22 11:37:09 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -70,4 +70,8 @@
       // Destructor.
 
+    G4PhysicsLnVector(const G4PhysicsLnVector&);
+    G4PhysicsLnVector& operator=(const G4PhysicsLnVector&);
+      // Copy constructor and assignment operator.
+
     G4bool Retrieve(std::ifstream& fIn, G4bool ascii);
       // To retrieve persistent data from file stream.
Index: trunk/source/global/management/include/G4PhysicsLogVector.hh
===================================================================
--- trunk/source/global/management/include/G4PhysicsLogVector.hh	(revision 850)
+++ trunk/source/global/management/include/G4PhysicsLogVector.hh	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsLogVector.hh,v 1.11 2006/06/29 19:02:25 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsLogVector.hh,v 1.13 2008/09/22 08:26:33 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -75,7 +75,11 @@
       // Destructor
 
+    G4PhysicsLogVector(const G4PhysicsLogVector&);
+    G4PhysicsLogVector& operator=(const G4PhysicsLogVector&);
+      // Copy constructor and assignment operator.
+      
     G4bool Retrieve(std::ifstream& fIn, G4bool ascii);
       // To retrieve persistent data from file stream.
-
+  
   protected:
 
Index: trunk/source/global/management/include/G4PhysicsOrderedFreeVector.hh
===================================================================
--- trunk/source/global/management/include/G4PhysicsOrderedFreeVector.hh	(revision 850)
+++ trunk/source/global/management/include/G4PhysicsOrderedFreeVector.hh	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsOrderedFreeVector.hh,v 1.9 2006/06/29 19:02:28 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsOrderedFreeVector.hh,v 1.11 2008/09/22 14:49:57 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 ////////////////////////////////////////////////////////////////////////
Index: trunk/source/global/management/include/G4PhysicsVector.hh
===================================================================
--- trunk/source/global/management/include/G4PhysicsVector.hh	(revision 850)
+++ trunk/source/global/management/include/G4PhysicsVector.hh	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsVector.hh,v 1.17 2008/04/07 14:18:57 gcosmo Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsVector.hh,v 1.18 2008/09/22 08:26:33 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -144,4 +144,10 @@
          // Find the bin# in which theEnergy belongs - pure virtual function
 
+    void DeleteData();
+    void CopyData(const G4PhysicsVector& vec);
+         // Internal methods for allowing copy of objects
+
+  protected:
+
     typedef std::vector<G4double> G4PVDataVector;
 
Index: trunk/source/global/management/include/G4PhysicsVector.icc
===================================================================
--- trunk/source/global/management/include/G4PhysicsVector.icc	(revision 850)
+++ trunk/source/global/management/include/G4PhysicsVector.icc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsVector.icc,v 1.14 2008/09/05 18:04:45 vnivanch Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsVector.icc,v 1.17 2008/09/22 08:26:33 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -41,6 +41,4 @@
 //    energy scale, for example like 'log', 'linear', 'free', etc.
 //
-// Modified:
-// 05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector
 //---------------------------------------------------------------
 
@@ -127,12 +125,12 @@
   if( theEnergy == lastEnergy ) {
 
-  } else if( theEnergy <= edgeMin ) {
-     lastBin = 0;
-     lastEnergy = theEnergy;
-     lastValue  = dataVector[0];
-
   } else if(theEnergy < lastEnergy && theEnergy >= binVector[lastBin]) {
      lastEnergy = theEnergy;
      Interpolation();
+
+  } else if( theEnergy <= edgeMin ) {
+     lastBin = 0;
+     lastEnergy = edgeMin;
+     lastValue  = dataVector[0];
 
   } else if(theEnergy < lastEnergy && theEnergy >= binVector[lastBin-1]) {
@@ -168,12 +166,10 @@
  void G4PhysicsVector::PutValue(size_t binNumber, G4double theValue)
 {
-  if(binNumber < numberOfBin) {
-    dataVector[binNumber] = theValue;
-
-    // Fill the bin which is hidden to user with theValue. This is to 
-    // handle correctly when Energy=theEmax in getValue.
-
-    if(binNumber==numberOfBin-1) { dataVector[binNumber+1] = theValue; }
-  }
+  dataVector[binNumber] = theValue;
+
+  // Fill the bin which is hidden to user with theValue. This is to 
+  // handle correctly when Energy=theEmax in getValue.
+
+  if(binNumber==numberOfBin-1) { dataVector[binNumber+1] = theValue; }
 }
 
Index: trunk/source/global/management/include/G4Version.hh
===================================================================
--- trunk/source/global/management/include/G4Version.hh	(revision 850)
+++ trunk/source/global/management/include/G4Version.hh	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4Version.hh,v 1.16 2008/06/26 06:38:51 gcosmo Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4Version.hh,v 1.17 2008/12/02 09:15:58 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // Version information
@@ -51,5 +51,5 @@
 
 #ifndef G4VERSION_TAG
-#define G4VERSION_TAG "$Name: HEAD $"
+#define G4VERSION_TAG "$Name: geant4-09-02-cand-01 $"
 #endif
 
@@ -58,6 +58,6 @@
 #include "G4String.hh"
 
-static const G4String G4Version = "$Name: HEAD $";
-static const G4String G4Date    = "(4-July-2008)";
+static const G4String G4Version = "$Name: geant4-09-02-cand-01 $";
+static const G4String G4Date    = "(19-December-2008)";
 
 #endif
Index: trunk/source/global/management/src/G4LPhysicsFreeVector.cc
===================================================================
--- trunk/source/global/management/src/G4LPhysicsFreeVector.cc	(revision 850)
+++ trunk/source/global/management/src/G4LPhysicsFreeVector.cc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4LPhysicsFreeVector.cc,v 1.17 2008/09/06 19:52:16 vnivanch Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4LPhysicsFreeVector.cc,v 1.22 2008/09/22 08:26:33 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -36,6 +36,4 @@
 // F.W. Jones, TRIUMF, 04-JUN-96
 //
-// 27-MAR-97 FWJ: first version for Alpha release
-// 05-SEP-2008, V.Ivanchenko : added protections for zero-length vector
 // --------------------------------------------------------------------
 
@@ -49,5 +47,5 @@
    : G4PhysicsVector(), verboseLevel(0)
 {
-  type = T_G4LPhysicsFreeVector;
+   type = T_G4LPhysicsFreeVector;
 }
 
@@ -59,17 +57,16 @@
   : G4PhysicsVector(), verboseLevel(0)
 {
-  type = T_G4LPhysicsFreeVector;
+   type = T_G4LPhysicsFreeVector;
    
-  numberOfBin = nbin;
-  if(nbin > 0) {
-    binVector.resize(nbin+1);
-    dataVector.resize(nbin+1);
-    edgeMin = binmin;
-    edgeMax = binmax;
-    for (size_t i=0; i<=numberOfBin; i++) {
-      binVector[i] = binmin;
-      dataVector[i]= 0.0;
-    }
-  }
+   edgeMin = binmin;
+   edgeMax = binmax;
+   numberOfBin = nbin;
+   binVector.reserve(nbin+1);
+   dataVector.reserve(nbin+1);
+   for (size_t i=0; i<=numberOfBin; i++)
+   {
+     binVector.push_back(0.0);
+     dataVector.push_back(0.0);
+   }
 }  
 
@@ -78,4 +75,28 @@
 G4LPhysicsFreeVector::~G4LPhysicsFreeVector()
 {
+}
+
+// --------------------------------------------------------------------
+
+G4LPhysicsFreeVector::G4LPhysicsFreeVector(const G4LPhysicsFreeVector& right)
+  : G4PhysicsVector(right)
+{
+  verboseLevel = right.verboseLevel;
+}
+
+// --------------------------------------------------------------------
+
+G4LPhysicsFreeVector& 
+G4LPhysicsFreeVector::operator=(const G4LPhysicsFreeVector& right)
+{
+  // Check assignment to self
+  //
+  if(this == &right) { return *this; }
+
+  DeleteData();
+  CopyData(right);
+
+  verboseLevel = right.verboseLevel;
+  return *this;
 }
 
Index: trunk/source/global/management/src/G4PhysicsFreeVector.cc
===================================================================
--- trunk/source/global/management/src/G4PhysicsFreeVector.cc	(revision 850)
+++ trunk/source/global/management/src/G4PhysicsFreeVector.cc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsFreeVector.cc,v 1.10 2006/06/29 19:04:10 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsFreeVector.cc,v 1.12 2008/09/22 14:49:57 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -47,14 +47,12 @@
 
 
-G4PhysicsFreeVector::G4PhysicsFreeVector()
+G4PhysicsFreeVector::G4PhysicsFreeVector() 
+  : G4PhysicsVector()
 {
-  edgeMin = 0.0;
-  edgeMax = 0.0;
-  numberOfBin = 0;
   type = T_G4PhysicsFreeVector;
 }
 
-
 G4PhysicsFreeVector::G4PhysicsFreeVector(size_t theNbin)
+  : G4PhysicsVector()
 {
   type = T_G4PhysicsFreeVector;
@@ -71,13 +69,5 @@
      dataVector.push_back(0.0);
   }
-
-  edgeMin = 0.;
-  edgeMax = 0.;
-
-  lastBin = INT_MAX;
-  lastEnergy = -DBL_MAX;
-  lastValue = DBL_MAX;
 }  
-
 
 G4PhysicsFreeVector::G4PhysicsFreeVector(const G4DataVector& theBinVector, 
@@ -111,13 +101,9 @@
   edgeMin = binVector[0];
   edgeMax = binVector[numberOfBin-1];
-
-  lastBin = INT_MAX;
-  lastEnergy = -DBL_MAX;
-  lastValue = DBL_MAX;
 }  
 
-
-G4PhysicsFreeVector::~G4PhysicsFreeVector(){}
-
+G4PhysicsFreeVector::~G4PhysicsFreeVector()
+{
+}
 
 void G4PhysicsFreeVector::PutValue( size_t theBinNumber, G4double theBinValue, 
Index: trunk/source/global/management/src/G4PhysicsLinearVector.cc
===================================================================
--- trunk/source/global/management/src/G4PhysicsLinearVector.cc	(revision 850)
+++ trunk/source/global/management/src/G4PhysicsLinearVector.cc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsLinearVector.cc,v 1.12 2006/06/29 19:04:13 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsLinearVector.cc,v 1.14 2008/09/22 14:49:57 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -34,12 +34,5 @@
 //  G4PhysicsLinearVector.cc
 //
-//  History:
-//    02 Dec. 1995, G.Cosmo : Structure created based on object model
-//    15 Feb. 1996, K.Amako : Implemented the 1st version
-//    01 Jul. 1996, K.Amako : Cache mechanism and hidden bin from the 
-//                            user introduced.
-//    26 Sep. 1996, K.Amako : Constructor with only 'bin size' added.
-//    11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
-//    9  Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
+//  15 Feb 1996 - K.Amako : 1st version
 //
 //--------------------------------------------------------------------
@@ -48,14 +41,11 @@
 
 G4PhysicsLinearVector::G4PhysicsLinearVector()
-  : dBin(0.), baseBin(0.)
+  : G4PhysicsVector(), dBin(0.), baseBin(0.)
 {
-  edgeMin = 0.0;
-  edgeMax = 0.0;
-  numberOfBin = 0;
   type = T_G4PhysicsLinearVector;
 }
 
 G4PhysicsLinearVector::G4PhysicsLinearVector(size_t theNbin)
-  : dBin(0.), baseBin(0.)
+  : G4PhysicsVector(), dBin(0.), baseBin(0.)
 {
   type = T_G4PhysicsLinearVector;
@@ -68,11 +58,4 @@
   numberOfBin = theNbin;
 
-  edgeMin = 0.;
-  edgeMax = 0.;
-
-  lastBin = INT_MAX;
-  lastEnergy = -DBL_MAX;
-  lastValue = DBL_MAX;
-
   for (size_t i=0; i<=numberOfBin; i++)
   {
@@ -84,5 +67,6 @@
 G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin, 
                                              G4double theEmax, size_t theNbin)
-  : dBin((theEmax-theEmin)/theNbin),
+  : G4PhysicsVector(),
+    dBin((theEmax-theEmin)/theNbin),
     baseBin(theEmin/dBin)
 {
@@ -105,7 +89,4 @@
   edgeMax = binVector[numberOfBin-1];
 
-  lastBin = INT_MAX;
-  lastEnergy = -DBL_MAX;
-  lastValue = DBL_MAX;
 }  
 
@@ -123,2 +104,24 @@
   return success;
 }
+
+G4PhysicsLinearVector::G4PhysicsLinearVector(const G4PhysicsLinearVector& right)
+  : G4PhysicsVector(right)
+{
+  dBin = right.dBin;
+  baseBin = right.baseBin;
+}
+
+G4PhysicsLinearVector& 
+G4PhysicsLinearVector::operator=(const G4PhysicsLinearVector& right)
+{
+  // Check assignment to self
+  //
+  if(this == &right) { return *this; }
+
+  DeleteData();
+  CopyData(right);
+
+  dBin    = right.dBin;
+  baseBin = right.baseBin;
+  return *this;
+}
Index: trunk/source/global/management/src/G4PhysicsLnVector.cc
===================================================================
--- trunk/source/global/management/src/G4PhysicsLnVector.cc	(revision 850)
+++ trunk/source/global/management/src/G4PhysicsLnVector.cc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsLnVector.cc,v 1.15 2006/06/29 19:04:15 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsLnVector.cc,v 1.17 2008/09/22 14:49:57 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -34,8 +34,5 @@
 //  G4PhysicsLnVector.cc
 //
-//  History:
-//    27 Apr. 1999, M.G. Pia: Created, copying from G4PhysicsLogVector
-//    11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
-//    9  Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
+//  27 Apr 1999 - M.G.Pia: Created from G4PhysicsLogVector
 //
 // --------------------------------------------------------------
@@ -44,5 +41,5 @@
 
 G4PhysicsLnVector::G4PhysicsLnVector()
-  : dBin(0.), baseBin(0.)
+  : G4PhysicsVector(), dBin(0.), baseBin(0.)
 {
   type = T_G4PhysicsLnVector;
@@ -50,5 +47,5 @@
 
 G4PhysicsLnVector::G4PhysicsLnVector(size_t theNbin)
-  : dBin(0.), baseBin(0.)
+  : G4PhysicsVector(), dBin(0.), baseBin(0.)
 {
   type = T_G4PhysicsLnVector;
@@ -61,11 +58,4 @@
   numberOfBin = theNbin;
 
-  edgeMin = 0.;
-  edgeMax = 0.;
-
-  lastBin = INT_MAX;
-  lastEnergy = -DBL_MAX;
-  lastValue = DBL_MAX;
-
   for (size_t i=0; i<=numberOfBin; i++)
   {
@@ -77,5 +67,6 @@
 G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin, 
                                      G4double theEmax, size_t theNbin)
-  : dBin(std::log(theEmax/theEmin)/theNbin),
+  : G4PhysicsVector(),
+    dBin(std::log(theEmax/theEmin)/theNbin),
     baseBin(std::log(theEmin)/dBin)
 {
@@ -97,8 +88,4 @@
   edgeMin = binVector[0];
   edgeMax = binVector[numberOfBin-1];
-
-  lastBin = INT_MAX;
-  lastEnergy = -DBL_MAX;
-  lastValue = DBL_MAX;
 }
 
@@ -116,2 +103,24 @@
   return success;
 }
+
+G4PhysicsLnVector::G4PhysicsLnVector(const G4PhysicsLnVector& right)
+  : G4PhysicsVector(right)
+{
+  dBin = right.dBin;
+  baseBin = right.baseBin;
+}
+
+G4PhysicsLnVector& 
+G4PhysicsLnVector::operator=(const G4PhysicsLnVector& right)
+{
+  // Check assignment to self
+  //
+  if(this == &right) { return *this; }
+
+  DeleteData();
+  CopyData(right);
+
+  dBin    = right.dBin;
+  baseBin = right.baseBin;
+  return *this;
+}
Index: trunk/source/global/management/src/G4PhysicsLogVector.cc
===================================================================
--- trunk/source/global/management/src/G4PhysicsLogVector.cc	(revision 850)
+++ trunk/source/global/management/src/G4PhysicsLogVector.cc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsLogVector.cc,v 1.16 2008/09/06 19:52:16 vnivanch Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsLogVector.cc,v 1.21 2008/09/22 08:26:33 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -40,5 +40,5 @@
 //    26 Sep. 1996, K.Amako : Constructor with only 'bin size' added
 //    11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
-//    9  Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
+//    9  Mar. 2001, H.Kurashige : added PhysicsVector type and Retrieve
 //    05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector
 //
@@ -60,16 +60,13 @@
   // Add extra one bin (hidden to user) to handle correctly when 
   // Energy=theEmax in getValue. 
+  dataVector.reserve(theNbin+1);
+  binVector.reserve(theNbin+1); 
 
   numberOfBin = theNbin;
 
-  if(numberOfBin > 0) {
-    dataVector.resize(theNbin+1);
-    binVector.resize(theNbin+1); 
-    edgeMin = 1;
-    edgeMax = numberOfBin;
-    for (size_t i=0; i<=numberOfBin; i++) {
-      binVector[i] = i + 1;
-      dataVector[i]= 0.0;
-    }
+  for (size_t i=0; i<=numberOfBin; i++)
+  {
+     binVector.push_back(0.0);
+     dataVector.push_back(0.0);
   }
 }  
@@ -84,20 +81,21 @@
   // Add extra one bin (hidden to user) to handle correctly when 
   // Energy=theEmax in getValue. 
-  dataVector.resize(theNbin+1);
-  binVector.resize(theNbin+1); 
+  dataVector.reserve(theNbin+1);
+  binVector.reserve(theNbin+1); 
 
   numberOfBin = theNbin;
 
-  if(numberOfBin > 0) {
-    for (size_t i=0; i<=numberOfBin; i++) {
-      binVector[i] = std::pow(10., std::log10(theEmin)+i*dBin);
-      dataVector[i]= 0.0;
-    }
-    edgeMin = binVector[0];
-    edgeMax = binVector[numberOfBin-1];
+  for (size_t i=0; i<numberOfBin+1; i++)
+  {
+    binVector.push_back(std::pow(10., std::log10(theEmin)+i*dBin));
+    dataVector.push_back(0.0);
   }
+  edgeMin = binVector[0];
+  edgeMax = binVector[numberOfBin-1];
 }  
 
-G4PhysicsLogVector::~G4PhysicsLogVector(){}
+G4PhysicsLogVector::~G4PhysicsLogVector()
+{
+}
 
 G4bool G4PhysicsLogVector::Retrieve(std::ifstream& fIn, G4bool ascii)
@@ -112,2 +110,24 @@
   return success;
 }
+
+G4PhysicsLogVector::G4PhysicsLogVector(const G4PhysicsLogVector& right)
+  : G4PhysicsVector(right)
+{
+  dBin = right.dBin;
+  baseBin = right.baseBin;
+}
+
+G4PhysicsLogVector& 
+G4PhysicsLogVector::operator=(const G4PhysicsLogVector& right)
+{
+  // Check assignment to self
+  //
+  if(this == &right) { return *this; }
+
+  DeleteData();
+  CopyData(right);
+
+  dBin    = right.dBin;
+  baseBin = right.baseBin;
+  return *this;
+}
Index: trunk/source/global/management/src/G4PhysicsOrderedFreeVector.cc
===================================================================
--- trunk/source/global/management/src/G4PhysicsOrderedFreeVector.cc	(revision 850)
+++ trunk/source/global/management/src/G4PhysicsOrderedFreeVector.cc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsOrderedFreeVector.cc,v 1.10 2006/06/29 19:04:20 gunter Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsOrderedFreeVector.cc,v 1.12 2008/09/22 14:49:57 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 ////////////////////////////////////////////////////////////////////////
@@ -61,12 +61,10 @@
                                                        G4double *Values,
                                                        size_t VectorLength)
+  : G4PhysicsVector()
 {
         type = T_G4PhysicsOrderedFreeVector;
 
-        lastBin = INT_MAX;
-
-        lastEnergy = -DBL_MAX;
-        lastValue = DBL_MAX;
-
+        dataVector.reserve(VectorLength+1);
+        binVector.reserve(VectorLength+1); 
         numberOfBin = VectorLength;
 
@@ -78,17 +76,12 @@
         edgeMin = binVector.front();
         edgeMax = binVector.back();
+	binVector.push_back ( binVector[numberOfBin-1] + 1.0 );
+	dataVector.push_back( dataVector[numberOfBin-1] );
 }
 
 G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector()
+  : G4PhysicsVector()
 {
         type = T_G4PhysicsOrderedFreeVector;
-
-        lastBin = INT_MAX;
-        lastEnergy = -DBL_MAX;
-        lastValue = DBL_MAX;
-
-        edgeMin = 0.0;
-        edgeMax = 0.0;
-        numberOfBin = 0;
 }
 
Index: trunk/source/global/management/src/G4PhysicsVector.cc
===================================================================
--- trunk/source/global/management/src/G4PhysicsVector.cc	(revision 850)
+++ trunk/source/global/management/src/G4PhysicsVector.cc	(revision 921)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhysicsVector.cc,v 1.22 2008/09/05 18:04:45 vnivanch Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4PhysicsVector.cc,v 1.27 2008/10/16 12:14:36 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-02-cand-01 $
 //
 // 
@@ -52,11 +52,8 @@
 G4PhysicsVector::G4PhysicsVector(G4bool spline)
  : type(T_G4PhysicsVector),
-   edgeMin(DBL_MAX), edgeMax(0.), numberOfBin(0),
+   edgeMin(0.), edgeMax(0.), numberOfBin(0),
    lastEnergy(0.), lastValue(0.), lastBin(0), 
    secDerivative(0), useSpline(spline)
-{
-  binVector.push_back(edgeMin);
-  dataVector.push_back(0.0);
-}
+{}
 
 // --------------------------------------------------------------
@@ -64,5 +61,5 @@
 G4PhysicsVector::~G4PhysicsVector() 
 {
-  delete [] secDerivative;
+  DeleteData();
 }
 
@@ -71,5 +68,5 @@
 G4PhysicsVector::G4PhysicsVector(const G4PhysicsVector& right)
 {
-  *this=right;
+  CopyData(right);
 }
 
@@ -81,16 +78,7 @@
   if (type != right.type)  { return *this; }
 
-  type = right.type;
-  edgeMin = right.edgeMin;
-  edgeMax = right.edgeMax;
-  numberOfBin = right.numberOfBin;
-  lastEnergy = right.lastEnergy;
-  lastValue = right.lastValue;
-  lastBin = right.lastBin;
-  dataVector = right.dataVector;
-  binVector = right.binVector;
-  secDerivative = right.secDerivative;
-  useSpline = right.useSpline;
-  comment = right.comment;
+  DeleteData();
+  CopyData(right);
+
   return *this;
 }
@@ -108,4 +96,41 @@
 {
   return (this != &right);
+}
+
+// --------------------------------------------------------------
+
+void G4PhysicsVector::DeleteData()
+{
+  delete [] secDerivative;
+  secDerivative = 0;
+}
+
+// --------------------------------------------------------------
+
+void G4PhysicsVector::CopyData(const G4PhysicsVector& vec)
+{
+  type = vec.type;
+  edgeMin = vec.edgeMin;
+  edgeMax = vec.edgeMax;
+  numberOfBin = vec.numberOfBin;
+  lastEnergy = vec.lastEnergy;
+  lastValue = vec.lastValue;
+  lastBin = vec.lastBin;
+  dataVector = vec.dataVector;
+  binVector = vec.binVector;
+  useSpline = vec.useSpline;
+  comment = vec.comment;
+  if (vec.secDerivative)
+  {
+    secDerivative = new G4double [numberOfBin];
+    for (size_t i=0; i<numberOfBin; i++)
+    {
+       secDerivative[i] = vec.secDerivative[i];
+    }
+  }
+  else
+  {
+    secDerivative = 0;
+  }
 }
 
@@ -224,43 +249,23 @@
   secDerivative = new G4double [numberOfBin];
 
-  secDerivative[0] = 0.0 ;
+  size_t n = numberOfBin-1;
 
   // cannot compute derivatives for less than 3 points
-  if(3 > numberOfBin) {
-    secDerivative[numberOfBin-1] = 0.0 ;
+  if(3 > numberOfBin)
+  {
+    secDerivative[0] = 0.0;
+    secDerivative[n] = 0.0;
     return;
   }
 
-  G4double* u = new G4double [numberOfBin];
-  u[0] = 0.0 ;
-   
-  // Decomposition loop for tridiagonal algorithm. secDerivative[i]
-  // and u[i] are used for temporary storage of the decomposed factors.
-   
-  for(size_t i=1; i<numberOfBin-1; i++)
-  {
-    G4double sig = (binVector[i]-binVector[i-1])
-                 / (binVector[i+1]-binVector[i-1]) ;
-    G4double p = sig*secDerivative[i-1] + 2.0 ;
-    secDerivative[i] = (sig - 1.0)/p ;
-    u[i] = (dataVector[i+1]-dataVector[i])/(binVector[i+1]-binVector[i])
-         - (dataVector[i]-dataVector[i-1])/(binVector[i]-binVector[i-1]) ;
-    u[i] =(6.0*u[i]/(binVector[i+1]-binVector[i-1]) - sig*u[i-1])/p ;
-  }
-
-  G4double qn = 0.0 ;
-  G4double un = 0.0 ;
-
-  secDerivative[numberOfBin-1] = (un - qn*u[numberOfBin-2])
-                               / (qn*secDerivative[numberOfBin-2] + 1.0) ;
-   
-  // The back-substitution loop for the triagonal algorithm of solving
-  // a linear system of equations.
-   
-  for(G4int k=numberOfBin-2; k>=0; k--)
-  {
-    secDerivative[k] = secDerivative[k]*secDerivative[k+1] + u[k];
-  }
-  delete [] u;
+  for(size_t i=1; i<n; i++)
+  {
+    secDerivative[i] = 
+      3.0*((dataVector[i+1]-dataVector[i])/(binVector[i+1]-binVector[i]) -
+           (dataVector[i]-dataVector[i-1])/(binVector[i]-binVector[i-1]))
+      /(binVector[i+1]-binVector[i-1]);
+  }
+  secDerivative[n] = secDerivative[n-1];
+  secDerivative[0] = secDerivative[1];
 }
    
