CLHEP VERSION Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: Power.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ 00003 //----------------------Power-----------------------------------------------// 00004 // // 00005 // Class Power // 00006 // Joe Boudreau, Petar Maksimovic, Nov. 1999 // 00007 // // 00008 // Power(x) returns x^n // 00009 //--------------------------------------------------------------------------// 00010 #ifndef Power_h 00011 #define Power_h 1 00012 #include "CLHEP/GenericFunctions/AbsFunction.hh" 00013 namespace Genfun { 00014 00019 class Power : public AbsFunction { 00020 00021 FUNCTION_OBJECT_DEF(Power) 00022 00023 public: 00024 00025 // Constructor 00026 Power(double n); 00027 Power(int n); 00028 Power(unsigned int n); 00029 00030 // Copy constructor 00031 Power(const Power &right); 00032 00033 // Destructor 00034 virtual ~Power(); 00035 00036 // Retrieve function value 00037 00038 virtual double operator ()(double argument) const; 00039 virtual double operator ()(const Argument & a) const {return operator() (a[0]);} 00040 00041 // Derivative. 00042 Derivative partial (unsigned int) const; 00043 00044 // Does this function have an analytic derivative? 00045 virtual bool hasAnalyticDerivative() const {return true;} 00046 00047 private: 00048 00049 // It is illegal to assign a fixed constant 00050 const Power & operator=(const Power &right); 00051 00052 double _doublePower; // power (as a double) 00053 int _intPower; // power (as an integer) 00054 bool _asInteger; // flag: object constructed with integer argument 00055 00056 }; 00057 } // namespace Genfun 00058 #endif