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 <boost/shared_ptr.hpp>
6 
7 namespace root {
8  namespace helper {
9 
10  template<typename F, unsigned int args>
13  RootFunctionAdapter(F & f) : f_(&f) { }
14  void addParameter(const boost::shared_ptr<double> & par) {
15  pars_.push_back(par);
16  }
17  void setParameters(const double * pars) {
18  for(size_t i = 0; i < pars_.size(); ++i) {
19  *pars_[i] = pars[i];
20  }
21  }
22  double operator()(const double * var) const {
23  return RootVarsAdapter<F, args>::value(*f_, var);
24  }
25  size_t numberOfParameters() const {
26  return pars_.size();
27  }
28  private:
29  F * f_;
30  std::vector<boost::shared_ptr<double> > pars_;
31  };
32 
33  }
34 
35 }
36 
37 #endif
void setParameters(const double *pars)
Definition: helper.py:1
std::vector< boost::shared_ptr< double > > pars_
void addParameter(const boost::shared_ptr< double > &par)
double operator()(const double *var) const
double f[11][100]
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281