CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

ArrayFunction.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id:
4 
5 namespace Genfun {
6 
7 FUNCTION_OBJECT_IMP(ArrayFunction)
8 
9 // Constructor
10 ArrayFunction::ArrayFunction(const double *begin, const double *end) :
11  _values(begin,end) {}
12 
13 // Destructor
15 
16 // Copy constructor
18  _values(right._values) {}
19 
20  // Retreive function value
21 double ArrayFunction::operator ()(double argument) const {
22  int i = int (argument+0.5);
23  if (i<0 || i>=int(_values.size())) return 0;
24  else return _values[i];
25 }
26 
27 }