/usr/include/CLHEP/GenericFunctions/SymToArgAdaptor.icc is in libclhep-dev 2.1.4.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | // -*- C++ -*-
// $Id:
#include "SymToArgAdaptor.hh"
#include <assert.h>
#include <iostream>
#include <cfloat>
namespace Genfun {
//FUNCTION_OBJECT_IMP(SymToArgAdaptor) Do it by hand here:
template <class F>
inline
FunctionComposition SymToArgAdaptor<F>::operator()(const AbsFunction & function) const
{
return AbsFunction::operator() (function);
}
template <class F>
inline
SymToArgAdaptor<F> *SymToArgAdaptor<F>::clone () const {
return (SymToArgAdaptor<F> *) _clone();
}
template <class F>
inline
AbsFunction *SymToArgAdaptor<F>::_clone () const {
return new SymToArgAdaptor<F>(*this);
}
template <class F>
inline
ParameterComposition SymToArgAdaptor<F>::operator()(const AbsParameter & p) const
{ \
return AbsFunction::operator() (p); \
}
template<class F>
inline
SymToArgAdaptor<F>::SymToArgAdaptor(F &function,
const AbsFunction & f_expression,
SymToArgAdaptor<F>::ScopedMethodPtr parameterFetchMethod,
const AbsFunction * p_expression):
_function(function.clone()),
_f_expression(f_expression.clone()),
_parameterFetchMethod(parameterFetchMethod),
_p_expression(p_expression->clone())
{
_parameterFetchMethod(*_function).setLowerLimit(-DBL_MAX);
_parameterFetchMethod(*_function).setUpperLimit(+DBL_MAX);
assert(f_expression.dimensionality()==p_expression->dimensionality());
}
template <class F>
inline
SymToArgAdaptor<F>::~SymToArgAdaptor() {
delete _function;
delete _f_expression;
delete _p_expression;
}
template <class F>
inline
SymToArgAdaptor<F>::SymToArgAdaptor(const SymToArgAdaptor & right):
_function(right._function->clone()),
_f_expression(right._f_expression->clone()),
_parameterFetchMethod(right._parameterFetchMethod),
_p_expression(right._p_expression->clone())
{
_parameterFetchMethod(*_function).setLowerLimit(-DBL_MAX);
_parameterFetchMethod(*_function).setUpperLimit(+DBL_MAX);
}
template <class F>
inline
double SymToArgAdaptor<F>::operator ()(double x) const
{
std::cerr
<< "Warning. SymToArgAdaptor called with scalar argument"
<< std::endl;
assert(0);
return 0;
}
template <class F>
inline
unsigned int SymToArgAdaptor<F>::dimensionality() const {
return _f_expression->dimensionality();
}
template <class F>
inline
double SymToArgAdaptor<F>::operator() (const Argument & a) const {
if (dimensionality()!= a.dimension()) {
std::cerr
<< "Warning: SymToArgAdaptor function/argument dimension mismatch"
<< std::endl;
assert(0);
return 0;
}
// First evaluate the sumbol.
double pVal= (*_p_expression)(a);
// Then set the associated parameter:
(_parameterFetchMethod(*_function)).setValue(pVal);
// Now evaluate the function:
return (*_function)((*_f_expression) (a));
}
} // end of namespace Genfun
|