CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

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 $
4 #include <assert.h>
5 #include <cmath> // for exp()
6 
7 namespace Genfun {
8 FUNCTION_OBJECT_IMP(Exponential)
9 
11  _decayConstant("Decay Constant", 1.0, 0,10)
12 {}
13 
15  AbsFunction(right),
16  _decayConstant(right._decayConstant)
17 {
18 }
19 
21 }
22 
23 double Exponential::operator() (double x) const {
24  if (x<0) return 0;
25  return exp(-x/_decayConstant.getValue())/_decayConstant.getValue();
26 }
27 
29  return _decayConstant;
30 }
31 
32 const Parameter & Exponential::decayConstant() const {
33  return _decayConstant;
34 }
35 
36 
37 Derivative Exponential::partial(unsigned int index) const {
38  assert(index==0);
39  const AbsFunction & fPrime = -_decayConstant*(*this);
40  return Derivative(&fPrime);
41 }
42 
43 
44 } // namespace Genfun
Genfun::Parameter::getValue
virtual double getValue() const
Definition: Parameter.cc:27
Genfun::Derivative
FunctionNoop Derivative
Definition: CLHEP/GenericFunctions/AbsFunction.hh:40
Genfun::AbsFunction
Definition: CLHEP/GenericFunctions/AbsFunction.hh:48
Genfun::Exponential
Definition: CLHEP/GenericFunctions/Exponential.hh:20
Genfun::Exponential::~Exponential
virtual ~Exponential()
Definition: Exponential.cc:20
Genfun::Exponential::partial
Derivative partial(unsigned int) const
Definition: Exponential.cc:37
Genfun::Exponential::operator()
virtual double operator()(double argument) const
Definition: Exponential.cc:23
Genfun::Exponential::Exponential
Exponential()
Definition: Exponential.cc:10
Genfun::FunctionNoop
Definition: CLHEP/GenericFunctions/FunctionNoop.hh:19
Genfun::Exponential::decayConstant
Parameter & decayConstant()
Definition: Exponential.cc:28
Exponential.hh
Genfun::Parameter
Definition: CLHEP/GenericFunctions/Parameter.hh:35
x
any side effects of that construction would occur twice The semantics of throw x
Definition: whyZMthrowRethrows.txt:37
FUNCTION_OBJECT_IMP
#define FUNCTION_OBJECT_IMP(classname)
Definition: CLHEP/GenericFunctions/AbsFunction.hh:156
Genfun
Definition: CLHEP/GenericFunctions/Abs.hh:14