CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RootFunctionAdapter.h
Go to the documentation of this file.
1 #ifndef PhysicTools_Utilities_RootFunctionAdapter_h
2 #define PhysicTools_Utilities_RootFunctionAdapter_h
3 #include <vector>
4 #include <memory>
5 
7 
8 namespace root {
9  namespace helper {
10 
11  template <typename F, unsigned int args>
13  RootFunctionAdapter() : f_(nullptr) {}
15  void addParameter(const std::shared_ptr<double>& par) { pars_.push_back(par); }
16  void setParameters(const double* pars) {
17  for (size_t i = 0; i < pars_.size(); ++i) {
18  *pars_[i] = pars[i];
19  }
20  }
21  double operator()(const double* var) const { return RootVarsAdapter<F, args>::value(*f_, var); }
22  size_t numberOfParameters() const { return pars_.size(); }
23 
24  private:
25  F* f_;
26  std::vector<std::shared_ptr<double> > pars_;
27  };
28 
29  } // namespace helper
30 
31 } // namespace root
32 
33 #endif
void setParameters(const double *pars)
double operator()(const double *var) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
std::vector< std::shared_ptr< double > > pars_
void addParameter(const std::shared_ptr< double > &par)