CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: ParamToArgAdaptor.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ 00003 //-----------------------Class ParaToArgAdaptor-----------------------------// 00004 // // 00005 // Joe Boudreau // 00006 // January 2000 // 00007 // // 00008 // This class changes the interpretation of a function's PARAMETER and // 00009 // turns it into an argument. In other words it makes a function like // 00010 // // 00011 // F(a_0, a_1, a_2; x) // 00012 // // 00013 // and reinterprets it as // 00014 // // 00015 // F(a_0, a_2; x, a_1) // 00016 // // 00017 // // 00018 //--------------------------------------------------------------------------// 00019 #ifndef ParamToArgAdaptor_h_ 00020 #define ParamToArgAdaptor_h_ 00021 00022 #include <functional> 00023 #include <iostream> 00024 #include <string> 00025 #include "CLHEP/GenericFunctions/Parameter.hh" 00026 #include "CLHEP/GenericFunctions/AbsFunction.hh" 00027 00028 namespace Genfun { 00029 00034 template <class F> 00035 class ParamToArgAdaptor : public AbsFunction { 00036 00037 FUNCTION_OBJECT_DEF(ParamToArgAdaptor) 00038 00039 public: 00040 00041 // ScopedMethodName 00042 typedef Parameter & (F::*ScopedMethodPtr) (); 00043 00044 // Constructor 00045 ParamToArgAdaptor(const F & function, 00046 ScopedMethodPtr parameterFetchMethod); 00047 00048 // Copy constructor 00049 ParamToArgAdaptor(const ParamToArgAdaptor &right); 00050 00051 // Destructor 00052 virtual ~ParamToArgAdaptor(); 00053 00054 // Retreive function value 00055 virtual double operator ()(double argument) const; // Gives an error. 00056 virtual double operator ()(const Argument & a) const; // Must use this one 00057 00058 // Dimensionality 00059 virtual unsigned int dimensionality() const; 00060 00061 // Get the mean of the ParamToArgAdaptor 00062 Parameter & scaleFactor(); 00063 const Parameter & scaleFactor() const; 00064 00065 00066 private: 00067 00068 // It is illegal to assign an adjustable constant 00069 const ParamToArgAdaptor & operator=(const ParamToArgAdaptor &right); 00070 00071 // Here is the sigma 00072 Parameter _scaleFactor; 00073 00074 // Here is the function being adapted; 00075 F *_function; 00076 00077 // Here is the recipe for fetching the parameter from the function: 00078 std::mem_fun_ref_t<Parameter &, F> _parameterFetchMethod; 00079 00080 }; 00081 } // namespace Genfun 00082 #include "CLHEP/GenericFunctions/ParamToArgAdaptor.icc" 00083 #endif