CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
ParamToArgAdaptor.hh
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: ParamToArgAdaptor.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
3//-----------------------Class ParaToArgAdaptor-----------------------------//
4// //
5// Joe Boudreau //
6// January 2000 //
7// //
8// This class changes the interpretation of a function's PARAMETER and //
9// turns it into an argument. In other words it makes a function like //
10// //
11// F(a_0, a_1, a_2; x) //
12// //
13// and reinterprets it as //
14// //
15// F(a_0, a_2; x, a_1) //
16// //
17// //
18//--------------------------------------------------------------------------//
19#ifndef ParamToArgAdaptor_h_
20#define ParamToArgAdaptor_h_
21
22#include <functional>
23#include <iostream>
24#include <string>
25#include "CLHEP/GenericFunctions/Parameter.hh"
26#include "CLHEP/GenericFunctions/AbsFunction.hh"
27
28namespace Genfun {
29
30 /**
31 * @author
32 * @ingroup genfun
33 */
34 template <class F>
36
38
39 public:
40
41 // ScopedMethodName
42 typedef Parameter & (F::*ScopedMethodPtr) ();
43
44 // Constructor
45 ParamToArgAdaptor(const F & function,
46 ScopedMethodPtr parameterFetchMethod);
47
48 // Copy constructor
50
51 // Destructor
53
54 // Retreive function value
55 virtual double operator ()(double argument) const override; // Gives an error.
56 virtual double operator ()(const Argument & a) const override; // Must use this one
57
58 // Dimensionality
59 virtual unsigned int dimensionality() const override;
60
61 // Get the mean of the ParamToArgAdaptor
63 const Parameter & scaleFactor() const;
64
65
66 private:
67
68 // It is illegal to assign an adjustable constant
69 const ParamToArgAdaptor & operator=(const ParamToArgAdaptor &right);
70
71 // Here is the sigma
72 Parameter _scaleFactor;
73
74 // Here is the function being adapted;
75 F *_function;
76
77 // Here is the recipe for fetching the parameter from the function:
78 std::mem_fun_ref_t<Parameter &, F> _parameterFetchMethod;
79
80 };
81} // namespace Genfun
82 #include "CLHEP/GenericFunctions/ParamToArgAdaptor.icc"
83#endif
#define FUNCTION_OBJECT_DEF(classname)
Definition: AbsFunction.hh:143
ParamToArgAdaptor(const F &function, ScopedMethodPtr parameterFetchMethod)
virtual unsigned int dimensionality() const override
virtual double operator()(double argument) const override
ParamToArgAdaptor(const ParamToArgAdaptor &right)
const Parameter & scaleFactor() const
Parameter &(F::* ScopedMethodPtr)()
Definition: Abs.hh:14