CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: FixedConstant.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ 00003 //----------------------FixedConstant --------------------------------------// 00004 // // 00005 // Class FixedConstant // 00006 // Joe Boudreau, Petar Maksimovic, Nov. 1999 // 00007 // // 00008 // FixedConstant allows use to treat "promote" fixed contants to 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 FixedConstant_h 00014 #define FixedConstant_h 1 00015 #include "CLHEP/GenericFunctions/AbsFunction.hh" 00016 00017 namespace Genfun { 00018 00023 class FixedConstant : public AbsFunction { 00024 00025 FUNCTION_OBJECT_DEF(FixedConstant) 00026 00027 public: 00028 00029 // Constructor 00030 FixedConstant(double value); 00031 00032 // Copy constructor 00033 FixedConstant(const FixedConstant &right); 00034 00035 // Destructor 00036 virtual ~FixedConstant(); 00037 00038 // Retrieve function value 00039 virtual double operator ()(double argument) const; 00040 virtual double operator ()(const Argument & a) const {return operator() (a[0]);} 00041 00042 // Derivative. 00043 Derivative partial (unsigned int) const; 00044 00045 // Does this function have an analytic derivative? 00046 virtual bool hasAnalyticDerivative() const {return true;} 00047 00048 private: 00049 00050 // It is illegal to assign a fixed constant 00051 const FixedConstant & operator=(const FixedConstant &right); 00052 00053 // The value of the constant: 00054 double _value; 00055 }; 00056 } // namespace Genfun 00057 #endif