CLHEP VERSION 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 AbsFunction(right),
00016 _decayConstant(right._decayConstant)
00017 {
00018 }
00019 
00020 ReverseExponential::~ReverseExponential() {
00021 }
00022 
00023 double ReverseExponential::operator() (double x) const {
00024   if (x>0) return 0;
00025   return exp(x/_decayConstant.getValue())/_decayConstant.getValue();
00026 }
00027 
00028 Parameter & ReverseExponential::decayConstant() {
00029   return _decayConstant;
00030 }
00031 
00032 
00033 Derivative ReverseExponential::partial(unsigned int index) const {
00034   assert(index==0);
00035   const AbsFunction & fPrime = _decayConstant*(*this);
00036   return Derivative(&fPrime);
00037 }
00038 
00039 
00040 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7