CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
SymToArgAdaptor.hh
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id:
3//-----------------------Class ParaToArgAdaptor-----------------------------//
4// //
5// Joe Boudreau //
6// June 2004 //
7// //
8// The purpose of this adaptor is to be able to create, starting FROM //
9// a function F of several variables and controlled by several parameters: //
10// //
11// F(alpha, beta, gamma....; x, y, z) //
12// //
13// a new function of several variables in which the parameter values are //
14// set by some of the variables. Application: event-per-event errors. //
15// //
16// Arguments to the adaptor: //
17// 1) The original generic function to adapt. //
18// 2) The symbolic expression to apply it to. //
19// 3) The name of a parameter to tweak. //
20// 4) The symbolic expression to tweak it with //
21// //
22//--------------------------------------------------------------------------//
23#ifndef _SYMTOARGADAPTOR_
24#define _SYMTOARGADAPTOR_
25#include <functional>
26#include <iostream>
27#include <string>
28#include "CLHEP/GenericFunctions/Parameter.hh"
29#include "CLHEP/GenericFunctions/AbsFunction.hh"
30
31namespace Genfun {
32
33 template <class F>
35
37
38 public:
39
40 // ScopedMethodName
41 typedef Parameter & (F::*ScopedMethodPtr) ();
42
43 // Constructor
44 SymToArgAdaptor( F & function, // A function.
45 const AbsFunction & f_expression, // An expression to apply it to
46 ScopedMethodPtr parameterFetchMethod, // A parameter.
47 const AbsFunction * p_expression); // An expression for the parameter
48
49 // Copy constructor
51
52 // Destructor
54
55 // Retreive function value
56 virtual double operator ()(double argument) const override; // Gives an error.
57 virtual double operator ()(const Argument & a) const override; // Must use this one
58
59 // Dimensionality
60 virtual unsigned int dimensionality() const override;
61
62 private:
63
64 // It is illegal to assign an adjustable constant
65 const SymToArgAdaptor & operator=(const SymToArgAdaptor &right);
66
67 // Here is the function being adapted;
68 F *_function;
69
70 // A Variable (int an argument) to which the function is going to apply:
71 const AbsFunction *_f_expression;
72
73 // Here is the recipe for fetching the parameter from the function:
74 std::mem_fun_ref_t<Parameter &, F> _parameterFetchMethod;
75
76 // Here is the symbol to be connect to the parameter:
77 const AbsFunction *_p_expression;
78
79 };
80} // namespace Genfun
81 #include "CLHEP/GenericFunctions/SymToArgAdaptor.icc"
82#endif
83
#define FUNCTION_OBJECT_DEF(classname)
Definition: AbsFunction.hh:143
SymToArgAdaptor(const SymToArgAdaptor &right)
virtual double operator()(double argument) const override
virtual unsigned int dimensionality() const override
Parameter &(F::* ScopedMethodPtr)()
SymToArgAdaptor(F &function, const AbsFunction &f_expression, ScopedMethodPtr parameterFetchMethod, const AbsFunction *p_expression)
Definition: Abs.hh:14