CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
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#include <iostream>
7
8namespace Genfun {
9FUNCTION_OBJECT_IMP(Exponential)
10
12 _decayConstant("Decay Constant", 1.0, 0,10)
13{}
14
16 AbsFunction(right),
17 _decayConstant(right._decayConstant)
18{
19}
20
22}
23
24double Exponential::operator() (double x) const {
25 if (x<0) return 0;
26 return exp(-x/_decayConstant.getValue())/_decayConstant.getValue();
27}
28
30 return _decayConstant;
31}
32
34 return _decayConstant;
35}
36
37// don't generate warnings about unused parameter inside assert
38#if defined __GNUC__
39 #if __GNUC__ > 3 && __GNUC_MINOR__ > 6
40 #pragma GCC diagnostic push
41 #pragma GCC diagnostic ignored "-Wunused-parameter"
42 #endif
43#endif
44#ifdef __clang__
45 #pragma clang diagnostic push
46 #pragma clang diagnostic ignored "-Wunused-parameter"
47#endif
48Derivative Exponential::partial(unsigned int index) const {
49 assert(index==0);
50 const AbsFunction & fPrime = -_decayConstant*(*this);
51 return Derivative(&fPrime);
52}
53#if defined __GNUC__
54 #if __GNUC__ > 3 && __GNUC_MINOR__ > 6
55 #pragma GCC diagnostic pop
56 #endif
57#endif
58#ifdef __clang__
59 #pragma clang diagnostic pop
60#endif
61
62
63} // namespace Genfun
#define FUNCTION_OBJECT_IMP(classname)
Definition: AbsFunction.hh:149
Derivative partial(unsigned int) const override
Definition: Exponential.cc:48
virtual ~Exponential()
Definition: Exponential.cc:21
Parameter & decayConstant()
Definition: Exponential.cc:29
virtual double operator()(double argument) const override
Definition: Exponential.cc:24
virtual double getValue() const
Definition: Parameter.cc:29
Definition: Abs.hh:14
FunctionNoop Derivative
Definition: AbsFunction.hh:42