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>
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
mps_fire.i
i
Definition: mps_fire.py:355
root::helper::RootFunctionAdapter
Definition: RootFunctionAdapter.h:12
root::helper::RootFunctionAdapter::RootFunctionAdapter
RootFunctionAdapter()
Definition: RootFunctionAdapter.h:13
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
root::helper::RootFunctionAdapter::pars_
std::vector< std::shared_ptr< double > > pars_
Definition: RootFunctionAdapter.h:26
root::helper::RootFunctionAdapter::f_
F * f_
Definition: RootFunctionAdapter.h:25
root::helper::RootFunctionAdapter::operator()
double operator()(const double *var) const
Definition: RootFunctionAdapter.h:21
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
root::helper::RootFunctionAdapter::numberOfParameters
size_t numberOfParameters() const
Definition: RootFunctionAdapter.h:22
root::helper::RootFunctionAdapter::addParameter
void addParameter(const std::shared_ptr< double > &par)
Definition: RootFunctionAdapter.h:15
helper
Definition: helper.py:1
root
Definition: RooFitFunction.h:10
relativeConstraints.value
value
Definition: relativeConstraints.py:53
root::helper::RootFunctionAdapter::RootFunctionAdapter
RootFunctionAdapter(F &f)
Definition: RootFunctionAdapter.h:14
root::helper::RootFunctionAdapter::setParameters
void setParameters(const double *pars)
Definition: RootFunctionAdapter.h:16
RootVarsAdapter.h