CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
cacheutils::ArgSetChecker Class Reference

#include <CachingNLL.h>

Public Member Functions

 ArgSetChecker ()
 
 ArgSetChecker (const RooAbsCollection &set)
 
bool changed (bool updateIfChanged=false)
 

Private Attributes

std::vector< double > vals_
 
std::vector< RooRealVar * > vars_
 

Detailed Description

Definition at line 19 of file CachingNLL.h.

Constructor & Destructor Documentation

cacheutils::ArgSetChecker::ArgSetChecker ( )
inline

Definition at line 21 of file CachingNLL.h.

21 {}
cacheutils::ArgSetChecker::ArgSetChecker ( const RooAbsCollection &  set)

Definition at line 62 of file CachingNLL.cc.

References a, vals_, and vars_.

63 {
64  std::auto_ptr<TIterator> iter(set.createIterator());
65  for (RooAbsArg *a = dynamic_cast<RooAbsArg *>(iter->Next());
66  a != 0;
67  a = dynamic_cast<RooAbsArg *>(iter->Next())) {
68  RooRealVar *rrv = dynamic_cast<RooRealVar *>(a);
69  if (rrv) { // && !rrv->isConstant()) {
70  vars_.push_back(rrv);
71  vals_.push_back(rrv->getVal());
72  }
73  }
74 }
std::vector< double > vals_
Definition: CachingNLL.h:26
std::vector< RooRealVar * > vars_
Definition: CachingNLL.h:25
double a
Definition: hdecay.h:121
void set(const std::string &name, int value)
set the flag, with a run-time name

Member Function Documentation

bool cacheutils::ArgSetChecker::changed ( bool  updateIfChanged = false)

Definition at line 77 of file CachingNLL.cc.

78 {
79  std::vector<RooRealVar *>::const_iterator it = vars_.begin(), ed = vars_.end();
80  std::vector<double>::iterator itv = vals_.begin();
81  bool changed = false;
82  for ( ; it != ed; ++it, ++itv) {
83  double val = (*it)->getVal();
84  if (val != *itv) {
85  //std::cerr << "var::CachingPdfable " << (*it)->GetName() << " changed: " << *itv << " -> " << val << std::endl;
86  changed = true;
87  if (updateIfChanged) { *itv = val; }
88  else break;
89  }
90  }
91  return changed;
92 }
bool changed(bool updateIfChanged=false)
Definition: CachingNLL.cc:77
std::vector< double > vals_
Definition: CachingNLL.h:26
std::vector< RooRealVar * > vars_
Definition: CachingNLL.h:25

Member Data Documentation

std::vector<double> cacheutils::ArgSetChecker::vals_
private

Definition at line 26 of file CachingNLL.h.

Referenced by ArgSetChecker().

std::vector<RooRealVar *> cacheutils::ArgSetChecker::vars_
private

Definition at line 25 of file CachingNLL.h.

Referenced by ArgSetChecker().