CLHEP VERSION Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: 00003 #include "CLHEP/GenericFunctions/ArrayFunction.hh" 00004 00005 namespace Genfun { 00006 00007 FUNCTION_OBJECT_IMP(ArrayFunction) 00008 00009 // Constructor 00010 ArrayFunction::ArrayFunction(const double *begin, const double *end) : 00011 _values(begin,end) {} 00012 00013 // Destructor 00014 ArrayFunction::~ArrayFunction(){} 00015 00016 // Copy constructor 00017 ArrayFunction::ArrayFunction(const ArrayFunction &right): 00018 AbsFunction(right), _values(right._values) {} 00019 00020 // Retreive function value 00021 double ArrayFunction::operator ()(double argument) const { 00022 int i = int (argument+0.5); 00023 if (i<0 || i>=int(_values.size())) return 0; 00024 else return _values[i]; 00025 } 00026 00027 }