CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: Exponential.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ 00003 #include "CLHEP/GenericFunctions/Exponential.hh" 00004 #include <assert.h> 00005 #include <cmath> // for exp() 00006 00007 namespace Genfun { 00008 FUNCTION_OBJECT_IMP(Exponential) 00009 00010 Exponential::Exponential(): 00011 _decayConstant("Decay Constant", 1.0, 0,10) 00012 {} 00013 00014 Exponential::Exponential(const Exponential & right): 00015 _decayConstant(right._decayConstant) 00016 { 00017 } 00018 00019 Exponential::~Exponential() { 00020 } 00021 00022 double Exponential::operator() (double x) const { 00023 if (x<0) return 0; 00024 return exp(-x/_decayConstant.getValue())/_decayConstant.getValue(); 00025 } 00026 00027 Parameter & Exponential::decayConstant() { 00028 return _decayConstant; 00029 } 00030 00031 const Parameter & Exponential::decayConstant() const { 00032 return _decayConstant; 00033 } 00034 00035 00036 Derivative Exponential::partial(unsigned int index) const { 00037 assert(index==0); 00038 const AbsFunction & fPrime = -_decayConstant*(*this); 00039 return Derivative(&fPrime); 00040 } 00041 00042 00043 } // namespace Genfun