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