CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: FloatingConstant.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ 00003 //----------------------FloatingConstant -----------------------------------// 00004 // // 00005 // Class FloatingConstant // 00006 // Joe Boudreau, Petar Maksimovic, Nov. 1999 // 00007 // // 00008 // FloatingConstant allows use to treat constants as floating-constant // 00009 // functions so that they automatically will inherit all the algebraic // 00010 // operations we have so painstakingly defined for functions. // 00011 // // 00012 //--------------------------------------------------------------------------// 00013 #ifndef FloatingConstant_h 00014 #define FloatingConstant_h 1 00015 #include "CLHEP/GenericFunctions/AbsFunction.hh" 00016 #include "CLHEP/GenericFunctions/Parameter.hh" 00017 00018 namespace Genfun { 00019 00024 class FloatingConstant : public AbsFunction { 00025 00026 FUNCTION_OBJECT_DEF(FloatingConstant) 00027 00028 public: 00029 00030 // Constructor 00031 FloatingConstant(const AbsParameter & p); 00032 00033 // Copy constructor 00034 FloatingConstant(const FloatingConstant &right); 00035 00036 // Destructor 00037 virtual ~FloatingConstant(); 00038 00039 // Retrieve the parameter: 00040 AbsParameter & value(); 00041 00042 // Retrieve function value 00043 virtual double operator ()(double argument) const; 00044 virtual double operator ()(const Argument & a) const {return operator() (a[0]);} 00045 00046 // Derivative. 00047 Derivative partial (unsigned int) const; 00048 00049 // Does this function have an analytic derivative? 00050 virtual bool hasAnalyticDerivative() const {return true;} 00051 00052 private: 00053 00054 // It is illegal to assign a fixed constant 00055 const FloatingConstant & operator=(const FloatingConstant &right); 00056 00057 // The value of the constant: 00058 AbsParameter *_value; 00059 }; 00060 } // namespace Genfun 00061 #endif