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