CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
ConstTimesFunction.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id: ConstTimesFunction.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
3
#include "
CLHEP/GenericFunctions/ConstTimesFunction.hh
"
4
5
namespace
Genfun {
6
FUNCTION_OBJECT_IMP
(ConstTimesFunction)
7
8
ConstTimesFunction
::
ConstTimesFunction
(
double
constant, const
AbsFunction
*arg):
9
_constant(constant),
10
_arg(arg->clone())
11
{
12
}
13
14
ConstTimesFunction::ConstTimesFunction
(
const
ConstTimesFunction
& right) :
15
_constant(right._constant),
16
_arg(right._arg->clone())
17
{}
18
19
unsigned
int
ConstTimesFunction::dimensionality
()
const
{
20
return
_arg->
dimensionality
();
21
}
22
23
ConstTimesFunction::~ConstTimesFunction
()
24
{
25
delete
_arg;
26
}
27
28
29
30
double
ConstTimesFunction::operator ()
(
double
x)
const
31
{
32
return
_constant * (*_arg)(x);
33
}
34
35
36
double
ConstTimesFunction::operator ()
(
const
Argument
& x)
const
37
{
38
return
_constant * (*_arg)(x);
39
}
40
41
Derivative
ConstTimesFunction::partial
(
unsigned
int
index)
const
{
42
// d/dx (k*f) = k*(df/dx)
43
const
AbsFunction
& fPrime = _constant*(_arg->
partial
(index));
44
return
Derivative
(& fPrime);
45
}
46
47
}
// namespace Genfun
Generated on Sun Jun 17 2012 08:08:26 for CLHEP by
1.8.1.1