forked from h2gglobe/h2gglobe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RooFuncReader.cc
22 lines (20 loc) · 1.02 KB
/
RooFuncReader.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "RooFuncReader.h"
// -----------------------------------------------------------------------------------------------------------
RooFuncReader::RooFuncReader(RooWorkspace * ws, const std::string name, const std::string & trainingvars)
{
ws_ = ws;
trainingvars_ = new RooArgList(*ws_->set(trainingvars.c_str()));
func_ = static_cast<RooAbsReal*>(ws_->function(name.c_str()))->functor(*trainingvars_);
varsbuf_.resize(trainingvars_->getSize(),0.);
}
// -----------------------------------------------------------------------------------------------------------
void RooFuncReader::bookVariable(const std::string &name, float * ptr)
{
std::cerr << "RooFuncReader::bookVariable " << trainingvars_->getSize() << " " << varsptrs_.size() << std::endl;
if( std::string(trainingvars_->at(varsptrs_.size())->GetName()) != name ) {
std::cerr << "RooFuncReader. Error booking variable: expecting " << trainingvars_->at(varsptrs_.size())->GetName()
<< " got " << name << std::endl;
assert( 0 );
}
varsptrs_.push_back(ptr);
}