Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:35

0001 // -*- C++ -*-
0002 // $Id: Power.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
0003 //----------------------Power-----------------------------------------------//
0004 //                                                                          //
0005 //  Class Power                                                             //
0006 //  Joe Boudreau, Petar Maksimovic, Nov. 1999                               //
0007 //                                                                          //
0008 //  Power(x) returns x^n                                                    //
0009 //--------------------------------------------------------------------------//
0010 #ifndef Power_h
0011 #define Power_h 1
0012 #include "CLHEP/GenericFunctions/AbsFunction.hh"
0013 namespace Genfun {
0014 
0015   /**
0016    * @author
0017    * @ingroup genfun
0018    */
0019   class Power : public AbsFunction  {
0020 
0021     FUNCTION_OBJECT_DEF(Power)
0022   
0023       public:
0024 
0025     // Constructor
0026     Power(double n);
0027     Power(int n);
0028     Power(unsigned int n);
0029   
0030     // Copy constructor
0031     Power(const Power &right);
0032   
0033     // Destructor
0034     virtual ~Power();
0035   
0036     // Retrieve function value
0037 
0038     virtual double operator ()(double argument) const override; 
0039     virtual double operator ()(const Argument & a) const override {return operator() (a[0]);}
0040   
0041     // Derivative.  
0042     Derivative partial (unsigned int) const override;
0043 
0044     // Does this function have an analytic derivative?
0045     virtual bool hasAnalyticDerivative() const override {return true;}
0046 
0047   private:
0048 
0049     // It is illegal to assign a fixed constant
0050     const Power & operator=(const Power &right);
0051 
0052     double _doublePower; // power (as a double)
0053     int    _intPower;    // power (as an integer)
0054     bool   _asInteger;   // flag:  object constructed with integer argument
0055 
0056   };
0057 } // namespace Genfun
0058 #endif