CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
GenericFunctions
GenericFunctions/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
31
namespace
Genfun {
32
33
template
<
class
F>
34
class
SymToArgAdaptor :
public
AbsFunction {
35
36
FUNCTION_OBJECT_DEF
(
SymToArgAdaptor
)
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
50
SymToArgAdaptor
(const
SymToArgAdaptor
&right);
51
52
// Destructor
53
virtual ~
SymToArgAdaptor
();
54
55
// Retreive function value
56
virtual
double
operator ()(
double
argument) const;
// Gives an error.
57
virtual
double
operator ()(const
Argument
&
a
) const;
// Must use this one
58
59
// Dimensionality
60
virtual
unsigned
int
dimensionality
() const;
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
Generated on Mon May 6 2013 04:04:11 for CLHEP by
1.8.1.2