CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

CLHEP/GenericFunctions/DoubleParamToArgAdaptor.hh
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: DoubleParamToArgAdaptor.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 two PARAMETERs to a function //
9 // connects them to a single argument, with scale factors controlling how //
10 // the argument is increased before it is used to adjust the parameter. //
11 // In other words it makes a function like //
12 // //
13 // F(a_0, a_1, a_2; x) //
14 // //
15 // and reinterprets it as //
16 // //
17 // F(a_0; x, a_1) //
18 // //
19 // //
20 //--------------------------------------------------------------------------//
21 #ifndef DoubleParamToArgAdaptor_h_
22 #define DoubleParamToArgAdaptor_h_
23 
24 #include <functional>
25 #include <iostream>
26 #include <string>
29 
30 namespace Genfun {
31 
36  template <class F>
38 
40 
41  public:
42 
43  // ScopedMethodName
44  typedef Parameter & (F::*ScopedMethodPtr) ();
45 
46  // Constructor
47  DoubleParamToArgAdaptor(const F & function,
48  ScopedMethodPtr parameterFetchMethod0,
49  ScopedMethodPtr paraemterFetchMethod1);
50 
51  // Copy constructor
53 
54  // Destructor
55  virtual ~DoubleParamToArgAdaptor();
56 
57  // Retreive function value
58  virtual double operator ()(double argument) const; // Gives an error.
59  virtual double operator ()(const Argument & a) const; // Must use this one
60 
61  // Dimensionality
62  virtual unsigned int dimensionality() const;
63 
64  // Get the mean of the DoubleParamToArgAdaptor
66  const Parameter & scaleFactor0() const;
67 
68  // Get the mean of the DoubleParamToArgAdaptor
70  const Parameter & scaleFactor1() const;
71 
72 
73  private:
74 
75  // It is illegal to assign an adjustable constant
76  const DoubleParamToArgAdaptor & operator=(const DoubleParamToArgAdaptor &right);
77 
78  // Here is the scale:
79  Parameter _scaleFactor0;
80  Parameter _scaleFactor1;
81 
82  // Here is the function being adapted;
83  F *_function;
84 
85  // Here is the recipe for fetching the parameter from the function:
86  std::mem_fun_ref_t<Parameter &, F> _parameterFetchMethod0;
87  std::mem_fun_ref_t<Parameter &, F> _parameterFetchMethod1;
88 
89  };
90 } // namespace Genfun
91  #include "CLHEP/GenericFunctions/DoubleParamToArgAdaptor.icc"
92 #endif
Genfun::DoubleParamToArgAdaptor::DoubleParamToArgAdaptor
DoubleParamToArgAdaptor(const F &function, ScopedMethodPtr parameterFetchMethod0, ScopedMethodPtr paraemterFetchMethod1)
Genfun::DoubleParamToArgAdaptor::~DoubleParamToArgAdaptor
virtual ~DoubleParamToArgAdaptor()
Genfun::DoubleParamToArgAdaptor::operator()
virtual double operator()(double argument) const
a
@ a
Definition: testCategories.cc:125
Parameter.hh
Genfun::AbsFunction
Definition: CLHEP/GenericFunctions/AbsFunction.hh:48
Genfun::DoubleParamToArgAdaptor
Definition: CLHEP/GenericFunctions/DoubleParamToArgAdaptor.hh:37
AbsFunction.hh
Genfun::DoubleParamToArgAdaptor::scaleFactor0
Parameter & scaleFactor0()
Genfun::DoubleParamToArgAdaptor::dimensionality
virtual unsigned int dimensionality() const
Genfun::Argument
Definition: CLHEP/GenericFunctions/Argument.hh:17
Genfun::Parameter
Definition: CLHEP/GenericFunctions/Parameter.hh:35
Genfun::DoubleParamToArgAdaptor::scaleFactor1
Parameter & scaleFactor1()
Genfun::DoubleParamToArgAdaptor::ScopedMethodPtr
Parameter &(F::* ScopedMethodPtr)()
Definition: CLHEP/GenericFunctions/DoubleParamToArgAdaptor.hh:44
FUNCTION_OBJECT_DEF
#define FUNCTION_OBJECT_DEF(classname)
Definition: CLHEP/GenericFunctions/AbsFunction.hh:144
Genfun
Definition: CLHEP/GenericFunctions/Abs.hh:14