/usr/include/CLHEP/GenericFunctions/ParamToArgAdaptor.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 | // -*- C++ -*-
// $Id: ParamToArgAdaptor.icc,v 1.2 2003/09/06 14:04:13 boudreau Exp $
#include "CLHEP/GenericFunctions/ParamToArgAdaptor.hh"
#include <assert.h>
#include <iostream>
#include <cfloat>
namespace Genfun {
//FUNCTION_OBJECT_IMP(ParamToArgAdaptor) Do it by hand here:
template <class F>
FunctionComposition ParamToArgAdaptor<F>::operator()(const AbsFunction & function) const
{
return AbsFunction::operator() (function);
}
template <class F>
ParamToArgAdaptor<F> *ParamToArgAdaptor<F>::clone () const {
return (ParamToArgAdaptor<F> *) _clone();
}
template <class F>
AbsFunction *ParamToArgAdaptor<F>::_clone () const {
return new ParamToArgAdaptor<F>(*this);
}
template<class F>
ParamToArgAdaptor<F>::ParamToArgAdaptor(const F &function,
ParamToArgAdaptor<F>::ScopedMethodPtr parameterFetchMethod):
_scaleFactor("Sigma", 1.0, 0, 10),
_function(function.clone()),
_parameterFetchMethod(parameterFetchMethod)
{
_parameterFetchMethod(*_function).setLowerLimit(-DBL_MAX);
_parameterFetchMethod(*_function).setUpperLimit(+DBL_MAX);
}
template <class F>
ParamToArgAdaptor<F>::~ParamToArgAdaptor() {
delete _function;
}
template <class F>
ParamToArgAdaptor<F>::ParamToArgAdaptor(const ParamToArgAdaptor & right):
_scaleFactor(right._scaleFactor),
_parameterFetchMethod(right._parameterFetchMethod),
_function(right._function->clone())
{
_parameterFetchMethod(*_function).setLowerLimit(-DBL_MAX);
_parameterFetchMethod(*_function).setUpperLimit(+DBL_MAX);
}
template <class F>
double ParamToArgAdaptor<F>::operator ()(double x) const
{
std::cerr
<< "Warning. ParamToArgAdaptor called with scalar argument"
<< std::endl;
assert(0);
return 0;
}
template <class F>
Parameter & ParamToArgAdaptor<F>::scaleFactor() {
return _scaleFactor;
}
template <class F>
const Parameter & ParamToArgAdaptor<F>::scaleFactor() const {
return _scaleFactor;
}
template <class F>
unsigned int ParamToArgAdaptor<F>::dimensionality() const {
return _function->dimensionality()+1;
}
template <class F>
double ParamToArgAdaptor<F>::operator() (const Argument & a) const {
if (dimensionality()!= a.dimension()) {
std::cerr
<< "Warning: ParamToArgAdaptor function/argument dimension mismatch"
<< std::endl;
assert(0);
return 0;
}
int dMinus = a.dimension()-1;
Argument aPrime(dMinus);
for (int i=0;i<dMinus;i++) aPrime[i]=a[i];
(_parameterFetchMethod(*_function)).setValue(_scaleFactor.getValue()*a[dMinus]);
return (*_function)(a);
}
} // end of namespace Genfun
|