|
||||
File indexing completed on 2025-01-18 09:54:36
0001 // -*- C++ -*- 0002 // $Id: 0003 //-----------------------Class ParaToArgAdaptor-----------------------------// 0004 // // 0005 // Joe Boudreau // 0006 // June 2004 // 0007 // // 0008 // The purpose of this adaptor is to be able to create, starting FROM // 0009 // a function F of several variables and controlled by several parameters: // 0010 // // 0011 // F(alpha, beta, gamma....; x, y, z) // 0012 // // 0013 // a new function of several variables in which the parameter values are // 0014 // set by some of the variables. Application: event-per-event errors. // 0015 // // 0016 // Arguments to the adaptor: // 0017 // 1) The original generic function to adapt. // 0018 // 2) The symbolic expression to apply it to. // 0019 // 3) The name of a parameter to tweak. // 0020 // 4) The symbolic expression to tweak it with // 0021 // // 0022 //--------------------------------------------------------------------------// 0023 #ifndef _SYMTOARGADAPTOR_ 0024 #define _SYMTOARGADAPTOR_ 0025 #include <functional> 0026 #include <iostream> 0027 #include <string> 0028 #include "CLHEP/GenericFunctions/Parameter.hh" 0029 #include "CLHEP/GenericFunctions/AbsFunction.hh" 0030 0031 namespace Genfun { 0032 0033 template <class F> 0034 class SymToArgAdaptor : public AbsFunction { 0035 0036 FUNCTION_OBJECT_DEF(SymToArgAdaptor) 0037 0038 public: 0039 0040 // ScopedMethodName 0041 typedef Parameter & (F::*ScopedMethodPtr) (); 0042 0043 // Constructor 0044 SymToArgAdaptor( F & function, // A function. 0045 const AbsFunction & f_expression, // An expression to apply it to 0046 ScopedMethodPtr parameterFetchMethod, // A parameter. 0047 const AbsFunction * p_expression); // An expression for the parameter 0048 0049 // Copy constructor 0050 SymToArgAdaptor(const SymToArgAdaptor &right); 0051 0052 // Destructor 0053 virtual ~SymToArgAdaptor(); 0054 0055 // Retreive function value 0056 virtual double operator ()(double argument) const override; // Gives an error. 0057 virtual double operator ()(const Argument & a) const override; // Must use this one 0058 0059 // Dimensionality 0060 virtual unsigned int dimensionality() const override; 0061 0062 private: 0063 0064 // It is illegal to assign an adjustable constant 0065 const SymToArgAdaptor & operator=(const SymToArgAdaptor &right); 0066 0067 // Here is the function being adapted; 0068 F *_function; 0069 0070 // A Variable (int an argument) to which the function is going to apply: 0071 const AbsFunction *_f_expression; 0072 0073 // Here is the recipe for fetching the parameter from the function: 0074 std::mem_fun_ref_t<Parameter &, F> _parameterFetchMethod; 0075 0076 // Here is the symbol to be connect to the parameter: 0077 const AbsFunction *_p_expression; 0078 0079 }; 0080 } // namespace Genfun 0081 #include "CLHEP/GenericFunctions/SymToArgAdaptor.icc" 0082 #endif 0083
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |