![]() |
![]() |
#include <utils.h>
Public Member Functions | |
CheapValueSnapshot () | |
CheapValueSnapshot (const RooAbsCollection &src) | |
void | clear () |
bool | empty () const |
void | Print (const char *fmt) const |
void | readFrom (const RooAbsCollection &) |
const RooAbsCollection & | src () const |
void | writeTo (const RooAbsCollection &) const |
Private Attributes | |
const RooAbsCollection * | src_ |
std::vector< double > | values_ |
utils::CheapValueSnapshot::CheapValueSnapshot | ( | ) | [inline] |
utils::CheapValueSnapshot::CheapValueSnapshot | ( | const RooAbsCollection & | src | ) | [inline] |
void utils::CheapValueSnapshot::clear | ( | void | ) | [inline] |
bool utils::CheapValueSnapshot::empty | ( | void | ) | const [inline] |
Definition at line 80 of file utils.h.
References src_.
Referenced by Asymptotic::getCLs().
{ return src_ == 0; }
void utils::CheapValueSnapshot::Print | ( | const char * | fmt | ) | const |
Definition at line 478 of file utils.cc.
Referenced by Asymptotic::getCLs(), and Asymptotic::runLimit().
{ if (src_ == 0) { printf("<NIL>\n"); return; } if (fmt[0] == 'V') { RooLinkedListIter iter = src_->iterator(); int i = 0; for (RooAbsArg *a = (RooAbsArg *) iter.Next(); a != 0; a = (RooAbsArg *) iter.Next(), ++i) { printf(" %3d) %-30s = %9.6g\n", i, a->GetName(), values_[i]); } printf("\n"); } else { src_->Print(fmt); } }
void utils::CheapValueSnapshot::readFrom | ( | const RooAbsCollection & | src | ) |
Definition at line 448 of file utils.cc.
References a, i, src(), src_, and values_.
Referenced by CheapValueSnapshot(), Asymptotic::getCLs(), and Asymptotic::runLimit().
{ if (&src != src_) { src_ = &src; values_.resize(src.getSize()); } RooLinkedListIter iter = src.iterator(); int i = 0; for (RooAbsArg *a = (RooAbsArg *) iter.Next(); a != 0; a = (RooAbsArg *) iter.Next(), ++i) { RooRealVar *rrv = dynamic_cast<RooRealVar *>(a); if (rrv == 0) throw std::invalid_argument("Collection to read from contains a non-RooRealVar"); values_[i] = rrv->getVal(); } }
const RooAbsCollection& utils::CheapValueSnapshot::src | ( | ) | const [inline] |
void utils::CheapValueSnapshot::writeTo | ( | const RooAbsCollection & | src | ) | const |
Definition at line 461 of file utils.cc.
Referenced by Asymptotic::runLimit().
{ if (&src == src_) { RooLinkedListIter iter = src.iterator(); int i = 0; for (RooAbsArg *a = (RooAbsArg *) iter.Next(); a != 0; a = (RooAbsArg *) iter.Next(), ++i) { RooRealVar *rrv = dynamic_cast<RooRealVar *>(a); rrv->setVal(values_[i]); } } else { RooLinkedListIter iter = src_->iterator(); int i = 0; for (RooAbsArg *a = (RooAbsArg *) iter.Next(); a != 0; a = (RooAbsArg *) iter.Next(), ++i) { RooAbsArg *a2 = src.find(a->GetName()); if (a2 == 0) continue; RooRealVar *rrv = dynamic_cast<RooRealVar *>(a2); rrv->setVal(values_[i]); } } }
const RooAbsCollection* utils::CheapValueSnapshot::src_ [private] |
std::vector<double> utils::CheapValueSnapshot::values_ [private] |
Definition at line 84 of file utils.h.
Referenced by clear(), and readFrom().