CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
ArrayFunction.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id:
3#include "CLHEP/GenericFunctions/AbsFunction.hh"
4#include "CLHEP/GenericFunctions/ArrayFunction.hh"
5
6#include <vector>
7
8namespace Genfun {
9
10FUNCTION_OBJECT_IMP(ArrayFunction)
11
12// Constructor
13ArrayFunction::ArrayFunction(const double *begin, const double *end) :
14 _values(begin,end) {}
15
16// Destructor
18
19// Copy constructor
21 AbsFunction(right), _values(right._values) {}
22
23 // Retreive function value
24double ArrayFunction::operator ()(double argument) const {
25 int i = int (argument+0.5);
26 if (i<0 || i>=int(_values.size())) return 0;
27 else return _values[i];
28}
29
30}
#define FUNCTION_OBJECT_IMP(classname)
Definition: AbsFunction.hh:149
ArrayFunction(const double *begin, const double *end)
virtual double operator()(double argument) const override
Definition: Abs.hh:14