/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
PhysicsTools/Utilities/interface/RootFunctionHelper.h
36 строк
1 KB
David
move away from boost shared_ptrs
23 авг 2019, 16:53
23 авг 2019, 16:53
12ff73e
Код
Авторство
О чём код?
#ifndef PhysicsTools_Utilities_RootFunctionHelper_h #define PhysicsTools_Utilities_RootFunctionHelper_h /* Warning: this class users a static cache, so multiple * instances of the same type would have the same cacke. * This should be fixed to handle more general cases * */ #include "PhysicsTools/Utilities/interface/RootFunctionAdapter.h" namespace root { namespace helper { struct null_t; template <typename F, unsigned int args, typename Tag = null_t> struct RootFunctionHelper { typedef double (*root_function)(const double *, const double *); static root_function fun(F &f) { adapter_ = RootFunctionAdapter<F, args>(f); return &fun_; } static void addParameter(const std::shared_ptr<double> &par) { adapter_.addParameter(par); } private: static double fun_(const double *x, const double *par) { adapter_.setParameters(par); return adapter_(x); } static RootFunctionAdapter<F, args> adapter_; }; template <typename F, unsigned int args, typename Tag> RootFunctionAdapter<F, args> RootFunctionHelper<F, args, Tag>::adapter_; } // namespace helper } // namespace root #endif