CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: DoubleParamToArgAdaptor.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 two PARAMETERs to a function // 00009 // connects them to a single argument, with scale factors controlling how // 00010 // the argument is increased before it is used to adjust the parameter. // 00011 // In other words it makes a function like // 00012 // // 00013 // F(a_0, a_1, a_2; x) // 00014 // // 00015 // and reinterprets it as // 00016 // // 00017 // F(a_0; x, a_1) // 00018 // // 00019 // // 00020 //--------------------------------------------------------------------------// 00021 #ifndef DoubleParamToArgAdaptor_h_ 00022 #define DoubleParamToArgAdaptor_h_ 00023 00024 #include <functional> 00025 #include <iostream> 00026 #include <string> 00027 #include "CLHEP/GenericFunctions/Parameter.hh" 00028 #include "CLHEP/GenericFunctions/AbsFunction.hh" 00029 00030 namespace Genfun { 00031 00036 template <class F> 00037 class DoubleParamToArgAdaptor : public AbsFunction { 00038 00039 FUNCTION_OBJECT_DEF(DoubleParamToArgAdaptor) 00040 00041 public: 00042 00043 // ScopedMethodName 00044 typedef Parameter & (F::*ScopedMethodPtr) (); 00045 00046 // Constructor 00047 DoubleParamToArgAdaptor(const F & function, 00048 ScopedMethodPtr parameterFetchMethod0, 00049 ScopedMethodPtr paraemterFetchMethod1); 00050 00051 // Copy constructor 00052 DoubleParamToArgAdaptor(const DoubleParamToArgAdaptor &right); 00053 00054 // Destructor 00055 virtual ~DoubleParamToArgAdaptor(); 00056 00057 // Retreive function value 00058 virtual double operator ()(double argument) const; // Gives an error. 00059 virtual double operator ()(const Argument & a) const; // Must use this one 00060 00061 // Dimensionality 00062 virtual unsigned int dimensionality() const; 00063 00064 // Get the mean of the DoubleParamToArgAdaptor 00065 Parameter & scaleFactor0(); 00066 const Parameter & scaleFactor0() const; 00067 00068 // Get the mean of the DoubleParamToArgAdaptor 00069 Parameter & scaleFactor1(); 00070 const Parameter & scaleFactor1() const; 00071 00072 00073 private: 00074 00075 // It is illegal to assign an adjustable constant 00076 const DoubleParamToArgAdaptor & operator=(const DoubleParamToArgAdaptor &right); 00077 00078 // Here is the scale: 00079 Parameter _scaleFactor0; 00080 Parameter _scaleFactor1; 00081 00082 // Here is the function being adapted; 00083 F *_function; 00084 00085 // Here is the recipe for fetching the parameter from the function: 00086 std::mem_fun_ref_t<Parameter &, F> _parameterFetchMethod0; 00087 std::mem_fun_ref_t<Parameter &, F> _parameterFetchMethod1; 00088 00089 }; 00090 } // namespace Genfun 00091 #include "CLHEP/GenericFunctions/DoubleParamToArgAdaptor.icc" 00092 #endif