Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:03:25

0001 // -*- C++ -*-
0002 // $Id: FloatingConstant.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
0003 //----------------------FloatingConstant -----------------------------------//
0004 //                                                                          //
0005 //  Class FloatingConstant                                                  //
0006 //  Joe Boudreau, Petar Maksimovic, Nov. 1999                               //
0007 //                                                                          //
0008 //  FloatingConstant allows use to treat constants as floating-constant     //
0009 //  functions so that they automatically will inherit all the algebraic     //
0010 //  operations we have so painstakingly defined for functions.              //
0011 //                                                                          //
0012 //--------------------------------------------------------------------------//
0013 #ifndef FloatingConstant_h
0014 #define FloatingConstant_h 1
0015 #include "CLHEP/GenericFunctions/AbsFunction.hh"
0016 #include "CLHEP/GenericFunctions/Parameter.hh"
0017 
0018 namespace Genfun {
0019 
0020   /**
0021    * @author
0022    * @ingroup genfun
0023    */
0024   class FloatingConstant : public AbsFunction  {
0025 
0026     FUNCTION_OBJECT_DEF(FloatingConstant)
0027   
0028       public:
0029 
0030     // Constructor
0031     FloatingConstant(const AbsParameter & p);
0032   
0033     // Copy constructor
0034     FloatingConstant(const FloatingConstant &right);
0035   
0036     // Destructor
0037     virtual ~FloatingConstant();
0038   
0039     // Retrieve the parameter:
0040     AbsParameter & value();
0041 
0042     // Retrieve function value
0043     virtual double operator ()(double argument) const override;
0044     virtual double operator ()(const Argument & a) const override {return operator() (a[0]);}
0045   
0046     // Derivative.  
0047     Derivative partial (unsigned int) const override;
0048 
0049     // Does this function have an analytic derivative?
0050     virtual bool hasAnalyticDerivative() const override {return true;}
0051 
0052   private:
0053 
0054     // It is illegal to assign a fixed constant
0055     const FloatingConstant & operator=(const FloatingConstant &right);
0056 
0057     // The value of the constant:
0058     AbsParameter *_value;
0059   };
0060 } // namespace Genfun
0061 #endif