// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicsOrderedFreeVector.icc,v 1.2 1999/11/23 15:00:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
////////////////////////////////////////////////////////////////////////
// PhysicsOrderedFreeVector Class Inline Functions Definitions
////////////////////////////////////////////////////////////////////////
//
// File:	G4PhysicsOrderedFreeVector.icc
// Version:	1.0
// Author:      Juliet Armstrong
// mail:        gum@triumf.ca
//
////////////////////////////////////////////////////////////////////////

////////////////////
// Inline methods
////////////////////

inline
G4double G4PhysicsOrderedFreeVector::GetMaxValue()
{
	return dataVector.last();
}

inline
G4double G4PhysicsOrderedFreeVector::GetMinValue()
{
	return dataVector.first();
}

inline
G4double G4PhysicsOrderedFreeVector::GetMaxLowEdgeEnergy()
{
	return binVector.last();
}

inline
G4double G4PhysicsOrderedFreeVector::GetMinLowEdgeEnergy()
{
	return binVector.first();
}

inline
void G4PhysicsOrderedFreeVector::DumpValues()
{
   for (G4int i = 0; i < numberOfBin; i++) {
      G4cout << binVector[i] << "\t" << dataVector[i] << G4endl;
   }
}

inline
size_t G4PhysicsOrderedFreeVector::FindBinLocation(G4double theEnergy) const
{
   G4int n1 = 0;
   G4int n2 = numberOfBin/2;
   G4int n3 = numberOfBin - 1;
   while (n1 != n3 - 1) {
      if (theEnergy > binVector(n2))
         n1 = n2;
      else
         n3 = n2;
      n2 = n1 + (n3 - n1 + 1)/2;
   }
   return (size_t)n1;
}
