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