CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

ReverseExponential.cc

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

Generated on Thu Jul 1 22:02:30 2010 for CLHEP by  doxygen 1.4.7