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

ConstOverFunction.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: ConstOverFunction.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
00003 #include "CLHEP/GenericFunctions/ConstOverFunction.hh"
00004 
00005 namespace Genfun {
00006 FUNCTION_OBJECT_IMP(ConstOverFunction)
00007 
00008 ConstOverFunction::ConstOverFunction(double constant, const AbsFunction *arg):
00009   _constant(constant),
00010   _arg(arg->clone())
00011 {
00012 }
00013 
00014 ConstOverFunction::ConstOverFunction(const ConstOverFunction & right) :
00015 _constant(right._constant),
00016 _arg(right._arg->clone())
00017 {}
00018 
00019 unsigned int ConstOverFunction::dimensionality() const {
00020   return _arg->dimensionality();
00021 }
00022 
00023 ConstOverFunction::~ConstOverFunction()
00024 {
00025   delete _arg;
00026 }
00027 
00028 
00029 
00030 double ConstOverFunction::operator ()(double x) const
00031 {
00032   return _constant / (*_arg)(x);
00033 }
00034 
00035 
00036 double ConstOverFunction::operator ()(const Argument & x) const
00037 {
00038   return _constant / (*_arg)(x);
00039 }
00040 
00041 
00042 Derivative ConstOverFunction::partial(unsigned int index) const {
00043   // d/dx (k/f) = -(k/f^2)(df/dx)
00044   const AbsFunction & fPrime = -_constant/(*_arg)/(*_arg)*(_arg->partial(index));
00045   return Derivative(& fPrime);
00046 }
00047 
00048 
00049 } // namespace Genfun

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