CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: Variable.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ 00003 //----------------------X------------ --------------------------------------// 00004 // // 00005 // Class Variable // 00006 // Joe Boudreau, Petar Maksimovic, Nov. 1999 // 00007 // // 00008 // Variable is a function that returns the variable itself. // 00009 //--------------------------------------------------------------------------// 00010 #ifndef Variable_h 00011 #define Variable_h 1 00012 #include "CLHEP/GenericFunctions/AbsFunction.hh" 00013 namespace Genfun { 00014 00019 class Variable : public AbsFunction { 00020 00021 FUNCTION_OBJECT_DEF(Variable) 00022 00023 public: 00024 00025 // Constructor 00026 Variable(unsigned int selectionIndex=0, 00027 unsigned int dimensionality=1); 00028 00029 // Copy constructor 00030 Variable(const Variable &right); 00031 00032 // Destructor 00033 virtual ~Variable(); 00034 00035 // Retrieve function value 00036 virtual double operator ()(double argument) const; 00037 virtual double operator ()(const Argument & a) const; 00038 00039 // Get the dimensionality, as specified in the constructor: 00040 virtual unsigned int dimensionality() const ; 00041 00042 // Get the selectionIndex: 00043 unsigned int index() const; 00044 00045 // Derivative. 00046 Derivative partial (unsigned int) const; 00047 00048 // Does this function have an analytic derivative? 00049 virtual bool hasAnalyticDerivative() const {return true;} 00050 00051 private: 00052 00053 // It is illegal to assign a fixed constant 00054 const Variable & operator=(const Variable &right); 00055 00056 // The selection index is used to select a particular element from 00057 // the argument. By default it is zero..... 00058 unsigned int _selectionIndex; 00059 00060 // The dimensionality, length of the argument list: 00061 unsigned int _dimensionality; 00062 00063 }; 00064 00065 } // namespace Genfun 00066 #endif