CMS 3D CMS Logo

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>
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)
Definition: helper.py:1
double operator()(const double *var) const
double f[11][100]
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)