CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
Exponential.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id: Exponential.cc,v 1.4 2003/10/10 17:40:39 garren Exp $
3
#include "
CLHEP/GenericFunctions/Exponential.hh
"
4
#include <assert.h>
5
#include <cmath>
// for exp()
6
7
namespace
Genfun {
8
FUNCTION_OBJECT_IMP
(Exponential)
9
10
Exponential
::
Exponential
():
11
_decayConstant("Decay Constant", 1.0, 0,10)
12
{}
13
14
Exponential::Exponential
(
const
Exponential
& right):
15
_decayConstant(right._decayConstant)
16
{
17
}
18
19
Exponential::~Exponential
() {
20
}
21
22
double
Exponential::operator()
(
double
x)
const
{
23
if
(x<0)
return
0;
24
return
exp(-x/_decayConstant.
getValue
())/_decayConstant.
getValue
();
25
}
26
27
Parameter
&
Exponential::decayConstant
() {
28
return
_decayConstant;
29
}
30
31
const
Parameter
&
Exponential::decayConstant
()
const
{
32
return
_decayConstant;
33
}
34
35
36
Derivative
Exponential::partial
(
unsigned
int
index)
const
{
37
assert(index==0);
38
const
AbsFunction
& fPrime = -_decayConstant*(*this);
39
return
Derivative
(&fPrime);
40
}
41
42
43
}
// namespace Genfun
Generated on Sun Jun 17 2012 08:08:26 for CLHEP by
1.8.1.1